]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Update to iD v2.22.0
[rails.git] / vendor / assets / iD / iD.js
1 (() => {
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 __commonJS = (cb, mod) => function __require() {
9     return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10   };
11   var __export = (target, all) => {
12     for (var name in all)
13       __defProp(target, name, { get: all[name], enumerable: true });
14   };
15   var __copyProps = (to, from, except, desc) => {
16     if (from && typeof from === "object" || typeof from === "function") {
17       for (let key of __getOwnPropNames(from))
18         if (!__hasOwnProp.call(to, key) && key !== except)
19           __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20     }
21     return to;
22   };
23   var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24     isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25     mod
26   ));
27
28   // node_modules/diacritics/index.js
29   var require_diacritics = __commonJS({
30     "node_modules/diacritics/index.js"(exports2) {
31       exports2.remove = removeDiacritics2;
32       var replacementList = [
33         {
34           base: " ",
35           chars: "\xA0"
36         },
37         {
38           base: "0",
39           chars: "\u07C0"
40         },
41         {
42           base: "A",
43           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"
44         },
45         {
46           base: "AA",
47           chars: "\uA732"
48         },
49         {
50           base: "AE",
51           chars: "\xC6\u01FC\u01E2"
52         },
53         {
54           base: "AO",
55           chars: "\uA734"
56         },
57         {
58           base: "AU",
59           chars: "\uA736"
60         },
61         {
62           base: "AV",
63           chars: "\uA738\uA73A"
64         },
65         {
66           base: "AY",
67           chars: "\uA73C"
68         },
69         {
70           base: "B",
71           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
72         },
73         {
74           base: "C",
75           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
76         },
77         {
78           base: "D",
79           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
80         },
81         {
82           base: "Dh",
83           chars: "\xD0"
84         },
85         {
86           base: "DZ",
87           chars: "\u01F1\u01C4"
88         },
89         {
90           base: "Dz",
91           chars: "\u01F2\u01C5"
92         },
93         {
94           base: "E",
95           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"
96         },
97         {
98           base: "F",
99           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
100         },
101         {
102           base: "G",
103           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
104         },
105         {
106           base: "H",
107           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
108         },
109         {
110           base: "I",
111           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
112         },
113         {
114           base: "J",
115           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
116         },
117         {
118           base: "K",
119           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
120         },
121         {
122           base: "L",
123           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
124         },
125         {
126           base: "LJ",
127           chars: "\u01C7"
128         },
129         {
130           base: "Lj",
131           chars: "\u01C8"
132         },
133         {
134           base: "M",
135           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
136         },
137         {
138           base: "N",
139           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
140         },
141         {
142           base: "NJ",
143           chars: "\u01CA"
144         },
145         {
146           base: "Nj",
147           chars: "\u01CB"
148         },
149         {
150           base: "O",
151           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"
152         },
153         {
154           base: "OE",
155           chars: "\u0152"
156         },
157         {
158           base: "OI",
159           chars: "\u01A2"
160         },
161         {
162           base: "OO",
163           chars: "\uA74E"
164         },
165         {
166           base: "OU",
167           chars: "\u0222"
168         },
169         {
170           base: "P",
171           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
172         },
173         {
174           base: "Q",
175           chars: "\u24C6\uFF31\uA756\uA758\u024A"
176         },
177         {
178           base: "R",
179           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
180         },
181         {
182           base: "S",
183           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
184         },
185         {
186           base: "T",
187           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
188         },
189         {
190           base: "Th",
191           chars: "\xDE"
192         },
193         {
194           base: "TZ",
195           chars: "\uA728"
196         },
197         {
198           base: "U",
199           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"
200         },
201         {
202           base: "V",
203           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
204         },
205         {
206           base: "VY",
207           chars: "\uA760"
208         },
209         {
210           base: "W",
211           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
212         },
213         {
214           base: "X",
215           chars: "\u24CD\uFF38\u1E8A\u1E8C"
216         },
217         {
218           base: "Y",
219           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
220         },
221         {
222           base: "Z",
223           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
224         },
225         {
226           base: "a",
227           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"
228         },
229         {
230           base: "aa",
231           chars: "\uA733"
232         },
233         {
234           base: "ae",
235           chars: "\xE6\u01FD\u01E3"
236         },
237         {
238           base: "ao",
239           chars: "\uA735"
240         },
241         {
242           base: "au",
243           chars: "\uA737"
244         },
245         {
246           base: "av",
247           chars: "\uA739\uA73B"
248         },
249         {
250           base: "ay",
251           chars: "\uA73D"
252         },
253         {
254           base: "b",
255           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
256         },
257         {
258           base: "c",
259           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
260         },
261         {
262           base: "d",
263           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
264         },
265         {
266           base: "dh",
267           chars: "\xF0"
268         },
269         {
270           base: "dz",
271           chars: "\u01F3\u01C6"
272         },
273         {
274           base: "e",
275           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"
276         },
277         {
278           base: "f",
279           chars: "\u24D5\uFF46\u1E1F\u0192"
280         },
281         {
282           base: "ff",
283           chars: "\uFB00"
284         },
285         {
286           base: "fi",
287           chars: "\uFB01"
288         },
289         {
290           base: "fl",
291           chars: "\uFB02"
292         },
293         {
294           base: "ffi",
295           chars: "\uFB03"
296         },
297         {
298           base: "ffl",
299           chars: "\uFB04"
300         },
301         {
302           base: "g",
303           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
304         },
305         {
306           base: "h",
307           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
308         },
309         {
310           base: "hv",
311           chars: "\u0195"
312         },
313         {
314           base: "i",
315           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
316         },
317         {
318           base: "j",
319           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
320         },
321         {
322           base: "k",
323           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
324         },
325         {
326           base: "l",
327           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
328         },
329         {
330           base: "lj",
331           chars: "\u01C9"
332         },
333         {
334           base: "m",
335           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
336         },
337         {
338           base: "n",
339           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
340         },
341         {
342           base: "nj",
343           chars: "\u01CC"
344         },
345         {
346           base: "o",
347           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"
348         },
349         {
350           base: "oe",
351           chars: "\u0153"
352         },
353         {
354           base: "oi",
355           chars: "\u01A3"
356         },
357         {
358           base: "oo",
359           chars: "\uA74F"
360         },
361         {
362           base: "ou",
363           chars: "\u0223"
364         },
365         {
366           base: "p",
367           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
368         },
369         {
370           base: "q",
371           chars: "\u24E0\uFF51\u024B\uA757\uA759"
372         },
373         {
374           base: "r",
375           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
376         },
377         {
378           base: "s",
379           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
380         },
381         {
382           base: "ss",
383           chars: "\xDF"
384         },
385         {
386           base: "t",
387           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
388         },
389         {
390           base: "th",
391           chars: "\xFE"
392         },
393         {
394           base: "tz",
395           chars: "\uA729"
396         },
397         {
398           base: "u",
399           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"
400         },
401         {
402           base: "v",
403           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
404         },
405         {
406           base: "vy",
407           chars: "\uA761"
408         },
409         {
410           base: "w",
411           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
412         },
413         {
414           base: "x",
415           chars: "\u24E7\uFF58\u1E8B\u1E8D"
416         },
417         {
418           base: "y",
419           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
420         },
421         {
422           base: "z",
423           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
424         }
425       ];
426       var diacriticsMap = {};
427       for (i2 = 0; i2 < replacementList.length; i2 += 1) {
428         chars = replacementList[i2].chars;
429         for (j2 = 0; j2 < chars.length; j2 += 1) {
430           diacriticsMap[chars[j2]] = replacementList[i2].base;
431         }
432       }
433       var chars;
434       var j2;
435       var i2;
436       function removeDiacritics2(str2) {
437         return str2.replace(/[^\u0000-\u007e]/g, function(c) {
438           return diacriticsMap[c] || c;
439         });
440       }
441       exports2.replacementList = replacementList;
442       exports2.diacriticsMap = diacriticsMap;
443     }
444   });
445
446   // node_modules/alif-toolkit/lib/isArabic.js
447   var require_isArabic = __commonJS({
448     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
449       "use strict";
450       Object.defineProperty(exports2, "__esModule", { value: true });
451       var arabicBlocks = [
452         [1536, 1791],
453         [1872, 1919],
454         [2208, 2303],
455         [64336, 65023],
456         [65136, 65279],
457         [69216, 69247],
458         [126064, 126143],
459         [126464, 126719]
460       ];
461       function isArabic(char) {
462         if (char.length > 1) {
463           throw new Error("isArabic works on only one-character strings");
464         }
465         let code = char.charCodeAt(0);
466         for (let i2 = 0; i2 < arabicBlocks.length; i2++) {
467           let block2 = arabicBlocks[i2];
468           if (code >= block2[0] && code <= block2[1]) {
469             return true;
470           }
471         }
472         return false;
473       }
474       exports2.isArabic = isArabic;
475       function isMath(char) {
476         if (char.length > 2) {
477           throw new Error("isMath works on only one-character strings");
478         }
479         let code = char.charCodeAt(0);
480         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
481       }
482       exports2.isMath = isMath;
483     }
484   });
485
486   // node_modules/alif-toolkit/lib/unicode-arabic.js
487   var require_unicode_arabic = __commonJS({
488     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
489       "use strict";
490       Object.defineProperty(exports2, "__esModule", { value: true });
491       var arabicReference = {
492         "alef": {
493           "normal": [
494             "\u0627"
495           ],
496           "madda_above": {
497             "normal": [
498               "\u0627\u0653",
499               "\u0622"
500             ],
501             "isolated": "\uFE81",
502             "final": "\uFE82"
503           },
504           "hamza_above": {
505             "normal": [
506               "\u0627\u0654",
507               "\u0623"
508             ],
509             "isolated": "\uFE83",
510             "final": "\uFE84"
511           },
512           "hamza_below": {
513             "normal": [
514               "\u0627\u0655",
515               "\u0625"
516             ],
517             "isolated": "\uFE87",
518             "final": "\uFE88"
519           },
520           "wasla": {
521             "normal": "\u0671",
522             "isolated": "\uFB50",
523             "final": "\uFB51"
524           },
525           "wavy_hamza_above": [
526             "\u0672"
527           ],
528           "wavy_hamza_below": [
529             "\u0627\u065F",
530             "\u0673"
531           ],
532           "high_hamza": [
533             "\u0675",
534             "\u0627\u0674"
535           ],
536           "indic_two_above": [
537             "\u0773"
538           ],
539           "indic_three_above": [
540             "\u0774"
541           ],
542           "fathatan": {
543             "normal": [
544               "\u0627\u064B"
545             ],
546             "final": "\uFD3C",
547             "isolated": "\uFD3D"
548           },
549           "isolated": "\uFE8D",
550           "final": "\uFE8E"
551         },
552         "beh": {
553           "normal": [
554             "\u0628"
555           ],
556           "dotless": [
557             "\u066E"
558           ],
559           "three_dots_horizontally_below": [
560             "\u0750"
561           ],
562           "dot_below_three_dots_above": [
563             "\u0751"
564           ],
565           "three_dots_pointing_upwards_below": [
566             "\u0752"
567           ],
568           "three_dots_pointing_upwards_below_two_dots_above": [
569             "\u0753"
570           ],
571           "two_dots_below_dot_above": [
572             "\u0754"
573           ],
574           "inverted_small_v_below": [
575             "\u0755"
576           ],
577           "small_v": [
578             "\u0756"
579           ],
580           "small_v_below": [
581             "\u08A0"
582           ],
583           "hamza_above": [
584             "\u08A1"
585           ],
586           "small_meem_above": [
587             "\u08B6"
588           ],
589           "isolated": "\uFE8F",
590           "final": "\uFE90",
591           "initial": "\uFE91",
592           "medial": "\uFE92"
593         },
594         "teh marbuta": {
595           "normal": [
596             "\u0629"
597           ],
598           "isolated": "\uFE93",
599           "final": "\uFE94"
600         },
601         "teh": {
602           "normal": [
603             "\u062A"
604           ],
605           "ring": [
606             "\u067C"
607           ],
608           "three_dots_above_downwards": [
609             "\u067D"
610           ],
611           "small_teh_above": [
612             "\u08B8"
613           ],
614           "isolated": "\uFE95",
615           "final": "\uFE96",
616           "initial": "\uFE97",
617           "medial": "\uFE98"
618         },
619         "theh": {
620           "normal": [
621             "\u062B"
622           ],
623           "isolated": "\uFE99",
624           "final": "\uFE9A",
625           "initial": "\uFE9B",
626           "medial": "\uFE9C"
627         },
628         "jeem": {
629           "normal": [
630             "\u062C"
631           ],
632           "two_dots_above": [
633             "\u08A2"
634           ],
635           "isolated": "\uFE9D",
636           "final": "\uFE9E",
637           "initial": "\uFE9F",
638           "medial": "\uFEA0"
639         },
640         "hah": {
641           "normal": [
642             "\u062D"
643           ],
644           "hamza_above": [
645             "\u0681"
646           ],
647           "two_dots_vertical_above": [
648             "\u0682"
649           ],
650           "three_dots_above": [
651             "\u0685"
652           ],
653           "two_dots_above": [
654             "\u0757"
655           ],
656           "three_dots_pointing_upwards_below": [
657             "\u0758"
658           ],
659           "small_tah_below": [
660             "\u076E"
661           ],
662           "small_tah_two_dots": [
663             "\u076F"
664           ],
665           "small_tah_above": [
666             "\u0772"
667           ],
668           "indic_four_below": [
669             "\u077C"
670           ],
671           "isolated": "\uFEA1",
672           "final": "\uFEA2",
673           "initial": "\uFEA3",
674           "medial": "\uFEA4"
675         },
676         "khah": {
677           "normal": [
678             "\u062E"
679           ],
680           "isolated": "\uFEA5",
681           "final": "\uFEA6",
682           "initial": "\uFEA7",
683           "medial": "\uFEA8"
684         },
685         "dal": {
686           "normal": [
687             "\u062F"
688           ],
689           "ring": [
690             "\u0689"
691           ],
692           "dot_below": [
693             "\u068A"
694           ],
695           "dot_below_small_tah": [
696             "\u068B"
697           ],
698           "three_dots_above_downwards": [
699             "\u068F"
700           ],
701           "four_dots_above": [
702             "\u0690"
703           ],
704           "inverted_v": [
705             "\u06EE"
706           ],
707           "two_dots_vertically_below_small_tah": [
708             "\u0759"
709           ],
710           "inverted_small_v_below": [
711             "\u075A"
712           ],
713           "three_dots_below": [
714             "\u08AE"
715           ],
716           "isolated": "\uFEA9",
717           "final": "\uFEAA"
718         },
719         "thal": {
720           "normal": [
721             "\u0630"
722           ],
723           "isolated": "\uFEAB",
724           "final": "\uFEAC"
725         },
726         "reh": {
727           "normal": [
728             "\u0631"
729           ],
730           "small_v": [
731             "\u0692"
732           ],
733           "ring": [
734             "\u0693"
735           ],
736           "dot_below": [
737             "\u0694"
738           ],
739           "small_v_below": [
740             "\u0695"
741           ],
742           "dot_below_dot_above": [
743             "\u0696"
744           ],
745           "two_dots_above": [
746             "\u0697"
747           ],
748           "four_dots_above": [
749             "\u0699"
750           ],
751           "inverted_v": [
752             "\u06EF"
753           ],
754           "stroke": [
755             "\u075B"
756           ],
757           "two_dots_vertically_above": [
758             "\u076B"
759           ],
760           "hamza_above": [
761             "\u076C"
762           ],
763           "small_tah_two_dots": [
764             "\u0771"
765           ],
766           "loop": [
767             "\u08AA"
768           ],
769           "small_noon_above": [
770             "\u08B9"
771           ],
772           "isolated": "\uFEAD",
773           "final": "\uFEAE"
774         },
775         "zain": {
776           "normal": [
777             "\u0632"
778           ],
779           "inverted_v_above": [
780             "\u08B2"
781           ],
782           "isolated": "\uFEAF",
783           "final": "\uFEB0"
784         },
785         "seen": {
786           "normal": [
787             "\u0633"
788           ],
789           "dot_below_dot_above": [
790             "\u069A"
791           ],
792           "three_dots_below": [
793             "\u069B"
794           ],
795           "three_dots_below_three_dots_above": [
796             "\u069C"
797           ],
798           "four_dots_above": [
799             "\u075C"
800           ],
801           "two_dots_vertically_above": [
802             "\u076D"
803           ],
804           "small_tah_two_dots": [
805             "\u0770"
806           ],
807           "indic_four_above": [
808             "\u077D"
809           ],
810           "inverted_v": [
811             "\u077E"
812           ],
813           "isolated": "\uFEB1",
814           "final": "\uFEB2",
815           "initial": "\uFEB3",
816           "medial": "\uFEB4"
817         },
818         "sheen": {
819           "normal": [
820             "\u0634"
821           ],
822           "dot_below": [
823             "\u06FA"
824           ],
825           "isolated": "\uFEB5",
826           "final": "\uFEB6",
827           "initial": "\uFEB7",
828           "medial": "\uFEB8"
829         },
830         "sad": {
831           "normal": [
832             "\u0635"
833           ],
834           "two_dots_below": [
835             "\u069D"
836           ],
837           "three_dots_above": [
838             "\u069E"
839           ],
840           "three_dots_below": [
841             "\u08AF"
842           ],
843           "isolated": "\uFEB9",
844           "final": "\uFEBA",
845           "initial": "\uFEBB",
846           "medial": "\uFEBC"
847         },
848         "dad": {
849           "normal": [
850             "\u0636"
851           ],
852           "dot_below": [
853             "\u06FB"
854           ],
855           "isolated": "\uFEBD",
856           "final": "\uFEBE",
857           "initial": "\uFEBF",
858           "medial": "\uFEC0"
859         },
860         "tah": {
861           "normal": [
862             "\u0637"
863           ],
864           "three_dots_above": [
865             "\u069F"
866           ],
867           "two_dots_above": [
868             "\u08A3"
869           ],
870           "isolated": "\uFEC1",
871           "final": "\uFEC2",
872           "initial": "\uFEC3",
873           "medial": "\uFEC4"
874         },
875         "zah": {
876           "normal": [
877             "\u0638"
878           ],
879           "isolated": "\uFEC5",
880           "final": "\uFEC6",
881           "initial": "\uFEC7",
882           "medial": "\uFEC8"
883         },
884         "ain": {
885           "normal": [
886             "\u0639"
887           ],
888           "three_dots_above": [
889             "\u06A0"
890           ],
891           "two_dots_above": [
892             "\u075D"
893           ],
894           "three_dots_pointing_downwards_above": [
895             "\u075E"
896           ],
897           "two_dots_vertically_above": [
898             "\u075F"
899           ],
900           "three_dots_below": [
901             "\u08B3"
902           ],
903           "isolated": "\uFEC9",
904           "final": "\uFECA",
905           "initial": "\uFECB",
906           "medial": "\uFECC"
907         },
908         "ghain": {
909           "normal": [
910             "\u063A"
911           ],
912           "dot_below": [
913             "\u06FC"
914           ],
915           "isolated": "\uFECD",
916           "final": "\uFECE",
917           "initial": "\uFECF",
918           "medial": "\uFED0"
919         },
920         "feh": {
921           "normal": [
922             "\u0641"
923           ],
924           "dotless": [
925             "\u06A1"
926           ],
927           "dot_moved_below": [
928             "\u06A2"
929           ],
930           "dot_below": [
931             "\u06A3"
932           ],
933           "three_dots_below": [
934             "\u06A5"
935           ],
936           "two_dots_below": [
937             "\u0760"
938           ],
939           "three_dots_pointing_upwards_below": [
940             "\u0761"
941           ],
942           "dot_below_three_dots_above": [
943             "\u08A4"
944           ],
945           "isolated": "\uFED1",
946           "final": "\uFED2",
947           "initial": "\uFED3",
948           "medial": "\uFED4"
949         },
950         "qaf": {
951           "normal": [
952             "\u0642"
953           ],
954           "dotless": [
955             "\u066F"
956           ],
957           "dot_above": [
958             "\u06A7"
959           ],
960           "three_dots_above": [
961             "\u06A8"
962           ],
963           "dot_below": [
964             "\u08A5"
965           ],
966           "isolated": "\uFED5",
967           "final": "\uFED6",
968           "initial": "\uFED7",
969           "medial": "\uFED8"
970         },
971         "kaf": {
972           "normal": [
973             "\u0643"
974           ],
975           "swash": [
976             "\u06AA"
977           ],
978           "ring": [
979             "\u06AB"
980           ],
981           "dot_above": [
982             "\u06AC"
983           ],
984           "three_dots_below": [
985             "\u06AE"
986           ],
987           "two_dots_above": [
988             "\u077F"
989           ],
990           "dot_below": [
991             "\u08B4"
992           ],
993           "isolated": "\uFED9",
994           "final": "\uFEDA",
995           "initial": "\uFEDB",
996           "medial": "\uFEDC"
997         },
998         "lam": {
999           "normal": [
1000             "\u0644"
1001           ],
1002           "small_v": [
1003             "\u06B5"
1004           ],
1005           "dot_above": [
1006             "\u06B6"
1007           ],
1008           "three_dots_above": [
1009             "\u06B7"
1010           ],
1011           "three_dots_below": [
1012             "\u06B8"
1013           ],
1014           "bar": [
1015             "\u076A"
1016           ],
1017           "double_bar": [
1018             "\u08A6"
1019           ],
1020           "isolated": "\uFEDD",
1021           "final": "\uFEDE",
1022           "initial": "\uFEDF",
1023           "medial": "\uFEE0"
1024         },
1025         "meem": {
1026           "normal": [
1027             "\u0645"
1028           ],
1029           "dot_above": [
1030             "\u0765"
1031           ],
1032           "dot_below": [
1033             "\u0766"
1034           ],
1035           "three_dots_above": [
1036             "\u08A7"
1037           ],
1038           "isolated": "\uFEE1",
1039           "final": "\uFEE2",
1040           "initial": "\uFEE3",
1041           "medial": "\uFEE4"
1042         },
1043         "noon": {
1044           "normal": [
1045             "\u0646"
1046           ],
1047           "dot_below": [
1048             "\u06B9"
1049           ],
1050           "ring": [
1051             "\u06BC"
1052           ],
1053           "three_dots_above": [
1054             "\u06BD"
1055           ],
1056           "two_dots_below": [
1057             "\u0767"
1058           ],
1059           "small_tah": [
1060             "\u0768"
1061           ],
1062           "small_v": [
1063             "\u0769"
1064           ],
1065           "isolated": "\uFEE5",
1066           "final": "\uFEE6",
1067           "initial": "\uFEE7",
1068           "medial": "\uFEE8"
1069         },
1070         "heh": {
1071           "normal": [
1072             "\u0647"
1073           ],
1074           "isolated": "\uFEE9",
1075           "final": "\uFEEA",
1076           "initial": "\uFEEB",
1077           "medial": "\uFEEC"
1078         },
1079         "waw": {
1080           "normal": [
1081             "\u0648"
1082           ],
1083           "hamza_above": {
1084             "normal": [
1085               "\u0624",
1086               "\u0648\u0654"
1087             ],
1088             "isolated": "\uFE85",
1089             "final": "\uFE86"
1090           },
1091           "high_hamza": [
1092             "\u0676",
1093             "\u0648\u0674"
1094           ],
1095           "ring": [
1096             "\u06C4"
1097           ],
1098           "two_dots_above": [
1099             "\u06CA"
1100           ],
1101           "dot_above": [
1102             "\u06CF"
1103           ],
1104           "indic_two_above": [
1105             "\u0778"
1106           ],
1107           "indic_three_above": [
1108             "\u0779"
1109           ],
1110           "dot_within": [
1111             "\u08AB"
1112           ],
1113           "isolated": "\uFEED",
1114           "final": "\uFEEE"
1115         },
1116         "alef_maksura": {
1117           "normal": [
1118             "\u0649"
1119           ],
1120           "hamza_above": [
1121             "\u0626",
1122             "\u064A\u0654"
1123           ],
1124           "initial": "\uFBE8",
1125           "medial": "\uFBE9",
1126           "isolated": "\uFEEF",
1127           "final": "\uFEF0"
1128         },
1129         "yeh": {
1130           "normal": [
1131             "\u064A"
1132           ],
1133           "hamza_above": {
1134             "normal": [
1135               "\u0626",
1136               "\u0649\u0654"
1137             ],
1138             "isolated": "\uFE89",
1139             "final": "\uFE8A",
1140             "initial": "\uFE8B",
1141             "medial": "\uFE8C"
1142           },
1143           "two_dots_below_hamza_above": [
1144             "\u08A8"
1145           ],
1146           "high_hamza": [
1147             "\u0678",
1148             "\u064A\u0674"
1149           ],
1150           "tail": [
1151             "\u06CD"
1152           ],
1153           "small_v": [
1154             "\u06CE"
1155           ],
1156           "three_dots_below": [
1157             "\u06D1"
1158           ],
1159           "two_dots_below_dot_above": [
1160             "\u08A9"
1161           ],
1162           "two_dots_below_small_noon_above": [
1163             "\u08BA"
1164           ],
1165           "isolated": "\uFEF1",
1166           "final": "\uFEF2",
1167           "initial": "\uFEF3",
1168           "medial": "\uFEF4"
1169         },
1170         "tteh": {
1171           "normal": [
1172             "\u0679"
1173           ],
1174           "isolated": "\uFB66",
1175           "final": "\uFB67",
1176           "initial": "\uFB68",
1177           "medial": "\uFB69"
1178         },
1179         "tteheh": {
1180           "normal": [
1181             "\u067A"
1182           ],
1183           "isolated": "\uFB5E",
1184           "final": "\uFB5F",
1185           "initial": "\uFB60",
1186           "medial": "\uFB61"
1187         },
1188         "beeh": {
1189           "normal": [
1190             "\u067B"
1191           ],
1192           "isolated": "\uFB52",
1193           "final": "\uFB53",
1194           "initial": "\uFB54",
1195           "medial": "\uFB55"
1196         },
1197         "peh": {
1198           "normal": [
1199             "\u067E"
1200           ],
1201           "small_meem_above": [
1202             "\u08B7"
1203           ],
1204           "isolated": "\uFB56",
1205           "final": "\uFB57",
1206           "initial": "\uFB58",
1207           "medial": "\uFB59"
1208         },
1209         "teheh": {
1210           "normal": [
1211             "\u067F"
1212           ],
1213           "isolated": "\uFB62",
1214           "final": "\uFB63",
1215           "initial": "\uFB64",
1216           "medial": "\uFB65"
1217         },
1218         "beheh": {
1219           "normal": [
1220             "\u0680"
1221           ],
1222           "isolated": "\uFB5A",
1223           "final": "\uFB5B",
1224           "initial": "\uFB5C",
1225           "medial": "\uFB5D"
1226         },
1227         "nyeh": {
1228           "normal": [
1229             "\u0683"
1230           ],
1231           "isolated": "\uFB76",
1232           "final": "\uFB77",
1233           "initial": "\uFB78",
1234           "medial": "\uFB79"
1235         },
1236         "dyeh": {
1237           "normal": [
1238             "\u0684"
1239           ],
1240           "isolated": "\uFB72",
1241           "final": "\uFB73",
1242           "initial": "\uFB74",
1243           "medial": "\uFB75"
1244         },
1245         "tcheh": {
1246           "normal": [
1247             "\u0686"
1248           ],
1249           "dot_above": [
1250             "\u06BF"
1251           ],
1252           "isolated": "\uFB7A",
1253           "final": "\uFB7B",
1254           "initial": "\uFB7C",
1255           "medial": "\uFB7D"
1256         },
1257         "tcheheh": {
1258           "normal": [
1259             "\u0687"
1260           ],
1261           "isolated": "\uFB7E",
1262           "final": "\uFB7F",
1263           "initial": "\uFB80",
1264           "medial": "\uFB81"
1265         },
1266         "ddal": {
1267           "normal": [
1268             "\u0688"
1269           ],
1270           "isolated": "\uFB88",
1271           "final": "\uFB89"
1272         },
1273         "dahal": {
1274           "normal": [
1275             "\u068C"
1276           ],
1277           "isolated": "\uFB84",
1278           "final": "\uFB85"
1279         },
1280         "ddahal": {
1281           "normal": [
1282             "\u068D"
1283           ],
1284           "isolated": "\uFB82",
1285           "final": "\uFB83"
1286         },
1287         "dul": {
1288           "normal": [
1289             "\u068F",
1290             "\u068E"
1291           ],
1292           "isolated": "\uFB86",
1293           "final": "\uFB87"
1294         },
1295         "rreh": {
1296           "normal": [
1297             "\u0691"
1298           ],
1299           "isolated": "\uFB8C",
1300           "final": "\uFB8D"
1301         },
1302         "jeh": {
1303           "normal": [
1304             "\u0698"
1305           ],
1306           "isolated": "\uFB8A",
1307           "final": "\uFB8B"
1308         },
1309         "veh": {
1310           "normal": [
1311             "\u06A4"
1312           ],
1313           "isolated": "\uFB6A",
1314           "final": "\uFB6B",
1315           "initial": "\uFB6C",
1316           "medial": "\uFB6D"
1317         },
1318         "peheh": {
1319           "normal": [
1320             "\u06A6"
1321           ],
1322           "isolated": "\uFB6E",
1323           "final": "\uFB6F",
1324           "initial": "\uFB70",
1325           "medial": "\uFB71"
1326         },
1327         "keheh": {
1328           "normal": [
1329             "\u06A9"
1330           ],
1331           "dot_above": [
1332             "\u0762"
1333           ],
1334           "three_dots_above": [
1335             "\u0763"
1336           ],
1337           "three_dots_pointing_upwards_below": [
1338             "\u0764"
1339           ],
1340           "isolated": "\uFB8E",
1341           "final": "\uFB8F",
1342           "initial": "\uFB90",
1343           "medial": "\uFB91"
1344         },
1345         "ng": {
1346           "normal": [
1347             "\u06AD"
1348           ],
1349           "isolated": "\uFBD3",
1350           "final": "\uFBD4",
1351           "initial": "\uFBD5",
1352           "medial": "\uFBD6"
1353         },
1354         "gaf": {
1355           "normal": [
1356             "\u06AF"
1357           ],
1358           "ring": [
1359             "\u06B0"
1360           ],
1361           "two_dots_below": [
1362             "\u06B2"
1363           ],
1364           "three_dots_above": [
1365             "\u06B4"
1366           ],
1367           "inverted_stroke": [
1368             "\u08B0"
1369           ],
1370           "isolated": "\uFB92",
1371           "final": "\uFB93",
1372           "initial": "\uFB94",
1373           "medial": "\uFB95"
1374         },
1375         "ngoeh": {
1376           "normal": [
1377             "\u06B1"
1378           ],
1379           "isolated": "\uFB9A",
1380           "final": "\uFB9B",
1381           "initial": "\uFB9C",
1382           "medial": "\uFB9D"
1383         },
1384         "gueh": {
1385           "normal": [
1386             "\u06B3"
1387           ],
1388           "isolated": "\uFB96",
1389           "final": "\uFB97",
1390           "initial": "\uFB98",
1391           "medial": "\uFB99"
1392         },
1393         "noon ghunna": {
1394           "normal": [
1395             "\u06BA"
1396           ],
1397           "isolated": "\uFB9E",
1398           "final": "\uFB9F"
1399         },
1400         "rnoon": {
1401           "normal": [
1402             "\u06BB"
1403           ],
1404           "isolated": "\uFBA0",
1405           "final": "\uFBA1",
1406           "initial": "\uFBA2",
1407           "medial": "\uFBA3"
1408         },
1409         "heh doachashmee": {
1410           "normal": [
1411             "\u06BE"
1412           ],
1413           "isolated": "\uFBAA",
1414           "final": "\uFBAB",
1415           "initial": "\uFBAC",
1416           "medial": "\uFBAD"
1417         },
1418         "heh goal": {
1419           "normal": [
1420             "\u06C1"
1421           ],
1422           "hamza_above": [
1423             "\u06C1\u0654",
1424             "\u06C2"
1425           ],
1426           "isolated": "\uFBA6",
1427           "final": "\uFBA7",
1428           "initial": "\uFBA8",
1429           "medial": "\uFBA9"
1430         },
1431         "teh marbuta goal": {
1432           "normal": [
1433             "\u06C3"
1434           ]
1435         },
1436         "kirghiz oe": {
1437           "normal": [
1438             "\u06C5"
1439           ],
1440           "isolated": "\uFBE0",
1441           "final": "\uFBE1"
1442         },
1443         "oe": {
1444           "normal": [
1445             "\u06C6"
1446           ],
1447           "isolated": "\uFBD9",
1448           "final": "\uFBDA"
1449         },
1450         "u": {
1451           "normal": [
1452             "\u06C7"
1453           ],
1454           "hamza_above": {
1455             "normal": [
1456               "\u0677",
1457               "\u06C7\u0674"
1458             ],
1459             "isolated": "\uFBDD"
1460           },
1461           "isolated": "\uFBD7",
1462           "final": "\uFBD8"
1463         },
1464         "yu": {
1465           "normal": [
1466             "\u06C8"
1467           ],
1468           "isolated": "\uFBDB",
1469           "final": "\uFBDC"
1470         },
1471         "kirghiz yu": {
1472           "normal": [
1473             "\u06C9"
1474           ],
1475           "isolated": "\uFBE2",
1476           "final": "\uFBE3"
1477         },
1478         "ve": {
1479           "normal": [
1480             "\u06CB"
1481           ],
1482           "isolated": "\uFBDE",
1483           "final": "\uFBDF"
1484         },
1485         "farsi yeh": {
1486           "normal": [
1487             "\u06CC"
1488           ],
1489           "indic_two_above": [
1490             "\u0775"
1491           ],
1492           "indic_three_above": [
1493             "\u0776"
1494           ],
1495           "indic_four_above": [
1496             "\u0777"
1497           ],
1498           "isolated": "\uFBFC",
1499           "final": "\uFBFD",
1500           "initial": "\uFBFE",
1501           "medial": "\uFBFF"
1502         },
1503         "e": {
1504           "normal": [
1505             "\u06D0"
1506           ],
1507           "isolated": "\uFBE4",
1508           "final": "\uFBE5",
1509           "initial": "\uFBE6",
1510           "medial": "\uFBE7"
1511         },
1512         "yeh barree": {
1513           "normal": [
1514             "\u06D2"
1515           ],
1516           "hamza_above": {
1517             "normal": [
1518               "\u06D2\u0654",
1519               "\u06D3"
1520             ],
1521             "isolated": "\uFBB0",
1522             "final": "\uFBB1"
1523           },
1524           "indic_two_above": [
1525             "\u077A"
1526           ],
1527           "indic_three_above": [
1528             "\u077B"
1529           ],
1530           "isolated": "\uFBAE",
1531           "final": "\uFBAF"
1532         },
1533         "ae": {
1534           "normal": [
1535             "\u06D5"
1536           ],
1537           "isolated": "\u06D5",
1538           "final": "\uFEEA",
1539           "yeh_above": {
1540             "normal": [
1541               "\u06C0",
1542               "\u06D5\u0654"
1543             ],
1544             "isolated": "\uFBA4",
1545             "final": "\uFBA5"
1546           }
1547         },
1548         "rohingya yeh": {
1549           "normal": [
1550             "\u08AC"
1551           ]
1552         },
1553         "low alef": {
1554           "normal": [
1555             "\u08AD"
1556           ]
1557         },
1558         "straight waw": {
1559           "normal": [
1560             "\u08B1"
1561           ]
1562         },
1563         "african feh": {
1564           "normal": [
1565             "\u08BB"
1566           ]
1567         },
1568         "african qaf": {
1569           "normal": [
1570             "\u08BC"
1571           ]
1572         },
1573         "african noon": {
1574           "normal": [
1575             "\u08BD"
1576           ]
1577         }
1578       };
1579       exports2.default = arabicReference;
1580     }
1581   });
1582
1583   // node_modules/alif-toolkit/lib/unicode-ligatures.js
1584   var require_unicode_ligatures = __commonJS({
1585     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1586       "use strict";
1587       Object.defineProperty(exports2, "__esModule", { value: true });
1588       var ligatureReference = {
1589         "\u0626\u0627": {
1590           "isolated": "\uFBEA",
1591           "final": "\uFBEB"
1592         },
1593         "\u0626\u06D5": {
1594           "isolated": "\uFBEC",
1595           "final": "\uFBED"
1596         },
1597         "\u0626\u0648": {
1598           "isolated": "\uFBEE",
1599           "final": "\uFBEF"
1600         },
1601         "\u0626\u06C7": {
1602           "isolated": "\uFBF0",
1603           "final": "\uFBF1"
1604         },
1605         "\u0626\u06C6": {
1606           "isolated": "\uFBF2",
1607           "final": "\uFBF3"
1608         },
1609         "\u0626\u06C8": {
1610           "isolated": "\uFBF4",
1611           "final": "\uFBF5"
1612         },
1613         "\u0626\u06D0": {
1614           "isolated": "\uFBF6",
1615           "final": "\uFBF7",
1616           "initial": "\uFBF8"
1617         },
1618         "\u0626\u0649": {
1619           "uighur_kirghiz": {
1620             "isolated": "\uFBF9",
1621             "final": "\uFBFA",
1622             "initial": "\uFBFB"
1623           },
1624           "isolated": "\uFC03",
1625           "final": "\uFC68"
1626         },
1627         "\u0626\u062C": {
1628           "isolated": "\uFC00",
1629           "initial": "\uFC97"
1630         },
1631         "\u0626\u062D": {
1632           "isolated": "\uFC01",
1633           "initial": "\uFC98"
1634         },
1635         "\u0626\u0645": {
1636           "isolated": "\uFC02",
1637           "final": "\uFC66",
1638           "initial": "\uFC9A",
1639           "medial": "\uFCDF"
1640         },
1641         "\u0626\u064A": {
1642           "isolated": "\uFC04",
1643           "final": "\uFC69"
1644         },
1645         "\u0628\u062C": {
1646           "isolated": "\uFC05",
1647           "initial": "\uFC9C"
1648         },
1649         "\u0628\u062D": {
1650           "isolated": "\uFC06",
1651           "initial": "\uFC9D"
1652         },
1653         "\u0628\u062E": {
1654           "isolated": "\uFC07",
1655           "initial": "\uFC9E"
1656         },
1657         "\u0628\u0645": {
1658           "isolated": "\uFC08",
1659           "final": "\uFC6C",
1660           "initial": "\uFC9F",
1661           "medial": "\uFCE1"
1662         },
1663         "\u0628\u0649": {
1664           "isolated": "\uFC09",
1665           "final": "\uFC6E"
1666         },
1667         "\u0628\u064A": {
1668           "isolated": "\uFC0A",
1669           "final": "\uFC6F"
1670         },
1671         "\u062A\u062C": {
1672           "isolated": "\uFC0B",
1673           "initial": "\uFCA1"
1674         },
1675         "\u062A\u062D": {
1676           "isolated": "\uFC0C",
1677           "initial": "\uFCA2"
1678         },
1679         "\u062A\u062E": {
1680           "isolated": "\uFC0D",
1681           "initial": "\uFCA3"
1682         },
1683         "\u062A\u0645": {
1684           "isolated": "\uFC0E",
1685           "final": "\uFC72",
1686           "initial": "\uFCA4",
1687           "medial": "\uFCE3"
1688         },
1689         "\u062A\u0649": {
1690           "isolated": "\uFC0F",
1691           "final": "\uFC74"
1692         },
1693         "\u062A\u064A": {
1694           "isolated": "\uFC10",
1695           "final": "\uFC75"
1696         },
1697         "\u062B\u062C": {
1698           "isolated": "\uFC11"
1699         },
1700         "\u062B\u0645": {
1701           "isolated": "\uFC12",
1702           "final": "\uFC78",
1703           "initial": "\uFCA6",
1704           "medial": "\uFCE5"
1705         },
1706         "\u062B\u0649": {
1707           "isolated": "\uFC13",
1708           "final": "\uFC7A"
1709         },
1710         "\u062B\u0648": {
1711           "isolated": "\uFC14"
1712         },
1713         "\u062C\u062D": {
1714           "isolated": "\uFC15",
1715           "initial": "\uFCA7"
1716         },
1717         "\u062C\u0645": {
1718           "isolated": "\uFC16",
1719           "initial": "\uFCA8"
1720         },
1721         "\u062D\u062C": {
1722           "isolated": "\uFC17",
1723           "initial": "\uFCA9"
1724         },
1725         "\u062D\u0645": {
1726           "isolated": "\uFC18",
1727           "initial": "\uFCAA"
1728         },
1729         "\u062E\u062C": {
1730           "isolated": "\uFC19",
1731           "initial": "\uFCAB"
1732         },
1733         "\u062E\u062D": {
1734           "isolated": "\uFC1A"
1735         },
1736         "\u062E\u0645": {
1737           "isolated": "\uFC1B",
1738           "initial": "\uFCAC"
1739         },
1740         "\u0633\u062C": {
1741           "isolated": "\uFC1C",
1742           "initial": "\uFCAD",
1743           "medial": "\uFD34"
1744         },
1745         "\u0633\u062D": {
1746           "isolated": "\uFC1D",
1747           "initial": "\uFCAE",
1748           "medial": "\uFD35"
1749         },
1750         "\u0633\u062E": {
1751           "isolated": "\uFC1E",
1752           "initial": "\uFCAF",
1753           "medial": "\uFD36"
1754         },
1755         "\u0633\u0645": {
1756           "isolated": "\uFC1F",
1757           "initial": "\uFCB0",
1758           "medial": "\uFCE7"
1759         },
1760         "\u0635\u062D": {
1761           "isolated": "\uFC20",
1762           "initial": "\uFCB1"
1763         },
1764         "\u0635\u0645": {
1765           "isolated": "\uFC21",
1766           "initial": "\uFCB3"
1767         },
1768         "\u0636\u062C": {
1769           "isolated": "\uFC22",
1770           "initial": "\uFCB4"
1771         },
1772         "\u0636\u062D": {
1773           "isolated": "\uFC23",
1774           "initial": "\uFCB5"
1775         },
1776         "\u0636\u062E": {
1777           "isolated": "\uFC24",
1778           "initial": "\uFCB6"
1779         },
1780         "\u0636\u0645": {
1781           "isolated": "\uFC25",
1782           "initial": "\uFCB7"
1783         },
1784         "\u0637\u062D": {
1785           "isolated": "\uFC26",
1786           "initial": "\uFCB8"
1787         },
1788         "\u0637\u0645": {
1789           "isolated": "\uFC27",
1790           "initial": "\uFD33",
1791           "medial": "\uFD3A"
1792         },
1793         "\u0638\u0645": {
1794           "isolated": "\uFC28",
1795           "initial": "\uFCB9",
1796           "medial": "\uFD3B"
1797         },
1798         "\u0639\u062C": {
1799           "isolated": "\uFC29",
1800           "initial": "\uFCBA"
1801         },
1802         "\u0639\u0645": {
1803           "isolated": "\uFC2A",
1804           "initial": "\uFCBB"
1805         },
1806         "\u063A\u062C": {
1807           "isolated": "\uFC2B",
1808           "initial": "\uFCBC"
1809         },
1810         "\u063A\u0645": {
1811           "isolated": "\uFC2C",
1812           "initial": "\uFCBD"
1813         },
1814         "\u0641\u062C": {
1815           "isolated": "\uFC2D",
1816           "initial": "\uFCBE"
1817         },
1818         "\u0641\u062D": {
1819           "isolated": "\uFC2E",
1820           "initial": "\uFCBF"
1821         },
1822         "\u0641\u062E": {
1823           "isolated": "\uFC2F",
1824           "initial": "\uFCC0"
1825         },
1826         "\u0641\u0645": {
1827           "isolated": "\uFC30",
1828           "initial": "\uFCC1"
1829         },
1830         "\u0641\u0649": {
1831           "isolated": "\uFC31",
1832           "final": "\uFC7C"
1833         },
1834         "\u0641\u064A": {
1835           "isolated": "\uFC32",
1836           "final": "\uFC7D"
1837         },
1838         "\u0642\u062D": {
1839           "isolated": "\uFC33",
1840           "initial": "\uFCC2"
1841         },
1842         "\u0642\u0645": {
1843           "isolated": "\uFC34",
1844           "initial": "\uFCC3"
1845         },
1846         "\u0642\u0649": {
1847           "isolated": "\uFC35",
1848           "final": "\uFC7E"
1849         },
1850         "\u0642\u064A": {
1851           "isolated": "\uFC36",
1852           "final": "\uFC7F"
1853         },
1854         "\u0643\u0627": {
1855           "isolated": "\uFC37",
1856           "final": "\uFC80"
1857         },
1858         "\u0643\u062C": {
1859           "isolated": "\uFC38",
1860           "initial": "\uFCC4"
1861         },
1862         "\u0643\u062D": {
1863           "isolated": "\uFC39",
1864           "initial": "\uFCC5"
1865         },
1866         "\u0643\u062E": {
1867           "isolated": "\uFC3A",
1868           "initial": "\uFCC6"
1869         },
1870         "\u0643\u0644": {
1871           "isolated": "\uFC3B",
1872           "final": "\uFC81",
1873           "initial": "\uFCC7",
1874           "medial": "\uFCEB"
1875         },
1876         "\u0643\u0645": {
1877           "isolated": "\uFC3C",
1878           "final": "\uFC82",
1879           "initial": "\uFCC8",
1880           "medial": "\uFCEC"
1881         },
1882         "\u0643\u0649": {
1883           "isolated": "\uFC3D",
1884           "final": "\uFC83"
1885         },
1886         "\u0643\u064A": {
1887           "isolated": "\uFC3E",
1888           "final": "\uFC84"
1889         },
1890         "\u0644\u062C": {
1891           "isolated": "\uFC3F",
1892           "initial": "\uFCC9"
1893         },
1894         "\u0644\u062D": {
1895           "isolated": "\uFC40",
1896           "initial": "\uFCCA"
1897         },
1898         "\u0644\u062E": {
1899           "isolated": "\uFC41",
1900           "initial": "\uFCCB"
1901         },
1902         "\u0644\u0645": {
1903           "isolated": "\uFC42",
1904           "final": "\uFC85",
1905           "initial": "\uFCCC",
1906           "medial": "\uFCED"
1907         },
1908         "\u0644\u0649": {
1909           "isolated": "\uFC43",
1910           "final": "\uFC86"
1911         },
1912         "\u0644\u064A": {
1913           "isolated": "\uFC44",
1914           "final": "\uFC87"
1915         },
1916         "\u0645\u062C": {
1917           "isolated": "\uFC45",
1918           "initial": "\uFCCE"
1919         },
1920         "\u0645\u062D": {
1921           "isolated": "\uFC46",
1922           "initial": "\uFCCF"
1923         },
1924         "\u0645\u062E": {
1925           "isolated": "\uFC47",
1926           "initial": "\uFCD0"
1927         },
1928         "\u0645\u0645": {
1929           "isolated": "\uFC48",
1930           "final": "\uFC89",
1931           "initial": "\uFCD1"
1932         },
1933         "\u0645\u0649": {
1934           "isolated": "\uFC49"
1935         },
1936         "\u0645\u064A": {
1937           "isolated": "\uFC4A"
1938         },
1939         "\u0646\u062C": {
1940           "isolated": "\uFC4B",
1941           "initial": "\uFCD2"
1942         },
1943         "\u0646\u062D": {
1944           "isolated": "\uFC4C",
1945           "initial": "\uFCD3"
1946         },
1947         "\u0646\u062E": {
1948           "isolated": "\uFC4D",
1949           "initial": "\uFCD4"
1950         },
1951         "\u0646\u0645": {
1952           "isolated": "\uFC4E",
1953           "final": "\uFC8C",
1954           "initial": "\uFCD5",
1955           "medial": "\uFCEE"
1956         },
1957         "\u0646\u0649": {
1958           "isolated": "\uFC4F",
1959           "final": "\uFC8E"
1960         },
1961         "\u0646\u064A": {
1962           "isolated": "\uFC50",
1963           "final": "\uFC8F"
1964         },
1965         "\u0647\u062C": {
1966           "isolated": "\uFC51",
1967           "initial": "\uFCD7"
1968         },
1969         "\u0647\u0645": {
1970           "isolated": "\uFC52",
1971           "initial": "\uFCD8"
1972         },
1973         "\u0647\u0649": {
1974           "isolated": "\uFC53"
1975         },
1976         "\u0647\u064A": {
1977           "isolated": "\uFC54"
1978         },
1979         "\u064A\u062C": {
1980           "isolated": "\uFC55",
1981           "initial": "\uFCDA"
1982         },
1983         "\u064A\u062D": {
1984           "isolated": "\uFC56",
1985           "initial": "\uFCDB"
1986         },
1987         "\u064A\u062E": {
1988           "isolated": "\uFC57",
1989           "initial": "\uFCDC"
1990         },
1991         "\u064A\u0645": {
1992           "isolated": "\uFC58",
1993           "final": "\uFC93",
1994           "initial": "\uFCDD",
1995           "medial": "\uFCF0"
1996         },
1997         "\u064A\u0649": {
1998           "isolated": "\uFC59",
1999           "final": "\uFC95"
2000         },
2001         "\u064A\u064A": {
2002           "isolated": "\uFC5A",
2003           "final": "\uFC96"
2004         },
2005         "\u0630\u0670": {
2006           "isolated": "\uFC5B"
2007         },
2008         "\u0631\u0670": {
2009           "isolated": "\uFC5C"
2010         },
2011         "\u0649\u0670": {
2012           "isolated": "\uFC5D",
2013           "final": "\uFC90"
2014         },
2015         "\u064C\u0651": {
2016           "isolated": "\uFC5E"
2017         },
2018         "\u064D\u0651": {
2019           "isolated": "\uFC5F"
2020         },
2021         "\u064E\u0651": {
2022           "isolated": "\uFC60"
2023         },
2024         "\u064F\u0651": {
2025           "isolated": "\uFC61"
2026         },
2027         "\u0650\u0651": {
2028           "isolated": "\uFC62"
2029         },
2030         "\u0651\u0670": {
2031           "isolated": "\uFC63"
2032         },
2033         "\u0626\u0631": {
2034           "final": "\uFC64"
2035         },
2036         "\u0626\u0632": {
2037           "final": "\uFC65"
2038         },
2039         "\u0626\u0646": {
2040           "final": "\uFC67"
2041         },
2042         "\u0628\u0631": {
2043           "final": "\uFC6A"
2044         },
2045         "\u0628\u0632": {
2046           "final": "\uFC6B"
2047         },
2048         "\u0628\u0646": {
2049           "final": "\uFC6D"
2050         },
2051         "\u062A\u0631": {
2052           "final": "\uFC70"
2053         },
2054         "\u062A\u0632": {
2055           "final": "\uFC71"
2056         },
2057         "\u062A\u0646": {
2058           "final": "\uFC73"
2059         },
2060         "\u062B\u0631": {
2061           "final": "\uFC76"
2062         },
2063         "\u062B\u0632": {
2064           "final": "\uFC77"
2065         },
2066         "\u062B\u0646": {
2067           "final": "\uFC79"
2068         },
2069         "\u062B\u064A": {
2070           "final": "\uFC7B"
2071         },
2072         "\u0645\u0627": {
2073           "final": "\uFC88"
2074         },
2075         "\u0646\u0631": {
2076           "final": "\uFC8A"
2077         },
2078         "\u0646\u0632": {
2079           "final": "\uFC8B"
2080         },
2081         "\u0646\u0646": {
2082           "final": "\uFC8D"
2083         },
2084         "\u064A\u0631": {
2085           "final": "\uFC91"
2086         },
2087         "\u064A\u0632": {
2088           "final": "\uFC92"
2089         },
2090         "\u064A\u0646": {
2091           "final": "\uFC94"
2092         },
2093         "\u0626\u062E": {
2094           "initial": "\uFC99"
2095         },
2096         "\u0626\u0647": {
2097           "initial": "\uFC9B",
2098           "medial": "\uFCE0"
2099         },
2100         "\u0628\u0647": {
2101           "initial": "\uFCA0",
2102           "medial": "\uFCE2"
2103         },
2104         "\u062A\u0647": {
2105           "initial": "\uFCA5",
2106           "medial": "\uFCE4"
2107         },
2108         "\u0635\u062E": {
2109           "initial": "\uFCB2"
2110         },
2111         "\u0644\u0647": {
2112           "initial": "\uFCCD"
2113         },
2114         "\u0646\u0647": {
2115           "initial": "\uFCD6",
2116           "medial": "\uFCEF"
2117         },
2118         "\u0647\u0670": {
2119           "initial": "\uFCD9"
2120         },
2121         "\u064A\u0647": {
2122           "initial": "\uFCDE",
2123           "medial": "\uFCF1"
2124         },
2125         "\u062B\u0647": {
2126           "medial": "\uFCE6"
2127         },
2128         "\u0633\u0647": {
2129           "medial": "\uFCE8",
2130           "initial": "\uFD31"
2131         },
2132         "\u0634\u0645": {
2133           "medial": "\uFCE9",
2134           "isolated": "\uFD0C",
2135           "final": "\uFD28",
2136           "initial": "\uFD30"
2137         },
2138         "\u0634\u0647": {
2139           "medial": "\uFCEA",
2140           "initial": "\uFD32"
2141         },
2142         "\u0640\u064E\u0651": {
2143           "medial": "\uFCF2"
2144         },
2145         "\u0640\u064F\u0651": {
2146           "medial": "\uFCF3"
2147         },
2148         "\u0640\u0650\u0651": {
2149           "medial": "\uFCF4"
2150         },
2151         "\u0637\u0649": {
2152           "isolated": "\uFCF5",
2153           "final": "\uFD11"
2154         },
2155         "\u0637\u064A": {
2156           "isolated": "\uFCF6",
2157           "final": "\uFD12"
2158         },
2159         "\u0639\u0649": {
2160           "isolated": "\uFCF7",
2161           "final": "\uFD13"
2162         },
2163         "\u0639\u064A": {
2164           "isolated": "\uFCF8",
2165           "final": "\uFD14"
2166         },
2167         "\u063A\u0649": {
2168           "isolated": "\uFCF9",
2169           "final": "\uFD15"
2170         },
2171         "\u063A\u064A": {
2172           "isolated": "\uFCFA",
2173           "final": "\uFD16"
2174         },
2175         "\u0633\u0649": {
2176           "isolated": "\uFCFB"
2177         },
2178         "\u0633\u064A": {
2179           "isolated": "\uFCFC",
2180           "final": "\uFD18"
2181         },
2182         "\u0634\u0649": {
2183           "isolated": "\uFCFD",
2184           "final": "\uFD19"
2185         },
2186         "\u0634\u064A": {
2187           "isolated": "\uFCFE",
2188           "final": "\uFD1A"
2189         },
2190         "\u062D\u0649": {
2191           "isolated": "\uFCFF",
2192           "final": "\uFD1B"
2193         },
2194         "\u062D\u064A": {
2195           "isolated": "\uFD00",
2196           "final": "\uFD1C"
2197         },
2198         "\u062C\u0649": {
2199           "isolated": "\uFD01",
2200           "final": "\uFD1D"
2201         },
2202         "\u062C\u064A": {
2203           "isolated": "\uFD02",
2204           "final": "\uFD1E"
2205         },
2206         "\u062E\u0649": {
2207           "isolated": "\uFD03",
2208           "final": "\uFD1F"
2209         },
2210         "\u062E\u064A": {
2211           "isolated": "\uFD04",
2212           "final": "\uFD20"
2213         },
2214         "\u0635\u0649": {
2215           "isolated": "\uFD05",
2216           "final": "\uFD21"
2217         },
2218         "\u0635\u064A": {
2219           "isolated": "\uFD06",
2220           "final": "\uFD22"
2221         },
2222         "\u0636\u0649": {
2223           "isolated": "\uFD07",
2224           "final": "\uFD23"
2225         },
2226         "\u0636\u064A": {
2227           "isolated": "\uFD08",
2228           "final": "\uFD24"
2229         },
2230         "\u0634\u062C": {
2231           "isolated": "\uFD09",
2232           "final": "\uFD25",
2233           "initial": "\uFD2D",
2234           "medial": "\uFD37"
2235         },
2236         "\u0634\u062D": {
2237           "isolated": "\uFD0A",
2238           "final": "\uFD26",
2239           "initial": "\uFD2E",
2240           "medial": "\uFD38"
2241         },
2242         "\u0634\u062E": {
2243           "isolated": "\uFD0B",
2244           "final": "\uFD27",
2245           "initial": "\uFD2F",
2246           "medial": "\uFD39"
2247         },
2248         "\u0634\u0631": {
2249           "isolated": "\uFD0D",
2250           "final": "\uFD29"
2251         },
2252         "\u0633\u0631": {
2253           "isolated": "\uFD0E",
2254           "final": "\uFD2A"
2255         },
2256         "\u0635\u0631": {
2257           "isolated": "\uFD0F",
2258           "final": "\uFD2B"
2259         },
2260         "\u0636\u0631": {
2261           "isolated": "\uFD10",
2262           "final": "\uFD2C"
2263         },
2264         "\u0633\u0639": {
2265           "final": "\uFD17"
2266         },
2267         "\u062A\u062C\u0645": {
2268           "initial": "\uFD50"
2269         },
2270         "\u062A\u062D\u062C": {
2271           "final": "\uFD51",
2272           "initial": "\uFD52"
2273         },
2274         "\u062A\u062D\u0645": {
2275           "initial": "\uFD53"
2276         },
2277         "\u062A\u062E\u0645": {
2278           "initial": "\uFD54"
2279         },
2280         "\u062A\u0645\u062C": {
2281           "initial": "\uFD55"
2282         },
2283         "\u062A\u0645\u062D": {
2284           "initial": "\uFD56"
2285         },
2286         "\u062A\u0645\u062E": {
2287           "initial": "\uFD57"
2288         },
2289         "\u062C\u0645\u062D": {
2290           "final": "\uFD58",
2291           "initial": "\uFD59"
2292         },
2293         "\u062D\u0645\u064A": {
2294           "final": "\uFD5A"
2295         },
2296         "\u062D\u0645\u0649": {
2297           "final": "\uFD5B"
2298         },
2299         "\u0633\u062D\u062C": {
2300           "initial": "\uFD5C"
2301         },
2302         "\u0633\u062C\u062D": {
2303           "initial": "\uFD5D"
2304         },
2305         "\u0633\u062C\u0649": {
2306           "final": "\uFD5E"
2307         },
2308         "\u0633\u0645\u062D": {
2309           "final": "\uFD5F",
2310           "initial": "\uFD60"
2311         },
2312         "\u0633\u0645\u062C": {
2313           "initial": "\uFD61"
2314         },
2315         "\u0633\u0645\u0645": {
2316           "final": "\uFD62",
2317           "initial": "\uFD63"
2318         },
2319         "\u0635\u062D\u062D": {
2320           "final": "\uFD64",
2321           "initial": "\uFD65"
2322         },
2323         "\u0635\u0645\u0645": {
2324           "final": "\uFD66",
2325           "initial": "\uFDC5"
2326         },
2327         "\u0634\u062D\u0645": {
2328           "final": "\uFD67",
2329           "initial": "\uFD68"
2330         },
2331         "\u0634\u062C\u064A": {
2332           "final": "\uFD69"
2333         },
2334         "\u0634\u0645\u062E": {
2335           "final": "\uFD6A",
2336           "initial": "\uFD6B"
2337         },
2338         "\u0634\u0645\u0645": {
2339           "final": "\uFD6C",
2340           "initial": "\uFD6D"
2341         },
2342         "\u0636\u062D\u0649": {
2343           "final": "\uFD6E"
2344         },
2345         "\u0636\u062E\u0645": {
2346           "final": "\uFD6F",
2347           "initial": "\uFD70"
2348         },
2349         "\u0636\u0645\u062D": {
2350           "final": "\uFD71"
2351         },
2352         "\u0637\u0645\u062D": {
2353           "initial": "\uFD72"
2354         },
2355         "\u0637\u0645\u0645": {
2356           "initial": "\uFD73"
2357         },
2358         "\u0637\u0645\u064A": {
2359           "final": "\uFD74"
2360         },
2361         "\u0639\u062C\u0645": {
2362           "final": "\uFD75",
2363           "initial": "\uFDC4"
2364         },
2365         "\u0639\u0645\u0645": {
2366           "final": "\uFD76",
2367           "initial": "\uFD77"
2368         },
2369         "\u0639\u0645\u0649": {
2370           "final": "\uFD78"
2371         },
2372         "\u063A\u0645\u0645": {
2373           "final": "\uFD79"
2374         },
2375         "\u063A\u0645\u064A": {
2376           "final": "\uFD7A"
2377         },
2378         "\u063A\u0645\u0649": {
2379           "final": "\uFD7B"
2380         },
2381         "\u0641\u062E\u0645": {
2382           "final": "\uFD7C",
2383           "initial": "\uFD7D"
2384         },
2385         "\u0642\u0645\u062D": {
2386           "final": "\uFD7E",
2387           "initial": "\uFDB4"
2388         },
2389         "\u0642\u0645\u0645": {
2390           "final": "\uFD7F"
2391         },
2392         "\u0644\u062D\u0645": {
2393           "final": "\uFD80",
2394           "initial": "\uFDB5"
2395         },
2396         "\u0644\u062D\u064A": {
2397           "final": "\uFD81"
2398         },
2399         "\u0644\u062D\u0649": {
2400           "final": "\uFD82"
2401         },
2402         "\u0644\u062C\u062C": {
2403           "initial": "\uFD83",
2404           "final": "\uFD84"
2405         },
2406         "\u0644\u062E\u0645": {
2407           "final": "\uFD85",
2408           "initial": "\uFD86"
2409         },
2410         "\u0644\u0645\u062D": {
2411           "final": "\uFD87",
2412           "initial": "\uFD88"
2413         },
2414         "\u0645\u062D\u062C": {
2415           "initial": "\uFD89"
2416         },
2417         "\u0645\u062D\u0645": {
2418           "initial": "\uFD8A"
2419         },
2420         "\u0645\u062D\u064A": {
2421           "final": "\uFD8B"
2422         },
2423         "\u0645\u062C\u062D": {
2424           "initial": "\uFD8C"
2425         },
2426         "\u0645\u062C\u0645": {
2427           "initial": "\uFD8D"
2428         },
2429         "\u0645\u062E\u062C": {
2430           "initial": "\uFD8E"
2431         },
2432         "\u0645\u062E\u0645": {
2433           "initial": "\uFD8F"
2434         },
2435         "\u0645\u062C\u062E": {
2436           "initial": "\uFD92"
2437         },
2438         "\u0647\u0645\u062C": {
2439           "initial": "\uFD93"
2440         },
2441         "\u0647\u0645\u0645": {
2442           "initial": "\uFD94"
2443         },
2444         "\u0646\u062D\u0645": {
2445           "initial": "\uFD95"
2446         },
2447         "\u0646\u062D\u0649": {
2448           "final": "\uFD96"
2449         },
2450         "\u0646\u062C\u0645": {
2451           "final": "\uFD97",
2452           "initial": "\uFD98"
2453         },
2454         "\u0646\u062C\u0649": {
2455           "final": "\uFD99"
2456         },
2457         "\u0646\u0645\u064A": {
2458           "final": "\uFD9A"
2459         },
2460         "\u0646\u0645\u0649": {
2461           "final": "\uFD9B"
2462         },
2463         "\u064A\u0645\u0645": {
2464           "final": "\uFD9C",
2465           "initial": "\uFD9D"
2466         },
2467         "\u0628\u062E\u064A": {
2468           "final": "\uFD9E"
2469         },
2470         "\u062A\u062C\u064A": {
2471           "final": "\uFD9F"
2472         },
2473         "\u062A\u062C\u0649": {
2474           "final": "\uFDA0"
2475         },
2476         "\u062A\u062E\u064A": {
2477           "final": "\uFDA1"
2478         },
2479         "\u062A\u062E\u0649": {
2480           "final": "\uFDA2"
2481         },
2482         "\u062A\u0645\u064A": {
2483           "final": "\uFDA3"
2484         },
2485         "\u062A\u0645\u0649": {
2486           "final": "\uFDA4"
2487         },
2488         "\u062C\u0645\u064A": {
2489           "final": "\uFDA5"
2490         },
2491         "\u062C\u062D\u0649": {
2492           "final": "\uFDA6"
2493         },
2494         "\u062C\u0645\u0649": {
2495           "final": "\uFDA7"
2496         },
2497         "\u0633\u062E\u0649": {
2498           "final": "\uFDA8"
2499         },
2500         "\u0635\u062D\u064A": {
2501           "final": "\uFDA9"
2502         },
2503         "\u0634\u062D\u064A": {
2504           "final": "\uFDAA"
2505         },
2506         "\u0636\u062D\u064A": {
2507           "final": "\uFDAB"
2508         },
2509         "\u0644\u062C\u064A": {
2510           "final": "\uFDAC"
2511         },
2512         "\u0644\u0645\u064A": {
2513           "final": "\uFDAD"
2514         },
2515         "\u064A\u062D\u064A": {
2516           "final": "\uFDAE"
2517         },
2518         "\u064A\u062C\u064A": {
2519           "final": "\uFDAF"
2520         },
2521         "\u064A\u0645\u064A": {
2522           "final": "\uFDB0"
2523         },
2524         "\u0645\u0645\u064A": {
2525           "final": "\uFDB1"
2526         },
2527         "\u0642\u0645\u064A": {
2528           "final": "\uFDB2"
2529         },
2530         "\u0646\u062D\u064A": {
2531           "final": "\uFDB3"
2532         },
2533         "\u0639\u0645\u064A": {
2534           "final": "\uFDB6"
2535         },
2536         "\u0643\u0645\u064A": {
2537           "final": "\uFDB7"
2538         },
2539         "\u0646\u062C\u062D": {
2540           "initial": "\uFDB8",
2541           "final": "\uFDBD"
2542         },
2543         "\u0645\u062E\u064A": {
2544           "final": "\uFDB9"
2545         },
2546         "\u0644\u062C\u0645": {
2547           "initial": "\uFDBA",
2548           "final": "\uFDBC"
2549         },
2550         "\u0643\u0645\u0645": {
2551           "final": "\uFDBB",
2552           "initial": "\uFDC3"
2553         },
2554         "\u062C\u062D\u064A": {
2555           "final": "\uFDBE"
2556         },
2557         "\u062D\u062C\u064A": {
2558           "final": "\uFDBF"
2559         },
2560         "\u0645\u062C\u064A": {
2561           "final": "\uFDC0"
2562         },
2563         "\u0641\u0645\u064A": {
2564           "final": "\uFDC1"
2565         },
2566         "\u0628\u062D\u064A": {
2567           "final": "\uFDC2"
2568         },
2569         "\u0633\u062E\u064A": {
2570           "final": "\uFDC6"
2571         },
2572         "\u0646\u062C\u064A": {
2573           "final": "\uFDC7"
2574         },
2575         "\u0644\u0622": {
2576           "isolated": "\uFEF5",
2577           "final": "\uFEF6"
2578         },
2579         "\u0644\u0623": {
2580           "isolated": "\uFEF7",
2581           "final": "\uFEF8"
2582         },
2583         "\u0644\u0625": {
2584           "isolated": "\uFEF9",
2585           "final": "\uFEFA"
2586         },
2587         "\u0644\u0627": {
2588           "isolated": "\uFEFB",
2589           "final": "\uFEFC"
2590         },
2591         "words": {
2592           "\u0635\u0644\u06D2": "\uFDF0",
2593           "\u0642\u0644\u06D2": "\uFDF1",
2594           "\u0627\u0644\u0644\u0647": "\uFDF2",
2595           "\u0627\u0643\u0628\u0631": "\uFDF3",
2596           "\u0645\u062D\u0645\u062F": "\uFDF4",
2597           "\u0635\u0644\u0639\u0645": "\uFDF5",
2598           "\u0631\u0633\u0648\u0644": "\uFDF6",
2599           "\u0639\u0644\u064A\u0647": "\uFDF7",
2600           "\u0648\u0633\u0644\u0645": "\uFDF8",
2601           "\u0635\u0644\u0649": "\uFDF9",
2602           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2603           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2604           "\u0631\u06CC\u0627\u0644": "\uFDFC"
2605         }
2606       };
2607       exports2.default = ligatureReference;
2608     }
2609   });
2610
2611   // node_modules/alif-toolkit/lib/reference.js
2612   var require_reference = __commonJS({
2613     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2614       "use strict";
2615       Object.defineProperty(exports2, "__esModule", { value: true });
2616       var unicode_arabic_1 = require_unicode_arabic();
2617       var unicode_ligatures_1 = require_unicode_ligatures();
2618       var letterList = Object.keys(unicode_arabic_1.default);
2619       exports2.letterList = letterList;
2620       var ligatureList = Object.keys(unicode_ligatures_1.default);
2621       exports2.ligatureList = ligatureList;
2622       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2623       exports2.ligatureWordList = ligatureWordList;
2624       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2625       exports2.lams = lams;
2626       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2627       exports2.alefs = alefs;
2628       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2629       exports2.tashkeel = tashkeel;
2630       function addToTashkeel(start2, finish) {
2631         for (var i2 = start2; i2 <= finish; i2++) {
2632           exports2.tashkeel = tashkeel += String.fromCharCode(i2);
2633         }
2634       }
2635       addToTashkeel(1552, 1562);
2636       addToTashkeel(1611, 1631);
2637       addToTashkeel(1750, 1756);
2638       addToTashkeel(1760, 1764);
2639       addToTashkeel(1770, 1773);
2640       addToTashkeel(2259, 2273);
2641       addToTashkeel(2275, 2303);
2642       addToTashkeel(65136, 65151);
2643       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2644       exports2.lineBreakers = lineBreakers;
2645       function addToLineBreakers(start2, finish) {
2646         for (var i2 = start2; i2 <= finish; i2++) {
2647           exports2.lineBreakers = lineBreakers += String.fromCharCode(i2);
2648         }
2649       }
2650       addToLineBreakers(1536, 1567);
2651       addToLineBreakers(1569, 1573);
2652       addToLineBreakers(1583, 1586);
2653       addToLineBreakers(1632, 1645);
2654       addToLineBreakers(1649, 1655);
2655       addToLineBreakers(1672, 1689);
2656       addToLineBreakers(1731, 1739);
2657       addToLineBreakers(1746, 1785);
2658       addToLineBreakers(1881, 1883);
2659       addToLineBreakers(2218, 2222);
2660       addToLineBreakers(64336, 65021);
2661       addToLineBreakers(65152, 65276);
2662       addToLineBreakers(69216, 69247);
2663       addToLineBreakers(126064, 126143);
2664       addToLineBreakers(126464, 126719);
2665     }
2666   });
2667
2668   // node_modules/alif-toolkit/lib/GlyphSplitter.js
2669   var require_GlyphSplitter = __commonJS({
2670     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2671       "use strict";
2672       Object.defineProperty(exports2, "__esModule", { value: true });
2673       var isArabic_1 = require_isArabic();
2674       var reference_1 = require_reference();
2675       function GlyphSplitter(word) {
2676         let letters = [];
2677         let lastLetter = "";
2678         word.split("").forEach((letter) => {
2679           if (isArabic_1.isArabic(letter)) {
2680             if (reference_1.tashkeel.indexOf(letter) > -1) {
2681               letters[letters.length - 1] += letter;
2682             } 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)) {
2683               letters[letters.length - 1] += letter;
2684             } else {
2685               letters.push(letter);
2686             }
2687           } else {
2688             letters.push(letter);
2689           }
2690           if (reference_1.tashkeel.indexOf(letter) === -1) {
2691             lastLetter = letter;
2692           }
2693         });
2694         return letters;
2695       }
2696       exports2.GlyphSplitter = GlyphSplitter;
2697     }
2698   });
2699
2700   // node_modules/alif-toolkit/lib/BaselineSplitter.js
2701   var require_BaselineSplitter = __commonJS({
2702     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2703       "use strict";
2704       Object.defineProperty(exports2, "__esModule", { value: true });
2705       var isArabic_1 = require_isArabic();
2706       var reference_1 = require_reference();
2707       function BaselineSplitter(word) {
2708         let letters = [];
2709         let lastLetter = "";
2710         word.split("").forEach((letter) => {
2711           if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) {
2712             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2713               letters[letters.length - 1] += letter;
2714             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2715               letters.push(letter);
2716             } else {
2717               letters[letters.length - 1] += letter;
2718             }
2719           } else {
2720             letters.push(letter);
2721           }
2722           if (reference_1.tashkeel.indexOf(letter) === -1) {
2723             lastLetter = letter;
2724           }
2725         });
2726         return letters;
2727       }
2728       exports2.BaselineSplitter = BaselineSplitter;
2729     }
2730   });
2731
2732   // node_modules/alif-toolkit/lib/Normalization.js
2733   var require_Normalization = __commonJS({
2734     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2735       "use strict";
2736       Object.defineProperty(exports2, "__esModule", { value: true });
2737       var unicode_arabic_1 = require_unicode_arabic();
2738       var unicode_ligatures_1 = require_unicode_ligatures();
2739       var isArabic_1 = require_isArabic();
2740       var reference_1 = require_reference();
2741       function Normal(word, breakPresentationForm) {
2742         if (typeof breakPresentationForm === "undefined") {
2743           breakPresentationForm = true;
2744         }
2745         let returnable = "";
2746         word.split("").forEach((letter) => {
2747           if (!isArabic_1.isArabic(letter)) {
2748             returnable += letter;
2749             return;
2750           }
2751           for (let w = 0; w < reference_1.letterList.length; w++) {
2752             let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2753             let versions = Object.keys(letterForms);
2754             for (let v = 0; v < versions.length; v++) {
2755               let localVersion = letterForms[versions[v]];
2756               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2757                 let embeddedForms = Object.keys(localVersion);
2758                 for (let ef = 0; ef < embeddedForms.length; ef++) {
2759                   let form = localVersion[embeddedForms[ef]];
2760                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2761                     if (form === letter) {
2762                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2763                         if (typeof localVersion["normal"] === "object") {
2764                           returnable += localVersion["normal"][0];
2765                         } else {
2766                           returnable += localVersion["normal"];
2767                         }
2768                         return;
2769                       }
2770                       returnable += letter;
2771                       return;
2772                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2773                       returnable += form[0];
2774                       return;
2775                     }
2776                   }
2777                 }
2778               } else if (localVersion === letter) {
2779                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v]) > -1) {
2780                   if (typeof letterForms["normal"] === "object") {
2781                     returnable += letterForms["normal"][0];
2782                   } else {
2783                     returnable += letterForms["normal"];
2784                   }
2785                   return;
2786                 }
2787                 returnable += letter;
2788                 return;
2789               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2790                 returnable += localVersion[0];
2791                 return;
2792               }
2793             }
2794           }
2795           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2796             let normalForm = reference_1.ligatureList[v2];
2797             if (normalForm !== "words") {
2798               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2799               for (let f2 = 0; f2 < ligForms.length; f2++) {
2800                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
2801                   returnable += normalForm;
2802                   return;
2803                 }
2804               }
2805             }
2806           }
2807           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2808             let normalForm = reference_1.ligatureWordList[v3];
2809             if (unicode_ligatures_1.default.words[normalForm] === letter) {
2810               returnable += normalForm;
2811               return;
2812             }
2813           }
2814           returnable += letter;
2815         });
2816         return returnable;
2817       }
2818       exports2.Normal = Normal;
2819     }
2820   });
2821
2822   // node_modules/alif-toolkit/lib/CharShaper.js
2823   var require_CharShaper = __commonJS({
2824     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2825       "use strict";
2826       Object.defineProperty(exports2, "__esModule", { value: true });
2827       var unicode_arabic_1 = require_unicode_arabic();
2828       var isArabic_1 = require_isArabic();
2829       var reference_1 = require_reference();
2830       function CharShaper(letter, form) {
2831         if (!isArabic_1.isArabic(letter)) {
2832           throw new Error("Not Arabic");
2833         }
2834         if (letter === "\u0621") {
2835           return "\u0621";
2836         }
2837         for (let w = 0; w < reference_1.letterList.length; w++) {
2838           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2839           let versions = Object.keys(letterForms);
2840           for (let v = 0; v < versions.length; v++) {
2841             let localVersion = letterForms[versions[v]];
2842             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2843               if (versions.indexOf(form) > -1) {
2844                 return letterForms[form];
2845               }
2846             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2847               let embeddedVersions = Object.keys(localVersion);
2848               for (let ev = 0; ev < embeddedVersions.length; ev++) {
2849                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2850                   if (embeddedVersions.indexOf(form) > -1) {
2851                     return localVersion[form];
2852                   }
2853                 }
2854               }
2855             }
2856           }
2857         }
2858       }
2859       exports2.CharShaper = CharShaper;
2860     }
2861   });
2862
2863   // node_modules/alif-toolkit/lib/WordShaper.js
2864   var require_WordShaper = __commonJS({
2865     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2866       "use strict";
2867       Object.defineProperty(exports2, "__esModule", { value: true });
2868       var isArabic_1 = require_isArabic();
2869       var reference_1 = require_reference();
2870       var CharShaper_1 = require_CharShaper();
2871       var unicode_ligatures_1 = require_unicode_ligatures();
2872       function WordShaper2(word) {
2873         let state = "initial";
2874         let output = "";
2875         for (let w = 0; w < word.length; w++) {
2876           let nextLetter = " ";
2877           for (let nxw = w + 1; nxw < word.length; nxw++) {
2878             if (!isArabic_1.isArabic(word[nxw])) {
2879               break;
2880             }
2881             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2882               nextLetter = word[nxw];
2883               break;
2884             }
2885           }
2886           if (!isArabic_1.isArabic(word[w]) || isArabic_1.isMath(word[w])) {
2887             output += word[w];
2888             state = "initial";
2889           } else if (reference_1.tashkeel.indexOf(word[w]) > -1) {
2890             output += word[w];
2891           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w]) > -1) {
2892             output += CharShaper_1.CharShaper(word[w], state === "initial" ? "isolated" : "final");
2893             state = "initial";
2894           } else if (reference_1.lams.indexOf(word[w]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2895             output += unicode_ligatures_1.default[word[w] + nextLetter][state === "initial" ? "isolated" : "final"];
2896             while (word[w] !== nextLetter) {
2897               w++;
2898             }
2899             state = "initial";
2900           } else {
2901             output += CharShaper_1.CharShaper(word[w], state);
2902             state = "medial";
2903           }
2904         }
2905         return output;
2906       }
2907       exports2.WordShaper = WordShaper2;
2908     }
2909   });
2910
2911   // node_modules/alif-toolkit/lib/ParentLetter.js
2912   var require_ParentLetter = __commonJS({
2913     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2914       "use strict";
2915       Object.defineProperty(exports2, "__esModule", { value: true });
2916       var unicode_arabic_1 = require_unicode_arabic();
2917       var isArabic_1 = require_isArabic();
2918       var reference_1 = require_reference();
2919       function ParentLetter(letter) {
2920         if (!isArabic_1.isArabic(letter)) {
2921           throw new Error("Not an Arabic letter");
2922         }
2923         for (let w = 0; w < reference_1.letterList.length; w++) {
2924           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2925           let versions = Object.keys(letterForms);
2926           for (let v = 0; v < versions.length; v++) {
2927             let localVersion = letterForms[versions[v]];
2928             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2929               let embeddedForms = Object.keys(localVersion);
2930               for (let ef = 0; ef < embeddedForms.length; ef++) {
2931                 let form = localVersion[embeddedForms[ef]];
2932                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2933                   return localVersion;
2934                 }
2935               }
2936             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2937               return letterForms;
2938             }
2939           }
2940           return null;
2941         }
2942       }
2943       exports2.ParentLetter = ParentLetter;
2944       function GrandparentLetter(letter) {
2945         if (!isArabic_1.isArabic(letter)) {
2946           throw new Error("Not an Arabic letter");
2947         }
2948         for (let w = 0; w < reference_1.letterList.length; w++) {
2949           let letterForms = unicode_arabic_1.default[reference_1.letterList[w]];
2950           let versions = Object.keys(letterForms);
2951           for (let v = 0; v < versions.length; v++) {
2952             let localVersion = letterForms[versions[v]];
2953             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2954               let embeddedForms = Object.keys(localVersion);
2955               for (let ef = 0; ef < embeddedForms.length; ef++) {
2956                 let form = localVersion[embeddedForms[ef]];
2957                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2958                   return letterForms;
2959                 }
2960               }
2961             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2962               return letterForms;
2963             }
2964           }
2965           return null;
2966         }
2967       }
2968       exports2.GrandparentLetter = GrandparentLetter;
2969     }
2970   });
2971
2972   // node_modules/alif-toolkit/lib/index.js
2973   var require_lib = __commonJS({
2974     "node_modules/alif-toolkit/lib/index.js"(exports2) {
2975       "use strict";
2976       Object.defineProperty(exports2, "__esModule", { value: true });
2977       var isArabic_1 = require_isArabic();
2978       exports2.isArabic = isArabic_1.isArabic;
2979       var GlyphSplitter_1 = require_GlyphSplitter();
2980       exports2.GlyphSplitter = GlyphSplitter_1.GlyphSplitter;
2981       var BaselineSplitter_1 = require_BaselineSplitter();
2982       exports2.BaselineSplitter = BaselineSplitter_1.BaselineSplitter;
2983       var Normalization_1 = require_Normalization();
2984       exports2.Normal = Normalization_1.Normal;
2985       var CharShaper_1 = require_CharShaper();
2986       exports2.CharShaper = CharShaper_1.CharShaper;
2987       var WordShaper_1 = require_WordShaper();
2988       exports2.WordShaper = WordShaper_1.WordShaper;
2989       var ParentLetter_1 = require_ParentLetter();
2990       exports2.ParentLetter = ParentLetter_1.ParentLetter;
2991       exports2.GrandparentLetter = ParentLetter_1.GrandparentLetter;
2992     }
2993   });
2994
2995   // node_modules/vparse/index.js
2996   var require_vparse = __commonJS({
2997     "node_modules/vparse/index.js"(exports2, module2) {
2998       (function(window2) {
2999         "use strict";
3000         function parseVersion3(v) {
3001           var m = v.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3002           v = {
3003             major: +m[0] || 0,
3004             minor: +m[1] || 0,
3005             patch: +m[2] || 0,
3006             build: +m[3] || 0
3007           };
3008           v.isEmpty = !v.major && !v.minor && !v.patch && !v.build;
3009           v.parsed = [v.major, v.minor, v.patch, v.build];
3010           v.text = v.parsed.join(".");
3011           v.compare = compare;
3012           return v;
3013         }
3014         function compare(v) {
3015           if (typeof v === "string") {
3016             v = parseVersion3(v);
3017           }
3018           for (var i2 = 0; i2 < 4; i2++) {
3019             if (this.parsed[i2] !== v.parsed[i2]) {
3020               return this.parsed[i2] > v.parsed[i2] ? 1 : -1;
3021             }
3022           }
3023           return 0;
3024         }
3025         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3026           module2.exports = parseVersion3;
3027         } else {
3028           window2.parseVersion = parseVersion3;
3029         }
3030       })(exports2);
3031     }
3032   });
3033
3034   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3035   var require_quickselect = __commonJS({
3036     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3037       (function(global3, factory) {
3038         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global3.quickselect = factory();
3039       })(exports2, function() {
3040         "use strict";
3041         function quickselect2(arr, k, left, right, compare) {
3042           quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare);
3043         }
3044         function quickselectStep(arr, k, left, right, compare) {
3045           while (right > left) {
3046             if (right - left > 600) {
3047               var n2 = right - left + 1;
3048               var m = k - left + 1;
3049               var z = Math.log(n2);
3050               var s = 0.5 * Math.exp(2 * z / 3);
3051               var sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
3052               var newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
3053               var newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
3054               quickselectStep(arr, k, newLeft, newRight, compare);
3055             }
3056             var t = arr[k];
3057             var i2 = left;
3058             var j2 = right;
3059             swap2(arr, left, k);
3060             if (compare(arr[right], t) > 0)
3061               swap2(arr, left, right);
3062             while (i2 < j2) {
3063               swap2(arr, i2, j2);
3064               i2++;
3065               j2--;
3066               while (compare(arr[i2], t) < 0)
3067                 i2++;
3068               while (compare(arr[j2], t) > 0)
3069                 j2--;
3070             }
3071             if (compare(arr[left], t) === 0)
3072               swap2(arr, left, j2);
3073             else {
3074               j2++;
3075               swap2(arr, j2, right);
3076             }
3077             if (j2 <= k)
3078               left = j2 + 1;
3079             if (k <= j2)
3080               right = j2 - 1;
3081           }
3082         }
3083         function swap2(arr, i2, j2) {
3084           var tmp = arr[i2];
3085           arr[i2] = arr[j2];
3086           arr[j2] = tmp;
3087         }
3088         function defaultCompare(a, b) {
3089           return a < b ? -1 : a > b ? 1 : 0;
3090         }
3091         return quickselect2;
3092       });
3093     }
3094   });
3095
3096   // node_modules/which-polygon/node_modules/rbush/index.js
3097   var require_rbush = __commonJS({
3098     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3099       "use strict";
3100       module2.exports = rbush;
3101       module2.exports.default = rbush;
3102       var quickselect2 = require_quickselect();
3103       function rbush(maxEntries, format2) {
3104         if (!(this instanceof rbush))
3105           return new rbush(maxEntries, format2);
3106         this._maxEntries = Math.max(4, maxEntries || 9);
3107         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3108         if (format2) {
3109           this._initFormat(format2);
3110         }
3111         this.clear();
3112       }
3113       rbush.prototype = {
3114         all: function() {
3115           return this._all(this.data, []);
3116         },
3117         search: function(bbox) {
3118           var node = this.data, result = [], toBBox = this.toBBox;
3119           if (!intersects(bbox, node))
3120             return result;
3121           var nodesToSearch = [], i2, len, child, childBBox;
3122           while (node) {
3123             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3124               child = node.children[i2];
3125               childBBox = node.leaf ? toBBox(child) : child;
3126               if (intersects(bbox, childBBox)) {
3127                 if (node.leaf)
3128                   result.push(child);
3129                 else if (contains(bbox, childBBox))
3130                   this._all(child, result);
3131                 else
3132                   nodesToSearch.push(child);
3133               }
3134             }
3135             node = nodesToSearch.pop();
3136           }
3137           return result;
3138         },
3139         collides: function(bbox) {
3140           var node = this.data, toBBox = this.toBBox;
3141           if (!intersects(bbox, node))
3142             return false;
3143           var nodesToSearch = [], i2, len, child, childBBox;
3144           while (node) {
3145             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3146               child = node.children[i2];
3147               childBBox = node.leaf ? toBBox(child) : child;
3148               if (intersects(bbox, childBBox)) {
3149                 if (node.leaf || contains(bbox, childBBox))
3150                   return true;
3151                 nodesToSearch.push(child);
3152               }
3153             }
3154             node = nodesToSearch.pop();
3155           }
3156           return false;
3157         },
3158         load: function(data) {
3159           if (!(data && data.length))
3160             return this;
3161           if (data.length < this._minEntries) {
3162             for (var i2 = 0, len = data.length; i2 < len; i2++) {
3163               this.insert(data[i2]);
3164             }
3165             return this;
3166           }
3167           var node = this._build(data.slice(), 0, data.length - 1, 0);
3168           if (!this.data.children.length) {
3169             this.data = node;
3170           } else if (this.data.height === node.height) {
3171             this._splitRoot(this.data, node);
3172           } else {
3173             if (this.data.height < node.height) {
3174               var tmpNode = this.data;
3175               this.data = node;
3176               node = tmpNode;
3177             }
3178             this._insert(node, this.data.height - node.height - 1, true);
3179           }
3180           return this;
3181         },
3182         insert: function(item) {
3183           if (item)
3184             this._insert(item, this.data.height - 1);
3185           return this;
3186         },
3187         clear: function() {
3188           this.data = createNode([]);
3189           return this;
3190         },
3191         remove: function(item, equalsFn) {
3192           if (!item)
3193             return this;
3194           var node = this.data, bbox = this.toBBox(item), path = [], indexes = [], i2, parent, index, goingUp;
3195           while (node || path.length) {
3196             if (!node) {
3197               node = path.pop();
3198               parent = path[path.length - 1];
3199               i2 = indexes.pop();
3200               goingUp = true;
3201             }
3202             if (node.leaf) {
3203               index = findItem(item, node.children, equalsFn);
3204               if (index !== -1) {
3205                 node.children.splice(index, 1);
3206                 path.push(node);
3207                 this._condense(path);
3208                 return this;
3209               }
3210             }
3211             if (!goingUp && !node.leaf && contains(node, bbox)) {
3212               path.push(node);
3213               indexes.push(i2);
3214               i2 = 0;
3215               parent = node;
3216               node = node.children[0];
3217             } else if (parent) {
3218               i2++;
3219               node = parent.children[i2];
3220               goingUp = false;
3221             } else
3222               node = null;
3223           }
3224           return this;
3225         },
3226         toBBox: function(item) {
3227           return item;
3228         },
3229         compareMinX: compareNodeMinX,
3230         compareMinY: compareNodeMinY,
3231         toJSON: function() {
3232           return this.data;
3233         },
3234         fromJSON: function(data) {
3235           this.data = data;
3236           return this;
3237         },
3238         _all: function(node, result) {
3239           var nodesToSearch = [];
3240           while (node) {
3241             if (node.leaf)
3242               result.push.apply(result, node.children);
3243             else
3244               nodesToSearch.push.apply(nodesToSearch, node.children);
3245             node = nodesToSearch.pop();
3246           }
3247           return result;
3248         },
3249         _build: function(items, left, right, height) {
3250           var N = right - left + 1, M = this._maxEntries, node;
3251           if (N <= M) {
3252             node = createNode(items.slice(left, right + 1));
3253             calcBBox(node, this.toBBox);
3254             return node;
3255           }
3256           if (!height) {
3257             height = Math.ceil(Math.log(N) / Math.log(M));
3258             M = Math.ceil(N / Math.pow(M, height - 1));
3259           }
3260           node = createNode([]);
3261           node.leaf = false;
3262           node.height = height;
3263           var N2 = Math.ceil(N / M), N1 = N2 * Math.ceil(Math.sqrt(M)), i2, j2, right2, right3;
3264           multiSelect(items, left, right, N1, this.compareMinX);
3265           for (i2 = left; i2 <= right; i2 += N1) {
3266             right2 = Math.min(i2 + N1 - 1, right);
3267             multiSelect(items, i2, right2, N2, this.compareMinY);
3268             for (j2 = i2; j2 <= right2; j2 += N2) {
3269               right3 = Math.min(j2 + N2 - 1, right2);
3270               node.children.push(this._build(items, j2, right3, height - 1));
3271             }
3272           }
3273           calcBBox(node, this.toBBox);
3274           return node;
3275         },
3276         _chooseSubtree: function(bbox, node, level, path) {
3277           var i2, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3278           while (true) {
3279             path.push(node);
3280             if (node.leaf || path.length - 1 === level)
3281               break;
3282             minArea = minEnlargement = Infinity;
3283             for (i2 = 0, len = node.children.length; i2 < len; i2++) {
3284               child = node.children[i2];
3285               area = bboxArea(child);
3286               enlargement = enlargedArea(bbox, child) - area;
3287               if (enlargement < minEnlargement) {
3288                 minEnlargement = enlargement;
3289                 minArea = area < minArea ? area : minArea;
3290                 targetNode = child;
3291               } else if (enlargement === minEnlargement) {
3292                 if (area < minArea) {
3293                   minArea = area;
3294                   targetNode = child;
3295                 }
3296               }
3297             }
3298             node = targetNode || node.children[0];
3299           }
3300           return node;
3301         },
3302         _insert: function(item, level, isNode) {
3303           var toBBox = this.toBBox, bbox = isNode ? item : toBBox(item), insertPath = [];
3304           var node = this._chooseSubtree(bbox, this.data, level, insertPath);
3305           node.children.push(item);
3306           extend2(node, bbox);
3307           while (level >= 0) {
3308             if (insertPath[level].children.length > this._maxEntries) {
3309               this._split(insertPath, level);
3310               level--;
3311             } else
3312               break;
3313           }
3314           this._adjustParentBBoxes(bbox, insertPath, level);
3315         },
3316         _split: function(insertPath, level) {
3317           var node = insertPath[level], M = node.children.length, m = this._minEntries;
3318           this._chooseSplitAxis(node, m, M);
3319           var splitIndex = this._chooseSplitIndex(node, m, M);
3320           var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
3321           newNode.height = node.height;
3322           newNode.leaf = node.leaf;
3323           calcBBox(node, this.toBBox);
3324           calcBBox(newNode, this.toBBox);
3325           if (level)
3326             insertPath[level - 1].children.push(newNode);
3327           else
3328             this._splitRoot(node, newNode);
3329         },
3330         _splitRoot: function(node, newNode) {
3331           this.data = createNode([node, newNode]);
3332           this.data.height = node.height + 1;
3333           this.data.leaf = false;
3334           calcBBox(this.data, this.toBBox);
3335         },
3336         _chooseSplitIndex: function(node, m, M) {
3337           var i2, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3338           minOverlap = minArea = Infinity;
3339           for (i2 = m; i2 <= M - m; i2++) {
3340             bbox1 = distBBox(node, 0, i2, this.toBBox);
3341             bbox2 = distBBox(node, i2, M, this.toBBox);
3342             overlap = intersectionArea(bbox1, bbox2);
3343             area = bboxArea(bbox1) + bboxArea(bbox2);
3344             if (overlap < minOverlap) {
3345               minOverlap = overlap;
3346               index = i2;
3347               minArea = area < minArea ? area : minArea;
3348             } else if (overlap === minOverlap) {
3349               if (area < minArea) {
3350                 minArea = area;
3351                 index = i2;
3352               }
3353             }
3354           }
3355           return index;
3356         },
3357         _chooseSplitAxis: function(node, m, M) {
3358           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m, M, compareMinX), yMargin = this._allDistMargin(node, m, M, compareMinY);
3359           if (xMargin < yMargin)
3360             node.children.sort(compareMinX);
3361         },
3362         _allDistMargin: function(node, m, M, compare) {
3363           node.children.sort(compare);
3364           var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i2, child;
3365           for (i2 = m; i2 < M - m; i2++) {
3366             child = node.children[i2];
3367             extend2(leftBBox, node.leaf ? toBBox(child) : child);
3368             margin += bboxMargin(leftBBox);
3369           }
3370           for (i2 = M - m - 1; i2 >= m; i2--) {
3371             child = node.children[i2];
3372             extend2(rightBBox, node.leaf ? toBBox(child) : child);
3373             margin += bboxMargin(rightBBox);
3374           }
3375           return margin;
3376         },
3377         _adjustParentBBoxes: function(bbox, path, level) {
3378           for (var i2 = level; i2 >= 0; i2--) {
3379             extend2(path[i2], bbox);
3380           }
3381         },
3382         _condense: function(path) {
3383           for (var i2 = path.length - 1, siblings; i2 >= 0; i2--) {
3384             if (path[i2].children.length === 0) {
3385               if (i2 > 0) {
3386                 siblings = path[i2 - 1].children;
3387                 siblings.splice(siblings.indexOf(path[i2]), 1);
3388               } else
3389                 this.clear();
3390             } else
3391               calcBBox(path[i2], this.toBBox);
3392           }
3393         },
3394         _initFormat: function(format2) {
3395           var compareArr = ["return a", " - b", ";"];
3396           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3397           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3398           this.toBBox = new Function(
3399             "a",
3400             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
3401           );
3402         }
3403       };
3404       function findItem(item, items, equalsFn) {
3405         if (!equalsFn)
3406           return items.indexOf(item);
3407         for (var i2 = 0; i2 < items.length; i2++) {
3408           if (equalsFn(item, items[i2]))
3409             return i2;
3410         }
3411         return -1;
3412       }
3413       function calcBBox(node, toBBox) {
3414         distBBox(node, 0, node.children.length, toBBox, node);
3415       }
3416       function distBBox(node, k, p, toBBox, destNode) {
3417         if (!destNode)
3418           destNode = createNode(null);
3419         destNode.minX = Infinity;
3420         destNode.minY = Infinity;
3421         destNode.maxX = -Infinity;
3422         destNode.maxY = -Infinity;
3423         for (var i2 = k, child; i2 < p; i2++) {
3424           child = node.children[i2];
3425           extend2(destNode, node.leaf ? toBBox(child) : child);
3426         }
3427         return destNode;
3428       }
3429       function extend2(a, b) {
3430         a.minX = Math.min(a.minX, b.minX);
3431         a.minY = Math.min(a.minY, b.minY);
3432         a.maxX = Math.max(a.maxX, b.maxX);
3433         a.maxY = Math.max(a.maxY, b.maxY);
3434         return a;
3435       }
3436       function compareNodeMinX(a, b) {
3437         return a.minX - b.minX;
3438       }
3439       function compareNodeMinY(a, b) {
3440         return a.minY - b.minY;
3441       }
3442       function bboxArea(a) {
3443         return (a.maxX - a.minX) * (a.maxY - a.minY);
3444       }
3445       function bboxMargin(a) {
3446         return a.maxX - a.minX + (a.maxY - a.minY);
3447       }
3448       function enlargedArea(a, b) {
3449         return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
3450       }
3451       function intersectionArea(a, b) {
3452         var minX = Math.max(a.minX, b.minX), minY = Math.max(a.minY, b.minY), maxX = Math.min(a.maxX, b.maxX), maxY = Math.min(a.maxY, b.maxY);
3453         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3454       }
3455       function contains(a, b) {
3456         return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
3457       }
3458       function intersects(a, b) {
3459         return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
3460       }
3461       function createNode(children2) {
3462         return {
3463           children: children2,
3464           height: 1,
3465           leaf: true,
3466           minX: Infinity,
3467           minY: Infinity,
3468           maxX: -Infinity,
3469           maxY: -Infinity
3470         };
3471       }
3472       function multiSelect(arr, left, right, n2, compare) {
3473         var stack = [left, right], mid;
3474         while (stack.length) {
3475           right = stack.pop();
3476           left = stack.pop();
3477           if (right - left <= n2)
3478             continue;
3479           mid = left + Math.ceil((right - left) / n2 / 2) * n2;
3480           quickselect2(arr, mid, left, right, compare);
3481           stack.push(left, mid, mid, right);
3482         }
3483       }
3484     }
3485   });
3486
3487   // node_modules/lineclip/index.js
3488   var require_lineclip = __commonJS({
3489     "node_modules/lineclip/index.js"(exports2, module2) {
3490       "use strict";
3491       module2.exports = lineclip2;
3492       lineclip2.polyline = lineclip2;
3493       lineclip2.polygon = polygonclip2;
3494       function lineclip2(points, bbox, result) {
3495         var len = points.length, codeA = bitCode2(points[0], bbox), part = [], i2, a, b, codeB, lastCode;
3496         if (!result)
3497           result = [];
3498         for (i2 = 1; i2 < len; i2++) {
3499           a = points[i2 - 1];
3500           b = points[i2];
3501           codeB = lastCode = bitCode2(b, bbox);
3502           while (true) {
3503             if (!(codeA | codeB)) {
3504               part.push(a);
3505               if (codeB !== lastCode) {
3506                 part.push(b);
3507                 if (i2 < len - 1) {
3508                   result.push(part);
3509                   part = [];
3510                 }
3511               } else if (i2 === len - 1) {
3512                 part.push(b);
3513               }
3514               break;
3515             } else if (codeA & codeB) {
3516               break;
3517             } else if (codeA) {
3518               a = intersect2(a, b, codeA, bbox);
3519               codeA = bitCode2(a, bbox);
3520             } else {
3521               b = intersect2(a, b, codeB, bbox);
3522               codeB = bitCode2(b, bbox);
3523             }
3524           }
3525           codeA = lastCode;
3526         }
3527         if (part.length)
3528           result.push(part);
3529         return result;
3530       }
3531       function polygonclip2(points, bbox) {
3532         var result, edge, prev, prevInside, i2, p, inside;
3533         for (edge = 1; edge <= 8; edge *= 2) {
3534           result = [];
3535           prev = points[points.length - 1];
3536           prevInside = !(bitCode2(prev, bbox) & edge);
3537           for (i2 = 0; i2 < points.length; i2++) {
3538             p = points[i2];
3539             inside = !(bitCode2(p, bbox) & edge);
3540             if (inside !== prevInside)
3541               result.push(intersect2(prev, p, edge, bbox));
3542             if (inside)
3543               result.push(p);
3544             prev = p;
3545             prevInside = inside;
3546           }
3547           points = result;
3548           if (!points.length)
3549             break;
3550         }
3551         return result;
3552       }
3553       function intersect2(a, b, edge, bbox) {
3554         return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox[3] - a[1]) / (b[1] - a[1]), bbox[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox[1] - a[1]) / (b[1] - a[1]), bbox[1]] : edge & 2 ? [bbox[2], a[1] + (b[1] - a[1]) * (bbox[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox[0], a[1] + (b[1] - a[1]) * (bbox[0] - a[0]) / (b[0] - a[0])] : null;
3555       }
3556       function bitCode2(p, bbox) {
3557         var code = 0;
3558         if (p[0] < bbox[0])
3559           code |= 1;
3560         else if (p[0] > bbox[2])
3561           code |= 2;
3562         if (p[1] < bbox[1])
3563           code |= 4;
3564         else if (p[1] > bbox[3])
3565           code |= 8;
3566         return code;
3567       }
3568     }
3569   });
3570
3571   // node_modules/which-polygon/index.js
3572   var require_which_polygon = __commonJS({
3573     "node_modules/which-polygon/index.js"(exports2, module2) {
3574       "use strict";
3575       var rbush = require_rbush();
3576       var lineclip2 = require_lineclip();
3577       module2.exports = whichPolygon5;
3578       function whichPolygon5(data) {
3579         var bboxes = [];
3580         for (var i2 = 0; i2 < data.features.length; i2++) {
3581           var feature3 = data.features[i2];
3582           var coords = feature3.geometry.coordinates;
3583           if (feature3.geometry.type === "Polygon") {
3584             bboxes.push(treeItem(coords, feature3.properties));
3585           } else if (feature3.geometry.type === "MultiPolygon") {
3586             for (var j2 = 0; j2 < coords.length; j2++) {
3587               bboxes.push(treeItem(coords[j2], feature3.properties));
3588             }
3589           }
3590         }
3591         var tree = rbush().load(bboxes);
3592         function query(p, multi) {
3593           var output = [], result = tree.search({
3594             minX: p[0],
3595             minY: p[1],
3596             maxX: p[0],
3597             maxY: p[1]
3598           });
3599           for (var i3 = 0; i3 < result.length; i3++) {
3600             if (insidePolygon(result[i3].coords, p)) {
3601               if (multi)
3602                 output.push(result[i3].props);
3603               else
3604                 return result[i3].props;
3605             }
3606           }
3607           return multi && output.length ? output : null;
3608         }
3609         query.tree = tree;
3610         query.bbox = function queryBBox(bbox) {
3611           var output = [];
3612           var result = tree.search({
3613             minX: bbox[0],
3614             minY: bbox[1],
3615             maxX: bbox[2],
3616             maxY: bbox[3]
3617           });
3618           for (var i3 = 0; i3 < result.length; i3++) {
3619             if (polygonIntersectsBBox(result[i3].coords, bbox)) {
3620               output.push(result[i3].props);
3621             }
3622           }
3623           return output;
3624         };
3625         return query;
3626       }
3627       function polygonIntersectsBBox(polygon2, bbox) {
3628         var bboxCenter = [
3629           (bbox[0] + bbox[2]) / 2,
3630           (bbox[1] + bbox[3]) / 2
3631         ];
3632         if (insidePolygon(polygon2, bboxCenter))
3633           return true;
3634         for (var i2 = 0; i2 < polygon2.length; i2++) {
3635           if (lineclip2(polygon2[i2], bbox).length > 0)
3636             return true;
3637         }
3638         return false;
3639       }
3640       function insidePolygon(rings, p) {
3641         var inside = false;
3642         for (var i2 = 0, len = rings.length; i2 < len; i2++) {
3643           var ring = rings[i2];
3644           for (var j2 = 0, len2 = ring.length, k = len2 - 1; j2 < len2; k = j2++) {
3645             if (rayIntersect(p, ring[j2], ring[k]))
3646               inside = !inside;
3647           }
3648         }
3649         return inside;
3650       }
3651       function rayIntersect(p, p1, p2) {
3652         return p1[1] > p[1] !== p2[1] > p[1] && p[0] < (p2[0] - p1[0]) * (p[1] - p1[1]) / (p2[1] - p1[1]) + p1[0];
3653       }
3654       function treeItem(coords, props) {
3655         var item = {
3656           minX: Infinity,
3657           minY: Infinity,
3658           maxX: -Infinity,
3659           maxY: -Infinity,
3660           coords,
3661           props
3662         };
3663         for (var i2 = 0; i2 < coords[0].length; i2++) {
3664           var p = coords[0][i2];
3665           item.minX = Math.min(item.minX, p[0]);
3666           item.minY = Math.min(item.minY, p[1]);
3667           item.maxX = Math.max(item.maxX, p[0]);
3668           item.maxY = Math.max(item.maxY, p[1]);
3669         }
3670         return item;
3671       }
3672     }
3673   });
3674
3675   // node_modules/wgs84/index.js
3676   var require_wgs84 = __commonJS({
3677     "node_modules/wgs84/index.js"(exports2, module2) {
3678       module2.exports.RADIUS = 6378137;
3679       module2.exports.FLATTENING = 1 / 298.257223563;
3680       module2.exports.POLAR_RADIUS = 63567523142e-4;
3681     }
3682   });
3683
3684   // node_modules/@mapbox/geojson-area/index.js
3685   var require_geojson_area = __commonJS({
3686     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3687       var wgs84 = require_wgs84();
3688       module2.exports.geometry = geometry;
3689       module2.exports.ring = ringArea;
3690       function geometry(_) {
3691         var area = 0, i2;
3692         switch (_.type) {
3693           case "Polygon":
3694             return polygonArea(_.coordinates);
3695           case "MultiPolygon":
3696             for (i2 = 0; i2 < _.coordinates.length; i2++) {
3697               area += polygonArea(_.coordinates[i2]);
3698             }
3699             return area;
3700           case "Point":
3701           case "MultiPoint":
3702           case "LineString":
3703           case "MultiLineString":
3704             return 0;
3705           case "GeometryCollection":
3706             for (i2 = 0; i2 < _.geometries.length; i2++) {
3707               area += geometry(_.geometries[i2]);
3708             }
3709             return area;
3710         }
3711       }
3712       function polygonArea(coords) {
3713         var area = 0;
3714         if (coords && coords.length > 0) {
3715           area += Math.abs(ringArea(coords[0]));
3716           for (var i2 = 1; i2 < coords.length; i2++) {
3717             area -= Math.abs(ringArea(coords[i2]));
3718           }
3719         }
3720         return area;
3721       }
3722       function ringArea(coords) {
3723         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i2, area = 0, coordsLength = coords.length;
3724         if (coordsLength > 2) {
3725           for (i2 = 0; i2 < coordsLength; i2++) {
3726             if (i2 === coordsLength - 2) {
3727               lowerIndex = coordsLength - 2;
3728               middleIndex = coordsLength - 1;
3729               upperIndex = 0;
3730             } else if (i2 === coordsLength - 1) {
3731               lowerIndex = coordsLength - 1;
3732               middleIndex = 0;
3733               upperIndex = 1;
3734             } else {
3735               lowerIndex = i2;
3736               middleIndex = i2 + 1;
3737               upperIndex = i2 + 2;
3738             }
3739             p1 = coords[lowerIndex];
3740             p2 = coords[middleIndex];
3741             p3 = coords[upperIndex];
3742             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3743           }
3744           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3745         }
3746         return area;
3747       }
3748       function rad(_) {
3749         return _ * Math.PI / 180;
3750       }
3751     }
3752   });
3753
3754   // node_modules/circle-to-polygon/input-validation/validateCenter.js
3755   var require_validateCenter = __commonJS({
3756     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3757       exports2.validateCenter = function validateCenter(center) {
3758         var validCenterLengths = [2, 3];
3759         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3760           throw new Error("ERROR! Center has to be an array of length two or three");
3761         }
3762         var [lng, lat] = center;
3763         if (typeof lng !== "number" || typeof lat !== "number") {
3764           throw new Error(
3765             `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
3766           );
3767         }
3768         if (lng > 180 || lng < -180) {
3769           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
3770         }
3771         if (lat > 90 || lat < -90) {
3772           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
3773         }
3774       };
3775     }
3776   });
3777
3778   // node_modules/circle-to-polygon/input-validation/validateRadius.js
3779   var require_validateRadius = __commonJS({
3780     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3781       exports2.validateRadius = function validateRadius(radius) {
3782         if (typeof radius !== "number") {
3783           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
3784         }
3785         if (radius <= 0) {
3786           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
3787         }
3788       };
3789     }
3790   });
3791
3792   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3793   var require_validateNumberOfEdges = __commonJS({
3794     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3795       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3796         if (typeof numberOfEdges !== "number") {
3797           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3798           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
3799         }
3800         if (numberOfEdges < 3) {
3801           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
3802         }
3803       };
3804     }
3805   });
3806
3807   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3808   var require_validateEarthRadius = __commonJS({
3809     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3810       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3811         if (typeof earthRadius2 !== "number") {
3812           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3813           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
3814         }
3815         if (earthRadius2 <= 0) {
3816           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
3817         }
3818       };
3819     }
3820   });
3821
3822   // node_modules/circle-to-polygon/input-validation/validateBearing.js
3823   var require_validateBearing = __commonJS({
3824     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3825       exports2.validateBearing = function validateBearing(bearing) {
3826         if (typeof bearing !== "number") {
3827           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3828           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
3829         }
3830       };
3831     }
3832   });
3833
3834   // node_modules/circle-to-polygon/input-validation/index.js
3835   var require_input_validation = __commonJS({
3836     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3837       var validateCenter = require_validateCenter().validateCenter;
3838       var validateRadius = require_validateRadius().validateRadius;
3839       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3840       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3841       var validateBearing = require_validateBearing().validateBearing;
3842       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3843         validateCenter(center);
3844         validateRadius(radius);
3845         validateNumberOfEdges(numberOfEdges);
3846         validateEarthRadius(earthRadius2);
3847         validateBearing(bearing);
3848       }
3849       exports2.validateCenter = validateCenter;
3850       exports2.validateRadius = validateRadius;
3851       exports2.validateNumberOfEdges = validateNumberOfEdges;
3852       exports2.validateEarthRadius = validateEarthRadius;
3853       exports2.validateBearing = validateBearing;
3854       exports2.validateInput = validateInput;
3855     }
3856   });
3857
3858   // node_modules/circle-to-polygon/index.js
3859   var require_circle_to_polygon = __commonJS({
3860     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3861       "use strict";
3862       var { validateInput } = require_input_validation();
3863       var defaultEarthRadius = 6378137;
3864       function toRadians(angleInDegrees) {
3865         return angleInDegrees * Math.PI / 180;
3866       }
3867       function toDegrees(angleInRadians) {
3868         return angleInRadians * 180 / Math.PI;
3869       }
3870       function offset(c1, distance, earthRadius2, bearing) {
3871         var lat1 = toRadians(c1[1]);
3872         var lon1 = toRadians(c1[0]);
3873         var dByR = distance / earthRadius2;
3874         var lat = Math.asin(
3875           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3876         );
3877         var lon = lon1 + Math.atan2(
3878           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3879           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3880         );
3881         return [toDegrees(lon), toDegrees(lat)];
3882       }
3883       module2.exports = function circleToPolygon2(center, radius, options2) {
3884         var n2 = getNumberOfEdges(options2);
3885         var earthRadius2 = getEarthRadius(options2);
3886         var bearing = getBearing(options2);
3887         var direction = getDirection(options2);
3888         validateInput({ center, radius, numberOfEdges: n2, earthRadius: earthRadius2, bearing });
3889         var start2 = toRadians(bearing);
3890         var coordinates = [];
3891         for (var i2 = 0; i2 < n2; ++i2) {
3892           coordinates.push(
3893             offset(
3894               center,
3895               radius,
3896               earthRadius2,
3897               start2 + direction * 2 * Math.PI * -i2 / n2
3898             )
3899           );
3900         }
3901         coordinates.push(coordinates[0]);
3902         return {
3903           type: "Polygon",
3904           coordinates: [coordinates]
3905         };
3906       };
3907       function getNumberOfEdges(options2) {
3908         if (isUndefinedOrNull(options2)) {
3909           return 32;
3910         } else if (isObjectNotArray(options2)) {
3911           var numberOfEdges = options2.numberOfEdges;
3912           return numberOfEdges === void 0 ? 32 : numberOfEdges;
3913         }
3914         return options2;
3915       }
3916       function getEarthRadius(options2) {
3917         if (isUndefinedOrNull(options2)) {
3918           return defaultEarthRadius;
3919         } else if (isObjectNotArray(options2)) {
3920           var earthRadius2 = options2.earthRadius;
3921           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3922         }
3923         return defaultEarthRadius;
3924       }
3925       function getDirection(options2) {
3926         if (isObjectNotArray(options2) && options2.rightHandRule) {
3927           return -1;
3928         }
3929         return 1;
3930       }
3931       function getBearing(options2) {
3932         if (isUndefinedOrNull(options2)) {
3933           return 0;
3934         } else if (isObjectNotArray(options2)) {
3935           var bearing = options2.bearing;
3936           return bearing === void 0 ? 0 : bearing;
3937         }
3938         return 0;
3939       }
3940       function isObjectNotArray(argument) {
3941         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3942       }
3943       function isUndefinedOrNull(argument) {
3944         return argument === null || argument === void 0;
3945       }
3946     }
3947   });
3948
3949   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
3950   var require_polygon_clipping_umd = __commonJS({
3951     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
3952       (function(global3, factory) {
3953         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global3 = typeof globalThis !== "undefined" ? globalThis : global3 || self, global3.polygonClipping = factory());
3954       })(exports2, function() {
3955         "use strict";
3956         function _classCallCheck(instance, Constructor) {
3957           if (!(instance instanceof Constructor)) {
3958             throw new TypeError("Cannot call a class as a function");
3959           }
3960         }
3961         function _defineProperties(target, props) {
3962           for (var i2 = 0; i2 < props.length; i2++) {
3963             var descriptor = props[i2];
3964             descriptor.enumerable = descriptor.enumerable || false;
3965             descriptor.configurable = true;
3966             if ("value" in descriptor)
3967               descriptor.writable = true;
3968             Object.defineProperty(target, descriptor.key, descriptor);
3969           }
3970         }
3971         function _createClass(Constructor, protoProps, staticProps) {
3972           if (protoProps)
3973             _defineProperties(Constructor.prototype, protoProps);
3974           if (staticProps)
3975             _defineProperties(Constructor, staticProps);
3976           return Constructor;
3977         }
3978         var Node = function() {
3979           function Node2(key, data) {
3980             this.next = null;
3981             this.key = key;
3982             this.data = data;
3983             this.left = null;
3984             this.right = null;
3985           }
3986           return Node2;
3987         }();
3988         function DEFAULT_COMPARE(a, b) {
3989           return a > b ? 1 : a < b ? -1 : 0;
3990         }
3991         function splay(i2, t, comparator) {
3992           var N = new Node(null, null);
3993           var l = N;
3994           var r = N;
3995           while (true) {
3996             var cmp2 = comparator(i2, t.key);
3997             if (cmp2 < 0) {
3998               if (t.left === null)
3999                 break;
4000               if (comparator(i2, t.left.key) < 0) {
4001                 var y = t.left;
4002                 t.left = y.right;
4003                 y.right = t;
4004                 t = y;
4005                 if (t.left === null)
4006                   break;
4007               }
4008               r.left = t;
4009               r = t;
4010               t = t.left;
4011             } else if (cmp2 > 0) {
4012               if (t.right === null)
4013                 break;
4014               if (comparator(i2, t.right.key) > 0) {
4015                 var y = t.right;
4016                 t.right = y.left;
4017                 y.left = t;
4018                 t = y;
4019                 if (t.right === null)
4020                   break;
4021               }
4022               l.right = t;
4023               l = t;
4024               t = t.right;
4025             } else
4026               break;
4027           }
4028           l.right = t.left;
4029           r.left = t.right;
4030           t.left = N.right;
4031           t.right = N.left;
4032           return t;
4033         }
4034         function insert(i2, data, t, comparator) {
4035           var node = new Node(i2, data);
4036           if (t === null) {
4037             node.left = node.right = null;
4038             return node;
4039           }
4040           t = splay(i2, t, comparator);
4041           var cmp2 = comparator(i2, t.key);
4042           if (cmp2 < 0) {
4043             node.left = t.left;
4044             node.right = t;
4045             t.left = null;
4046           } else if (cmp2 >= 0) {
4047             node.right = t.right;
4048             node.left = t;
4049             t.right = null;
4050           }
4051           return node;
4052         }
4053         function split(key, v, comparator) {
4054           var left = null;
4055           var right = null;
4056           if (v) {
4057             v = splay(key, v, comparator);
4058             var cmp2 = comparator(v.key, key);
4059             if (cmp2 === 0) {
4060               left = v.left;
4061               right = v.right;
4062             } else if (cmp2 < 0) {
4063               right = v.right;
4064               v.right = null;
4065               left = v;
4066             } else {
4067               left = v.left;
4068               v.left = null;
4069               right = v;
4070             }
4071           }
4072           return {
4073             left,
4074             right
4075           };
4076         }
4077         function merge3(left, right, comparator) {
4078           if (right === null)
4079             return left;
4080           if (left === null)
4081             return right;
4082           right = splay(left.key, right, comparator);
4083           right.left = left;
4084           return right;
4085         }
4086         function printRow(root3, prefix, isTail, out, printNode) {
4087           if (root3) {
4088             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
4089             var indent2 = prefix + (isTail ? "    " : "\u2502   ");
4090             if (root3.left)
4091               printRow(root3.left, indent2, false, out, printNode);
4092             if (root3.right)
4093               printRow(root3.right, indent2, true, out, printNode);
4094           }
4095         }
4096         var Tree = function() {
4097           function Tree2(comparator) {
4098             if (comparator === void 0) {
4099               comparator = DEFAULT_COMPARE;
4100             }
4101             this._root = null;
4102             this._size = 0;
4103             this._comparator = comparator;
4104           }
4105           Tree2.prototype.insert = function(key, data) {
4106             this._size++;
4107             return this._root = insert(key, data, this._root, this._comparator);
4108           };
4109           Tree2.prototype.add = function(key, data) {
4110             var node = new Node(key, data);
4111             if (this._root === null) {
4112               node.left = node.right = null;
4113               this._size++;
4114               this._root = node;
4115             }
4116             var comparator = this._comparator;
4117             var t = splay(key, this._root, comparator);
4118             var cmp2 = comparator(key, t.key);
4119             if (cmp2 === 0)
4120               this._root = t;
4121             else {
4122               if (cmp2 < 0) {
4123                 node.left = t.left;
4124                 node.right = t;
4125                 t.left = null;
4126               } else if (cmp2 > 0) {
4127                 node.right = t.right;
4128                 node.left = t;
4129                 t.right = null;
4130               }
4131               this._size++;
4132               this._root = node;
4133             }
4134             return this._root;
4135           };
4136           Tree2.prototype.remove = function(key) {
4137             this._root = this._remove(key, this._root, this._comparator);
4138           };
4139           Tree2.prototype._remove = function(i2, t, comparator) {
4140             var x;
4141             if (t === null)
4142               return null;
4143             t = splay(i2, t, comparator);
4144             var cmp2 = comparator(i2, t.key);
4145             if (cmp2 === 0) {
4146               if (t.left === null) {
4147                 x = t.right;
4148               } else {
4149                 x = splay(i2, t.left, comparator);
4150                 x.right = t.right;
4151               }
4152               this._size--;
4153               return x;
4154             }
4155             return t;
4156           };
4157           Tree2.prototype.pop = function() {
4158             var node = this._root;
4159             if (node) {
4160               while (node.left) {
4161                 node = node.left;
4162               }
4163               this._root = splay(node.key, this._root, this._comparator);
4164               this._root = this._remove(node.key, this._root, this._comparator);
4165               return {
4166                 key: node.key,
4167                 data: node.data
4168               };
4169             }
4170             return null;
4171           };
4172           Tree2.prototype.findStatic = function(key) {
4173             var current = this._root;
4174             var compare = this._comparator;
4175             while (current) {
4176               var cmp2 = compare(key, current.key);
4177               if (cmp2 === 0)
4178                 return current;
4179               else if (cmp2 < 0)
4180                 current = current.left;
4181               else
4182                 current = current.right;
4183             }
4184             return null;
4185           };
4186           Tree2.prototype.find = function(key) {
4187             if (this._root) {
4188               this._root = splay(key, this._root, this._comparator);
4189               if (this._comparator(key, this._root.key) !== 0)
4190                 return null;
4191             }
4192             return this._root;
4193           };
4194           Tree2.prototype.contains = function(key) {
4195             var current = this._root;
4196             var compare = this._comparator;
4197             while (current) {
4198               var cmp2 = compare(key, current.key);
4199               if (cmp2 === 0)
4200                 return true;
4201               else if (cmp2 < 0)
4202                 current = current.left;
4203               else
4204                 current = current.right;
4205             }
4206             return false;
4207           };
4208           Tree2.prototype.forEach = function(visitor, ctx) {
4209             var current = this._root;
4210             var Q = [];
4211             var done = false;
4212             while (!done) {
4213               if (current !== null) {
4214                 Q.push(current);
4215                 current = current.left;
4216               } else {
4217                 if (Q.length !== 0) {
4218                   current = Q.pop();
4219                   visitor.call(ctx, current);
4220                   current = current.right;
4221                 } else
4222                   done = true;
4223               }
4224             }
4225             return this;
4226           };
4227           Tree2.prototype.range = function(low, high, fn, ctx) {
4228             var Q = [];
4229             var compare = this._comparator;
4230             var node = this._root;
4231             var cmp2;
4232             while (Q.length !== 0 || node) {
4233               if (node) {
4234                 Q.push(node);
4235                 node = node.left;
4236               } else {
4237                 node = Q.pop();
4238                 cmp2 = compare(node.key, high);
4239                 if (cmp2 > 0) {
4240                   break;
4241                 } else if (compare(node.key, low) >= 0) {
4242                   if (fn.call(ctx, node))
4243                     return this;
4244                 }
4245                 node = node.right;
4246               }
4247             }
4248             return this;
4249           };
4250           Tree2.prototype.keys = function() {
4251             var keys = [];
4252             this.forEach(function(_a) {
4253               var key = _a.key;
4254               return keys.push(key);
4255             });
4256             return keys;
4257           };
4258           Tree2.prototype.values = function() {
4259             var values = [];
4260             this.forEach(function(_a) {
4261               var data = _a.data;
4262               return values.push(data);
4263             });
4264             return values;
4265           };
4266           Tree2.prototype.min = function() {
4267             if (this._root)
4268               return this.minNode(this._root).key;
4269             return null;
4270           };
4271           Tree2.prototype.max = function() {
4272             if (this._root)
4273               return this.maxNode(this._root).key;
4274             return null;
4275           };
4276           Tree2.prototype.minNode = function(t) {
4277             if (t === void 0) {
4278               t = this._root;
4279             }
4280             if (t)
4281               while (t.left) {
4282                 t = t.left;
4283               }
4284             return t;
4285           };
4286           Tree2.prototype.maxNode = function(t) {
4287             if (t === void 0) {
4288               t = this._root;
4289             }
4290             if (t)
4291               while (t.right) {
4292                 t = t.right;
4293               }
4294             return t;
4295           };
4296           Tree2.prototype.at = function(index2) {
4297             var current = this._root;
4298             var done = false;
4299             var i2 = 0;
4300             var Q = [];
4301             while (!done) {
4302               if (current) {
4303                 Q.push(current);
4304                 current = current.left;
4305               } else {
4306                 if (Q.length > 0) {
4307                   current = Q.pop();
4308                   if (i2 === index2)
4309                     return current;
4310                   i2++;
4311                   current = current.right;
4312                 } else
4313                   done = true;
4314               }
4315             }
4316             return null;
4317           };
4318           Tree2.prototype.next = function(d) {
4319             var root3 = this._root;
4320             var successor = null;
4321             if (d.right) {
4322               successor = d.right;
4323               while (successor.left) {
4324                 successor = successor.left;
4325               }
4326               return successor;
4327             }
4328             var comparator = this._comparator;
4329             while (root3) {
4330               var cmp2 = comparator(d.key, root3.key);
4331               if (cmp2 === 0)
4332                 break;
4333               else if (cmp2 < 0) {
4334                 successor = root3;
4335                 root3 = root3.left;
4336               } else
4337                 root3 = root3.right;
4338             }
4339             return successor;
4340           };
4341           Tree2.prototype.prev = function(d) {
4342             var root3 = this._root;
4343             var predecessor = null;
4344             if (d.left !== null) {
4345               predecessor = d.left;
4346               while (predecessor.right) {
4347                 predecessor = predecessor.right;
4348               }
4349               return predecessor;
4350             }
4351             var comparator = this._comparator;
4352             while (root3) {
4353               var cmp2 = comparator(d.key, root3.key);
4354               if (cmp2 === 0)
4355                 break;
4356               else if (cmp2 < 0)
4357                 root3 = root3.left;
4358               else {
4359                 predecessor = root3;
4360                 root3 = root3.right;
4361               }
4362             }
4363             return predecessor;
4364           };
4365           Tree2.prototype.clear = function() {
4366             this._root = null;
4367             this._size = 0;
4368             return this;
4369           };
4370           Tree2.prototype.toList = function() {
4371             return toList(this._root);
4372           };
4373           Tree2.prototype.load = function(keys, values, presort) {
4374             if (values === void 0) {
4375               values = [];
4376             }
4377             if (presort === void 0) {
4378               presort = false;
4379             }
4380             var size = keys.length;
4381             var comparator = this._comparator;
4382             if (presort)
4383               sort(keys, values, 0, size - 1, comparator);
4384             if (this._root === null) {
4385               this._root = loadRecursive(keys, values, 0, size);
4386               this._size = size;
4387             } else {
4388               var mergedList = mergeLists(this.toList(), createList(keys, values), comparator);
4389               size = this._size + size;
4390               this._root = sortedListToBST({
4391                 head: mergedList
4392               }, 0, size);
4393             }
4394             return this;
4395           };
4396           Tree2.prototype.isEmpty = function() {
4397             return this._root === null;
4398           };
4399           Object.defineProperty(Tree2.prototype, "size", {
4400             get: function get4() {
4401               return this._size;
4402             },
4403             enumerable: true,
4404             configurable: true
4405           });
4406           Object.defineProperty(Tree2.prototype, "root", {
4407             get: function get4() {
4408               return this._root;
4409             },
4410             enumerable: true,
4411             configurable: true
4412           });
4413           Tree2.prototype.toString = function(printNode) {
4414             if (printNode === void 0) {
4415               printNode = function printNode2(n2) {
4416                 return String(n2.key);
4417               };
4418             }
4419             var out = [];
4420             printRow(this._root, "", true, function(v) {
4421               return out.push(v);
4422             }, printNode);
4423             return out.join("");
4424           };
4425           Tree2.prototype.update = function(key, newKey, newData) {
4426             var comparator = this._comparator;
4427             var _a = split(key, this._root, comparator), left = _a.left, right = _a.right;
4428             if (comparator(key, newKey) < 0) {
4429               right = insert(newKey, newData, right, comparator);
4430             } else {
4431               left = insert(newKey, newData, left, comparator);
4432             }
4433             this._root = merge3(left, right, comparator);
4434           };
4435           Tree2.prototype.split = function(key) {
4436             return split(key, this._root, this._comparator);
4437           };
4438           return Tree2;
4439         }();
4440         function loadRecursive(keys, values, start2, end) {
4441           var size = end - start2;
4442           if (size > 0) {
4443             var middle = start2 + Math.floor(size / 2);
4444             var key = keys[middle];
4445             var data = values[middle];
4446             var node = new Node(key, data);
4447             node.left = loadRecursive(keys, values, start2, middle);
4448             node.right = loadRecursive(keys, values, middle + 1, end);
4449             return node;
4450           }
4451           return null;
4452         }
4453         function createList(keys, values) {
4454           var head = new Node(null, null);
4455           var p = head;
4456           for (var i2 = 0; i2 < keys.length; i2++) {
4457             p = p.next = new Node(keys[i2], values[i2]);
4458           }
4459           p.next = null;
4460           return head.next;
4461         }
4462         function toList(root3) {
4463           var current = root3;
4464           var Q = [];
4465           var done = false;
4466           var head = new Node(null, null);
4467           var p = head;
4468           while (!done) {
4469             if (current) {
4470               Q.push(current);
4471               current = current.left;
4472             } else {
4473               if (Q.length > 0) {
4474                 current = p = p.next = Q.pop();
4475                 current = current.right;
4476               } else
4477                 done = true;
4478             }
4479           }
4480           p.next = null;
4481           return head.next;
4482         }
4483         function sortedListToBST(list, start2, end) {
4484           var size = end - start2;
4485           if (size > 0) {
4486             var middle = start2 + Math.floor(size / 2);
4487             var left = sortedListToBST(list, start2, middle);
4488             var root3 = list.head;
4489             root3.left = left;
4490             list.head = list.head.next;
4491             root3.right = sortedListToBST(list, middle + 1, end);
4492             return root3;
4493           }
4494           return null;
4495         }
4496         function mergeLists(l1, l2, compare) {
4497           var head = new Node(null, null);
4498           var p = head;
4499           var p1 = l1;
4500           var p2 = l2;
4501           while (p1 !== null && p2 !== null) {
4502             if (compare(p1.key, p2.key) < 0) {
4503               p.next = p1;
4504               p1 = p1.next;
4505             } else {
4506               p.next = p2;
4507               p2 = p2.next;
4508             }
4509             p = p.next;
4510           }
4511           if (p1 !== null) {
4512             p.next = p1;
4513           } else if (p2 !== null) {
4514             p.next = p2;
4515           }
4516           return head.next;
4517         }
4518         function sort(keys, values, left, right, compare) {
4519           if (left >= right)
4520             return;
4521           var pivot = keys[left + right >> 1];
4522           var i2 = left - 1;
4523           var j2 = right + 1;
4524           while (true) {
4525             do {
4526               i2++;
4527             } while (compare(keys[i2], pivot) < 0);
4528             do {
4529               j2--;
4530             } while (compare(keys[j2], pivot) > 0);
4531             if (i2 >= j2)
4532               break;
4533             var tmp = keys[i2];
4534             keys[i2] = keys[j2];
4535             keys[j2] = tmp;
4536             tmp = values[i2];
4537             values[i2] = values[j2];
4538             values[j2] = tmp;
4539           }
4540           sort(keys, values, left, j2, compare);
4541           sort(keys, values, j2 + 1, right, compare);
4542         }
4543         var isInBbox = function isInBbox2(bbox, point) {
4544           return bbox.ll.x <= point.x && point.x <= bbox.ur.x && bbox.ll.y <= point.y && point.y <= bbox.ur.y;
4545         };
4546         var getBboxOverlap = function getBboxOverlap2(b1, b2) {
4547           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)
4548             return null;
4549           var lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
4550           var upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
4551           var lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
4552           var upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
4553           return {
4554             ll: {
4555               x: lowerX,
4556               y: lowerY
4557             },
4558             ur: {
4559               x: upperX,
4560               y: upperY
4561             }
4562           };
4563         };
4564         var epsilon3 = Number.EPSILON;
4565         if (epsilon3 === void 0)
4566           epsilon3 = Math.pow(2, -52);
4567         var EPSILON_SQ = epsilon3 * epsilon3;
4568         var cmp = function cmp2(a, b) {
4569           if (-epsilon3 < a && a < epsilon3) {
4570             if (-epsilon3 < b && b < epsilon3) {
4571               return 0;
4572             }
4573           }
4574           var ab = a - b;
4575           if (ab * ab < EPSILON_SQ * a * b) {
4576             return 0;
4577           }
4578           return a < b ? -1 : 1;
4579         };
4580         var PtRounder = /* @__PURE__ */ function() {
4581           function PtRounder2() {
4582             _classCallCheck(this, PtRounder2);
4583             this.reset();
4584           }
4585           _createClass(PtRounder2, [{
4586             key: "reset",
4587             value: function reset() {
4588               this.xRounder = new CoordRounder();
4589               this.yRounder = new CoordRounder();
4590             }
4591           }, {
4592             key: "round",
4593             value: function round(x, y) {
4594               return {
4595                 x: this.xRounder.round(x),
4596                 y: this.yRounder.round(y)
4597               };
4598             }
4599           }]);
4600           return PtRounder2;
4601         }();
4602         var CoordRounder = /* @__PURE__ */ function() {
4603           function CoordRounder2() {
4604             _classCallCheck(this, CoordRounder2);
4605             this.tree = new Tree();
4606             this.round(0);
4607           }
4608           _createClass(CoordRounder2, [{
4609             key: "round",
4610             value: function round(coord2) {
4611               var node = this.tree.add(coord2);
4612               var prevNode = this.tree.prev(node);
4613               if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
4614                 this.tree.remove(coord2);
4615                 return prevNode.key;
4616               }
4617               var nextNode = this.tree.next(node);
4618               if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
4619                 this.tree.remove(coord2);
4620                 return nextNode.key;
4621               }
4622               return coord2;
4623             }
4624           }]);
4625           return CoordRounder2;
4626         }();
4627         var rounder = new PtRounder();
4628         var crossProduct = function crossProduct2(a, b) {
4629           return a.x * b.y - a.y * b.x;
4630         };
4631         var dotProduct = function dotProduct2(a, b) {
4632           return a.x * b.x + a.y * b.y;
4633         };
4634         var compareVectorAngles = function compareVectorAngles2(basePt, endPt1, endPt2) {
4635           var v1 = {
4636             x: endPt1.x - basePt.x,
4637             y: endPt1.y - basePt.y
4638           };
4639           var v2 = {
4640             x: endPt2.x - basePt.x,
4641             y: endPt2.y - basePt.y
4642           };
4643           var kross = crossProduct(v1, v2);
4644           return cmp(kross, 0);
4645         };
4646         var length = function length2(v) {
4647           return Math.sqrt(dotProduct(v, v));
4648         };
4649         var sineOfAngle = function sineOfAngle2(pShared, pBase, pAngle) {
4650           var vBase = {
4651             x: pBase.x - pShared.x,
4652             y: pBase.y - pShared.y
4653           };
4654           var vAngle = {
4655             x: pAngle.x - pShared.x,
4656             y: pAngle.y - pShared.y
4657           };
4658           return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4659         };
4660         var cosineOfAngle = function cosineOfAngle2(pShared, pBase, pAngle) {
4661           var vBase = {
4662             x: pBase.x - pShared.x,
4663             y: pBase.y - pShared.y
4664           };
4665           var vAngle = {
4666             x: pAngle.x - pShared.x,
4667             y: pAngle.y - pShared.y
4668           };
4669           return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4670         };
4671         var horizontalIntersection = function horizontalIntersection2(pt, v, y) {
4672           if (v.y === 0)
4673             return null;
4674           return {
4675             x: pt.x + v.x / v.y * (y - pt.y),
4676             y
4677           };
4678         };
4679         var verticalIntersection = function verticalIntersection2(pt, v, x) {
4680           if (v.x === 0)
4681             return null;
4682           return {
4683             x,
4684             y: pt.y + v.y / v.x * (x - pt.x)
4685           };
4686         };
4687         var intersection = function intersection2(pt1, v1, pt2, v2) {
4688           if (v1.x === 0)
4689             return verticalIntersection(pt2, v2, pt1.x);
4690           if (v2.x === 0)
4691             return verticalIntersection(pt1, v1, pt2.x);
4692           if (v1.y === 0)
4693             return horizontalIntersection(pt2, v2, pt1.y);
4694           if (v2.y === 0)
4695             return horizontalIntersection(pt1, v1, pt2.y);
4696           var kross = crossProduct(v1, v2);
4697           if (kross == 0)
4698             return null;
4699           var ve = {
4700             x: pt2.x - pt1.x,
4701             y: pt2.y - pt1.y
4702           };
4703           var d1 = crossProduct(ve, v1) / kross;
4704           var d2 = crossProduct(ve, v2) / kross;
4705           var x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
4706           var y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
4707           var x = (x12 + x2) / 2;
4708           var y = (y12 + y2) / 2;
4709           return {
4710             x,
4711             y
4712           };
4713         };
4714         var SweepEvent = /* @__PURE__ */ function() {
4715           _createClass(SweepEvent2, null, [{
4716             key: "compare",
4717             value: function compare(a, b) {
4718               var ptCmp = SweepEvent2.comparePoints(a.point, b.point);
4719               if (ptCmp !== 0)
4720                 return ptCmp;
4721               if (a.point !== b.point)
4722                 a.link(b);
4723               if (a.isLeft !== b.isLeft)
4724                 return a.isLeft ? 1 : -1;
4725               return Segment.compare(a.segment, b.segment);
4726             }
4727           }, {
4728             key: "comparePoints",
4729             value: function comparePoints(aPt, bPt) {
4730               if (aPt.x < bPt.x)
4731                 return -1;
4732               if (aPt.x > bPt.x)
4733                 return 1;
4734               if (aPt.y < bPt.y)
4735                 return -1;
4736               if (aPt.y > bPt.y)
4737                 return 1;
4738               return 0;
4739             }
4740           }]);
4741           function SweepEvent2(point, isLeft) {
4742             _classCallCheck(this, SweepEvent2);
4743             if (point.events === void 0)
4744               point.events = [this];
4745             else
4746               point.events.push(this);
4747             this.point = point;
4748             this.isLeft = isLeft;
4749           }
4750           _createClass(SweepEvent2, [{
4751             key: "link",
4752             value: function link2(other) {
4753               if (other.point === this.point) {
4754                 throw new Error("Tried to link already linked events");
4755               }
4756               var otherEvents = other.point.events;
4757               for (var i2 = 0, iMax = otherEvents.length; i2 < iMax; i2++) {
4758                 var evt = otherEvents[i2];
4759                 this.point.events.push(evt);
4760                 evt.point = this.point;
4761               }
4762               this.checkForConsuming();
4763             }
4764           }, {
4765             key: "checkForConsuming",
4766             value: function checkForConsuming() {
4767               var numEvents = this.point.events.length;
4768               for (var i2 = 0; i2 < numEvents; i2++) {
4769                 var evt1 = this.point.events[i2];
4770                 if (evt1.segment.consumedBy !== void 0)
4771                   continue;
4772                 for (var j2 = i2 + 1; j2 < numEvents; j2++) {
4773                   var evt2 = this.point.events[j2];
4774                   if (evt2.consumedBy !== void 0)
4775                     continue;
4776                   if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
4777                     continue;
4778                   evt1.segment.consume(evt2.segment);
4779                 }
4780               }
4781             }
4782           }, {
4783             key: "getAvailableLinkedEvents",
4784             value: function getAvailableLinkedEvents() {
4785               var events = [];
4786               for (var i2 = 0, iMax = this.point.events.length; i2 < iMax; i2++) {
4787                 var evt = this.point.events[i2];
4788                 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
4789                   events.push(evt);
4790                 }
4791               }
4792               return events;
4793             }
4794           }, {
4795             key: "getLeftmostComparator",
4796             value: function getLeftmostComparator(baseEvent) {
4797               var _this = this;
4798               var cache = /* @__PURE__ */ new Map();
4799               var fillCache = function fillCache2(linkedEvent) {
4800                 var nextEvent = linkedEvent.otherSE;
4801                 cache.set(linkedEvent, {
4802                   sine: sineOfAngle(_this.point, baseEvent.point, nextEvent.point),
4803                   cosine: cosineOfAngle(_this.point, baseEvent.point, nextEvent.point)
4804                 });
4805               };
4806               return function(a, b) {
4807                 if (!cache.has(a))
4808                   fillCache(a);
4809                 if (!cache.has(b))
4810                   fillCache(b);
4811                 var _cache$get = cache.get(a), asine = _cache$get.sine, acosine = _cache$get.cosine;
4812                 var _cache$get2 = cache.get(b), bsine = _cache$get2.sine, bcosine = _cache$get2.cosine;
4813                 if (asine >= 0 && bsine >= 0) {
4814                   if (acosine < bcosine)
4815                     return 1;
4816                   if (acosine > bcosine)
4817                     return -1;
4818                   return 0;
4819                 }
4820                 if (asine < 0 && bsine < 0) {
4821                   if (acosine < bcosine)
4822                     return -1;
4823                   if (acosine > bcosine)
4824                     return 1;
4825                   return 0;
4826                 }
4827                 if (bsine < asine)
4828                   return -1;
4829                 if (bsine > asine)
4830                   return 1;
4831                 return 0;
4832               };
4833             }
4834           }]);
4835           return SweepEvent2;
4836         }();
4837         var segmentId = 0;
4838         var Segment = /* @__PURE__ */ function() {
4839           _createClass(Segment2, null, [{
4840             key: "compare",
4841             value: function compare(a, b) {
4842               var alx = a.leftSE.point.x;
4843               var blx = b.leftSE.point.x;
4844               var arx = a.rightSE.point.x;
4845               var brx = b.rightSE.point.x;
4846               if (brx < alx)
4847                 return 1;
4848               if (arx < blx)
4849                 return -1;
4850               var aly = a.leftSE.point.y;
4851               var bly = b.leftSE.point.y;
4852               var ary = a.rightSE.point.y;
4853               var bry = b.rightSE.point.y;
4854               if (alx < blx) {
4855                 if (bly < aly && bly < ary)
4856                   return 1;
4857                 if (bly > aly && bly > ary)
4858                   return -1;
4859                 var aCmpBLeft = a.comparePoint(b.leftSE.point);
4860                 if (aCmpBLeft < 0)
4861                   return 1;
4862                 if (aCmpBLeft > 0)
4863                   return -1;
4864                 var bCmpARight = b.comparePoint(a.rightSE.point);
4865                 if (bCmpARight !== 0)
4866                   return bCmpARight;
4867                 return -1;
4868               }
4869               if (alx > blx) {
4870                 if (aly < bly && aly < bry)
4871                   return -1;
4872                 if (aly > bly && aly > bry)
4873                   return 1;
4874                 var bCmpALeft = b.comparePoint(a.leftSE.point);
4875                 if (bCmpALeft !== 0)
4876                   return bCmpALeft;
4877                 var aCmpBRight = a.comparePoint(b.rightSE.point);
4878                 if (aCmpBRight < 0)
4879                   return 1;
4880                 if (aCmpBRight > 0)
4881                   return -1;
4882                 return 1;
4883               }
4884               if (aly < bly)
4885                 return -1;
4886               if (aly > bly)
4887                 return 1;
4888               if (arx < brx) {
4889                 var _bCmpARight = b.comparePoint(a.rightSE.point);
4890                 if (_bCmpARight !== 0)
4891                   return _bCmpARight;
4892               }
4893               if (arx > brx) {
4894                 var _aCmpBRight = a.comparePoint(b.rightSE.point);
4895                 if (_aCmpBRight < 0)
4896                   return 1;
4897                 if (_aCmpBRight > 0)
4898                   return -1;
4899               }
4900               if (arx !== brx) {
4901                 var ay = ary - aly;
4902                 var ax = arx - alx;
4903                 var by = bry - bly;
4904                 var bx = brx - blx;
4905                 if (ay > ax && by < bx)
4906                   return 1;
4907                 if (ay < ax && by > bx)
4908                   return -1;
4909               }
4910               if (arx > brx)
4911                 return 1;
4912               if (arx < brx)
4913                 return -1;
4914               if (ary < bry)
4915                 return -1;
4916               if (ary > bry)
4917                 return 1;
4918               if (a.id < b.id)
4919                 return -1;
4920               if (a.id > b.id)
4921                 return 1;
4922               return 0;
4923             }
4924           }]);
4925           function Segment2(leftSE, rightSE, rings, windings) {
4926             _classCallCheck(this, Segment2);
4927             this.id = ++segmentId;
4928             this.leftSE = leftSE;
4929             leftSE.segment = this;
4930             leftSE.otherSE = rightSE;
4931             this.rightSE = rightSE;
4932             rightSE.segment = this;
4933             rightSE.otherSE = leftSE;
4934             this.rings = rings;
4935             this.windings = windings;
4936           }
4937           _createClass(Segment2, [{
4938             key: "replaceRightSE",
4939             value: function replaceRightSE(newRightSE) {
4940               this.rightSE = newRightSE;
4941               this.rightSE.segment = this;
4942               this.rightSE.otherSE = this.leftSE;
4943               this.leftSE.otherSE = this.rightSE;
4944             }
4945           }, {
4946             key: "bbox",
4947             value: function bbox() {
4948               var y12 = this.leftSE.point.y;
4949               var y2 = this.rightSE.point.y;
4950               return {
4951                 ll: {
4952                   x: this.leftSE.point.x,
4953                   y: y12 < y2 ? y12 : y2
4954                 },
4955                 ur: {
4956                   x: this.rightSE.point.x,
4957                   y: y12 > y2 ? y12 : y2
4958                 }
4959               };
4960             }
4961           }, {
4962             key: "vector",
4963             value: function vector() {
4964               return {
4965                 x: this.rightSE.point.x - this.leftSE.point.x,
4966                 y: this.rightSE.point.y - this.leftSE.point.y
4967               };
4968             }
4969           }, {
4970             key: "isAnEndpoint",
4971             value: function isAnEndpoint(pt) {
4972               return pt.x === this.leftSE.point.x && pt.y === this.leftSE.point.y || pt.x === this.rightSE.point.x && pt.y === this.rightSE.point.y;
4973             }
4974           }, {
4975             key: "comparePoint",
4976             value: function comparePoint(point) {
4977               if (this.isAnEndpoint(point))
4978                 return 0;
4979               var lPt = this.leftSE.point;
4980               var rPt = this.rightSE.point;
4981               var v = this.vector();
4982               if (lPt.x === rPt.x) {
4983                 if (point.x === lPt.x)
4984                   return 0;
4985                 return point.x < lPt.x ? 1 : -1;
4986               }
4987               var yDist = (point.y - lPt.y) / v.y;
4988               var xFromYDist = lPt.x + yDist * v.x;
4989               if (point.x === xFromYDist)
4990                 return 0;
4991               var xDist = (point.x - lPt.x) / v.x;
4992               var yFromXDist = lPt.y + xDist * v.y;
4993               if (point.y === yFromXDist)
4994                 return 0;
4995               return point.y < yFromXDist ? -1 : 1;
4996             }
4997           }, {
4998             key: "getIntersection",
4999             value: function getIntersection(other) {
5000               var tBbox = this.bbox();
5001               var oBbox = other.bbox();
5002               var bboxOverlap = getBboxOverlap(tBbox, oBbox);
5003               if (bboxOverlap === null)
5004                 return null;
5005               var tlp = this.leftSE.point;
5006               var trp = this.rightSE.point;
5007               var olp = other.leftSE.point;
5008               var orp = other.rightSE.point;
5009               var touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
5010               var touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
5011               var touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
5012               var touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
5013               if (touchesThisLSE && touchesOtherLSE) {
5014                 if (touchesThisRSE && !touchesOtherRSE)
5015                   return trp;
5016                 if (!touchesThisRSE && touchesOtherRSE)
5017                   return orp;
5018                 return null;
5019               }
5020               if (touchesThisLSE) {
5021                 if (touchesOtherRSE) {
5022                   if (tlp.x === orp.x && tlp.y === orp.y)
5023                     return null;
5024                 }
5025                 return tlp;
5026               }
5027               if (touchesOtherLSE) {
5028                 if (touchesThisRSE) {
5029                   if (trp.x === olp.x && trp.y === olp.y)
5030                     return null;
5031                 }
5032                 return olp;
5033               }
5034               if (touchesThisRSE && touchesOtherRSE)
5035                 return null;
5036               if (touchesThisRSE)
5037                 return trp;
5038               if (touchesOtherRSE)
5039                 return orp;
5040               var pt = intersection(tlp, this.vector(), olp, other.vector());
5041               if (pt === null)
5042                 return null;
5043               if (!isInBbox(bboxOverlap, pt))
5044                 return null;
5045               return rounder.round(pt.x, pt.y);
5046             }
5047           }, {
5048             key: "split",
5049             value: function split2(point) {
5050               var newEvents = [];
5051               var alreadyLinked = point.events !== void 0;
5052               var newLeftSE = new SweepEvent(point, true);
5053               var newRightSE = new SweepEvent(point, false);
5054               var oldRightSE = this.rightSE;
5055               this.replaceRightSE(newRightSE);
5056               newEvents.push(newRightSE);
5057               newEvents.push(newLeftSE);
5058               var newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
5059               if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
5060                 newSeg.swapEvents();
5061               }
5062               if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
5063                 this.swapEvents();
5064               }
5065               if (alreadyLinked) {
5066                 newLeftSE.checkForConsuming();
5067                 newRightSE.checkForConsuming();
5068               }
5069               return newEvents;
5070             }
5071           }, {
5072             key: "swapEvents",
5073             value: function swapEvents() {
5074               var tmpEvt = this.rightSE;
5075               this.rightSE = this.leftSE;
5076               this.leftSE = tmpEvt;
5077               this.leftSE.isLeft = true;
5078               this.rightSE.isLeft = false;
5079               for (var i2 = 0, iMax = this.windings.length; i2 < iMax; i2++) {
5080                 this.windings[i2] *= -1;
5081               }
5082             }
5083           }, {
5084             key: "consume",
5085             value: function consume(other) {
5086               var consumer = this;
5087               var consumee = other;
5088               while (consumer.consumedBy) {
5089                 consumer = consumer.consumedBy;
5090               }
5091               while (consumee.consumedBy) {
5092                 consumee = consumee.consumedBy;
5093               }
5094               var cmp2 = Segment2.compare(consumer, consumee);
5095               if (cmp2 === 0)
5096                 return;
5097               if (cmp2 > 0) {
5098                 var tmp = consumer;
5099                 consumer = consumee;
5100                 consumee = tmp;
5101               }
5102               if (consumer.prev === consumee) {
5103                 var _tmp = consumer;
5104                 consumer = consumee;
5105                 consumee = _tmp;
5106               }
5107               for (var i2 = 0, iMax = consumee.rings.length; i2 < iMax; i2++) {
5108                 var ring = consumee.rings[i2];
5109                 var winding = consumee.windings[i2];
5110                 var index2 = consumer.rings.indexOf(ring);
5111                 if (index2 === -1) {
5112                   consumer.rings.push(ring);
5113                   consumer.windings.push(winding);
5114                 } else
5115                   consumer.windings[index2] += winding;
5116               }
5117               consumee.rings = null;
5118               consumee.windings = null;
5119               consumee.consumedBy = consumer;
5120               consumee.leftSE.consumedBy = consumer.leftSE;
5121               consumee.rightSE.consumedBy = consumer.rightSE;
5122             }
5123           }, {
5124             key: "prevInResult",
5125             value: function prevInResult() {
5126               if (this._prevInResult !== void 0)
5127                 return this._prevInResult;
5128               if (!this.prev)
5129                 this._prevInResult = null;
5130               else if (this.prev.isInResult())
5131                 this._prevInResult = this.prev;
5132               else
5133                 this._prevInResult = this.prev.prevInResult();
5134               return this._prevInResult;
5135             }
5136           }, {
5137             key: "beforeState",
5138             value: function beforeState() {
5139               if (this._beforeState !== void 0)
5140                 return this._beforeState;
5141               if (!this.prev)
5142                 this._beforeState = {
5143                   rings: [],
5144                   windings: [],
5145                   multiPolys: []
5146                 };
5147               else {
5148                 var seg = this.prev.consumedBy || this.prev;
5149                 this._beforeState = seg.afterState();
5150               }
5151               return this._beforeState;
5152             }
5153           }, {
5154             key: "afterState",
5155             value: function afterState() {
5156               if (this._afterState !== void 0)
5157                 return this._afterState;
5158               var beforeState = this.beforeState();
5159               this._afterState = {
5160                 rings: beforeState.rings.slice(0),
5161                 windings: beforeState.windings.slice(0),
5162                 multiPolys: []
5163               };
5164               var ringsAfter = this._afterState.rings;
5165               var windingsAfter = this._afterState.windings;
5166               var mpsAfter = this._afterState.multiPolys;
5167               for (var i2 = 0, iMax = this.rings.length; i2 < iMax; i2++) {
5168                 var ring = this.rings[i2];
5169                 var winding = this.windings[i2];
5170                 var index2 = ringsAfter.indexOf(ring);
5171                 if (index2 === -1) {
5172                   ringsAfter.push(ring);
5173                   windingsAfter.push(winding);
5174                 } else
5175                   windingsAfter[index2] += winding;
5176               }
5177               var polysAfter = [];
5178               var polysExclude = [];
5179               for (var _i = 0, _iMax = ringsAfter.length; _i < _iMax; _i++) {
5180                 if (windingsAfter[_i] === 0)
5181                   continue;
5182                 var _ring = ringsAfter[_i];
5183                 var poly = _ring.poly;
5184                 if (polysExclude.indexOf(poly) !== -1)
5185                   continue;
5186                 if (_ring.isExterior)
5187                   polysAfter.push(poly);
5188                 else {
5189                   if (polysExclude.indexOf(poly) === -1)
5190                     polysExclude.push(poly);
5191                   var _index = polysAfter.indexOf(_ring.poly);
5192                   if (_index !== -1)
5193                     polysAfter.splice(_index, 1);
5194                 }
5195               }
5196               for (var _i2 = 0, _iMax2 = polysAfter.length; _i2 < _iMax2; _i2++) {
5197                 var mp = polysAfter[_i2].multiPoly;
5198                 if (mpsAfter.indexOf(mp) === -1)
5199                   mpsAfter.push(mp);
5200               }
5201               return this._afterState;
5202             }
5203           }, {
5204             key: "isInResult",
5205             value: function isInResult() {
5206               if (this.consumedBy)
5207                 return false;
5208               if (this._isInResult !== void 0)
5209                 return this._isInResult;
5210               var mpsBefore = this.beforeState().multiPolys;
5211               var mpsAfter = this.afterState().multiPolys;
5212               switch (operation.type) {
5213                 case "union": {
5214                   var noBefores = mpsBefore.length === 0;
5215                   var noAfters = mpsAfter.length === 0;
5216                   this._isInResult = noBefores !== noAfters;
5217                   break;
5218                 }
5219                 case "intersection": {
5220                   var least;
5221                   var most;
5222                   if (mpsBefore.length < mpsAfter.length) {
5223                     least = mpsBefore.length;
5224                     most = mpsAfter.length;
5225                   } else {
5226                     least = mpsAfter.length;
5227                     most = mpsBefore.length;
5228                   }
5229                   this._isInResult = most === operation.numMultiPolys && least < most;
5230                   break;
5231                 }
5232                 case "xor": {
5233                   var diff = Math.abs(mpsBefore.length - mpsAfter.length);
5234                   this._isInResult = diff % 2 === 1;
5235                   break;
5236                 }
5237                 case "difference": {
5238                   var isJustSubject = function isJustSubject2(mps) {
5239                     return mps.length === 1 && mps[0].isSubject;
5240                   };
5241                   this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
5242                   break;
5243                 }
5244                 default:
5245                   throw new Error("Unrecognized operation type found ".concat(operation.type));
5246               }
5247               return this._isInResult;
5248             }
5249           }], [{
5250             key: "fromRing",
5251             value: function fromRing(pt1, pt2, ring) {
5252               var leftPt, rightPt, winding;
5253               var cmpPts = SweepEvent.comparePoints(pt1, pt2);
5254               if (cmpPts < 0) {
5255                 leftPt = pt1;
5256                 rightPt = pt2;
5257                 winding = 1;
5258               } else if (cmpPts > 0) {
5259                 leftPt = pt2;
5260                 rightPt = pt1;
5261                 winding = -1;
5262               } else
5263                 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
5264               var leftSE = new SweepEvent(leftPt, true);
5265               var rightSE = new SweepEvent(rightPt, false);
5266               return new Segment2(leftSE, rightSE, [ring], [winding]);
5267             }
5268           }]);
5269           return Segment2;
5270         }();
5271         var RingIn = /* @__PURE__ */ function() {
5272           function RingIn2(geomRing, poly, isExterior) {
5273             _classCallCheck(this, RingIn2);
5274             if (!Array.isArray(geomRing) || geomRing.length === 0) {
5275               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5276             }
5277             this.poly = poly;
5278             this.isExterior = isExterior;
5279             this.segments = [];
5280             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
5281               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5282             }
5283             var firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
5284             this.bbox = {
5285               ll: {
5286                 x: firstPoint.x,
5287                 y: firstPoint.y
5288               },
5289               ur: {
5290                 x: firstPoint.x,
5291                 y: firstPoint.y
5292               }
5293             };
5294             var prevPoint = firstPoint;
5295             for (var i2 = 1, iMax = geomRing.length; i2 < iMax; i2++) {
5296               if (typeof geomRing[i2][0] !== "number" || typeof geomRing[i2][1] !== "number") {
5297                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5298               }
5299               var point = rounder.round(geomRing[i2][0], geomRing[i2][1]);
5300               if (point.x === prevPoint.x && point.y === prevPoint.y)
5301                 continue;
5302               this.segments.push(Segment.fromRing(prevPoint, point, this));
5303               if (point.x < this.bbox.ll.x)
5304                 this.bbox.ll.x = point.x;
5305               if (point.y < this.bbox.ll.y)
5306                 this.bbox.ll.y = point.y;
5307               if (point.x > this.bbox.ur.x)
5308                 this.bbox.ur.x = point.x;
5309               if (point.y > this.bbox.ur.y)
5310                 this.bbox.ur.y = point.y;
5311               prevPoint = point;
5312             }
5313             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
5314               this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
5315             }
5316           }
5317           _createClass(RingIn2, [{
5318             key: "getSweepEvents",
5319             value: function getSweepEvents() {
5320               var sweepEvents = [];
5321               for (var i2 = 0, iMax = this.segments.length; i2 < iMax; i2++) {
5322                 var segment = this.segments[i2];
5323                 sweepEvents.push(segment.leftSE);
5324                 sweepEvents.push(segment.rightSE);
5325               }
5326               return sweepEvents;
5327             }
5328           }]);
5329           return RingIn2;
5330         }();
5331         var PolyIn = /* @__PURE__ */ function() {
5332           function PolyIn2(geomPoly, multiPoly) {
5333             _classCallCheck(this, PolyIn2);
5334             if (!Array.isArray(geomPoly)) {
5335               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5336             }
5337             this.exteriorRing = new RingIn(geomPoly[0], this, true);
5338             this.bbox = {
5339               ll: {
5340                 x: this.exteriorRing.bbox.ll.x,
5341                 y: this.exteriorRing.bbox.ll.y
5342               },
5343               ur: {
5344                 x: this.exteriorRing.bbox.ur.x,
5345                 y: this.exteriorRing.bbox.ur.y
5346               }
5347             };
5348             this.interiorRings = [];
5349             for (var i2 = 1, iMax = geomPoly.length; i2 < iMax; i2++) {
5350               var ring = new RingIn(geomPoly[i2], this, false);
5351               if (ring.bbox.ll.x < this.bbox.ll.x)
5352                 this.bbox.ll.x = ring.bbox.ll.x;
5353               if (ring.bbox.ll.y < this.bbox.ll.y)
5354                 this.bbox.ll.y = ring.bbox.ll.y;
5355               if (ring.bbox.ur.x > this.bbox.ur.x)
5356                 this.bbox.ur.x = ring.bbox.ur.x;
5357               if (ring.bbox.ur.y > this.bbox.ur.y)
5358                 this.bbox.ur.y = ring.bbox.ur.y;
5359               this.interiorRings.push(ring);
5360             }
5361             this.multiPoly = multiPoly;
5362           }
5363           _createClass(PolyIn2, [{
5364             key: "getSweepEvents",
5365             value: function getSweepEvents() {
5366               var sweepEvents = this.exteriorRing.getSweepEvents();
5367               for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5368                 var ringSweepEvents = this.interiorRings[i2].getSweepEvents();
5369                 for (var j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
5370                   sweepEvents.push(ringSweepEvents[j2]);
5371                 }
5372               }
5373               return sweepEvents;
5374             }
5375           }]);
5376           return PolyIn2;
5377         }();
5378         var MultiPolyIn = /* @__PURE__ */ function() {
5379           function MultiPolyIn2(geom, isSubject) {
5380             _classCallCheck(this, MultiPolyIn2);
5381             if (!Array.isArray(geom)) {
5382               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5383             }
5384             try {
5385               if (typeof geom[0][0][0] === "number")
5386                 geom = [geom];
5387             } catch (ex) {
5388             }
5389             this.polys = [];
5390             this.bbox = {
5391               ll: {
5392                 x: Number.POSITIVE_INFINITY,
5393                 y: Number.POSITIVE_INFINITY
5394               },
5395               ur: {
5396                 x: Number.NEGATIVE_INFINITY,
5397                 y: Number.NEGATIVE_INFINITY
5398               }
5399             };
5400             for (var i2 = 0, iMax = geom.length; i2 < iMax; i2++) {
5401               var poly = new PolyIn(geom[i2], this);
5402               if (poly.bbox.ll.x < this.bbox.ll.x)
5403                 this.bbox.ll.x = poly.bbox.ll.x;
5404               if (poly.bbox.ll.y < this.bbox.ll.y)
5405                 this.bbox.ll.y = poly.bbox.ll.y;
5406               if (poly.bbox.ur.x > this.bbox.ur.x)
5407                 this.bbox.ur.x = poly.bbox.ur.x;
5408               if (poly.bbox.ur.y > this.bbox.ur.y)
5409                 this.bbox.ur.y = poly.bbox.ur.y;
5410               this.polys.push(poly);
5411             }
5412             this.isSubject = isSubject;
5413           }
5414           _createClass(MultiPolyIn2, [{
5415             key: "getSweepEvents",
5416             value: function getSweepEvents() {
5417               var sweepEvents = [];
5418               for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5419                 var polySweepEvents = this.polys[i2].getSweepEvents();
5420                 for (var j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
5421                   sweepEvents.push(polySweepEvents[j2]);
5422                 }
5423               }
5424               return sweepEvents;
5425             }
5426           }]);
5427           return MultiPolyIn2;
5428         }();
5429         var RingOut = /* @__PURE__ */ function() {
5430           _createClass(RingOut2, null, [{
5431             key: "factory",
5432             value: function factory(allSegments) {
5433               var ringsOut = [];
5434               for (var i2 = 0, iMax = allSegments.length; i2 < iMax; i2++) {
5435                 var segment = allSegments[i2];
5436                 if (!segment.isInResult() || segment.ringOut)
5437                   continue;
5438                 var prevEvent = null;
5439                 var event = segment.leftSE;
5440                 var nextEvent = segment.rightSE;
5441                 var events = [event];
5442                 var startingPoint = event.point;
5443                 var intersectionLEs = [];
5444                 while (true) {
5445                   prevEvent = event;
5446                   event = nextEvent;
5447                   events.push(event);
5448                   if (event.point === startingPoint)
5449                     break;
5450                   while (true) {
5451                     var availableLEs = event.getAvailableLinkedEvents();
5452                     if (availableLEs.length === 0) {
5453                       var firstPt = events[0].point;
5454                       var lastPt = events[events.length - 1].point;
5455                       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, "]."));
5456                     }
5457                     if (availableLEs.length === 1) {
5458                       nextEvent = availableLEs[0].otherSE;
5459                       break;
5460                     }
5461                     var indexLE = null;
5462                     for (var j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
5463                       if (intersectionLEs[j2].point === event.point) {
5464                         indexLE = j2;
5465                         break;
5466                       }
5467                     }
5468                     if (indexLE !== null) {
5469                       var intersectionLE = intersectionLEs.splice(indexLE)[0];
5470                       var ringEvents = events.splice(intersectionLE.index);
5471                       ringEvents.unshift(ringEvents[0].otherSE);
5472                       ringsOut.push(new RingOut2(ringEvents.reverse()));
5473                       continue;
5474                     }
5475                     intersectionLEs.push({
5476                       index: events.length,
5477                       point: event.point
5478                     });
5479                     var comparator = event.getLeftmostComparator(prevEvent);
5480                     nextEvent = availableLEs.sort(comparator)[0].otherSE;
5481                     break;
5482                   }
5483                 }
5484                 ringsOut.push(new RingOut2(events));
5485               }
5486               return ringsOut;
5487             }
5488           }]);
5489           function RingOut2(events) {
5490             _classCallCheck(this, RingOut2);
5491             this.events = events;
5492             for (var i2 = 0, iMax = events.length; i2 < iMax; i2++) {
5493               events[i2].segment.ringOut = this;
5494             }
5495             this.poly = null;
5496           }
5497           _createClass(RingOut2, [{
5498             key: "getGeom",
5499             value: function getGeom2() {
5500               var prevPt = this.events[0].point;
5501               var points = [prevPt];
5502               for (var i2 = 1, iMax = this.events.length - 1; i2 < iMax; i2++) {
5503                 var _pt = this.events[i2].point;
5504                 var _nextPt = this.events[i2 + 1].point;
5505                 if (compareVectorAngles(_pt, prevPt, _nextPt) === 0)
5506                   continue;
5507                 points.push(_pt);
5508                 prevPt = _pt;
5509               }
5510               if (points.length === 1)
5511                 return null;
5512               var pt = points[0];
5513               var nextPt = points[1];
5514               if (compareVectorAngles(pt, prevPt, nextPt) === 0)
5515                 points.shift();
5516               points.push(points[0]);
5517               var step = this.isExteriorRing() ? 1 : -1;
5518               var iStart = this.isExteriorRing() ? 0 : points.length - 1;
5519               var iEnd = this.isExteriorRing() ? points.length : -1;
5520               var orderedPoints = [];
5521               for (var _i = iStart; _i != iEnd; _i += step) {
5522                 orderedPoints.push([points[_i].x, points[_i].y]);
5523               }
5524               return orderedPoints;
5525             }
5526           }, {
5527             key: "isExteriorRing",
5528             value: function isExteriorRing() {
5529               if (this._isExteriorRing === void 0) {
5530                 var enclosing = this.enclosingRing();
5531                 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
5532               }
5533               return this._isExteriorRing;
5534             }
5535           }, {
5536             key: "enclosingRing",
5537             value: function enclosingRing() {
5538               if (this._enclosingRing === void 0) {
5539                 this._enclosingRing = this._calcEnclosingRing();
5540               }
5541               return this._enclosingRing;
5542             }
5543           }, {
5544             key: "_calcEnclosingRing",
5545             value: function _calcEnclosingRing() {
5546               var leftMostEvt = this.events[0];
5547               for (var i2 = 1, iMax = this.events.length; i2 < iMax; i2++) {
5548                 var evt = this.events[i2];
5549                 if (SweepEvent.compare(leftMostEvt, evt) > 0)
5550                   leftMostEvt = evt;
5551               }
5552               var prevSeg = leftMostEvt.segment.prevInResult();
5553               var prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5554               while (true) {
5555                 if (!prevSeg)
5556                   return null;
5557                 if (!prevPrevSeg)
5558                   return prevSeg.ringOut;
5559                 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
5560                   if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
5561                     return prevSeg.ringOut;
5562                   } else
5563                     return prevSeg.ringOut.enclosingRing();
5564                 }
5565                 prevSeg = prevPrevSeg.prevInResult();
5566                 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5567               }
5568             }
5569           }]);
5570           return RingOut2;
5571         }();
5572         var PolyOut = /* @__PURE__ */ function() {
5573           function PolyOut2(exteriorRing) {
5574             _classCallCheck(this, PolyOut2);
5575             this.exteriorRing = exteriorRing;
5576             exteriorRing.poly = this;
5577             this.interiorRings = [];
5578           }
5579           _createClass(PolyOut2, [{
5580             key: "addInterior",
5581             value: function addInterior(ring) {
5582               this.interiorRings.push(ring);
5583               ring.poly = this;
5584             }
5585           }, {
5586             key: "getGeom",
5587             value: function getGeom2() {
5588               var geom = [this.exteriorRing.getGeom()];
5589               if (geom[0] === null)
5590                 return null;
5591               for (var i2 = 0, iMax = this.interiorRings.length; i2 < iMax; i2++) {
5592                 var ringGeom = this.interiorRings[i2].getGeom();
5593                 if (ringGeom === null)
5594                   continue;
5595                 geom.push(ringGeom);
5596               }
5597               return geom;
5598             }
5599           }]);
5600           return PolyOut2;
5601         }();
5602         var MultiPolyOut = /* @__PURE__ */ function() {
5603           function MultiPolyOut2(rings) {
5604             _classCallCheck(this, MultiPolyOut2);
5605             this.rings = rings;
5606             this.polys = this._composePolys(rings);
5607           }
5608           _createClass(MultiPolyOut2, [{
5609             key: "getGeom",
5610             value: function getGeom2() {
5611               var geom = [];
5612               for (var i2 = 0, iMax = this.polys.length; i2 < iMax; i2++) {
5613                 var polyGeom = this.polys[i2].getGeom();
5614                 if (polyGeom === null)
5615                   continue;
5616                 geom.push(polyGeom);
5617               }
5618               return geom;
5619             }
5620           }, {
5621             key: "_composePolys",
5622             value: function _composePolys(rings) {
5623               var polys = [];
5624               for (var i2 = 0, iMax = rings.length; i2 < iMax; i2++) {
5625                 var ring = rings[i2];
5626                 if (ring.poly)
5627                   continue;
5628                 if (ring.isExteriorRing())
5629                   polys.push(new PolyOut(ring));
5630                 else {
5631                   var enclosingRing = ring.enclosingRing();
5632                   if (!enclosingRing.poly)
5633                     polys.push(new PolyOut(enclosingRing));
5634                   enclosingRing.poly.addInterior(ring);
5635                 }
5636               }
5637               return polys;
5638             }
5639           }]);
5640           return MultiPolyOut2;
5641         }();
5642         var SweepLine = /* @__PURE__ */ function() {
5643           function SweepLine2(queue) {
5644             var comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment.compare;
5645             _classCallCheck(this, SweepLine2);
5646             this.queue = queue;
5647             this.tree = new Tree(comparator);
5648             this.segments = [];
5649           }
5650           _createClass(SweepLine2, [{
5651             key: "process",
5652             value: function process2(event) {
5653               var segment = event.segment;
5654               var newEvents = [];
5655               if (event.consumedBy) {
5656                 if (event.isLeft)
5657                   this.queue.remove(event.otherSE);
5658                 else
5659                   this.tree.remove(segment);
5660                 return newEvents;
5661               }
5662               var node = event.isLeft ? this.tree.insert(segment) : this.tree.find(segment);
5663               if (!node)
5664                 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. Please submit a bug report.");
5665               var prevNode = node;
5666               var nextNode = node;
5667               var prevSeg = void 0;
5668               var nextSeg = void 0;
5669               while (prevSeg === void 0) {
5670                 prevNode = this.tree.prev(prevNode);
5671                 if (prevNode === null)
5672                   prevSeg = null;
5673                 else if (prevNode.key.consumedBy === void 0)
5674                   prevSeg = prevNode.key;
5675               }
5676               while (nextSeg === void 0) {
5677                 nextNode = this.tree.next(nextNode);
5678                 if (nextNode === null)
5679                   nextSeg = null;
5680                 else if (nextNode.key.consumedBy === void 0)
5681                   nextSeg = nextNode.key;
5682               }
5683               if (event.isLeft) {
5684                 var prevMySplitter = null;
5685                 if (prevSeg) {
5686                   var prevInter = prevSeg.getIntersection(segment);
5687                   if (prevInter !== null) {
5688                     if (!segment.isAnEndpoint(prevInter))
5689                       prevMySplitter = prevInter;
5690                     if (!prevSeg.isAnEndpoint(prevInter)) {
5691                       var newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
5692                       for (var i2 = 0, iMax = newEventsFromSplit.length; i2 < iMax; i2++) {
5693                         newEvents.push(newEventsFromSplit[i2]);
5694                       }
5695                     }
5696                   }
5697                 }
5698                 var nextMySplitter = null;
5699                 if (nextSeg) {
5700                   var nextInter = nextSeg.getIntersection(segment);
5701                   if (nextInter !== null) {
5702                     if (!segment.isAnEndpoint(nextInter))
5703                       nextMySplitter = nextInter;
5704                     if (!nextSeg.isAnEndpoint(nextInter)) {
5705                       var _newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
5706                       for (var _i = 0, _iMax = _newEventsFromSplit.length; _i < _iMax; _i++) {
5707                         newEvents.push(_newEventsFromSplit[_i]);
5708                       }
5709                     }
5710                   }
5711                 }
5712                 if (prevMySplitter !== null || nextMySplitter !== null) {
5713                   var mySplitter = null;
5714                   if (prevMySplitter === null)
5715                     mySplitter = nextMySplitter;
5716                   else if (nextMySplitter === null)
5717                     mySplitter = prevMySplitter;
5718                   else {
5719                     var cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
5720                     mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
5721                   }
5722                   this.queue.remove(segment.rightSE);
5723                   newEvents.push(segment.rightSE);
5724                   var _newEventsFromSplit2 = segment.split(mySplitter);
5725                   for (var _i2 = 0, _iMax2 = _newEventsFromSplit2.length; _i2 < _iMax2; _i2++) {
5726                     newEvents.push(_newEventsFromSplit2[_i2]);
5727                   }
5728                 }
5729                 if (newEvents.length > 0) {
5730                   this.tree.remove(segment);
5731                   newEvents.push(event);
5732                 } else {
5733                   this.segments.push(segment);
5734                   segment.prev = prevSeg;
5735                 }
5736               } else {
5737                 if (prevSeg && nextSeg) {
5738                   var inter = prevSeg.getIntersection(nextSeg);
5739                   if (inter !== null) {
5740                     if (!prevSeg.isAnEndpoint(inter)) {
5741                       var _newEventsFromSplit3 = this._splitSafely(prevSeg, inter);
5742                       for (var _i3 = 0, _iMax3 = _newEventsFromSplit3.length; _i3 < _iMax3; _i3++) {
5743                         newEvents.push(_newEventsFromSplit3[_i3]);
5744                       }
5745                     }
5746                     if (!nextSeg.isAnEndpoint(inter)) {
5747                       var _newEventsFromSplit4 = this._splitSafely(nextSeg, inter);
5748                       for (var _i4 = 0, _iMax4 = _newEventsFromSplit4.length; _i4 < _iMax4; _i4++) {
5749                         newEvents.push(_newEventsFromSplit4[_i4]);
5750                       }
5751                     }
5752                   }
5753                 }
5754                 this.tree.remove(segment);
5755               }
5756               return newEvents;
5757             }
5758           }, {
5759             key: "_splitSafely",
5760             value: function _splitSafely(seg, pt) {
5761               this.tree.remove(seg);
5762               var rightSE = seg.rightSE;
5763               this.queue.remove(rightSE);
5764               var newEvents = seg.split(pt);
5765               newEvents.push(rightSE);
5766               if (seg.consumedBy === void 0)
5767                 this.tree.insert(seg);
5768               return newEvents;
5769             }
5770           }]);
5771           return SweepLine2;
5772         }();
5773         var POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
5774         var POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
5775         var Operation = /* @__PURE__ */ function() {
5776           function Operation2() {
5777             _classCallCheck(this, Operation2);
5778           }
5779           _createClass(Operation2, [{
5780             key: "run",
5781             value: function run(type3, geom, moreGeoms) {
5782               operation.type = type3;
5783               rounder.reset();
5784               var multipolys = [new MultiPolyIn(geom, true)];
5785               for (var i2 = 0, iMax = moreGeoms.length; i2 < iMax; i2++) {
5786                 multipolys.push(new MultiPolyIn(moreGeoms[i2], false));
5787               }
5788               operation.numMultiPolys = multipolys.length;
5789               if (operation.type === "difference") {
5790                 var subject = multipolys[0];
5791                 var _i = 1;
5792                 while (_i < multipolys.length) {
5793                   if (getBboxOverlap(multipolys[_i].bbox, subject.bbox) !== null)
5794                     _i++;
5795                   else
5796                     multipolys.splice(_i, 1);
5797                 }
5798               }
5799               if (operation.type === "intersection") {
5800                 for (var _i2 = 0, _iMax = multipolys.length; _i2 < _iMax; _i2++) {
5801                   var mpA = multipolys[_i2];
5802                   for (var j2 = _i2 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
5803                     if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null)
5804                       return [];
5805                   }
5806                 }
5807               }
5808               var queue = new Tree(SweepEvent.compare);
5809               for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) {
5810                 var sweepEvents = multipolys[_i3].getSweepEvents();
5811                 for (var _j = 0, _jMax = sweepEvents.length; _j < _jMax; _j++) {
5812                   queue.insert(sweepEvents[_j]);
5813                   if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5814                     throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");
5815                   }
5816                 }
5817               }
5818               var sweepLine = new SweepLine(queue);
5819               var prevQueueSize = queue.size;
5820               var node = queue.pop();
5821               while (node) {
5822                 var evt = node.key;
5823                 if (queue.size === prevQueueSize) {
5824                   var seg = evt.segment;
5825                   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. ") + "Please file a bug report.");
5826                 }
5827                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5828                   throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");
5829                 }
5830                 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
5831                   throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");
5832                 }
5833                 var newEvents = sweepLine.process(evt);
5834                 for (var _i4 = 0, _iMax3 = newEvents.length; _i4 < _iMax3; _i4++) {
5835                   var _evt = newEvents[_i4];
5836                   if (_evt.consumedBy === void 0)
5837                     queue.insert(_evt);
5838                 }
5839                 prevQueueSize = queue.size;
5840                 node = queue.pop();
5841               }
5842               rounder.reset();
5843               var ringsOut = RingOut.factory(sweepLine.segments);
5844               var result = new MultiPolyOut(ringsOut);
5845               return result.getGeom();
5846             }
5847           }]);
5848           return Operation2;
5849         }();
5850         var operation = new Operation();
5851         var union = function union2(geom) {
5852           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5853             moreGeoms[_key - 1] = arguments[_key];
5854           }
5855           return operation.run("union", geom, moreGeoms);
5856         };
5857         var intersection$1 = function intersection2(geom) {
5858           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
5859             moreGeoms[_key2 - 1] = arguments[_key2];
5860           }
5861           return operation.run("intersection", geom, moreGeoms);
5862         };
5863         var xor = function xor2(geom) {
5864           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5865             moreGeoms[_key3 - 1] = arguments[_key3];
5866           }
5867           return operation.run("xor", geom, moreGeoms);
5868         };
5869         var difference = function difference2(subjectGeom) {
5870           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
5871             clippingGeoms[_key4 - 1] = arguments[_key4];
5872           }
5873           return operation.run("difference", subjectGeom, clippingGeoms);
5874         };
5875         var index = {
5876           union,
5877           intersection: intersection$1,
5878           xor,
5879           difference
5880         };
5881         return index;
5882       });
5883     }
5884   });
5885
5886   // node_modules/geojson-precision/index.js
5887   var require_geojson_precision = __commonJS({
5888     "node_modules/geojson-precision/index.js"(exports2, module2) {
5889       (function() {
5890         function parse(t, coordinatePrecision, extrasPrecision) {
5891           function point(p) {
5892             return p.map(function(e, index) {
5893               if (index < 2) {
5894                 return 1 * e.toFixed(coordinatePrecision);
5895               } else {
5896                 return 1 * e.toFixed(extrasPrecision);
5897               }
5898             });
5899           }
5900           function multi(l) {
5901             return l.map(point);
5902           }
5903           function poly(p) {
5904             return p.map(multi);
5905           }
5906           function multiPoly(m) {
5907             return m.map(poly);
5908           }
5909           function geometry(obj) {
5910             if (!obj) {
5911               return {};
5912             }
5913             switch (obj.type) {
5914               case "Point":
5915                 obj.coordinates = point(obj.coordinates);
5916                 return obj;
5917               case "LineString":
5918               case "MultiPoint":
5919                 obj.coordinates = multi(obj.coordinates);
5920                 return obj;
5921               case "Polygon":
5922               case "MultiLineString":
5923                 obj.coordinates = poly(obj.coordinates);
5924                 return obj;
5925               case "MultiPolygon":
5926                 obj.coordinates = multiPoly(obj.coordinates);
5927                 return obj;
5928               case "GeometryCollection":
5929                 obj.geometries = obj.geometries.map(geometry);
5930                 return obj;
5931               default:
5932                 return {};
5933             }
5934           }
5935           function feature3(obj) {
5936             obj.geometry = geometry(obj.geometry);
5937             return obj;
5938           }
5939           function featureCollection(f2) {
5940             f2.features = f2.features.map(feature3);
5941             return f2;
5942           }
5943           function geometryCollection(g) {
5944             g.geometries = g.geometries.map(geometry);
5945             return g;
5946           }
5947           if (!t) {
5948             return t;
5949           }
5950           switch (t.type) {
5951             case "Feature":
5952               return feature3(t);
5953             case "GeometryCollection":
5954               return geometryCollection(t);
5955             case "FeatureCollection":
5956               return featureCollection(t);
5957             case "Point":
5958             case "LineString":
5959             case "Polygon":
5960             case "MultiPoint":
5961             case "MultiPolygon":
5962             case "MultiLineString":
5963               return geometry(t);
5964             default:
5965               return t;
5966           }
5967         }
5968         module2.exports = parse;
5969         module2.exports.parse = parse;
5970       })();
5971     }
5972   });
5973
5974   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
5975   var require_json_stringify_pretty_compact = __commonJS({
5976     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
5977       function isObject2(obj) {
5978         return typeof obj === "object" && obj !== null;
5979       }
5980       function forEach(obj, cb) {
5981         if (Array.isArray(obj)) {
5982           obj.forEach(cb);
5983         } else if (isObject2(obj)) {
5984           Object.keys(obj).forEach(function(key) {
5985             var val = obj[key];
5986             cb(val, key);
5987           });
5988         }
5989       }
5990       function getTreeDepth(obj) {
5991         var depth = 0;
5992         if (Array.isArray(obj) || isObject2(obj)) {
5993           forEach(obj, function(val) {
5994             if (Array.isArray(val) || isObject2(val)) {
5995               var tmpDepth = getTreeDepth(val);
5996               if (tmpDepth > depth) {
5997                 depth = tmpDepth;
5998               }
5999             }
6000           });
6001           return depth + 1;
6002         }
6003         return depth;
6004       }
6005       function stringify3(obj, options2) {
6006         options2 = options2 || {};
6007         var indent2 = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
6008         var addMargin = get4(options2, "margins", false);
6009         var addArrayMargin = get4(options2, "arrayMargins", false);
6010         var addObjectMargin = get4(options2, "objectMargins", false);
6011         var maxLength = indent2 === "" ? Infinity : get4(options2, "maxLength", 80);
6012         var maxNesting = get4(options2, "maxNesting", Infinity);
6013         return function _stringify(obj2, currentIndent, reserved) {
6014           if (obj2 && typeof obj2.toJSON === "function") {
6015             obj2 = obj2.toJSON();
6016           }
6017           var string = JSON.stringify(obj2);
6018           if (string === void 0) {
6019             return string;
6020           }
6021           var length = maxLength - currentIndent.length - reserved;
6022           var treeDepth = getTreeDepth(obj2);
6023           if (treeDepth <= maxNesting && string.length <= length) {
6024             var prettified = prettify(string, {
6025               addMargin,
6026               addArrayMargin,
6027               addObjectMargin
6028             });
6029             if (prettified.length <= length) {
6030               return prettified;
6031             }
6032           }
6033           if (isObject2(obj2)) {
6034             var nextIndent = currentIndent + indent2;
6035             var items = [];
6036             var delimiters;
6037             var comma = function(array2, index2) {
6038               return index2 === array2.length - 1 ? 0 : 1;
6039             };
6040             if (Array.isArray(obj2)) {
6041               for (var index = 0; index < obj2.length; index++) {
6042                 items.push(
6043                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
6044                 );
6045               }
6046               delimiters = "[]";
6047             } else {
6048               Object.keys(obj2).forEach(function(key, index2, array2) {
6049                 var keyPart = JSON.stringify(key) + ": ";
6050                 var value = _stringify(
6051                   obj2[key],
6052                   nextIndent,
6053                   keyPart.length + comma(array2, index2)
6054                 );
6055                 if (value !== void 0) {
6056                   items.push(keyPart + value);
6057                 }
6058               });
6059               delimiters = "{}";
6060             }
6061             if (items.length > 0) {
6062               return [
6063                 delimiters[0],
6064                 indent2 + items.join(",\n" + nextIndent),
6065                 delimiters[1]
6066               ].join("\n" + currentIndent);
6067             }
6068           }
6069           return string;
6070         }(obj, "", 0);
6071       }
6072       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
6073       function prettify(string, options2) {
6074         options2 = options2 || {};
6075         var tokens = {
6076           "{": "{",
6077           "}": "}",
6078           "[": "[",
6079           "]": "]",
6080           ",": ", ",
6081           ":": ": "
6082         };
6083         if (options2.addMargin || options2.addObjectMargin) {
6084           tokens["{"] = "{ ";
6085           tokens["}"] = " }";
6086         }
6087         if (options2.addMargin || options2.addArrayMargin) {
6088           tokens["["] = "[ ";
6089           tokens["]"] = " ]";
6090         }
6091         return string.replace(stringOrChar, function(match, string2) {
6092           return string2 ? match : tokens[match];
6093         });
6094       }
6095       function get4(options2, name, defaultValue) {
6096         return name in options2 ? options2[name] : defaultValue;
6097       }
6098       module2.exports = stringify3;
6099     }
6100   });
6101
6102   // node_modules/aes-js/index.js
6103   var require_aes_js = __commonJS({
6104     "node_modules/aes-js/index.js"(exports2, module2) {
6105       (function(root3) {
6106         "use strict";
6107         function checkInt(value) {
6108           return parseInt(value) === value;
6109         }
6110         function checkInts(arrayish) {
6111           if (!checkInt(arrayish.length)) {
6112             return false;
6113           }
6114           for (var i2 = 0; i2 < arrayish.length; i2++) {
6115             if (!checkInt(arrayish[i2]) || arrayish[i2] < 0 || arrayish[i2] > 255) {
6116               return false;
6117             }
6118           }
6119           return true;
6120         }
6121         function coerceArray(arg, copy2) {
6122           if (arg.buffer && arg.name === "Uint8Array") {
6123             if (copy2) {
6124               if (arg.slice) {
6125                 arg = arg.slice();
6126               } else {
6127                 arg = Array.prototype.slice.call(arg);
6128               }
6129             }
6130             return arg;
6131           }
6132           if (Array.isArray(arg)) {
6133             if (!checkInts(arg)) {
6134               throw new Error("Array contains invalid value: " + arg);
6135             }
6136             return new Uint8Array(arg);
6137           }
6138           if (checkInt(arg.length) && checkInts(arg)) {
6139             return new Uint8Array(arg);
6140           }
6141           throw new Error("unsupported array-like object");
6142         }
6143         function createArray(length) {
6144           return new Uint8Array(length);
6145         }
6146         function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
6147           if (sourceStart != null || sourceEnd != null) {
6148             if (sourceArray.slice) {
6149               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
6150             } else {
6151               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
6152             }
6153           }
6154           targetArray.set(sourceArray, targetStart);
6155         }
6156         var convertUtf8 = function() {
6157           function toBytes(text2) {
6158             var result = [], i2 = 0;
6159             text2 = encodeURI(text2);
6160             while (i2 < text2.length) {
6161               var c = text2.charCodeAt(i2++);
6162               if (c === 37) {
6163                 result.push(parseInt(text2.substr(i2, 2), 16));
6164                 i2 += 2;
6165               } else {
6166                 result.push(c);
6167               }
6168             }
6169             return coerceArray(result);
6170           }
6171           function fromBytes(bytes) {
6172             var result = [], i2 = 0;
6173             while (i2 < bytes.length) {
6174               var c = bytes[i2];
6175               if (c < 128) {
6176                 result.push(String.fromCharCode(c));
6177                 i2++;
6178               } else if (c > 191 && c < 224) {
6179                 result.push(String.fromCharCode((c & 31) << 6 | bytes[i2 + 1] & 63));
6180                 i2 += 2;
6181               } else {
6182                 result.push(String.fromCharCode((c & 15) << 12 | (bytes[i2 + 1] & 63) << 6 | bytes[i2 + 2] & 63));
6183                 i2 += 3;
6184               }
6185             }
6186             return result.join("");
6187           }
6188           return {
6189             toBytes,
6190             fromBytes
6191           };
6192         }();
6193         var convertHex = function() {
6194           function toBytes(text2) {
6195             var result = [];
6196             for (var i2 = 0; i2 < text2.length; i2 += 2) {
6197               result.push(parseInt(text2.substr(i2, 2), 16));
6198             }
6199             return result;
6200           }
6201           var Hex = "0123456789abcdef";
6202           function fromBytes(bytes) {
6203             var result = [];
6204             for (var i2 = 0; i2 < bytes.length; i2++) {
6205               var v = bytes[i2];
6206               result.push(Hex[(v & 240) >> 4] + Hex[v & 15]);
6207             }
6208             return result.join("");
6209           }
6210           return {
6211             toBytes,
6212             fromBytes
6213           };
6214         }();
6215         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
6216         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];
6217         var S = [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];
6218         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];
6219         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];
6220         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];
6221         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];
6222         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];
6223         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];
6224         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];
6225         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];
6226         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];
6227         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];
6228         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];
6229         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];
6230         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];
6231         function convertToInt32(bytes) {
6232           var result = [];
6233           for (var i2 = 0; i2 < bytes.length; i2 += 4) {
6234             result.push(
6235               bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]
6236             );
6237           }
6238           return result;
6239         }
6240         var AES = function(key) {
6241           if (!(this instanceof AES)) {
6242             throw Error("AES must be instanitated with `new`");
6243           }
6244           Object.defineProperty(this, "key", {
6245             value: coerceArray(key, true)
6246           });
6247           this._prepare();
6248         };
6249         AES.prototype._prepare = function() {
6250           var rounds = numberOfRounds[this.key.length];
6251           if (rounds == null) {
6252             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
6253           }
6254           this._Ke = [];
6255           this._Kd = [];
6256           for (var i2 = 0; i2 <= rounds; i2++) {
6257             this._Ke.push([0, 0, 0, 0]);
6258             this._Kd.push([0, 0, 0, 0]);
6259           }
6260           var roundKeyCount = (rounds + 1) * 4;
6261           var KC = this.key.length / 4;
6262           var tk = convertToInt32(this.key);
6263           var index;
6264           for (var i2 = 0; i2 < KC; i2++) {
6265             index = i2 >> 2;
6266             this._Ke[index][i2 % 4] = tk[i2];
6267             this._Kd[rounds - index][i2 % 4] = tk[i2];
6268           }
6269           var rconpointer = 0;
6270           var t = KC, tt;
6271           while (t < roundKeyCount) {
6272             tt = tk[KC - 1];
6273             tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24;
6274             rconpointer += 1;
6275             if (KC != 8) {
6276               for (var i2 = 1; i2 < KC; i2++) {
6277                 tk[i2] ^= tk[i2 - 1];
6278               }
6279             } else {
6280               for (var i2 = 1; i2 < KC / 2; i2++) {
6281                 tk[i2] ^= tk[i2 - 1];
6282               }
6283               tt = tk[KC / 2 - 1];
6284               tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24;
6285               for (var i2 = KC / 2 + 1; i2 < KC; i2++) {
6286                 tk[i2] ^= tk[i2 - 1];
6287               }
6288             }
6289             var i2 = 0, r, c;
6290             while (i2 < KC && t < roundKeyCount) {
6291               r = t >> 2;
6292               c = t % 4;
6293               this._Ke[r][c] = tk[i2];
6294               this._Kd[rounds - r][c] = tk[i2++];
6295               t++;
6296             }
6297           }
6298           for (var r = 1; r < rounds; r++) {
6299             for (var c = 0; c < 4; c++) {
6300               tt = this._Kd[r][c];
6301               this._Kd[r][c] = U1[tt >> 24 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255];
6302             }
6303           }
6304         };
6305         AES.prototype.encrypt = function(plaintext) {
6306           if (plaintext.length != 16) {
6307             throw new Error("invalid plaintext size (must be 16 bytes)");
6308           }
6309           var rounds = this._Ke.length - 1;
6310           var a = [0, 0, 0, 0];
6311           var t = convertToInt32(plaintext);
6312           for (var i2 = 0; i2 < 4; i2++) {
6313             t[i2] ^= this._Ke[0][i2];
6314           }
6315           for (var r = 1; r < rounds; r++) {
6316             for (var i2 = 0; i2 < 4; i2++) {
6317               a[i2] = T1[t[i2] >> 24 & 255] ^ T2[t[(i2 + 1) % 4] >> 16 & 255] ^ T3[t[(i2 + 2) % 4] >> 8 & 255] ^ T4[t[(i2 + 3) % 4] & 255] ^ this._Ke[r][i2];
6318             }
6319             t = a.slice();
6320           }
6321           var result = createArray(16), tt;
6322           for (var i2 = 0; i2 < 4; i2++) {
6323             tt = this._Ke[rounds][i2];
6324             result[4 * i2] = (S[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6325             result[4 * i2 + 1] = (S[t[(i2 + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6326             result[4 * i2 + 2] = (S[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6327             result[4 * i2 + 3] = (S[t[(i2 + 3) % 4] & 255] ^ tt) & 255;
6328           }
6329           return result;
6330         };
6331         AES.prototype.decrypt = function(ciphertext) {
6332           if (ciphertext.length != 16) {
6333             throw new Error("invalid ciphertext size (must be 16 bytes)");
6334           }
6335           var rounds = this._Kd.length - 1;
6336           var a = [0, 0, 0, 0];
6337           var t = convertToInt32(ciphertext);
6338           for (var i2 = 0; i2 < 4; i2++) {
6339             t[i2] ^= this._Kd[0][i2];
6340           }
6341           for (var r = 1; r < rounds; r++) {
6342             for (var i2 = 0; i2 < 4; i2++) {
6343               a[i2] = T5[t[i2] >> 24 & 255] ^ T6[t[(i2 + 3) % 4] >> 16 & 255] ^ T7[t[(i2 + 2) % 4] >> 8 & 255] ^ T8[t[(i2 + 1) % 4] & 255] ^ this._Kd[r][i2];
6344             }
6345             t = a.slice();
6346           }
6347           var result = createArray(16), tt;
6348           for (var i2 = 0; i2 < 4; i2++) {
6349             tt = this._Kd[rounds][i2];
6350             result[4 * i2] = (Si[t[i2] >> 24 & 255] ^ tt >> 24) & 255;
6351             result[4 * i2 + 1] = (Si[t[(i2 + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255;
6352             result[4 * i2 + 2] = (Si[t[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255;
6353             result[4 * i2 + 3] = (Si[t[(i2 + 1) % 4] & 255] ^ tt) & 255;
6354           }
6355           return result;
6356         };
6357         var ModeOfOperationECB = function(key) {
6358           if (!(this instanceof ModeOfOperationECB)) {
6359             throw Error("AES must be instanitated with `new`");
6360           }
6361           this.description = "Electronic Code Block";
6362           this.name = "ecb";
6363           this._aes = new AES(key);
6364         };
6365         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
6366           plaintext = coerceArray(plaintext);
6367           if (plaintext.length % 16 !== 0) {
6368             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6369           }
6370           var ciphertext = createArray(plaintext.length);
6371           var block2 = createArray(16);
6372           for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6373             copyArray(plaintext, block2, 0, i2, i2 + 16);
6374             block2 = this._aes.encrypt(block2);
6375             copyArray(block2, ciphertext, i2);
6376           }
6377           return ciphertext;
6378         };
6379         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
6380           ciphertext = coerceArray(ciphertext);
6381           if (ciphertext.length % 16 !== 0) {
6382             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6383           }
6384           var plaintext = createArray(ciphertext.length);
6385           var block2 = createArray(16);
6386           for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6387             copyArray(ciphertext, block2, 0, i2, i2 + 16);
6388             block2 = this._aes.decrypt(block2);
6389             copyArray(block2, plaintext, i2);
6390           }
6391           return plaintext;
6392         };
6393         var ModeOfOperationCBC = function(key, iv) {
6394           if (!(this instanceof ModeOfOperationCBC)) {
6395             throw Error("AES must be instanitated with `new`");
6396           }
6397           this.description = "Cipher Block Chaining";
6398           this.name = "cbc";
6399           if (!iv) {
6400             iv = createArray(16);
6401           } else if (iv.length != 16) {
6402             throw new Error("invalid initialation vector size (must be 16 bytes)");
6403           }
6404           this._lastCipherblock = coerceArray(iv, true);
6405           this._aes = new AES(key);
6406         };
6407         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
6408           plaintext = coerceArray(plaintext);
6409           if (plaintext.length % 16 !== 0) {
6410             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6411           }
6412           var ciphertext = createArray(plaintext.length);
6413           var block2 = createArray(16);
6414           for (var i2 = 0; i2 < plaintext.length; i2 += 16) {
6415             copyArray(plaintext, block2, 0, i2, i2 + 16);
6416             for (var j2 = 0; j2 < 16; j2++) {
6417               block2[j2] ^= this._lastCipherblock[j2];
6418             }
6419             this._lastCipherblock = this._aes.encrypt(block2);
6420             copyArray(this._lastCipherblock, ciphertext, i2);
6421           }
6422           return ciphertext;
6423         };
6424         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
6425           ciphertext = coerceArray(ciphertext);
6426           if (ciphertext.length % 16 !== 0) {
6427             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6428           }
6429           var plaintext = createArray(ciphertext.length);
6430           var block2 = createArray(16);
6431           for (var i2 = 0; i2 < ciphertext.length; i2 += 16) {
6432             copyArray(ciphertext, block2, 0, i2, i2 + 16);
6433             block2 = this._aes.decrypt(block2);
6434             for (var j2 = 0; j2 < 16; j2++) {
6435               plaintext[i2 + j2] = block2[j2] ^ this._lastCipherblock[j2];
6436             }
6437             copyArray(ciphertext, this._lastCipherblock, 0, i2, i2 + 16);
6438           }
6439           return plaintext;
6440         };
6441         var ModeOfOperationCFB = function(key, iv, segmentSize) {
6442           if (!(this instanceof ModeOfOperationCFB)) {
6443             throw Error("AES must be instanitated with `new`");
6444           }
6445           this.description = "Cipher Feedback";
6446           this.name = "cfb";
6447           if (!iv) {
6448             iv = createArray(16);
6449           } else if (iv.length != 16) {
6450             throw new Error("invalid initialation vector size (must be 16 size)");
6451           }
6452           if (!segmentSize) {
6453             segmentSize = 1;
6454           }
6455           this.segmentSize = segmentSize;
6456           this._shiftRegister = coerceArray(iv, true);
6457           this._aes = new AES(key);
6458         };
6459         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
6460           if (plaintext.length % this.segmentSize != 0) {
6461             throw new Error("invalid plaintext size (must be segmentSize bytes)");
6462           }
6463           var encrypted = coerceArray(plaintext, true);
6464           var xorSegment;
6465           for (var i2 = 0; i2 < encrypted.length; i2 += this.segmentSize) {
6466             xorSegment = this._aes.encrypt(this._shiftRegister);
6467             for (var j2 = 0; j2 < this.segmentSize; j2++) {
6468               encrypted[i2 + j2] ^= xorSegment[j2];
6469             }
6470             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6471             copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6472           }
6473           return encrypted;
6474         };
6475         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
6476           if (ciphertext.length % this.segmentSize != 0) {
6477             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
6478           }
6479           var plaintext = coerceArray(ciphertext, true);
6480           var xorSegment;
6481           for (var i2 = 0; i2 < plaintext.length; i2 += this.segmentSize) {
6482             xorSegment = this._aes.encrypt(this._shiftRegister);
6483             for (var j2 = 0; j2 < this.segmentSize; j2++) {
6484               plaintext[i2 + j2] ^= xorSegment[j2];
6485             }
6486             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6487             copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize);
6488           }
6489           return plaintext;
6490         };
6491         var ModeOfOperationOFB = function(key, iv) {
6492           if (!(this instanceof ModeOfOperationOFB)) {
6493             throw Error("AES must be instanitated with `new`");
6494           }
6495           this.description = "Output Feedback";
6496           this.name = "ofb";
6497           if (!iv) {
6498             iv = createArray(16);
6499           } else if (iv.length != 16) {
6500             throw new Error("invalid initialation vector size (must be 16 bytes)");
6501           }
6502           this._lastPrecipher = coerceArray(iv, true);
6503           this._lastPrecipherIndex = 16;
6504           this._aes = new AES(key);
6505         };
6506         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
6507           var encrypted = coerceArray(plaintext, true);
6508           for (var i2 = 0; i2 < encrypted.length; i2++) {
6509             if (this._lastPrecipherIndex === 16) {
6510               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
6511               this._lastPrecipherIndex = 0;
6512             }
6513             encrypted[i2] ^= this._lastPrecipher[this._lastPrecipherIndex++];
6514           }
6515           return encrypted;
6516         };
6517         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
6518         var Counter = function(initialValue) {
6519           if (!(this instanceof Counter)) {
6520             throw Error("Counter must be instanitated with `new`");
6521           }
6522           if (initialValue !== 0 && !initialValue) {
6523             initialValue = 1;
6524           }
6525           if (typeof initialValue === "number") {
6526             this._counter = createArray(16);
6527             this.setValue(initialValue);
6528           } else {
6529             this.setBytes(initialValue);
6530           }
6531         };
6532         Counter.prototype.setValue = function(value) {
6533           if (typeof value !== "number" || parseInt(value) != value) {
6534             throw new Error("invalid counter value (must be an integer)");
6535           }
6536           if (value > Number.MAX_SAFE_INTEGER) {
6537             throw new Error("integer value out of safe range");
6538           }
6539           for (var index = 15; index >= 0; --index) {
6540             this._counter[index] = value % 256;
6541             value = parseInt(value / 256);
6542           }
6543         };
6544         Counter.prototype.setBytes = function(bytes) {
6545           bytes = coerceArray(bytes, true);
6546           if (bytes.length != 16) {
6547             throw new Error("invalid counter bytes size (must be 16 bytes)");
6548           }
6549           this._counter = bytes;
6550         };
6551         Counter.prototype.increment = function() {
6552           for (var i2 = 15; i2 >= 0; i2--) {
6553             if (this._counter[i2] === 255) {
6554               this._counter[i2] = 0;
6555             } else {
6556               this._counter[i2]++;
6557               break;
6558             }
6559           }
6560         };
6561         var ModeOfOperationCTR = function(key, counter) {
6562           if (!(this instanceof ModeOfOperationCTR)) {
6563             throw Error("AES must be instanitated with `new`");
6564           }
6565           this.description = "Counter";
6566           this.name = "ctr";
6567           if (!(counter instanceof Counter)) {
6568             counter = new Counter(counter);
6569           }
6570           this._counter = counter;
6571           this._remainingCounter = null;
6572           this._remainingCounterIndex = 16;
6573           this._aes = new AES(key);
6574         };
6575         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
6576           var encrypted = coerceArray(plaintext, true);
6577           for (var i2 = 0; i2 < encrypted.length; i2++) {
6578             if (this._remainingCounterIndex === 16) {
6579               this._remainingCounter = this._aes.encrypt(this._counter._counter);
6580               this._remainingCounterIndex = 0;
6581               this._counter.increment();
6582             }
6583             encrypted[i2] ^= this._remainingCounter[this._remainingCounterIndex++];
6584           }
6585           return encrypted;
6586         };
6587         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
6588         function pkcs7pad(data) {
6589           data = coerceArray(data, true);
6590           var padder = 16 - data.length % 16;
6591           var result = createArray(data.length + padder);
6592           copyArray(data, result);
6593           for (var i2 = data.length; i2 < result.length; i2++) {
6594             result[i2] = padder;
6595           }
6596           return result;
6597         }
6598         function pkcs7strip(data) {
6599           data = coerceArray(data, true);
6600           if (data.length < 16) {
6601             throw new Error("PKCS#7 invalid length");
6602           }
6603           var padder = data[data.length - 1];
6604           if (padder > 16) {
6605             throw new Error("PKCS#7 padding byte out of range");
6606           }
6607           var length = data.length - padder;
6608           for (var i2 = 0; i2 < padder; i2++) {
6609             if (data[length + i2] !== padder) {
6610               throw new Error("PKCS#7 invalid padding byte");
6611             }
6612           }
6613           var result = createArray(length);
6614           copyArray(data, result, 0, 0, length);
6615           return result;
6616         }
6617         var aesjs2 = {
6618           AES,
6619           Counter,
6620           ModeOfOperation: {
6621             ecb: ModeOfOperationECB,
6622             cbc: ModeOfOperationCBC,
6623             cfb: ModeOfOperationCFB,
6624             ofb: ModeOfOperationOFB,
6625             ctr: ModeOfOperationCTR
6626           },
6627           utils: {
6628             hex: convertHex,
6629             utf8: convertUtf8
6630           },
6631           padding: {
6632             pkcs7: {
6633               pad: pkcs7pad,
6634               strip: pkcs7strip
6635             }
6636           },
6637           _arrayTest: {
6638             coerceArray,
6639             createArray,
6640             copyArray
6641           }
6642         };
6643         if (typeof exports2 !== "undefined") {
6644           module2.exports = aesjs2;
6645         } else if (typeof define === "function" && define.amd) {
6646           define([], function() {
6647             return aesjs2;
6648           });
6649         } else {
6650           if (root3.aesjs) {
6651             aesjs2._aesjs = root3.aesjs;
6652           }
6653           root3.aesjs = aesjs2;
6654         }
6655       })(exports2);
6656     }
6657   });
6658
6659   // node_modules/fast-deep-equal/index.js
6660   var require_fast_deep_equal = __commonJS({
6661     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
6662       "use strict";
6663       module2.exports = function equal(a, b) {
6664         if (a === b)
6665           return true;
6666         if (a && b && typeof a == "object" && typeof b == "object") {
6667           if (a.constructor !== b.constructor)
6668             return false;
6669           var length, i2, keys;
6670           if (Array.isArray(a)) {
6671             length = a.length;
6672             if (length != b.length)
6673               return false;
6674             for (i2 = length; i2-- !== 0; )
6675               if (!equal(a[i2], b[i2]))
6676                 return false;
6677             return true;
6678           }
6679           if (a.constructor === RegExp)
6680             return a.source === b.source && a.flags === b.flags;
6681           if (a.valueOf !== Object.prototype.valueOf)
6682             return a.valueOf() === b.valueOf();
6683           if (a.toString !== Object.prototype.toString)
6684             return a.toString() === b.toString();
6685           keys = Object.keys(a);
6686           length = keys.length;
6687           if (length !== Object.keys(b).length)
6688             return false;
6689           for (i2 = length; i2-- !== 0; )
6690             if (!Object.prototype.hasOwnProperty.call(b, keys[i2]))
6691               return false;
6692           for (i2 = length; i2-- !== 0; ) {
6693             var key = keys[i2];
6694             if (!equal(a[key], b[key]))
6695               return false;
6696           }
6697           return true;
6698         }
6699         return a !== a && b !== b;
6700       };
6701     }
6702   });
6703
6704   // node_modules/lodash/lodash.js
6705   var require_lodash = __commonJS({
6706     "node_modules/lodash/lodash.js"(exports2, module2) {
6707       (function() {
6708         var undefined2;
6709         var VERSION = "4.17.21";
6710         var LARGE_ARRAY_SIZE = 200;
6711         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`";
6712         var HASH_UNDEFINED = "__lodash_hash_undefined__";
6713         var MAX_MEMOIZE_SIZE = 500;
6714         var PLACEHOLDER = "__lodash_placeholder__";
6715         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
6716         var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
6717         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;
6718         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
6719         var HOT_COUNT = 800, HOT_SPAN = 16;
6720         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
6721         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
6722         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
6723         var wrapFlags = [
6724           ["ary", WRAP_ARY_FLAG],
6725           ["bind", WRAP_BIND_FLAG],
6726           ["bindKey", WRAP_BIND_KEY_FLAG],
6727           ["curry", WRAP_CURRY_FLAG],
6728           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
6729           ["flip", WRAP_FLIP_FLAG],
6730           ["partial", WRAP_PARTIAL_FLAG],
6731           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
6732           ["rearg", WRAP_REARG_FLAG]
6733         ];
6734         var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag2 = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
6735         var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
6736         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
6737         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
6738         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
6739         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
6740         var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
6741         var reTrimStart2 = /^\s+/;
6742         var reWhitespace2 = /\s/;
6743         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
6744         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
6745         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
6746         var reEscapeChar = /\\(\\)?/g;
6747         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
6748         var reFlags = /\w*$/;
6749         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
6750         var reIsBinary2 = /^0b[01]+$/i;
6751         var reIsHostCtor = /^\[object .+?Constructor\]$/;
6752         var reIsOctal2 = /^0o[0-7]+$/i;
6753         var reIsUint = /^(?:0|[1-9]\d*)$/;
6754         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
6755         var reNoMatch = /($^)/;
6756         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
6757         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;
6758         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";
6759         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("|") + ")";
6760         var reApos = RegExp(rsApos, "g");
6761         var reComboMark = RegExp(rsCombo, "g");
6762         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
6763         var reUnicodeWord = RegExp([
6764           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
6765           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
6766           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
6767           rsUpper + "+" + rsOptContrUpper,
6768           rsOrdUpper,
6769           rsOrdLower,
6770           rsDigits,
6771           rsEmoji
6772         ].join("|"), "g");
6773         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
6774         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 ]/;
6775         var contextProps = [
6776           "Array",
6777           "Buffer",
6778           "DataView",
6779           "Date",
6780           "Error",
6781           "Float32Array",
6782           "Float64Array",
6783           "Function",
6784           "Int8Array",
6785           "Int16Array",
6786           "Int32Array",
6787           "Map",
6788           "Math",
6789           "Object",
6790           "Promise",
6791           "RegExp",
6792           "Set",
6793           "String",
6794           "Symbol",
6795           "TypeError",
6796           "Uint8Array",
6797           "Uint8ClampedArray",
6798           "Uint16Array",
6799           "Uint32Array",
6800           "WeakMap",
6801           "_",
6802           "clearTimeout",
6803           "isFinite",
6804           "parseInt",
6805           "setTimeout"
6806         ];
6807         var templateCounter = -1;
6808         var typedArrayTags = {};
6809         typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
6810         typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
6811         var cloneableTags = {};
6812         cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag2] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
6813         cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
6814         var deburredLetters = {
6815           "\xC0": "A",
6816           "\xC1": "A",
6817           "\xC2": "A",
6818           "\xC3": "A",
6819           "\xC4": "A",
6820           "\xC5": "A",
6821           "\xE0": "a",
6822           "\xE1": "a",
6823           "\xE2": "a",
6824           "\xE3": "a",
6825           "\xE4": "a",
6826           "\xE5": "a",
6827           "\xC7": "C",
6828           "\xE7": "c",
6829           "\xD0": "D",
6830           "\xF0": "d",
6831           "\xC8": "E",
6832           "\xC9": "E",
6833           "\xCA": "E",
6834           "\xCB": "E",
6835           "\xE8": "e",
6836           "\xE9": "e",
6837           "\xEA": "e",
6838           "\xEB": "e",
6839           "\xCC": "I",
6840           "\xCD": "I",
6841           "\xCE": "I",
6842           "\xCF": "I",
6843           "\xEC": "i",
6844           "\xED": "i",
6845           "\xEE": "i",
6846           "\xEF": "i",
6847           "\xD1": "N",
6848           "\xF1": "n",
6849           "\xD2": "O",
6850           "\xD3": "O",
6851           "\xD4": "O",
6852           "\xD5": "O",
6853           "\xD6": "O",
6854           "\xD8": "O",
6855           "\xF2": "o",
6856           "\xF3": "o",
6857           "\xF4": "o",
6858           "\xF5": "o",
6859           "\xF6": "o",
6860           "\xF8": "o",
6861           "\xD9": "U",
6862           "\xDA": "U",
6863           "\xDB": "U",
6864           "\xDC": "U",
6865           "\xF9": "u",
6866           "\xFA": "u",
6867           "\xFB": "u",
6868           "\xFC": "u",
6869           "\xDD": "Y",
6870           "\xFD": "y",
6871           "\xFF": "y",
6872           "\xC6": "Ae",
6873           "\xE6": "ae",
6874           "\xDE": "Th",
6875           "\xFE": "th",
6876           "\xDF": "ss",
6877           "\u0100": "A",
6878           "\u0102": "A",
6879           "\u0104": "A",
6880           "\u0101": "a",
6881           "\u0103": "a",
6882           "\u0105": "a",
6883           "\u0106": "C",
6884           "\u0108": "C",
6885           "\u010A": "C",
6886           "\u010C": "C",
6887           "\u0107": "c",
6888           "\u0109": "c",
6889           "\u010B": "c",
6890           "\u010D": "c",
6891           "\u010E": "D",
6892           "\u0110": "D",
6893           "\u010F": "d",
6894           "\u0111": "d",
6895           "\u0112": "E",
6896           "\u0114": "E",
6897           "\u0116": "E",
6898           "\u0118": "E",
6899           "\u011A": "E",
6900           "\u0113": "e",
6901           "\u0115": "e",
6902           "\u0117": "e",
6903           "\u0119": "e",
6904           "\u011B": "e",
6905           "\u011C": "G",
6906           "\u011E": "G",
6907           "\u0120": "G",
6908           "\u0122": "G",
6909           "\u011D": "g",
6910           "\u011F": "g",
6911           "\u0121": "g",
6912           "\u0123": "g",
6913           "\u0124": "H",
6914           "\u0126": "H",
6915           "\u0125": "h",
6916           "\u0127": "h",
6917           "\u0128": "I",
6918           "\u012A": "I",
6919           "\u012C": "I",
6920           "\u012E": "I",
6921           "\u0130": "I",
6922           "\u0129": "i",
6923           "\u012B": "i",
6924           "\u012D": "i",
6925           "\u012F": "i",
6926           "\u0131": "i",
6927           "\u0134": "J",
6928           "\u0135": "j",
6929           "\u0136": "K",
6930           "\u0137": "k",
6931           "\u0138": "k",
6932           "\u0139": "L",
6933           "\u013B": "L",
6934           "\u013D": "L",
6935           "\u013F": "L",
6936           "\u0141": "L",
6937           "\u013A": "l",
6938           "\u013C": "l",
6939           "\u013E": "l",
6940           "\u0140": "l",
6941           "\u0142": "l",
6942           "\u0143": "N",
6943           "\u0145": "N",
6944           "\u0147": "N",
6945           "\u014A": "N",
6946           "\u0144": "n",
6947           "\u0146": "n",
6948           "\u0148": "n",
6949           "\u014B": "n",
6950           "\u014C": "O",
6951           "\u014E": "O",
6952           "\u0150": "O",
6953           "\u014D": "o",
6954           "\u014F": "o",
6955           "\u0151": "o",
6956           "\u0154": "R",
6957           "\u0156": "R",
6958           "\u0158": "R",
6959           "\u0155": "r",
6960           "\u0157": "r",
6961           "\u0159": "r",
6962           "\u015A": "S",
6963           "\u015C": "S",
6964           "\u015E": "S",
6965           "\u0160": "S",
6966           "\u015B": "s",
6967           "\u015D": "s",
6968           "\u015F": "s",
6969           "\u0161": "s",
6970           "\u0162": "T",
6971           "\u0164": "T",
6972           "\u0166": "T",
6973           "\u0163": "t",
6974           "\u0165": "t",
6975           "\u0167": "t",
6976           "\u0168": "U",
6977           "\u016A": "U",
6978           "\u016C": "U",
6979           "\u016E": "U",
6980           "\u0170": "U",
6981           "\u0172": "U",
6982           "\u0169": "u",
6983           "\u016B": "u",
6984           "\u016D": "u",
6985           "\u016F": "u",
6986           "\u0171": "u",
6987           "\u0173": "u",
6988           "\u0174": "W",
6989           "\u0175": "w",
6990           "\u0176": "Y",
6991           "\u0177": "y",
6992           "\u0178": "Y",
6993           "\u0179": "Z",
6994           "\u017B": "Z",
6995           "\u017D": "Z",
6996           "\u017A": "z",
6997           "\u017C": "z",
6998           "\u017E": "z",
6999           "\u0132": "IJ",
7000           "\u0133": "ij",
7001           "\u0152": "Oe",
7002           "\u0153": "oe",
7003           "\u0149": "'n",
7004           "\u017F": "s"
7005         };
7006         var htmlEscapes2 = {
7007           "&": "&amp;",
7008           "<": "&lt;",
7009           ">": "&gt;",
7010           '"': "&quot;",
7011           "'": "&#39;"
7012         };
7013         var htmlUnescapes2 = {
7014           "&amp;": "&",
7015           "&lt;": "<",
7016           "&gt;": ">",
7017           "&quot;": '"',
7018           "&#39;": "'"
7019         };
7020         var stringEscapes = {
7021           "\\": "\\",
7022           "'": "'",
7023           "\n": "n",
7024           "\r": "r",
7025           "\u2028": "u2028",
7026           "\u2029": "u2029"
7027         };
7028         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
7029         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
7030         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
7031         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
7032         var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
7033         var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
7034         var moduleExports = freeModule && freeModule.exports === freeExports;
7035         var freeProcess = moduleExports && freeGlobal2.process;
7036         var nodeUtil = function() {
7037           try {
7038             var types = freeModule && freeModule.require && freeModule.require("util").types;
7039             if (types) {
7040               return types;
7041             }
7042             return freeProcess && freeProcess.binding && freeProcess.binding("util");
7043           } catch (e) {
7044           }
7045         }();
7046         var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
7047         function apply(func, thisArg, args) {
7048           switch (args.length) {
7049             case 0:
7050               return func.call(thisArg);
7051             case 1:
7052               return func.call(thisArg, args[0]);
7053             case 2:
7054               return func.call(thisArg, args[0], args[1]);
7055             case 3:
7056               return func.call(thisArg, args[0], args[1], args[2]);
7057           }
7058           return func.apply(thisArg, args);
7059         }
7060         function arrayAggregator(array2, setter, iteratee, accumulator) {
7061           var index = -1, length = array2 == null ? 0 : array2.length;
7062           while (++index < length) {
7063             var value = array2[index];
7064             setter(accumulator, value, iteratee(value), array2);
7065           }
7066           return accumulator;
7067         }
7068         function arrayEach(array2, iteratee) {
7069           var index = -1, length = array2 == null ? 0 : array2.length;
7070           while (++index < length) {
7071             if (iteratee(array2[index], index, array2) === false) {
7072               break;
7073             }
7074           }
7075           return array2;
7076         }
7077         function arrayEachRight(array2, iteratee) {
7078           var length = array2 == null ? 0 : array2.length;
7079           while (length--) {
7080             if (iteratee(array2[length], length, array2) === false) {
7081               break;
7082             }
7083           }
7084           return array2;
7085         }
7086         function arrayEvery(array2, predicate) {
7087           var index = -1, length = array2 == null ? 0 : array2.length;
7088           while (++index < length) {
7089             if (!predicate(array2[index], index, array2)) {
7090               return false;
7091             }
7092           }
7093           return true;
7094         }
7095         function arrayFilter(array2, predicate) {
7096           var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
7097           while (++index < length) {
7098             var value = array2[index];
7099             if (predicate(value, index, array2)) {
7100               result[resIndex++] = value;
7101             }
7102           }
7103           return result;
7104         }
7105         function arrayIncludes(array2, value) {
7106           var length = array2 == null ? 0 : array2.length;
7107           return !!length && baseIndexOf(array2, value, 0) > -1;
7108         }
7109         function arrayIncludesWith(array2, value, comparator) {
7110           var index = -1, length = array2 == null ? 0 : array2.length;
7111           while (++index < length) {
7112             if (comparator(value, array2[index])) {
7113               return true;
7114             }
7115           }
7116           return false;
7117         }
7118         function arrayMap2(array2, iteratee) {
7119           var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
7120           while (++index < length) {
7121             result[index] = iteratee(array2[index], index, array2);
7122           }
7123           return result;
7124         }
7125         function arrayPush(array2, values) {
7126           var index = -1, length = values.length, offset = array2.length;
7127           while (++index < length) {
7128             array2[offset + index] = values[index];
7129           }
7130           return array2;
7131         }
7132         function arrayReduce(array2, iteratee, accumulator, initAccum) {
7133           var index = -1, length = array2 == null ? 0 : array2.length;
7134           if (initAccum && length) {
7135             accumulator = array2[++index];
7136           }
7137           while (++index < length) {
7138             accumulator = iteratee(accumulator, array2[index], index, array2);
7139           }
7140           return accumulator;
7141         }
7142         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
7143           var length = array2 == null ? 0 : array2.length;
7144           if (initAccum && length) {
7145             accumulator = array2[--length];
7146           }
7147           while (length--) {
7148             accumulator = iteratee(accumulator, array2[length], length, array2);
7149           }
7150           return accumulator;
7151         }
7152         function arraySome(array2, predicate) {
7153           var index = -1, length = array2 == null ? 0 : array2.length;
7154           while (++index < length) {
7155             if (predicate(array2[index], index, array2)) {
7156               return true;
7157             }
7158           }
7159           return false;
7160         }
7161         var asciiSize = baseProperty("length");
7162         function asciiToArray(string) {
7163           return string.split("");
7164         }
7165         function asciiWords(string) {
7166           return string.match(reAsciiWord) || [];
7167         }
7168         function baseFindKey(collection, predicate, eachFunc) {
7169           var result;
7170           eachFunc(collection, function(value, key, collection2) {
7171             if (predicate(value, key, collection2)) {
7172               result = key;
7173               return false;
7174             }
7175           });
7176           return result;
7177         }
7178         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
7179           var length = array2.length, index = fromIndex + (fromRight ? 1 : -1);
7180           while (fromRight ? index-- : ++index < length) {
7181             if (predicate(array2[index], index, array2)) {
7182               return index;
7183             }
7184           }
7185           return -1;
7186         }
7187         function baseIndexOf(array2, value, fromIndex) {
7188           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
7189         }
7190         function baseIndexOfWith(array2, value, fromIndex, comparator) {
7191           var index = fromIndex - 1, length = array2.length;
7192           while (++index < length) {
7193             if (comparator(array2[index], value)) {
7194               return index;
7195             }
7196           }
7197           return -1;
7198         }
7199         function baseIsNaN(value) {
7200           return value !== value;
7201         }
7202         function baseMean(array2, iteratee) {
7203           var length = array2 == null ? 0 : array2.length;
7204           return length ? baseSum(array2, iteratee) / length : NAN2;
7205         }
7206         function baseProperty(key) {
7207           return function(object) {
7208             return object == null ? undefined2 : object[key];
7209           };
7210         }
7211         function basePropertyOf2(object) {
7212           return function(key) {
7213             return object == null ? undefined2 : object[key];
7214           };
7215         }
7216         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
7217           eachFunc(collection, function(value, index, collection2) {
7218             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
7219           });
7220           return accumulator;
7221         }
7222         function baseSortBy(array2, comparer) {
7223           var length = array2.length;
7224           array2.sort(comparer);
7225           while (length--) {
7226             array2[length] = array2[length].value;
7227           }
7228           return array2;
7229         }
7230         function baseSum(array2, iteratee) {
7231           var result, index = -1, length = array2.length;
7232           while (++index < length) {
7233             var current = iteratee(array2[index]);
7234             if (current !== undefined2) {
7235               result = result === undefined2 ? current : result + current;
7236             }
7237           }
7238           return result;
7239         }
7240         function baseTimes(n2, iteratee) {
7241           var index = -1, result = Array(n2);
7242           while (++index < n2) {
7243             result[index] = iteratee(index);
7244           }
7245           return result;
7246         }
7247         function baseToPairs(object, props) {
7248           return arrayMap2(props, function(key) {
7249             return [key, object[key]];
7250           });
7251         }
7252         function baseTrim2(string) {
7253           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
7254         }
7255         function baseUnary(func) {
7256           return function(value) {
7257             return func(value);
7258           };
7259         }
7260         function baseValues(object, props) {
7261           return arrayMap2(props, function(key) {
7262             return object[key];
7263           });
7264         }
7265         function cacheHas(cache, key) {
7266           return cache.has(key);
7267         }
7268         function charsStartIndex(strSymbols, chrSymbols) {
7269           var index = -1, length = strSymbols.length;
7270           while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7271           }
7272           return index;
7273         }
7274         function charsEndIndex(strSymbols, chrSymbols) {
7275           var index = strSymbols.length;
7276           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7277           }
7278           return index;
7279         }
7280         function countHolders(array2, placeholder) {
7281           var length = array2.length, result = 0;
7282           while (length--) {
7283             if (array2[length] === placeholder) {
7284               ++result;
7285             }
7286           }
7287           return result;
7288         }
7289         var deburrLetter = basePropertyOf2(deburredLetters);
7290         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
7291         function escapeStringChar(chr) {
7292           return "\\" + stringEscapes[chr];
7293         }
7294         function getValue(object, key) {
7295           return object == null ? undefined2 : object[key];
7296         }
7297         function hasUnicode(string) {
7298           return reHasUnicode.test(string);
7299         }
7300         function hasUnicodeWord(string) {
7301           return reHasUnicodeWord.test(string);
7302         }
7303         function iteratorToArray(iterator) {
7304           var data, result = [];
7305           while (!(data = iterator.next()).done) {
7306             result.push(data.value);
7307           }
7308           return result;
7309         }
7310         function mapToArray(map2) {
7311           var index = -1, result = Array(map2.size);
7312           map2.forEach(function(value, key) {
7313             result[++index] = [key, value];
7314           });
7315           return result;
7316         }
7317         function overArg(func, transform2) {
7318           return function(arg) {
7319             return func(transform2(arg));
7320           };
7321         }
7322         function replaceHolders(array2, placeholder) {
7323           var index = -1, length = array2.length, resIndex = 0, result = [];
7324           while (++index < length) {
7325             var value = array2[index];
7326             if (value === placeholder || value === PLACEHOLDER) {
7327               array2[index] = PLACEHOLDER;
7328               result[resIndex++] = index;
7329             }
7330           }
7331           return result;
7332         }
7333         function setToArray(set3) {
7334           var index = -1, result = Array(set3.size);
7335           set3.forEach(function(value) {
7336             result[++index] = value;
7337           });
7338           return result;
7339         }
7340         function setToPairs(set3) {
7341           var index = -1, result = Array(set3.size);
7342           set3.forEach(function(value) {
7343             result[++index] = [value, value];
7344           });
7345           return result;
7346         }
7347         function strictIndexOf(array2, value, fromIndex) {
7348           var index = fromIndex - 1, length = array2.length;
7349           while (++index < length) {
7350             if (array2[index] === value) {
7351               return index;
7352             }
7353           }
7354           return -1;
7355         }
7356         function strictLastIndexOf(array2, value, fromIndex) {
7357           var index = fromIndex + 1;
7358           while (index--) {
7359             if (array2[index] === value) {
7360               return index;
7361             }
7362           }
7363           return index;
7364         }
7365         function stringSize(string) {
7366           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
7367         }
7368         function stringToArray(string) {
7369           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
7370         }
7371         function trimmedEndIndex2(string) {
7372           var index = string.length;
7373           while (index-- && reWhitespace2.test(string.charAt(index))) {
7374           }
7375           return index;
7376         }
7377         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
7378         function unicodeSize(string) {
7379           var result = reUnicode.lastIndex = 0;
7380           while (reUnicode.test(string)) {
7381             ++result;
7382           }
7383           return result;
7384         }
7385         function unicodeToArray(string) {
7386           return string.match(reUnicode) || [];
7387         }
7388         function unicodeWords(string) {
7389           return string.match(reUnicodeWord) || [];
7390         }
7391         var runInContext = function runInContext2(context) {
7392           context = context == null ? root3 : _.defaults(root3.Object(), context, _.pick(root3, contextProps));
7393           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;
7394           var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto3 = Object2.prototype;
7395           var coreJsData = context["__core-js_shared__"];
7396           var funcToString = funcProto.toString;
7397           var hasOwnProperty2 = objectProto3.hasOwnProperty;
7398           var idCounter = 0;
7399           var maskSrcKey = function() {
7400             var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
7401             return uid ? "Symbol(src)_1." + uid : "";
7402           }();
7403           var nativeObjectToString3 = objectProto3.toString;
7404           var objectCtorString = funcToString.call(Object2);
7405           var oldDash = root3._;
7406           var reIsNative = RegExp2(
7407             "^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
7408           );
7409           var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto3.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
7410           var defineProperty = function() {
7411             try {
7412               var func = getNative(Object2, "defineProperty");
7413               func({}, "", {});
7414               return func;
7415             } catch (e) {
7416             }
7417           }();
7418           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
7419           var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
7420           var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
7421           var metaMap = WeakMap && new WeakMap();
7422           var realNames = {};
7423           var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
7424           var symbolProto2 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf = symbolProto2 ? symbolProto2.valueOf : undefined2, symbolToString2 = symbolProto2 ? symbolProto2.toString : undefined2;
7425           function lodash(value) {
7426             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
7427               if (value instanceof LodashWrapper) {
7428                 return value;
7429               }
7430               if (hasOwnProperty2.call(value, "__wrapped__")) {
7431                 return wrapperClone(value);
7432               }
7433             }
7434             return new LodashWrapper(value);
7435           }
7436           var baseCreate = function() {
7437             function object() {
7438             }
7439             return function(proto) {
7440               if (!isObject2(proto)) {
7441                 return {};
7442               }
7443               if (objectCreate) {
7444                 return objectCreate(proto);
7445               }
7446               object.prototype = proto;
7447               var result2 = new object();
7448               object.prototype = undefined2;
7449               return result2;
7450             };
7451           }();
7452           function baseLodash() {
7453           }
7454           function LodashWrapper(value, chainAll) {
7455             this.__wrapped__ = value;
7456             this.__actions__ = [];
7457             this.__chain__ = !!chainAll;
7458             this.__index__ = 0;
7459             this.__values__ = undefined2;
7460           }
7461           lodash.templateSettings = {
7462             "escape": reEscape,
7463             "evaluate": reEvaluate,
7464             "interpolate": reInterpolate,
7465             "variable": "",
7466             "imports": {
7467               "_": lodash
7468             }
7469           };
7470           lodash.prototype = baseLodash.prototype;
7471           lodash.prototype.constructor = lodash;
7472           LodashWrapper.prototype = baseCreate(baseLodash.prototype);
7473           LodashWrapper.prototype.constructor = LodashWrapper;
7474           function LazyWrapper(value) {
7475             this.__wrapped__ = value;
7476             this.__actions__ = [];
7477             this.__dir__ = 1;
7478             this.__filtered__ = false;
7479             this.__iteratees__ = [];
7480             this.__takeCount__ = MAX_ARRAY_LENGTH;
7481             this.__views__ = [];
7482           }
7483           function lazyClone() {
7484             var result2 = new LazyWrapper(this.__wrapped__);
7485             result2.__actions__ = copyArray(this.__actions__);
7486             result2.__dir__ = this.__dir__;
7487             result2.__filtered__ = this.__filtered__;
7488             result2.__iteratees__ = copyArray(this.__iteratees__);
7489             result2.__takeCount__ = this.__takeCount__;
7490             result2.__views__ = copyArray(this.__views__);
7491             return result2;
7492           }
7493           function lazyReverse() {
7494             if (this.__filtered__) {
7495               var result2 = new LazyWrapper(this);
7496               result2.__dir__ = -1;
7497               result2.__filtered__ = true;
7498             } else {
7499               result2 = this.clone();
7500               result2.__dir__ *= -1;
7501             }
7502             return result2;
7503           }
7504           function lazyValue() {
7505             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, length = end - start2, index = isRight ? end : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length, this.__takeCount__);
7506             if (!isArr || !isRight && arrLength == length && takeCount == length) {
7507               return baseWrapperValue(array2, this.__actions__);
7508             }
7509             var result2 = [];
7510             outer:
7511               while (length-- && resIndex < takeCount) {
7512                 index += dir;
7513                 var iterIndex = -1, value = array2[index];
7514                 while (++iterIndex < iterLength) {
7515                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type3 = data.type, computed = iteratee2(value);
7516                   if (type3 == LAZY_MAP_FLAG) {
7517                     value = computed;
7518                   } else if (!computed) {
7519                     if (type3 == LAZY_FILTER_FLAG) {
7520                       continue outer;
7521                     } else {
7522                       break outer;
7523                     }
7524                   }
7525                 }
7526                 result2[resIndex++] = value;
7527               }
7528             return result2;
7529           }
7530           LazyWrapper.prototype = baseCreate(baseLodash.prototype);
7531           LazyWrapper.prototype.constructor = LazyWrapper;
7532           function Hash(entries) {
7533             var index = -1, length = entries == null ? 0 : entries.length;
7534             this.clear();
7535             while (++index < length) {
7536               var entry = entries[index];
7537               this.set(entry[0], entry[1]);
7538             }
7539           }
7540           function hashClear() {
7541             this.__data__ = nativeCreate ? nativeCreate(null) : {};
7542             this.size = 0;
7543           }
7544           function hashDelete(key) {
7545             var result2 = this.has(key) && delete this.__data__[key];
7546             this.size -= result2 ? 1 : 0;
7547             return result2;
7548           }
7549           function hashGet(key) {
7550             var data = this.__data__;
7551             if (nativeCreate) {
7552               var result2 = data[key];
7553               return result2 === HASH_UNDEFINED ? undefined2 : result2;
7554             }
7555             return hasOwnProperty2.call(data, key) ? data[key] : undefined2;
7556           }
7557           function hashHas(key) {
7558             var data = this.__data__;
7559             return nativeCreate ? data[key] !== undefined2 : hasOwnProperty2.call(data, key);
7560           }
7561           function hashSet(key, value) {
7562             var data = this.__data__;
7563             this.size += this.has(key) ? 0 : 1;
7564             data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
7565             return this;
7566           }
7567           Hash.prototype.clear = hashClear;
7568           Hash.prototype["delete"] = hashDelete;
7569           Hash.prototype.get = hashGet;
7570           Hash.prototype.has = hashHas;
7571           Hash.prototype.set = hashSet;
7572           function ListCache(entries) {
7573             var index = -1, length = entries == null ? 0 : entries.length;
7574             this.clear();
7575             while (++index < length) {
7576               var entry = entries[index];
7577               this.set(entry[0], entry[1]);
7578             }
7579           }
7580           function listCacheClear() {
7581             this.__data__ = [];
7582             this.size = 0;
7583           }
7584           function listCacheDelete(key) {
7585             var data = this.__data__, index = assocIndexOf(data, key);
7586             if (index < 0) {
7587               return false;
7588             }
7589             var lastIndex = data.length - 1;
7590             if (index == lastIndex) {
7591               data.pop();
7592             } else {
7593               splice.call(data, index, 1);
7594             }
7595             --this.size;
7596             return true;
7597           }
7598           function listCacheGet(key) {
7599             var data = this.__data__, index = assocIndexOf(data, key);
7600             return index < 0 ? undefined2 : data[index][1];
7601           }
7602           function listCacheHas(key) {
7603             return assocIndexOf(this.__data__, key) > -1;
7604           }
7605           function listCacheSet(key, value) {
7606             var data = this.__data__, index = assocIndexOf(data, key);
7607             if (index < 0) {
7608               ++this.size;
7609               data.push([key, value]);
7610             } else {
7611               data[index][1] = value;
7612             }
7613             return this;
7614           }
7615           ListCache.prototype.clear = listCacheClear;
7616           ListCache.prototype["delete"] = listCacheDelete;
7617           ListCache.prototype.get = listCacheGet;
7618           ListCache.prototype.has = listCacheHas;
7619           ListCache.prototype.set = listCacheSet;
7620           function MapCache(entries) {
7621             var index = -1, length = entries == null ? 0 : entries.length;
7622             this.clear();
7623             while (++index < length) {
7624               var entry = entries[index];
7625               this.set(entry[0], entry[1]);
7626             }
7627           }
7628           function mapCacheClear() {
7629             this.size = 0;
7630             this.__data__ = {
7631               "hash": new Hash(),
7632               "map": new (Map2 || ListCache)(),
7633               "string": new Hash()
7634             };
7635           }
7636           function mapCacheDelete(key) {
7637             var result2 = getMapData(this, key)["delete"](key);
7638             this.size -= result2 ? 1 : 0;
7639             return result2;
7640           }
7641           function mapCacheGet(key) {
7642             return getMapData(this, key).get(key);
7643           }
7644           function mapCacheHas(key) {
7645             return getMapData(this, key).has(key);
7646           }
7647           function mapCacheSet(key, value) {
7648             var data = getMapData(this, key), size2 = data.size;
7649             data.set(key, value);
7650             this.size += data.size == size2 ? 0 : 1;
7651             return this;
7652           }
7653           MapCache.prototype.clear = mapCacheClear;
7654           MapCache.prototype["delete"] = mapCacheDelete;
7655           MapCache.prototype.get = mapCacheGet;
7656           MapCache.prototype.has = mapCacheHas;
7657           MapCache.prototype.set = mapCacheSet;
7658           function SetCache(values2) {
7659             var index = -1, length = values2 == null ? 0 : values2.length;
7660             this.__data__ = new MapCache();
7661             while (++index < length) {
7662               this.add(values2[index]);
7663             }
7664           }
7665           function setCacheAdd(value) {
7666             this.__data__.set(value, HASH_UNDEFINED);
7667             return this;
7668           }
7669           function setCacheHas(value) {
7670             return this.__data__.has(value);
7671           }
7672           SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
7673           SetCache.prototype.has = setCacheHas;
7674           function Stack(entries) {
7675             var data = this.__data__ = new ListCache(entries);
7676             this.size = data.size;
7677           }
7678           function stackClear() {
7679             this.__data__ = new ListCache();
7680             this.size = 0;
7681           }
7682           function stackDelete(key) {
7683             var data = this.__data__, result2 = data["delete"](key);
7684             this.size = data.size;
7685             return result2;
7686           }
7687           function stackGet(key) {
7688             return this.__data__.get(key);
7689           }
7690           function stackHas(key) {
7691             return this.__data__.has(key);
7692           }
7693           function stackSet(key, value) {
7694             var data = this.__data__;
7695             if (data instanceof ListCache) {
7696               var pairs = data.__data__;
7697               if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
7698                 pairs.push([key, value]);
7699                 this.size = ++data.size;
7700                 return this;
7701               }
7702               data = this.__data__ = new MapCache(pairs);
7703             }
7704             data.set(key, value);
7705             this.size = data.size;
7706             return this;
7707           }
7708           Stack.prototype.clear = stackClear;
7709           Stack.prototype["delete"] = stackDelete;
7710           Stack.prototype.get = stackGet;
7711           Stack.prototype.has = stackHas;
7712           Stack.prototype.set = stackSet;
7713           function arrayLikeKeys(value, inherited) {
7714             var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
7715             for (var key in value) {
7716               if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
7717                 result2.push(key);
7718               }
7719             }
7720             return result2;
7721           }
7722           function arraySample(array2) {
7723             var length = array2.length;
7724             return length ? array2[baseRandom(0, length - 1)] : undefined2;
7725           }
7726           function arraySampleSize(array2, n2) {
7727             return shuffleSelf(copyArray(array2), baseClamp(n2, 0, array2.length));
7728           }
7729           function arrayShuffle(array2) {
7730             return shuffleSelf(copyArray(array2));
7731           }
7732           function assignMergeValue(object, key, value) {
7733             if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
7734               baseAssignValue(object, key, value);
7735             }
7736           }
7737           function assignValue(object, key, value) {
7738             var objValue = object[key];
7739             if (!(hasOwnProperty2.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
7740               baseAssignValue(object, key, value);
7741             }
7742           }
7743           function assocIndexOf(array2, key) {
7744             var length = array2.length;
7745             while (length--) {
7746               if (eq(array2[length][0], key)) {
7747                 return length;
7748               }
7749             }
7750             return -1;
7751           }
7752           function baseAggregator(collection, setter, iteratee2, accumulator) {
7753             baseEach(collection, function(value, key, collection2) {
7754               setter(accumulator, value, iteratee2(value), collection2);
7755             });
7756             return accumulator;
7757           }
7758           function baseAssign(object, source) {
7759             return object && copyObject(source, keys(source), object);
7760           }
7761           function baseAssignIn(object, source) {
7762             return object && copyObject(source, keysIn(source), object);
7763           }
7764           function baseAssignValue(object, key, value) {
7765             if (key == "__proto__" && defineProperty) {
7766               defineProperty(object, key, {
7767                 "configurable": true,
7768                 "enumerable": true,
7769                 "value": value,
7770                 "writable": true
7771               });
7772             } else {
7773               object[key] = value;
7774             }
7775           }
7776           function baseAt(object, paths) {
7777             var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
7778             while (++index < length) {
7779               result2[index] = skip ? undefined2 : get4(object, paths[index]);
7780             }
7781             return result2;
7782           }
7783           function baseClamp(number3, lower2, upper) {
7784             if (number3 === number3) {
7785               if (upper !== undefined2) {
7786                 number3 = number3 <= upper ? number3 : upper;
7787               }
7788               if (lower2 !== undefined2) {
7789                 number3 = number3 >= lower2 ? number3 : lower2;
7790               }
7791             }
7792             return number3;
7793           }
7794           function baseClone(value, bitmask, customizer, key, object, stack) {
7795             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
7796             if (customizer) {
7797               result2 = object ? customizer(value, key, object, stack) : customizer(value);
7798             }
7799             if (result2 !== undefined2) {
7800               return result2;
7801             }
7802             if (!isObject2(value)) {
7803               return value;
7804             }
7805             var isArr = isArray2(value);
7806             if (isArr) {
7807               result2 = initCloneArray(value);
7808               if (!isDeep) {
7809                 return copyArray(value, result2);
7810               }
7811             } else {
7812               var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
7813               if (isBuffer(value)) {
7814                 return cloneBuffer(value, isDeep);
7815               }
7816               if (tag == objectTag || tag == argsTag || isFunc && !object) {
7817                 result2 = isFlat || isFunc ? {} : initCloneObject(value);
7818                 if (!isDeep) {
7819                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
7820                 }
7821               } else {
7822                 if (!cloneableTags[tag]) {
7823                   return object ? value : {};
7824                 }
7825                 result2 = initCloneByTag(value, tag, isDeep);
7826               }
7827             }
7828             stack || (stack = new Stack());
7829             var stacked = stack.get(value);
7830             if (stacked) {
7831               return stacked;
7832             }
7833             stack.set(value, result2);
7834             if (isSet(value)) {
7835               value.forEach(function(subValue) {
7836                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
7837               });
7838             } else if (isMap(value)) {
7839               value.forEach(function(subValue, key2) {
7840                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7841               });
7842             }
7843             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
7844             var props = isArr ? undefined2 : keysFunc(value);
7845             arrayEach(props || value, function(subValue, key2) {
7846               if (props) {
7847                 key2 = subValue;
7848                 subValue = value[key2];
7849               }
7850               assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7851             });
7852             return result2;
7853           }
7854           function baseConforms(source) {
7855             var props = keys(source);
7856             return function(object) {
7857               return baseConformsTo(object, source, props);
7858             };
7859           }
7860           function baseConformsTo(object, source, props) {
7861             var length = props.length;
7862             if (object == null) {
7863               return !length;
7864             }
7865             object = Object2(object);
7866             while (length--) {
7867               var key = props[length], predicate = source[key], value = object[key];
7868               if (value === undefined2 && !(key in object) || !predicate(value)) {
7869                 return false;
7870               }
7871             }
7872             return true;
7873           }
7874           function baseDelay(func, wait, args) {
7875             if (typeof func != "function") {
7876               throw new TypeError2(FUNC_ERROR_TEXT3);
7877             }
7878             return setTimeout2(function() {
7879               func.apply(undefined2, args);
7880             }, wait);
7881           }
7882           function baseDifference(array2, values2, iteratee2, comparator) {
7883             var index = -1, includes2 = arrayIncludes, isCommon = true, length = array2.length, result2 = [], valuesLength = values2.length;
7884             if (!length) {
7885               return result2;
7886             }
7887             if (iteratee2) {
7888               values2 = arrayMap2(values2, baseUnary(iteratee2));
7889             }
7890             if (comparator) {
7891               includes2 = arrayIncludesWith;
7892               isCommon = false;
7893             } else if (values2.length >= LARGE_ARRAY_SIZE) {
7894               includes2 = cacheHas;
7895               isCommon = false;
7896               values2 = new SetCache(values2);
7897             }
7898             outer:
7899               while (++index < length) {
7900                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
7901                 value = comparator || value !== 0 ? value : 0;
7902                 if (isCommon && computed === computed) {
7903                   var valuesIndex = valuesLength;
7904                   while (valuesIndex--) {
7905                     if (values2[valuesIndex] === computed) {
7906                       continue outer;
7907                     }
7908                   }
7909                   result2.push(value);
7910                 } else if (!includes2(values2, computed, comparator)) {
7911                   result2.push(value);
7912                 }
7913               }
7914             return result2;
7915           }
7916           var baseEach = createBaseEach(baseForOwn);
7917           var baseEachRight = createBaseEach(baseForOwnRight, true);
7918           function baseEvery(collection, predicate) {
7919             var result2 = true;
7920             baseEach(collection, function(value, index, collection2) {
7921               result2 = !!predicate(value, index, collection2);
7922               return result2;
7923             });
7924             return result2;
7925           }
7926           function baseExtremum(array2, iteratee2, comparator) {
7927             var index = -1, length = array2.length;
7928             while (++index < length) {
7929               var value = array2[index], current = iteratee2(value);
7930               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
7931                 var computed = current, result2 = value;
7932               }
7933             }
7934             return result2;
7935           }
7936           function baseFill(array2, value, start2, end) {
7937             var length = array2.length;
7938             start2 = toInteger(start2);
7939             if (start2 < 0) {
7940               start2 = -start2 > length ? 0 : length + start2;
7941             }
7942             end = end === undefined2 || end > length ? length : toInteger(end);
7943             if (end < 0) {
7944               end += length;
7945             }
7946             end = start2 > end ? 0 : toLength(end);
7947             while (start2 < end) {
7948               array2[start2++] = value;
7949             }
7950             return array2;
7951           }
7952           function baseFilter(collection, predicate) {
7953             var result2 = [];
7954             baseEach(collection, function(value, index, collection2) {
7955               if (predicate(value, index, collection2)) {
7956                 result2.push(value);
7957               }
7958             });
7959             return result2;
7960           }
7961           function baseFlatten(array2, depth, predicate, isStrict, result2) {
7962             var index = -1, length = array2.length;
7963             predicate || (predicate = isFlattenable);
7964             result2 || (result2 = []);
7965             while (++index < length) {
7966               var value = array2[index];
7967               if (depth > 0 && predicate(value)) {
7968                 if (depth > 1) {
7969                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
7970                 } else {
7971                   arrayPush(result2, value);
7972                 }
7973               } else if (!isStrict) {
7974                 result2[result2.length] = value;
7975               }
7976             }
7977             return result2;
7978           }
7979           var baseFor = createBaseFor();
7980           var baseForRight = createBaseFor(true);
7981           function baseForOwn(object, iteratee2) {
7982             return object && baseFor(object, iteratee2, keys);
7983           }
7984           function baseForOwnRight(object, iteratee2) {
7985             return object && baseForRight(object, iteratee2, keys);
7986           }
7987           function baseFunctions(object, props) {
7988             return arrayFilter(props, function(key) {
7989               return isFunction(object[key]);
7990             });
7991           }
7992           function baseGet(object, path) {
7993             path = castPath(path, object);
7994             var index = 0, length = path.length;
7995             while (object != null && index < length) {
7996               object = object[toKey(path[index++])];
7997             }
7998             return index && index == length ? object : undefined2;
7999           }
8000           function baseGetAllKeys(object, keysFunc, symbolsFunc) {
8001             var result2 = keysFunc(object);
8002             return isArray2(object) ? result2 : arrayPush(result2, symbolsFunc(object));
8003           }
8004           function baseGetTag2(value) {
8005             if (value == null) {
8006               return value === undefined2 ? undefinedTag2 : nullTag2;
8007             }
8008             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
8009           }
8010           function baseGt(value, other) {
8011             return value > other;
8012           }
8013           function baseHas(object, key) {
8014             return object != null && hasOwnProperty2.call(object, key);
8015           }
8016           function baseHasIn(object, key) {
8017             return object != null && key in Object2(object);
8018           }
8019           function baseInRange(number3, start2, end) {
8020             return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
8021           }
8022           function baseIntersection(arrays, iteratee2, comparator) {
8023             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
8024             while (othIndex--) {
8025               var array2 = arrays[othIndex];
8026               if (othIndex && iteratee2) {
8027                 array2 = arrayMap2(array2, baseUnary(iteratee2));
8028               }
8029               maxLength = nativeMin2(array2.length, maxLength);
8030               caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache(othIndex && array2) : undefined2;
8031             }
8032             array2 = arrays[0];
8033             var index = -1, seen = caches[0];
8034             outer:
8035               while (++index < length && result2.length < maxLength) {
8036                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8037                 value = comparator || value !== 0 ? value : 0;
8038                 if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
8039                   othIndex = othLength;
8040                   while (--othIndex) {
8041                     var cache = caches[othIndex];
8042                     if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
8043                       continue outer;
8044                     }
8045                   }
8046                   if (seen) {
8047                     seen.push(computed);
8048                   }
8049                   result2.push(value);
8050                 }
8051               }
8052             return result2;
8053           }
8054           function baseInverter(object, setter, iteratee2, accumulator) {
8055             baseForOwn(object, function(value, key, object2) {
8056               setter(accumulator, iteratee2(value), key, object2);
8057             });
8058             return accumulator;
8059           }
8060           function baseInvoke(object, path, args) {
8061             path = castPath(path, object);
8062             object = parent(object, path);
8063             var func = object == null ? object : object[toKey(last(path))];
8064             return func == null ? undefined2 : apply(func, object, args);
8065           }
8066           function baseIsArguments(value) {
8067             return isObjectLike2(value) && baseGetTag2(value) == argsTag;
8068           }
8069           function baseIsArrayBuffer(value) {
8070             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag;
8071           }
8072           function baseIsDate(value) {
8073             return isObjectLike2(value) && baseGetTag2(value) == dateTag;
8074           }
8075           function baseIsEqual(value, other, bitmask, customizer, stack) {
8076             if (value === other) {
8077               return true;
8078             }
8079             if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
8080               return value !== value && other !== other;
8081             }
8082             return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
8083           }
8084           function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
8085             var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
8086             objTag = objTag == argsTag ? objectTag : objTag;
8087             othTag = othTag == argsTag ? objectTag : othTag;
8088             var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
8089             if (isSameTag && isBuffer(object)) {
8090               if (!isBuffer(other)) {
8091                 return false;
8092               }
8093               objIsArr = true;
8094               objIsObj = false;
8095             }
8096             if (isSameTag && !objIsObj) {
8097               stack || (stack = new Stack());
8098               return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
8099             }
8100             if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
8101               var objIsWrapped = objIsObj && hasOwnProperty2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
8102               if (objIsWrapped || othIsWrapped) {
8103                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
8104                 stack || (stack = new Stack());
8105                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
8106               }
8107             }
8108             if (!isSameTag) {
8109               return false;
8110             }
8111             stack || (stack = new Stack());
8112             return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
8113           }
8114           function baseIsMap(value) {
8115             return isObjectLike2(value) && getTag(value) == mapTag;
8116           }
8117           function baseIsMatch(object, source, matchData, customizer) {
8118             var index = matchData.length, length = index, noCustomizer = !customizer;
8119             if (object == null) {
8120               return !length;
8121             }
8122             object = Object2(object);
8123             while (index--) {
8124               var data = matchData[index];
8125               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
8126                 return false;
8127               }
8128             }
8129             while (++index < length) {
8130               data = matchData[index];
8131               var key = data[0], objValue = object[key], srcValue = data[1];
8132               if (noCustomizer && data[2]) {
8133                 if (objValue === undefined2 && !(key in object)) {
8134                   return false;
8135                 }
8136               } else {
8137                 var stack = new Stack();
8138                 if (customizer) {
8139                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
8140                 }
8141                 if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
8142                   return false;
8143                 }
8144               }
8145             }
8146             return true;
8147           }
8148           function baseIsNative(value) {
8149             if (!isObject2(value) || isMasked(value)) {
8150               return false;
8151             }
8152             var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
8153             return pattern.test(toSource(value));
8154           }
8155           function baseIsRegExp(value) {
8156             return isObjectLike2(value) && baseGetTag2(value) == regexpTag;
8157           }
8158           function baseIsSet(value) {
8159             return isObjectLike2(value) && getTag(value) == setTag;
8160           }
8161           function baseIsTypedArray(value) {
8162             return isObjectLike2(value) && isLength(value.length) && !!typedArrayTags[baseGetTag2(value)];
8163           }
8164           function baseIteratee(value) {
8165             if (typeof value == "function") {
8166               return value;
8167             }
8168             if (value == null) {
8169               return identity4;
8170             }
8171             if (typeof value == "object") {
8172               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
8173             }
8174             return property(value);
8175           }
8176           function baseKeys(object) {
8177             if (!isPrototype(object)) {
8178               return nativeKeys(object);
8179             }
8180             var result2 = [];
8181             for (var key in Object2(object)) {
8182               if (hasOwnProperty2.call(object, key) && key != "constructor") {
8183                 result2.push(key);
8184               }
8185             }
8186             return result2;
8187           }
8188           function baseKeysIn(object) {
8189             if (!isObject2(object)) {
8190               return nativeKeysIn(object);
8191             }
8192             var isProto = isPrototype(object), result2 = [];
8193             for (var key in object) {
8194               if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object, key)))) {
8195                 result2.push(key);
8196               }
8197             }
8198             return result2;
8199           }
8200           function baseLt(value, other) {
8201             return value < other;
8202           }
8203           function baseMap(collection, iteratee2) {
8204             var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : [];
8205             baseEach(collection, function(value, key, collection2) {
8206               result2[++index] = iteratee2(value, key, collection2);
8207             });
8208             return result2;
8209           }
8210           function baseMatches(source) {
8211             var matchData = getMatchData(source);
8212             if (matchData.length == 1 && matchData[0][2]) {
8213               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
8214             }
8215             return function(object) {
8216               return object === source || baseIsMatch(object, source, matchData);
8217             };
8218           }
8219           function baseMatchesProperty(path, srcValue) {
8220             if (isKey(path) && isStrictComparable(srcValue)) {
8221               return matchesStrictComparable(toKey(path), srcValue);
8222             }
8223             return function(object) {
8224               var objValue = get4(object, path);
8225               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
8226             };
8227           }
8228           function baseMerge(object, source, srcIndex, customizer, stack) {
8229             if (object === source) {
8230               return;
8231             }
8232             baseFor(source, function(srcValue, key) {
8233               stack || (stack = new Stack());
8234               if (isObject2(srcValue)) {
8235                 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
8236               } else {
8237                 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
8238                 if (newValue === undefined2) {
8239                   newValue = srcValue;
8240                 }
8241                 assignMergeValue(object, key, newValue);
8242               }
8243             }, keysIn);
8244           }
8245           function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
8246             var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
8247             if (stacked) {
8248               assignMergeValue(object, key, stacked);
8249               return;
8250             }
8251             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
8252             var isCommon = newValue === undefined2;
8253             if (isCommon) {
8254               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
8255               newValue = srcValue;
8256               if (isArr || isBuff || isTyped) {
8257                 if (isArray2(objValue)) {
8258                   newValue = objValue;
8259                 } else if (isArrayLikeObject(objValue)) {
8260                   newValue = copyArray(objValue);
8261                 } else if (isBuff) {
8262                   isCommon = false;
8263                   newValue = cloneBuffer(srcValue, true);
8264                 } else if (isTyped) {
8265                   isCommon = false;
8266                   newValue = cloneTypedArray(srcValue, true);
8267                 } else {
8268                   newValue = [];
8269                 }
8270               } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
8271                 newValue = objValue;
8272                 if (isArguments(objValue)) {
8273                   newValue = toPlainObject(objValue);
8274                 } else if (!isObject2(objValue) || isFunction(objValue)) {
8275                   newValue = initCloneObject(srcValue);
8276                 }
8277               } else {
8278                 isCommon = false;
8279               }
8280             }
8281             if (isCommon) {
8282               stack.set(srcValue, newValue);
8283               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
8284               stack["delete"](srcValue);
8285             }
8286             assignMergeValue(object, key, newValue);
8287           }
8288           function baseNth(array2, n2) {
8289             var length = array2.length;
8290             if (!length) {
8291               return;
8292             }
8293             n2 += n2 < 0 ? length : 0;
8294             return isIndex(n2, length) ? array2[n2] : undefined2;
8295           }
8296           function baseOrderBy(collection, iteratees, orders) {
8297             if (iteratees.length) {
8298               iteratees = arrayMap2(iteratees, function(iteratee2) {
8299                 if (isArray2(iteratee2)) {
8300                   return function(value) {
8301                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
8302                   };
8303                 }
8304                 return iteratee2;
8305               });
8306             } else {
8307               iteratees = [identity4];
8308             }
8309             var index = -1;
8310             iteratees = arrayMap2(iteratees, baseUnary(getIteratee()));
8311             var result2 = baseMap(collection, function(value, key, collection2) {
8312               var criteria = arrayMap2(iteratees, function(iteratee2) {
8313                 return iteratee2(value);
8314               });
8315               return { "criteria": criteria, "index": ++index, "value": value };
8316             });
8317             return baseSortBy(result2, function(object, other) {
8318               return compareMultiple(object, other, orders);
8319             });
8320           }
8321           function basePick(object, paths) {
8322             return basePickBy(object, paths, function(value, path) {
8323               return hasIn(object, path);
8324             });
8325           }
8326           function basePickBy(object, paths, predicate) {
8327             var index = -1, length = paths.length, result2 = {};
8328             while (++index < length) {
8329               var path = paths[index], value = baseGet(object, path);
8330               if (predicate(value, path)) {
8331                 baseSet(result2, castPath(path, object), value);
8332               }
8333             }
8334             return result2;
8335           }
8336           function basePropertyDeep(path) {
8337             return function(object) {
8338               return baseGet(object, path);
8339             };
8340           }
8341           function basePullAll(array2, values2, iteratee2, comparator) {
8342             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array2;
8343             if (array2 === values2) {
8344               values2 = copyArray(values2);
8345             }
8346             if (iteratee2) {
8347               seen = arrayMap2(array2, baseUnary(iteratee2));
8348             }
8349             while (++index < length) {
8350               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
8351               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
8352                 if (seen !== array2) {
8353                   splice.call(seen, fromIndex, 1);
8354                 }
8355                 splice.call(array2, fromIndex, 1);
8356               }
8357             }
8358             return array2;
8359           }
8360           function basePullAt(array2, indexes) {
8361             var length = array2 ? indexes.length : 0, lastIndex = length - 1;
8362             while (length--) {
8363               var index = indexes[length];
8364               if (length == lastIndex || index !== previous) {
8365                 var previous = index;
8366                 if (isIndex(index)) {
8367                   splice.call(array2, index, 1);
8368                 } else {
8369                   baseUnset(array2, index);
8370                 }
8371               }
8372             }
8373             return array2;
8374           }
8375           function baseRandom(lower2, upper) {
8376             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
8377           }
8378           function baseRange(start2, end, step, fromRight) {
8379             var index = -1, length = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length);
8380             while (length--) {
8381               result2[fromRight ? length : ++index] = start2;
8382               start2 += step;
8383             }
8384             return result2;
8385           }
8386           function baseRepeat(string, n2) {
8387             var result2 = "";
8388             if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER) {
8389               return result2;
8390             }
8391             do {
8392               if (n2 % 2) {
8393                 result2 += string;
8394               }
8395               n2 = nativeFloor(n2 / 2);
8396               if (n2) {
8397                 string += string;
8398               }
8399             } while (n2);
8400             return result2;
8401           }
8402           function baseRest(func, start2) {
8403             return setToString(overRest(func, start2, identity4), func + "");
8404           }
8405           function baseSample(collection) {
8406             return arraySample(values(collection));
8407           }
8408           function baseSampleSize(collection, n2) {
8409             var array2 = values(collection);
8410             return shuffleSelf(array2, baseClamp(n2, 0, array2.length));
8411           }
8412           function baseSet(object, path, value, customizer) {
8413             if (!isObject2(object)) {
8414               return object;
8415             }
8416             path = castPath(path, object);
8417             var index = -1, length = path.length, lastIndex = length - 1, nested = object;
8418             while (nested != null && ++index < length) {
8419               var key = toKey(path[index]), newValue = value;
8420               if (key === "__proto__" || key === "constructor" || key === "prototype") {
8421                 return object;
8422               }
8423               if (index != lastIndex) {
8424                 var objValue = nested[key];
8425                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
8426                 if (newValue === undefined2) {
8427                   newValue = isObject2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
8428                 }
8429               }
8430               assignValue(nested, key, newValue);
8431               nested = nested[key];
8432             }
8433             return object;
8434           }
8435           var baseSetData = !metaMap ? identity4 : function(func, data) {
8436             metaMap.set(func, data);
8437             return func;
8438           };
8439           var baseSetToString = !defineProperty ? identity4 : function(func, string) {
8440             return defineProperty(func, "toString", {
8441               "configurable": true,
8442               "enumerable": false,
8443               "value": constant(string),
8444               "writable": true
8445             });
8446           };
8447           function baseShuffle(collection) {
8448             return shuffleSelf(values(collection));
8449           }
8450           function baseSlice(array2, start2, end) {
8451             var index = -1, length = array2.length;
8452             if (start2 < 0) {
8453               start2 = -start2 > length ? 0 : length + start2;
8454             }
8455             end = end > length ? length : end;
8456             if (end < 0) {
8457               end += length;
8458             }
8459             length = start2 > end ? 0 : end - start2 >>> 0;
8460             start2 >>>= 0;
8461             var result2 = Array2(length);
8462             while (++index < length) {
8463               result2[index] = array2[index + start2];
8464             }
8465             return result2;
8466           }
8467           function baseSome(collection, predicate) {
8468             var result2;
8469             baseEach(collection, function(value, index, collection2) {
8470               result2 = predicate(value, index, collection2);
8471               return !result2;
8472             });
8473             return !!result2;
8474           }
8475           function baseSortedIndex(array2, value, retHighest) {
8476             var low = 0, high = array2 == null ? low : array2.length;
8477             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
8478               while (low < high) {
8479                 var mid = low + high >>> 1, computed = array2[mid];
8480                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
8481                   low = mid + 1;
8482                 } else {
8483                   high = mid;
8484                 }
8485               }
8486               return high;
8487             }
8488             return baseSortedIndexBy(array2, value, identity4, retHighest);
8489           }
8490           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
8491             var low = 0, high = array2 == null ? 0 : array2.length;
8492             if (high === 0) {
8493               return 0;
8494             }
8495             value = iteratee2(value);
8496             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
8497             while (low < high) {
8498               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
8499               if (valIsNaN) {
8500                 var setLow = retHighest || othIsReflexive;
8501               } else if (valIsUndefined) {
8502                 setLow = othIsReflexive && (retHighest || othIsDefined);
8503               } else if (valIsNull) {
8504                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
8505               } else if (valIsSymbol) {
8506                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
8507               } else if (othIsNull || othIsSymbol) {
8508                 setLow = false;
8509               } else {
8510                 setLow = retHighest ? computed <= value : computed < value;
8511               }
8512               if (setLow) {
8513                 low = mid + 1;
8514               } else {
8515                 high = mid;
8516               }
8517             }
8518             return nativeMin2(high, MAX_ARRAY_INDEX);
8519           }
8520           function baseSortedUniq(array2, iteratee2) {
8521             var index = -1, length = array2.length, resIndex = 0, result2 = [];
8522             while (++index < length) {
8523               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8524               if (!index || !eq(computed, seen)) {
8525                 var seen = computed;
8526                 result2[resIndex++] = value === 0 ? 0 : value;
8527               }
8528             }
8529             return result2;
8530           }
8531           function baseToNumber(value) {
8532             if (typeof value == "number") {
8533               return value;
8534             }
8535             if (isSymbol2(value)) {
8536               return NAN2;
8537             }
8538             return +value;
8539           }
8540           function baseToString2(value) {
8541             if (typeof value == "string") {
8542               return value;
8543             }
8544             if (isArray2(value)) {
8545               return arrayMap2(value, baseToString2) + "";
8546             }
8547             if (isSymbol2(value)) {
8548               return symbolToString2 ? symbolToString2.call(value) : "";
8549             }
8550             var result2 = value + "";
8551             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
8552           }
8553           function baseUniq(array2, iteratee2, comparator) {
8554             var index = -1, includes2 = arrayIncludes, length = array2.length, isCommon = true, result2 = [], seen = result2;
8555             if (comparator) {
8556               isCommon = false;
8557               includes2 = arrayIncludesWith;
8558             } else if (length >= LARGE_ARRAY_SIZE) {
8559               var set4 = iteratee2 ? null : createSet(array2);
8560               if (set4) {
8561                 return setToArray(set4);
8562               }
8563               isCommon = false;
8564               includes2 = cacheHas;
8565               seen = new SetCache();
8566             } else {
8567               seen = iteratee2 ? [] : result2;
8568             }
8569             outer:
8570               while (++index < length) {
8571                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8572                 value = comparator || value !== 0 ? value : 0;
8573                 if (isCommon && computed === computed) {
8574                   var seenIndex = seen.length;
8575                   while (seenIndex--) {
8576                     if (seen[seenIndex] === computed) {
8577                       continue outer;
8578                     }
8579                   }
8580                   if (iteratee2) {
8581                     seen.push(computed);
8582                   }
8583                   result2.push(value);
8584                 } else if (!includes2(seen, computed, comparator)) {
8585                   if (seen !== result2) {
8586                     seen.push(computed);
8587                   }
8588                   result2.push(value);
8589                 }
8590               }
8591             return result2;
8592           }
8593           function baseUnset(object, path) {
8594             path = castPath(path, object);
8595             object = parent(object, path);
8596             return object == null || delete object[toKey(last(path))];
8597           }
8598           function baseUpdate(object, path, updater, customizer) {
8599             return baseSet(object, path, updater(baseGet(object, path)), customizer);
8600           }
8601           function baseWhile(array2, predicate, isDrop, fromRight) {
8602             var length = array2.length, index = fromRight ? length : -1;
8603             while ((fromRight ? index-- : ++index < length) && predicate(array2[index], index, array2)) {
8604             }
8605             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length : index);
8606           }
8607           function baseWrapperValue(value, actions) {
8608             var result2 = value;
8609             if (result2 instanceof LazyWrapper) {
8610               result2 = result2.value();
8611             }
8612             return arrayReduce(actions, function(result3, action) {
8613               return action.func.apply(action.thisArg, arrayPush([result3], action.args));
8614             }, result2);
8615           }
8616           function baseXor(arrays, iteratee2, comparator) {
8617             var length = arrays.length;
8618             if (length < 2) {
8619               return length ? baseUniq(arrays[0]) : [];
8620             }
8621             var index = -1, result2 = Array2(length);
8622             while (++index < length) {
8623               var array2 = arrays[index], othIndex = -1;
8624               while (++othIndex < length) {
8625                 if (othIndex != index) {
8626                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
8627                 }
8628               }
8629             }
8630             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
8631           }
8632           function baseZipObject(props, values2, assignFunc) {
8633             var index = -1, length = props.length, valsLength = values2.length, result2 = {};
8634             while (++index < length) {
8635               var value = index < valsLength ? values2[index] : undefined2;
8636               assignFunc(result2, props[index], value);
8637             }
8638             return result2;
8639           }
8640           function castArrayLikeObject(value) {
8641             return isArrayLikeObject(value) ? value : [];
8642           }
8643           function castFunction(value) {
8644             return typeof value == "function" ? value : identity4;
8645           }
8646           function castPath(value, object) {
8647             if (isArray2(value)) {
8648               return value;
8649             }
8650             return isKey(value, object) ? [value] : stringToPath(toString2(value));
8651           }
8652           var castRest = baseRest;
8653           function castSlice(array2, start2, end) {
8654             var length = array2.length;
8655             end = end === undefined2 ? length : end;
8656             return !start2 && end >= length ? array2 : baseSlice(array2, start2, end);
8657           }
8658           var clearTimeout2 = ctxClearTimeout || function(id2) {
8659             return root3.clearTimeout(id2);
8660           };
8661           function cloneBuffer(buffer, isDeep) {
8662             if (isDeep) {
8663               return buffer.slice();
8664             }
8665             var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
8666             buffer.copy(result2);
8667             return result2;
8668           }
8669           function cloneArrayBuffer(arrayBuffer) {
8670             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
8671             new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
8672             return result2;
8673           }
8674           function cloneDataView(dataView, isDeep) {
8675             var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
8676             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
8677           }
8678           function cloneRegExp(regexp) {
8679             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
8680             result2.lastIndex = regexp.lastIndex;
8681             return result2;
8682           }
8683           function cloneSymbol(symbol) {
8684             return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
8685           }
8686           function cloneTypedArray(typedArray, isDeep) {
8687             var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
8688             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
8689           }
8690           function compareAscending(value, other) {
8691             if (value !== other) {
8692               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
8693               var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
8694               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
8695                 return 1;
8696               }
8697               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
8698                 return -1;
8699               }
8700             }
8701             return 0;
8702           }
8703           function compareMultiple(object, other, orders) {
8704             var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
8705             while (++index < length) {
8706               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
8707               if (result2) {
8708                 if (index >= ordersLength) {
8709                   return result2;
8710                 }
8711                 var order = orders[index];
8712                 return result2 * (order == "desc" ? -1 : 1);
8713               }
8714             }
8715             return object.index - other.index;
8716           }
8717           function composeArgs(args, partials, holders, isCurried) {
8718             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;
8719             while (++leftIndex < leftLength) {
8720               result2[leftIndex] = partials[leftIndex];
8721             }
8722             while (++argsIndex < holdersLength) {
8723               if (isUncurried || argsIndex < argsLength) {
8724                 result2[holders[argsIndex]] = args[argsIndex];
8725               }
8726             }
8727             while (rangeLength--) {
8728               result2[leftIndex++] = args[argsIndex++];
8729             }
8730             return result2;
8731           }
8732           function composeArgsRight(args, partials, holders, isCurried) {
8733             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;
8734             while (++argsIndex < rangeLength) {
8735               result2[argsIndex] = args[argsIndex];
8736             }
8737             var offset = argsIndex;
8738             while (++rightIndex < rightLength) {
8739               result2[offset + rightIndex] = partials[rightIndex];
8740             }
8741             while (++holdersIndex < holdersLength) {
8742               if (isUncurried || argsIndex < argsLength) {
8743                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
8744               }
8745             }
8746             return result2;
8747           }
8748           function copyArray(source, array2) {
8749             var index = -1, length = source.length;
8750             array2 || (array2 = Array2(length));
8751             while (++index < length) {
8752               array2[index] = source[index];
8753             }
8754             return array2;
8755           }
8756           function copyObject(source, props, object, customizer) {
8757             var isNew = !object;
8758             object || (object = {});
8759             var index = -1, length = props.length;
8760             while (++index < length) {
8761               var key = props[index];
8762               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
8763               if (newValue === undefined2) {
8764                 newValue = source[key];
8765               }
8766               if (isNew) {
8767                 baseAssignValue(object, key, newValue);
8768               } else {
8769                 assignValue(object, key, newValue);
8770               }
8771             }
8772             return object;
8773           }
8774           function copySymbols(source, object) {
8775             return copyObject(source, getSymbols(source), object);
8776           }
8777           function copySymbolsIn(source, object) {
8778             return copyObject(source, getSymbolsIn(source), object);
8779           }
8780           function createAggregator(setter, initializer) {
8781             return function(collection, iteratee2) {
8782               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
8783               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
8784             };
8785           }
8786           function createAssigner(assigner) {
8787             return baseRest(function(object, sources) {
8788               var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
8789               customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
8790               if (guard && isIterateeCall(sources[0], sources[1], guard)) {
8791                 customizer = length < 3 ? undefined2 : customizer;
8792                 length = 1;
8793               }
8794               object = Object2(object);
8795               while (++index < length) {
8796                 var source = sources[index];
8797                 if (source) {
8798                   assigner(object, source, index, customizer);
8799                 }
8800               }
8801               return object;
8802             });
8803           }
8804           function createBaseEach(eachFunc, fromRight) {
8805             return function(collection, iteratee2) {
8806               if (collection == null) {
8807                 return collection;
8808               }
8809               if (!isArrayLike(collection)) {
8810                 return eachFunc(collection, iteratee2);
8811               }
8812               var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
8813               while (fromRight ? index-- : ++index < length) {
8814                 if (iteratee2(iterable[index], index, iterable) === false) {
8815                   break;
8816                 }
8817               }
8818               return collection;
8819             };
8820           }
8821           function createBaseFor(fromRight) {
8822             return function(object, iteratee2, keysFunc) {
8823               var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
8824               while (length--) {
8825                 var key = props[fromRight ? length : ++index];
8826                 if (iteratee2(iterable[key], key, iterable) === false) {
8827                   break;
8828                 }
8829               }
8830               return object;
8831             };
8832           }
8833           function createBind(func, bitmask, thisArg) {
8834             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
8835             function wrapper() {
8836               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8837               return fn.apply(isBind ? thisArg : this, arguments);
8838             }
8839             return wrapper;
8840           }
8841           function createCaseFirst(methodName) {
8842             return function(string) {
8843               string = toString2(string);
8844               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
8845               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
8846               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
8847               return chr[methodName]() + trailing;
8848             };
8849           }
8850           function createCompounder(callback) {
8851             return function(string) {
8852               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
8853             };
8854           }
8855           function createCtor(Ctor) {
8856             return function() {
8857               var args = arguments;
8858               switch (args.length) {
8859                 case 0:
8860                   return new Ctor();
8861                 case 1:
8862                   return new Ctor(args[0]);
8863                 case 2:
8864                   return new Ctor(args[0], args[1]);
8865                 case 3:
8866                   return new Ctor(args[0], args[1], args[2]);
8867                 case 4:
8868                   return new Ctor(args[0], args[1], args[2], args[3]);
8869                 case 5:
8870                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
8871                 case 6:
8872                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
8873                 case 7:
8874                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
8875               }
8876               var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
8877               return isObject2(result2) ? result2 : thisBinding;
8878             };
8879           }
8880           function createCurry(func, bitmask, arity) {
8881             var Ctor = createCtor(func);
8882             function wrapper() {
8883               var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
8884               while (index--) {
8885                 args[index] = arguments[index];
8886               }
8887               var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
8888               length -= holders.length;
8889               if (length < arity) {
8890                 return createRecurry(
8891                   func,
8892                   bitmask,
8893                   createHybrid,
8894                   wrapper.placeholder,
8895                   undefined2,
8896                   args,
8897                   holders,
8898                   undefined2,
8899                   undefined2,
8900                   arity - length
8901                 );
8902               }
8903               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8904               return apply(fn, this, args);
8905             }
8906             return wrapper;
8907           }
8908           function createFind(findIndexFunc) {
8909             return function(collection, predicate, fromIndex) {
8910               var iterable = Object2(collection);
8911               if (!isArrayLike(collection)) {
8912                 var iteratee2 = getIteratee(predicate, 3);
8913                 collection = keys(collection);
8914                 predicate = function(key) {
8915                   return iteratee2(iterable[key], key, iterable);
8916                 };
8917               }
8918               var index = findIndexFunc(collection, predicate, fromIndex);
8919               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
8920             };
8921           }
8922           function createFlow(fromRight) {
8923             return flatRest(function(funcs) {
8924               var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
8925               if (fromRight) {
8926                 funcs.reverse();
8927               }
8928               while (index--) {
8929                 var func = funcs[index];
8930                 if (typeof func != "function") {
8931                   throw new TypeError2(FUNC_ERROR_TEXT3);
8932                 }
8933                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
8934                   var wrapper = new LodashWrapper([], true);
8935                 }
8936               }
8937               index = wrapper ? index : length;
8938               while (++index < length) {
8939                 func = funcs[index];
8940                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
8941                 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) {
8942                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
8943                 } else {
8944                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
8945                 }
8946               }
8947               return function() {
8948                 var args = arguments, value = args[0];
8949                 if (wrapper && args.length == 1 && isArray2(value)) {
8950                   return wrapper.plant(value).value();
8951                 }
8952                 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
8953                 while (++index2 < length) {
8954                   result2 = funcs[index2].call(this, result2);
8955                 }
8956                 return result2;
8957               };
8958             });
8959           }
8960           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
8961             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);
8962             function wrapper() {
8963               var length = arguments.length, args = Array2(length), index = length;
8964               while (index--) {
8965                 args[index] = arguments[index];
8966               }
8967               if (isCurried) {
8968                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
8969               }
8970               if (partials) {
8971                 args = composeArgs(args, partials, holders, isCurried);
8972               }
8973               if (partialsRight) {
8974                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
8975               }
8976               length -= holdersCount;
8977               if (isCurried && length < arity) {
8978                 var newHolders = replaceHolders(args, placeholder);
8979                 return createRecurry(
8980                   func,
8981                   bitmask,
8982                   createHybrid,
8983                   wrapper.placeholder,
8984                   thisArg,
8985                   args,
8986                   newHolders,
8987                   argPos,
8988                   ary2,
8989                   arity - length
8990                 );
8991               }
8992               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
8993               length = args.length;
8994               if (argPos) {
8995                 args = reorder(args, argPos);
8996               } else if (isFlip && length > 1) {
8997                 args.reverse();
8998               }
8999               if (isAry && ary2 < length) {
9000                 args.length = ary2;
9001               }
9002               if (this && this !== root3 && this instanceof wrapper) {
9003                 fn = Ctor || createCtor(fn);
9004               }
9005               return fn.apply(thisBinding, args);
9006             }
9007             return wrapper;
9008           }
9009           function createInverter(setter, toIteratee) {
9010             return function(object, iteratee2) {
9011               return baseInverter(object, setter, toIteratee(iteratee2), {});
9012             };
9013           }
9014           function createMathOperation(operator, defaultValue) {
9015             return function(value, other) {
9016               var result2;
9017               if (value === undefined2 && other === undefined2) {
9018                 return defaultValue;
9019               }
9020               if (value !== undefined2) {
9021                 result2 = value;
9022               }
9023               if (other !== undefined2) {
9024                 if (result2 === undefined2) {
9025                   return other;
9026                 }
9027                 if (typeof value == "string" || typeof other == "string") {
9028                   value = baseToString2(value);
9029                   other = baseToString2(other);
9030                 } else {
9031                   value = baseToNumber(value);
9032                   other = baseToNumber(other);
9033                 }
9034                 result2 = operator(value, other);
9035               }
9036               return result2;
9037             };
9038           }
9039           function createOver(arrayFunc) {
9040             return flatRest(function(iteratees) {
9041               iteratees = arrayMap2(iteratees, baseUnary(getIteratee()));
9042               return baseRest(function(args) {
9043                 var thisArg = this;
9044                 return arrayFunc(iteratees, function(iteratee2) {
9045                   return apply(iteratee2, thisArg, args);
9046                 });
9047               });
9048             });
9049           }
9050           function createPadding(length, chars) {
9051             chars = chars === undefined2 ? " " : baseToString2(chars);
9052             var charsLength = chars.length;
9053             if (charsLength < 2) {
9054               return charsLength ? baseRepeat(chars, length) : chars;
9055             }
9056             var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
9057             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
9058           }
9059           function createPartial(func, bitmask, thisArg, partials) {
9060             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
9061             function wrapper() {
9062               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9063               while (++leftIndex < leftLength) {
9064                 args[leftIndex] = partials[leftIndex];
9065               }
9066               while (argsLength--) {
9067                 args[leftIndex++] = arguments[++argsIndex];
9068               }
9069               return apply(fn, isBind ? thisArg : this, args);
9070             }
9071             return wrapper;
9072           }
9073           function createRange(fromRight) {
9074             return function(start2, end, step) {
9075               if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
9076                 end = step = undefined2;
9077               }
9078               start2 = toFinite(start2);
9079               if (end === undefined2) {
9080                 end = start2;
9081                 start2 = 0;
9082               } else {
9083                 end = toFinite(end);
9084               }
9085               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
9086               return baseRange(start2, end, step, fromRight);
9087             };
9088           }
9089           function createRelationalOperation(operator) {
9090             return function(value, other) {
9091               if (!(typeof value == "string" && typeof other == "string")) {
9092                 value = toNumber2(value);
9093                 other = toNumber2(other);
9094               }
9095               return operator(value, other);
9096             };
9097           }
9098           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
9099             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
9100             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
9101             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
9102             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
9103               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
9104             }
9105             var newData = [
9106               func,
9107               bitmask,
9108               thisArg,
9109               newPartials,
9110               newHolders,
9111               newPartialsRight,
9112               newHoldersRight,
9113               argPos,
9114               ary2,
9115               arity
9116             ];
9117             var result2 = wrapFunc.apply(undefined2, newData);
9118             if (isLaziable(func)) {
9119               setData(result2, newData);
9120             }
9121             result2.placeholder = placeholder;
9122             return setWrapToString(result2, func, bitmask);
9123           }
9124           function createRound(methodName) {
9125             var func = Math2[methodName];
9126             return function(number3, precision2) {
9127               number3 = toNumber2(number3);
9128               precision2 = precision2 == null ? 0 : nativeMin2(toInteger(precision2), 292);
9129               if (precision2 && nativeIsFinite(number3)) {
9130                 var pair2 = (toString2(number3) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision2));
9131                 pair2 = (toString2(value) + "e").split("e");
9132                 return +(pair2[0] + "e" + (+pair2[1] - precision2));
9133               }
9134               return func(number3);
9135             };
9136           }
9137           var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
9138             return new Set2(values2);
9139           };
9140           function createToPairs(keysFunc) {
9141             return function(object) {
9142               var tag = getTag(object);
9143               if (tag == mapTag) {
9144                 return mapToArray(object);
9145               }
9146               if (tag == setTag) {
9147                 return setToPairs(object);
9148               }
9149               return baseToPairs(object, keysFunc(object));
9150             };
9151           }
9152           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
9153             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
9154             if (!isBindKey && typeof func != "function") {
9155               throw new TypeError2(FUNC_ERROR_TEXT3);
9156             }
9157             var length = partials ? partials.length : 0;
9158             if (!length) {
9159               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
9160               partials = holders = undefined2;
9161             }
9162             ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
9163             arity = arity === undefined2 ? arity : toInteger(arity);
9164             length -= holders ? holders.length : 0;
9165             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
9166               var partialsRight = partials, holdersRight = holders;
9167               partials = holders = undefined2;
9168             }
9169             var data = isBindKey ? undefined2 : getData(func);
9170             var newData = [
9171               func,
9172               bitmask,
9173               thisArg,
9174               partials,
9175               holders,
9176               partialsRight,
9177               holdersRight,
9178               argPos,
9179               ary2,
9180               arity
9181             ];
9182             if (data) {
9183               mergeData(newData, data);
9184             }
9185             func = newData[0];
9186             bitmask = newData[1];
9187             thisArg = newData[2];
9188             partials = newData[3];
9189             holders = newData[4];
9190             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length, 0);
9191             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
9192               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
9193             }
9194             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
9195               var result2 = createBind(func, bitmask, thisArg);
9196             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
9197               result2 = createCurry(func, bitmask, arity);
9198             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
9199               result2 = createPartial(func, bitmask, thisArg, partials);
9200             } else {
9201               result2 = createHybrid.apply(undefined2, newData);
9202             }
9203             var setter = data ? baseSetData : setData;
9204             return setWrapToString(setter(result2, newData), func, bitmask);
9205           }
9206           function customDefaultsAssignIn(objValue, srcValue, key, object) {
9207             if (objValue === undefined2 || eq(objValue, objectProto3[key]) && !hasOwnProperty2.call(object, key)) {
9208               return srcValue;
9209             }
9210             return objValue;
9211           }
9212           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
9213             if (isObject2(objValue) && isObject2(srcValue)) {
9214               stack.set(srcValue, objValue);
9215               baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
9216               stack["delete"](srcValue);
9217             }
9218             return objValue;
9219           }
9220           function customOmitClone(value) {
9221             return isPlainObject(value) ? undefined2 : value;
9222           }
9223           function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
9224             var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
9225             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
9226               return false;
9227             }
9228             var arrStacked = stack.get(array2);
9229             var othStacked = stack.get(other);
9230             if (arrStacked && othStacked) {
9231               return arrStacked == other && othStacked == array2;
9232             }
9233             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
9234             stack.set(array2, other);
9235             stack.set(other, array2);
9236             while (++index < arrLength) {
9237               var arrValue = array2[index], othValue = other[index];
9238               if (customizer) {
9239                 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
9240               }
9241               if (compared !== undefined2) {
9242                 if (compared) {
9243                   continue;
9244                 }
9245                 result2 = false;
9246                 break;
9247               }
9248               if (seen) {
9249                 if (!arraySome(other, function(othValue2, othIndex) {
9250                   if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
9251                     return seen.push(othIndex);
9252                   }
9253                 })) {
9254                   result2 = false;
9255                   break;
9256                 }
9257               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
9258                 result2 = false;
9259                 break;
9260               }
9261             }
9262             stack["delete"](array2);
9263             stack["delete"](other);
9264             return result2;
9265           }
9266           function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
9267             switch (tag) {
9268               case dataViewTag:
9269                 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
9270                   return false;
9271                 }
9272                 object = object.buffer;
9273                 other = other.buffer;
9274               case arrayBufferTag:
9275                 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
9276                   return false;
9277                 }
9278                 return true;
9279               case boolTag:
9280               case dateTag:
9281               case numberTag:
9282                 return eq(+object, +other);
9283               case errorTag:
9284                 return object.name == other.name && object.message == other.message;
9285               case regexpTag:
9286               case stringTag:
9287                 return object == other + "";
9288               case mapTag:
9289                 var convert = mapToArray;
9290               case setTag:
9291                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
9292                 convert || (convert = setToArray);
9293                 if (object.size != other.size && !isPartial) {
9294                   return false;
9295                 }
9296                 var stacked = stack.get(object);
9297                 if (stacked) {
9298                   return stacked == other;
9299                 }
9300                 bitmask |= COMPARE_UNORDERED_FLAG;
9301                 stack.set(object, other);
9302                 var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
9303                 stack["delete"](object);
9304                 return result2;
9305               case symbolTag2:
9306                 if (symbolValueOf) {
9307                   return symbolValueOf.call(object) == symbolValueOf.call(other);
9308                 }
9309             }
9310             return false;
9311           }
9312           function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
9313             var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
9314             if (objLength != othLength && !isPartial) {
9315               return false;
9316             }
9317             var index = objLength;
9318             while (index--) {
9319               var key = objProps[index];
9320               if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
9321                 return false;
9322               }
9323             }
9324             var objStacked = stack.get(object);
9325             var othStacked = stack.get(other);
9326             if (objStacked && othStacked) {
9327               return objStacked == other && othStacked == object;
9328             }
9329             var result2 = true;
9330             stack.set(object, other);
9331             stack.set(other, object);
9332             var skipCtor = isPartial;
9333             while (++index < objLength) {
9334               key = objProps[index];
9335               var objValue = object[key], othValue = other[key];
9336               if (customizer) {
9337                 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
9338               }
9339               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
9340                 result2 = false;
9341                 break;
9342               }
9343               skipCtor || (skipCtor = key == "constructor");
9344             }
9345             if (result2 && !skipCtor) {
9346               var objCtor = object.constructor, othCtor = other.constructor;
9347               if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
9348                 result2 = false;
9349               }
9350             }
9351             stack["delete"](object);
9352             stack["delete"](other);
9353             return result2;
9354           }
9355           function flatRest(func) {
9356             return setToString(overRest(func, undefined2, flatten2), func + "");
9357           }
9358           function getAllKeys(object) {
9359             return baseGetAllKeys(object, keys, getSymbols);
9360           }
9361           function getAllKeysIn(object) {
9362             return baseGetAllKeys(object, keysIn, getSymbolsIn);
9363           }
9364           var getData = !metaMap ? noop3 : function(func) {
9365             return metaMap.get(func);
9366           };
9367           function getFuncName(func) {
9368             var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array2.length : 0;
9369             while (length--) {
9370               var data = array2[length], otherFunc = data.func;
9371               if (otherFunc == null || otherFunc == func) {
9372                 return data.name;
9373               }
9374             }
9375             return result2;
9376           }
9377           function getHolder(func) {
9378             var object = hasOwnProperty2.call(lodash, "placeholder") ? lodash : func;
9379             return object.placeholder;
9380           }
9381           function getIteratee() {
9382             var result2 = lodash.iteratee || iteratee;
9383             result2 = result2 === iteratee ? baseIteratee : result2;
9384             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
9385           }
9386           function getMapData(map3, key) {
9387             var data = map3.__data__;
9388             return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9389           }
9390           function getMatchData(object) {
9391             var result2 = keys(object), length = result2.length;
9392             while (length--) {
9393               var key = result2[length], value = object[key];
9394               result2[length] = [key, value, isStrictComparable(value)];
9395             }
9396             return result2;
9397           }
9398           function getNative(object, key) {
9399             var value = getValue(object, key);
9400             return baseIsNative(value) ? value : undefined2;
9401           }
9402           function getRawTag2(value) {
9403             var isOwn = hasOwnProperty2.call(value, symToStringTag3), tag = value[symToStringTag3];
9404             try {
9405               value[symToStringTag3] = undefined2;
9406               var unmasked = true;
9407             } catch (e) {
9408             }
9409             var result2 = nativeObjectToString3.call(value);
9410             if (unmasked) {
9411               if (isOwn) {
9412                 value[symToStringTag3] = tag;
9413               } else {
9414                 delete value[symToStringTag3];
9415               }
9416             }
9417             return result2;
9418           }
9419           var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
9420             if (object == null) {
9421               return [];
9422             }
9423             object = Object2(object);
9424             return arrayFilter(nativeGetSymbols(object), function(symbol) {
9425               return propertyIsEnumerable.call(object, symbol);
9426             });
9427           };
9428           var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
9429             var result2 = [];
9430             while (object) {
9431               arrayPush(result2, getSymbols(object));
9432               object = getPrototype(object);
9433             }
9434             return result2;
9435           };
9436           var getTag = baseGetTag2;
9437           if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
9438             getTag = function(value) {
9439               var result2 = baseGetTag2(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
9440               if (ctorString) {
9441                 switch (ctorString) {
9442                   case dataViewCtorString:
9443                     return dataViewTag;
9444                   case mapCtorString:
9445                     return mapTag;
9446                   case promiseCtorString:
9447                     return promiseTag;
9448                   case setCtorString:
9449                     return setTag;
9450                   case weakMapCtorString:
9451                     return weakMapTag;
9452                 }
9453               }
9454               return result2;
9455             };
9456           }
9457           function getView(start2, end, transforms) {
9458             var index = -1, length = transforms.length;
9459             while (++index < length) {
9460               var data = transforms[index], size2 = data.size;
9461               switch (data.type) {
9462                 case "drop":
9463                   start2 += size2;
9464                   break;
9465                 case "dropRight":
9466                   end -= size2;
9467                   break;
9468                 case "take":
9469                   end = nativeMin2(end, start2 + size2);
9470                   break;
9471                 case "takeRight":
9472                   start2 = nativeMax2(start2, end - size2);
9473                   break;
9474               }
9475             }
9476             return { "start": start2, "end": end };
9477           }
9478           function getWrapDetails(source) {
9479             var match = source.match(reWrapDetails);
9480             return match ? match[1].split(reSplitDetails) : [];
9481           }
9482           function hasPath(object, path, hasFunc) {
9483             path = castPath(path, object);
9484             var index = -1, length = path.length, result2 = false;
9485             while (++index < length) {
9486               var key = toKey(path[index]);
9487               if (!(result2 = object != null && hasFunc(object, key))) {
9488                 break;
9489               }
9490               object = object[key];
9491             }
9492             if (result2 || ++index != length) {
9493               return result2;
9494             }
9495             length = object == null ? 0 : object.length;
9496             return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
9497           }
9498           function initCloneArray(array2) {
9499             var length = array2.length, result2 = new array2.constructor(length);
9500             if (length && typeof array2[0] == "string" && hasOwnProperty2.call(array2, "index")) {
9501               result2.index = array2.index;
9502               result2.input = array2.input;
9503             }
9504             return result2;
9505           }
9506           function initCloneObject(object) {
9507             return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
9508           }
9509           function initCloneByTag(object, tag, isDeep) {
9510             var Ctor = object.constructor;
9511             switch (tag) {
9512               case arrayBufferTag:
9513                 return cloneArrayBuffer(object);
9514               case boolTag:
9515               case dateTag:
9516                 return new Ctor(+object);
9517               case dataViewTag:
9518                 return cloneDataView(object, isDeep);
9519               case float32Tag:
9520               case float64Tag:
9521               case int8Tag:
9522               case int16Tag:
9523               case int32Tag:
9524               case uint8Tag:
9525               case uint8ClampedTag:
9526               case uint16Tag:
9527               case uint32Tag:
9528                 return cloneTypedArray(object, isDeep);
9529               case mapTag:
9530                 return new Ctor();
9531               case numberTag:
9532               case stringTag:
9533                 return new Ctor(object);
9534               case regexpTag:
9535                 return cloneRegExp(object);
9536               case setTag:
9537                 return new Ctor();
9538               case symbolTag2:
9539                 return cloneSymbol(object);
9540             }
9541           }
9542           function insertWrapDetails(source, details) {
9543             var length = details.length;
9544             if (!length) {
9545               return source;
9546             }
9547             var lastIndex = length - 1;
9548             details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
9549             details = details.join(length > 2 ? ", " : " ");
9550             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
9551           }
9552           function isFlattenable(value) {
9553             return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9554           }
9555           function isIndex(value, length) {
9556             var type3 = typeof value;
9557             length = length == null ? MAX_SAFE_INTEGER : length;
9558             return !!length && (type3 == "number" || type3 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
9559           }
9560           function isIterateeCall(value, index, object) {
9561             if (!isObject2(object)) {
9562               return false;
9563             }
9564             var type3 = typeof index;
9565             if (type3 == "number" ? isArrayLike(object) && isIndex(index, object.length) : type3 == "string" && index in object) {
9566               return eq(object[index], value);
9567             }
9568             return false;
9569           }
9570           function isKey(value, object) {
9571             if (isArray2(value)) {
9572               return false;
9573             }
9574             var type3 = typeof value;
9575             if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value == null || isSymbol2(value)) {
9576               return true;
9577             }
9578             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
9579           }
9580           function isKeyable(value) {
9581             var type3 = typeof value;
9582             return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value !== "__proto__" : value === null;
9583           }
9584           function isLaziable(func) {
9585             var funcName = getFuncName(func), other = lodash[funcName];
9586             if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
9587               return false;
9588             }
9589             if (func === other) {
9590               return true;
9591             }
9592             var data = getData(other);
9593             return !!data && func === data[0];
9594           }
9595           function isMasked(func) {
9596             return !!maskSrcKey && maskSrcKey in func;
9597           }
9598           var isMaskable = coreJsData ? isFunction : stubFalse;
9599           function isPrototype(value) {
9600             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto3;
9601             return value === proto;
9602           }
9603           function isStrictComparable(value) {
9604             return value === value && !isObject2(value);
9605           }
9606           function matchesStrictComparable(key, srcValue) {
9607             return function(object) {
9608               if (object == null) {
9609                 return false;
9610               }
9611               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
9612             };
9613           }
9614           function memoizeCapped(func) {
9615             var result2 = memoize(func, function(key) {
9616               if (cache.size === MAX_MEMOIZE_SIZE) {
9617                 cache.clear();
9618               }
9619               return key;
9620             });
9621             var cache = result2.cache;
9622             return result2;
9623           }
9624           function mergeData(data, source) {
9625             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
9626             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;
9627             if (!(isCommon || isCombo)) {
9628               return data;
9629             }
9630             if (srcBitmask & WRAP_BIND_FLAG) {
9631               data[2] = source[2];
9632               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
9633             }
9634             var value = source[3];
9635             if (value) {
9636               var partials = data[3];
9637               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
9638               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
9639             }
9640             value = source[5];
9641             if (value) {
9642               partials = data[5];
9643               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
9644               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
9645             }
9646             value = source[7];
9647             if (value) {
9648               data[7] = value;
9649             }
9650             if (srcBitmask & WRAP_ARY_FLAG) {
9651               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
9652             }
9653             if (data[9] == null) {
9654               data[9] = source[9];
9655             }
9656             data[0] = source[0];
9657             data[1] = newBitmask;
9658             return data;
9659           }
9660           function nativeKeysIn(object) {
9661             var result2 = [];
9662             if (object != null) {
9663               for (var key in Object2(object)) {
9664                 result2.push(key);
9665               }
9666             }
9667             return result2;
9668           }
9669           function objectToString2(value) {
9670             return nativeObjectToString3.call(value);
9671           }
9672           function overRest(func, start2, transform3) {
9673             start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
9674             return function() {
9675               var args = arguments, index = -1, length = nativeMax2(args.length - start2, 0), array2 = Array2(length);
9676               while (++index < length) {
9677                 array2[index] = args[start2 + index];
9678               }
9679               index = -1;
9680               var otherArgs = Array2(start2 + 1);
9681               while (++index < start2) {
9682                 otherArgs[index] = args[index];
9683               }
9684               otherArgs[start2] = transform3(array2);
9685               return apply(func, this, otherArgs);
9686             };
9687           }
9688           function parent(object, path) {
9689             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
9690           }
9691           function reorder(array2, indexes) {
9692             var arrLength = array2.length, length = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
9693             while (length--) {
9694               var index = indexes[length];
9695               array2[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
9696             }
9697             return array2;
9698           }
9699           function safeGet(object, key) {
9700             if (key === "constructor" && typeof object[key] === "function") {
9701               return;
9702             }
9703             if (key == "__proto__") {
9704               return;
9705             }
9706             return object[key];
9707           }
9708           var setData = shortOut(baseSetData);
9709           var setTimeout2 = ctxSetTimeout || function(func, wait) {
9710             return root3.setTimeout(func, wait);
9711           };
9712           var setToString = shortOut(baseSetToString);
9713           function setWrapToString(wrapper, reference, bitmask) {
9714             var source = reference + "";
9715             return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
9716           }
9717           function shortOut(func) {
9718             var count = 0, lastCalled = 0;
9719             return function() {
9720               var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
9721               lastCalled = stamp;
9722               if (remaining > 0) {
9723                 if (++count >= HOT_COUNT) {
9724                   return arguments[0];
9725                 }
9726               } else {
9727                 count = 0;
9728               }
9729               return func.apply(undefined2, arguments);
9730             };
9731           }
9732           function shuffleSelf(array2, size2) {
9733             var index = -1, length = array2.length, lastIndex = length - 1;
9734             size2 = size2 === undefined2 ? length : size2;
9735             while (++index < size2) {
9736               var rand = baseRandom(index, lastIndex), value = array2[rand];
9737               array2[rand] = array2[index];
9738               array2[index] = value;
9739             }
9740             array2.length = size2;
9741             return array2;
9742           }
9743           var stringToPath = memoizeCapped(function(string) {
9744             var result2 = [];
9745             if (string.charCodeAt(0) === 46) {
9746               result2.push("");
9747             }
9748             string.replace(rePropName, function(match, number3, quote2, subString) {
9749               result2.push(quote2 ? subString.replace(reEscapeChar, "$1") : number3 || match);
9750             });
9751             return result2;
9752           });
9753           function toKey(value) {
9754             if (typeof value == "string" || isSymbol2(value)) {
9755               return value;
9756             }
9757             var result2 = value + "";
9758             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
9759           }
9760           function toSource(func) {
9761             if (func != null) {
9762               try {
9763                 return funcToString.call(func);
9764               } catch (e) {
9765               }
9766               try {
9767                 return func + "";
9768               } catch (e) {
9769               }
9770             }
9771             return "";
9772           }
9773           function updateWrapDetails(details, bitmask) {
9774             arrayEach(wrapFlags, function(pair2) {
9775               var value = "_." + pair2[0];
9776               if (bitmask & pair2[1] && !arrayIncludes(details, value)) {
9777                 details.push(value);
9778               }
9779             });
9780             return details.sort();
9781           }
9782           function wrapperClone(wrapper) {
9783             if (wrapper instanceof LazyWrapper) {
9784               return wrapper.clone();
9785             }
9786             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
9787             result2.__actions__ = copyArray(wrapper.__actions__);
9788             result2.__index__ = wrapper.__index__;
9789             result2.__values__ = wrapper.__values__;
9790             return result2;
9791           }
9792           function chunk(array2, size2, guard) {
9793             if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
9794               size2 = 1;
9795             } else {
9796               size2 = nativeMax2(toInteger(size2), 0);
9797             }
9798             var length = array2 == null ? 0 : array2.length;
9799             if (!length || size2 < 1) {
9800               return [];
9801             }
9802             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
9803             while (index < length) {
9804               result2[resIndex++] = baseSlice(array2, index, index += size2);
9805             }
9806             return result2;
9807           }
9808           function compact(array2) {
9809             var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
9810             while (++index < length) {
9811               var value = array2[index];
9812               if (value) {
9813                 result2[resIndex++] = value;
9814               }
9815             }
9816             return result2;
9817           }
9818           function concat() {
9819             var length = arguments.length;
9820             if (!length) {
9821               return [];
9822             }
9823             var args = Array2(length - 1), array2 = arguments[0], index = length;
9824             while (index--) {
9825               args[index - 1] = arguments[index];
9826             }
9827             return arrayPush(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
9828           }
9829           var difference = baseRest(function(array2, values2) {
9830             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
9831           });
9832           var differenceBy = baseRest(function(array2, values2) {
9833             var iteratee2 = last(values2);
9834             if (isArrayLikeObject(iteratee2)) {
9835               iteratee2 = undefined2;
9836             }
9837             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
9838           });
9839           var differenceWith = baseRest(function(array2, values2) {
9840             var comparator = last(values2);
9841             if (isArrayLikeObject(comparator)) {
9842               comparator = undefined2;
9843             }
9844             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
9845           });
9846           function drop(array2, n2, guard) {
9847             var length = array2 == null ? 0 : array2.length;
9848             if (!length) {
9849               return [];
9850             }
9851             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9852             return baseSlice(array2, n2 < 0 ? 0 : n2, length);
9853           }
9854           function dropRight(array2, n2, guard) {
9855             var length = array2 == null ? 0 : array2.length;
9856             if (!length) {
9857               return [];
9858             }
9859             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
9860             n2 = length - n2;
9861             return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
9862           }
9863           function dropRightWhile(array2, predicate) {
9864             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
9865           }
9866           function dropWhile(array2, predicate) {
9867             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
9868           }
9869           function fill(array2, value, start2, end) {
9870             var length = array2 == null ? 0 : array2.length;
9871             if (!length) {
9872               return [];
9873             }
9874             if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
9875               start2 = 0;
9876               end = length;
9877             }
9878             return baseFill(array2, value, start2, end);
9879           }
9880           function findIndex(array2, predicate, fromIndex) {
9881             var length = array2 == null ? 0 : array2.length;
9882             if (!length) {
9883               return -1;
9884             }
9885             var index = fromIndex == null ? 0 : toInteger(fromIndex);
9886             if (index < 0) {
9887               index = nativeMax2(length + index, 0);
9888             }
9889             return baseFindIndex(array2, getIteratee(predicate, 3), index);
9890           }
9891           function findLastIndex(array2, predicate, fromIndex) {
9892             var length = array2 == null ? 0 : array2.length;
9893             if (!length) {
9894               return -1;
9895             }
9896             var index = length - 1;
9897             if (fromIndex !== undefined2) {
9898               index = toInteger(fromIndex);
9899               index = fromIndex < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
9900             }
9901             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
9902           }
9903           function flatten2(array2) {
9904             var length = array2 == null ? 0 : array2.length;
9905             return length ? baseFlatten(array2, 1) : [];
9906           }
9907           function flattenDeep(array2) {
9908             var length = array2 == null ? 0 : array2.length;
9909             return length ? baseFlatten(array2, INFINITY2) : [];
9910           }
9911           function flattenDepth(array2, depth) {
9912             var length = array2 == null ? 0 : array2.length;
9913             if (!length) {
9914               return [];
9915             }
9916             depth = depth === undefined2 ? 1 : toInteger(depth);
9917             return baseFlatten(array2, depth);
9918           }
9919           function fromPairs(pairs) {
9920             var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
9921             while (++index < length) {
9922               var pair2 = pairs[index];
9923               result2[pair2[0]] = pair2[1];
9924             }
9925             return result2;
9926           }
9927           function head(array2) {
9928             return array2 && array2.length ? array2[0] : undefined2;
9929           }
9930           function indexOf(array2, value, fromIndex) {
9931             var length = array2 == null ? 0 : array2.length;
9932             if (!length) {
9933               return -1;
9934             }
9935             var index = fromIndex == null ? 0 : toInteger(fromIndex);
9936             if (index < 0) {
9937               index = nativeMax2(length + index, 0);
9938             }
9939             return baseIndexOf(array2, value, index);
9940           }
9941           function initial(array2) {
9942             var length = array2 == null ? 0 : array2.length;
9943             return length ? baseSlice(array2, 0, -1) : [];
9944           }
9945           var intersection = baseRest(function(arrays) {
9946             var mapped = arrayMap2(arrays, castArrayLikeObject);
9947             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
9948           });
9949           var intersectionBy = baseRest(function(arrays) {
9950             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
9951             if (iteratee2 === last(mapped)) {
9952               iteratee2 = undefined2;
9953             } else {
9954               mapped.pop();
9955             }
9956             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
9957           });
9958           var intersectionWith = baseRest(function(arrays) {
9959             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
9960             comparator = typeof comparator == "function" ? comparator : undefined2;
9961             if (comparator) {
9962               mapped.pop();
9963             }
9964             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
9965           });
9966           function join(array2, separator) {
9967             return array2 == null ? "" : nativeJoin.call(array2, separator);
9968           }
9969           function last(array2) {
9970             var length = array2 == null ? 0 : array2.length;
9971             return length ? array2[length - 1] : undefined2;
9972           }
9973           function lastIndexOf(array2, value, fromIndex) {
9974             var length = array2 == null ? 0 : array2.length;
9975             if (!length) {
9976               return -1;
9977             }
9978             var index = length;
9979             if (fromIndex !== undefined2) {
9980               index = toInteger(fromIndex);
9981               index = index < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
9982             }
9983             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
9984           }
9985           function nth(array2, n2) {
9986             return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
9987           }
9988           var pull = baseRest(pullAll);
9989           function pullAll(array2, values2) {
9990             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
9991           }
9992           function pullAllBy(array2, values2, iteratee2) {
9993             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
9994           }
9995           function pullAllWith(array2, values2, comparator) {
9996             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
9997           }
9998           var pullAt = flatRest(function(array2, indexes) {
9999             var length = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
10000             basePullAt(array2, arrayMap2(indexes, function(index) {
10001               return isIndex(index, length) ? +index : index;
10002             }).sort(compareAscending));
10003             return result2;
10004           });
10005           function remove2(array2, predicate) {
10006             var result2 = [];
10007             if (!(array2 && array2.length)) {
10008               return result2;
10009             }
10010             var index = -1, indexes = [], length = array2.length;
10011             predicate = getIteratee(predicate, 3);
10012             while (++index < length) {
10013               var value = array2[index];
10014               if (predicate(value, index, array2)) {
10015                 result2.push(value);
10016                 indexes.push(index);
10017               }
10018             }
10019             basePullAt(array2, indexes);
10020             return result2;
10021           }
10022           function reverse(array2) {
10023             return array2 == null ? array2 : nativeReverse.call(array2);
10024           }
10025           function slice(array2, start2, end) {
10026             var length = array2 == null ? 0 : array2.length;
10027             if (!length) {
10028               return [];
10029             }
10030             if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
10031               start2 = 0;
10032               end = length;
10033             } else {
10034               start2 = start2 == null ? 0 : toInteger(start2);
10035               end = end === undefined2 ? length : toInteger(end);
10036             }
10037             return baseSlice(array2, start2, end);
10038           }
10039           function sortedIndex(array2, value) {
10040             return baseSortedIndex(array2, value);
10041           }
10042           function sortedIndexBy(array2, value, iteratee2) {
10043             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
10044           }
10045           function sortedIndexOf(array2, value) {
10046             var length = array2 == null ? 0 : array2.length;
10047             if (length) {
10048               var index = baseSortedIndex(array2, value);
10049               if (index < length && eq(array2[index], value)) {
10050                 return index;
10051               }
10052             }
10053             return -1;
10054           }
10055           function sortedLastIndex(array2, value) {
10056             return baseSortedIndex(array2, value, true);
10057           }
10058           function sortedLastIndexBy(array2, value, iteratee2) {
10059             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
10060           }
10061           function sortedLastIndexOf(array2, value) {
10062             var length = array2 == null ? 0 : array2.length;
10063             if (length) {
10064               var index = baseSortedIndex(array2, value, true) - 1;
10065               if (eq(array2[index], value)) {
10066                 return index;
10067               }
10068             }
10069             return -1;
10070           }
10071           function sortedUniq(array2) {
10072             return array2 && array2.length ? baseSortedUniq(array2) : [];
10073           }
10074           function sortedUniqBy(array2, iteratee2) {
10075             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
10076           }
10077           function tail(array2) {
10078             var length = array2 == null ? 0 : array2.length;
10079             return length ? baseSlice(array2, 1, length) : [];
10080           }
10081           function take(array2, n2, guard) {
10082             if (!(array2 && array2.length)) {
10083               return [];
10084             }
10085             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10086             return baseSlice(array2, 0, n2 < 0 ? 0 : n2);
10087           }
10088           function takeRight(array2, n2, guard) {
10089             var length = array2 == null ? 0 : array2.length;
10090             if (!length) {
10091               return [];
10092             }
10093             n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
10094             n2 = length - n2;
10095             return baseSlice(array2, n2 < 0 ? 0 : n2, length);
10096           }
10097           function takeRightWhile(array2, predicate) {
10098             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
10099           }
10100           function takeWhile(array2, predicate) {
10101             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
10102           }
10103           var union = baseRest(function(arrays) {
10104             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
10105           });
10106           var unionBy = baseRest(function(arrays) {
10107             var iteratee2 = last(arrays);
10108             if (isArrayLikeObject(iteratee2)) {
10109               iteratee2 = undefined2;
10110             }
10111             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
10112           });
10113           var unionWith = baseRest(function(arrays) {
10114             var comparator = last(arrays);
10115             comparator = typeof comparator == "function" ? comparator : undefined2;
10116             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
10117           });
10118           function uniq(array2) {
10119             return array2 && array2.length ? baseUniq(array2) : [];
10120           }
10121           function uniqBy(array2, iteratee2) {
10122             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
10123           }
10124           function uniqWith(array2, comparator) {
10125             comparator = typeof comparator == "function" ? comparator : undefined2;
10126             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
10127           }
10128           function unzip(array2) {
10129             if (!(array2 && array2.length)) {
10130               return [];
10131             }
10132             var length = 0;
10133             array2 = arrayFilter(array2, function(group) {
10134               if (isArrayLikeObject(group)) {
10135                 length = nativeMax2(group.length, length);
10136                 return true;
10137               }
10138             });
10139             return baseTimes(length, function(index) {
10140               return arrayMap2(array2, baseProperty(index));
10141             });
10142           }
10143           function unzipWith(array2, iteratee2) {
10144             if (!(array2 && array2.length)) {
10145               return [];
10146             }
10147             var result2 = unzip(array2);
10148             if (iteratee2 == null) {
10149               return result2;
10150             }
10151             return arrayMap2(result2, function(group) {
10152               return apply(iteratee2, undefined2, group);
10153             });
10154           }
10155           var without = baseRest(function(array2, values2) {
10156             return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
10157           });
10158           var xor = baseRest(function(arrays) {
10159             return baseXor(arrayFilter(arrays, isArrayLikeObject));
10160           });
10161           var xorBy = baseRest(function(arrays) {
10162             var iteratee2 = last(arrays);
10163             if (isArrayLikeObject(iteratee2)) {
10164               iteratee2 = undefined2;
10165             }
10166             return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
10167           });
10168           var xorWith = baseRest(function(arrays) {
10169             var comparator = last(arrays);
10170             comparator = typeof comparator == "function" ? comparator : undefined2;
10171             return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
10172           });
10173           var zip = baseRest(unzip);
10174           function zipObject(props, values2) {
10175             return baseZipObject(props || [], values2 || [], assignValue);
10176           }
10177           function zipObjectDeep(props, values2) {
10178             return baseZipObject(props || [], values2 || [], baseSet);
10179           }
10180           var zipWith = baseRest(function(arrays) {
10181             var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
10182             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
10183             return unzipWith(arrays, iteratee2);
10184           });
10185           function chain(value) {
10186             var result2 = lodash(value);
10187             result2.__chain__ = true;
10188             return result2;
10189           }
10190           function tap(value, interceptor) {
10191             interceptor(value);
10192             return value;
10193           }
10194           function thru(value, interceptor) {
10195             return interceptor(value);
10196           }
10197           var wrapperAt = flatRest(function(paths) {
10198             var length = paths.length, start2 = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
10199               return baseAt(object, paths);
10200             };
10201             if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start2)) {
10202               return this.thru(interceptor);
10203             }
10204             value = value.slice(start2, +start2 + (length ? 1 : 0));
10205             value.__actions__.push({
10206               "func": thru,
10207               "args": [interceptor],
10208               "thisArg": undefined2
10209             });
10210             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
10211               if (length && !array2.length) {
10212                 array2.push(undefined2);
10213               }
10214               return array2;
10215             });
10216           });
10217           function wrapperChain() {
10218             return chain(this);
10219           }
10220           function wrapperCommit() {
10221             return new LodashWrapper(this.value(), this.__chain__);
10222           }
10223           function wrapperNext() {
10224             if (this.__values__ === undefined2) {
10225               this.__values__ = toArray(this.value());
10226             }
10227             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
10228             return { "done": done, "value": value };
10229           }
10230           function wrapperToIterator() {
10231             return this;
10232           }
10233           function wrapperPlant(value) {
10234             var result2, parent2 = this;
10235             while (parent2 instanceof baseLodash) {
10236               var clone2 = wrapperClone(parent2);
10237               clone2.__index__ = 0;
10238               clone2.__values__ = undefined2;
10239               if (result2) {
10240                 previous.__wrapped__ = clone2;
10241               } else {
10242                 result2 = clone2;
10243               }
10244               var previous = clone2;
10245               parent2 = parent2.__wrapped__;
10246             }
10247             previous.__wrapped__ = value;
10248             return result2;
10249           }
10250           function wrapperReverse() {
10251             var value = this.__wrapped__;
10252             if (value instanceof LazyWrapper) {
10253               var wrapped = value;
10254               if (this.__actions__.length) {
10255                 wrapped = new LazyWrapper(this);
10256               }
10257               wrapped = wrapped.reverse();
10258               wrapped.__actions__.push({
10259                 "func": thru,
10260                 "args": [reverse],
10261                 "thisArg": undefined2
10262               });
10263               return new LodashWrapper(wrapped, this.__chain__);
10264             }
10265             return this.thru(reverse);
10266           }
10267           function wrapperValue() {
10268             return baseWrapperValue(this.__wrapped__, this.__actions__);
10269           }
10270           var countBy = createAggregator(function(result2, value, key) {
10271             if (hasOwnProperty2.call(result2, key)) {
10272               ++result2[key];
10273             } else {
10274               baseAssignValue(result2, key, 1);
10275             }
10276           });
10277           function every(collection, predicate, guard) {
10278             var func = isArray2(collection) ? arrayEvery : baseEvery;
10279             if (guard && isIterateeCall(collection, predicate, guard)) {
10280               predicate = undefined2;
10281             }
10282             return func(collection, getIteratee(predicate, 3));
10283           }
10284           function filter2(collection, predicate) {
10285             var func = isArray2(collection) ? arrayFilter : baseFilter;
10286             return func(collection, getIteratee(predicate, 3));
10287           }
10288           var find2 = createFind(findIndex);
10289           var findLast = createFind(findLastIndex);
10290           function flatMap(collection, iteratee2) {
10291             return baseFlatten(map2(collection, iteratee2), 1);
10292           }
10293           function flatMapDeep(collection, iteratee2) {
10294             return baseFlatten(map2(collection, iteratee2), INFINITY2);
10295           }
10296           function flatMapDepth(collection, iteratee2, depth) {
10297             depth = depth === undefined2 ? 1 : toInteger(depth);
10298             return baseFlatten(map2(collection, iteratee2), depth);
10299           }
10300           function forEach(collection, iteratee2) {
10301             var func = isArray2(collection) ? arrayEach : baseEach;
10302             return func(collection, getIteratee(iteratee2, 3));
10303           }
10304           function forEachRight(collection, iteratee2) {
10305             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
10306             return func(collection, getIteratee(iteratee2, 3));
10307           }
10308           var groupBy = createAggregator(function(result2, value, key) {
10309             if (hasOwnProperty2.call(result2, key)) {
10310               result2[key].push(value);
10311             } else {
10312               baseAssignValue(result2, key, [value]);
10313             }
10314           });
10315           function includes(collection, value, fromIndex, guard) {
10316             collection = isArrayLike(collection) ? collection : values(collection);
10317             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10318             var length = collection.length;
10319             if (fromIndex < 0) {
10320               fromIndex = nativeMax2(length + fromIndex, 0);
10321             }
10322             return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10323           }
10324           var invokeMap = baseRest(function(collection, path, args) {
10325             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
10326             baseEach(collection, function(value) {
10327               result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10328             });
10329             return result2;
10330           });
10331           var keyBy = createAggregator(function(result2, value, key) {
10332             baseAssignValue(result2, key, value);
10333           });
10334           function map2(collection, iteratee2) {
10335             var func = isArray2(collection) ? arrayMap2 : baseMap;
10336             return func(collection, getIteratee(iteratee2, 3));
10337           }
10338           function orderBy(collection, iteratees, orders, guard) {
10339             if (collection == null) {
10340               return [];
10341             }
10342             if (!isArray2(iteratees)) {
10343               iteratees = iteratees == null ? [] : [iteratees];
10344             }
10345             orders = guard ? undefined2 : orders;
10346             if (!isArray2(orders)) {
10347               orders = orders == null ? [] : [orders];
10348             }
10349             return baseOrderBy(collection, iteratees, orders);
10350           }
10351           var partition = createAggregator(function(result2, value, key) {
10352             result2[key ? 0 : 1].push(value);
10353           }, function() {
10354             return [[], []];
10355           });
10356           function reduce(collection, iteratee2, accumulator) {
10357             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
10358             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
10359           }
10360           function reduceRight(collection, iteratee2, accumulator) {
10361             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
10362             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
10363           }
10364           function reject(collection, predicate) {
10365             var func = isArray2(collection) ? arrayFilter : baseFilter;
10366             return func(collection, negate(getIteratee(predicate, 3)));
10367           }
10368           function sample(collection) {
10369             var func = isArray2(collection) ? arraySample : baseSample;
10370             return func(collection);
10371           }
10372           function sampleSize(collection, n2, guard) {
10373             if (guard ? isIterateeCall(collection, n2, guard) : n2 === undefined2) {
10374               n2 = 1;
10375             } else {
10376               n2 = toInteger(n2);
10377             }
10378             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
10379             return func(collection, n2);
10380           }
10381           function shuffle(collection) {
10382             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
10383             return func(collection);
10384           }
10385           function size(collection) {
10386             if (collection == null) {
10387               return 0;
10388             }
10389             if (isArrayLike(collection)) {
10390               return isString(collection) ? stringSize(collection) : collection.length;
10391             }
10392             var tag = getTag(collection);
10393             if (tag == mapTag || tag == setTag) {
10394               return collection.size;
10395             }
10396             return baseKeys(collection).length;
10397           }
10398           function some(collection, predicate, guard) {
10399             var func = isArray2(collection) ? arraySome : baseSome;
10400             if (guard && isIterateeCall(collection, predicate, guard)) {
10401               predicate = undefined2;
10402             }
10403             return func(collection, getIteratee(predicate, 3));
10404           }
10405           var sortBy = baseRest(function(collection, iteratees) {
10406             if (collection == null) {
10407               return [];
10408             }
10409             var length = iteratees.length;
10410             if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
10411               iteratees = [];
10412             } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
10413               iteratees = [iteratees[0]];
10414             }
10415             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10416           });
10417           var now3 = ctxNow || function() {
10418             return root3.Date.now();
10419           };
10420           function after(n2, func) {
10421             if (typeof func != "function") {
10422               throw new TypeError2(FUNC_ERROR_TEXT3);
10423             }
10424             n2 = toInteger(n2);
10425             return function() {
10426               if (--n2 < 1) {
10427                 return func.apply(this, arguments);
10428               }
10429             };
10430           }
10431           function ary(func, n2, guard) {
10432             n2 = guard ? undefined2 : n2;
10433             n2 = func && n2 == null ? func.length : n2;
10434             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n2);
10435           }
10436           function before(n2, func) {
10437             var result2;
10438             if (typeof func != "function") {
10439               throw new TypeError2(FUNC_ERROR_TEXT3);
10440             }
10441             n2 = toInteger(n2);
10442             return function() {
10443               if (--n2 > 0) {
10444                 result2 = func.apply(this, arguments);
10445               }
10446               if (n2 <= 1) {
10447                 func = undefined2;
10448               }
10449               return result2;
10450             };
10451           }
10452           var bind = baseRest(function(func, thisArg, partials) {
10453             var bitmask = WRAP_BIND_FLAG;
10454             if (partials.length) {
10455               var holders = replaceHolders(partials, getHolder(bind));
10456               bitmask |= WRAP_PARTIAL_FLAG;
10457             }
10458             return createWrap(func, bitmask, thisArg, partials, holders);
10459           });
10460           var bindKey2 = baseRest(function(object, key, partials) {
10461             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10462             if (partials.length) {
10463               var holders = replaceHolders(partials, getHolder(bindKey2));
10464               bitmask |= WRAP_PARTIAL_FLAG;
10465             }
10466             return createWrap(key, bitmask, object, partials, holders);
10467           });
10468           function curry(func, arity, guard) {
10469             arity = guard ? undefined2 : arity;
10470             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10471             result2.placeholder = curry.placeholder;
10472             return result2;
10473           }
10474           function curryRight(func, arity, guard) {
10475             arity = guard ? undefined2 : arity;
10476             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10477             result2.placeholder = curryRight.placeholder;
10478             return result2;
10479           }
10480           function debounce2(func, wait, options2) {
10481             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10482             if (typeof func != "function") {
10483               throw new TypeError2(FUNC_ERROR_TEXT3);
10484             }
10485             wait = toNumber2(wait) || 0;
10486             if (isObject2(options2)) {
10487               leading = !!options2.leading;
10488               maxing = "maxWait" in options2;
10489               maxWait = maxing ? nativeMax2(toNumber2(options2.maxWait) || 0, wait) : maxWait;
10490               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10491             }
10492             function invokeFunc(time) {
10493               var args = lastArgs, thisArg = lastThis;
10494               lastArgs = lastThis = undefined2;
10495               lastInvokeTime = time;
10496               result2 = func.apply(thisArg, args);
10497               return result2;
10498             }
10499             function leadingEdge(time) {
10500               lastInvokeTime = time;
10501               timerId = setTimeout2(timerExpired, wait);
10502               return leading ? invokeFunc(time) : result2;
10503             }
10504             function remainingWait(time) {
10505               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10506               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10507             }
10508             function shouldInvoke(time) {
10509               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10510               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10511             }
10512             function timerExpired() {
10513               var time = now3();
10514               if (shouldInvoke(time)) {
10515                 return trailingEdge(time);
10516               }
10517               timerId = setTimeout2(timerExpired, remainingWait(time));
10518             }
10519             function trailingEdge(time) {
10520               timerId = undefined2;
10521               if (trailing && lastArgs) {
10522                 return invokeFunc(time);
10523               }
10524               lastArgs = lastThis = undefined2;
10525               return result2;
10526             }
10527             function cancel() {
10528               if (timerId !== undefined2) {
10529                 clearTimeout2(timerId);
10530               }
10531               lastInvokeTime = 0;
10532               lastArgs = lastCallTime = lastThis = timerId = undefined2;
10533             }
10534             function flush() {
10535               return timerId === undefined2 ? result2 : trailingEdge(now3());
10536             }
10537             function debounced() {
10538               var time = now3(), isInvoking = shouldInvoke(time);
10539               lastArgs = arguments;
10540               lastThis = this;
10541               lastCallTime = time;
10542               if (isInvoking) {
10543                 if (timerId === undefined2) {
10544                   return leadingEdge(lastCallTime);
10545                 }
10546                 if (maxing) {
10547                   clearTimeout2(timerId);
10548                   timerId = setTimeout2(timerExpired, wait);
10549                   return invokeFunc(lastCallTime);
10550                 }
10551               }
10552               if (timerId === undefined2) {
10553                 timerId = setTimeout2(timerExpired, wait);
10554               }
10555               return result2;
10556             }
10557             debounced.cancel = cancel;
10558             debounced.flush = flush;
10559             return debounced;
10560           }
10561           var defer = baseRest(function(func, args) {
10562             return baseDelay(func, 1, args);
10563           });
10564           var delay = baseRest(function(func, wait, args) {
10565             return baseDelay(func, toNumber2(wait) || 0, args);
10566           });
10567           function flip(func) {
10568             return createWrap(func, WRAP_FLIP_FLAG);
10569           }
10570           function memoize(func, resolver) {
10571             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
10572               throw new TypeError2(FUNC_ERROR_TEXT3);
10573             }
10574             var memoized = function() {
10575               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
10576               if (cache.has(key)) {
10577                 return cache.get(key);
10578               }
10579               var result2 = func.apply(this, args);
10580               memoized.cache = cache.set(key, result2) || cache;
10581               return result2;
10582             };
10583             memoized.cache = new (memoize.Cache || MapCache)();
10584             return memoized;
10585           }
10586           memoize.Cache = MapCache;
10587           function negate(predicate) {
10588             if (typeof predicate != "function") {
10589               throw new TypeError2(FUNC_ERROR_TEXT3);
10590             }
10591             return function() {
10592               var args = arguments;
10593               switch (args.length) {
10594                 case 0:
10595                   return !predicate.call(this);
10596                 case 1:
10597                   return !predicate.call(this, args[0]);
10598                 case 2:
10599                   return !predicate.call(this, args[0], args[1]);
10600                 case 3:
10601                   return !predicate.call(this, args[0], args[1], args[2]);
10602               }
10603               return !predicate.apply(this, args);
10604             };
10605           }
10606           function once(func) {
10607             return before(2, func);
10608           }
10609           var overArgs = castRest(function(func, transforms) {
10610             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary(getIteratee()));
10611             var funcsLength = transforms.length;
10612             return baseRest(function(args) {
10613               var index = -1, length = nativeMin2(args.length, funcsLength);
10614               while (++index < length) {
10615                 args[index] = transforms[index].call(this, args[index]);
10616               }
10617               return apply(func, this, args);
10618             });
10619           });
10620           var partial = baseRest(function(func, partials) {
10621             var holders = replaceHolders(partials, getHolder(partial));
10622             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
10623           });
10624           var partialRight = baseRest(function(func, partials) {
10625             var holders = replaceHolders(partials, getHolder(partialRight));
10626             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
10627           });
10628           var rearg = flatRest(function(func, indexes) {
10629             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
10630           });
10631           function rest(func, start2) {
10632             if (typeof func != "function") {
10633               throw new TypeError2(FUNC_ERROR_TEXT3);
10634             }
10635             start2 = start2 === undefined2 ? start2 : toInteger(start2);
10636             return baseRest(func, start2);
10637           }
10638           function spread(func, start2) {
10639             if (typeof func != "function") {
10640               throw new TypeError2(FUNC_ERROR_TEXT3);
10641             }
10642             start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
10643             return baseRest(function(args) {
10644               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
10645               if (array2) {
10646                 arrayPush(otherArgs, array2);
10647               }
10648               return apply(func, this, otherArgs);
10649             });
10650           }
10651           function throttle2(func, wait, options2) {
10652             var leading = true, trailing = true;
10653             if (typeof func != "function") {
10654               throw new TypeError2(FUNC_ERROR_TEXT3);
10655             }
10656             if (isObject2(options2)) {
10657               leading = "leading" in options2 ? !!options2.leading : leading;
10658               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10659             }
10660             return debounce2(func, wait, {
10661               "leading": leading,
10662               "maxWait": wait,
10663               "trailing": trailing
10664             });
10665           }
10666           function unary(func) {
10667             return ary(func, 1);
10668           }
10669           function wrap2(value, wrapper) {
10670             return partial(castFunction(wrapper), value);
10671           }
10672           function castArray() {
10673             if (!arguments.length) {
10674               return [];
10675             }
10676             var value = arguments[0];
10677             return isArray2(value) ? value : [value];
10678           }
10679           function clone(value) {
10680             return baseClone(value, CLONE_SYMBOLS_FLAG);
10681           }
10682           function cloneWith(value, customizer) {
10683             customizer = typeof customizer == "function" ? customizer : undefined2;
10684             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
10685           }
10686           function cloneDeep(value) {
10687             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
10688           }
10689           function cloneDeepWith(value, customizer) {
10690             customizer = typeof customizer == "function" ? customizer : undefined2;
10691             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
10692           }
10693           function conformsTo(object, source) {
10694             return source == null || baseConformsTo(object, source, keys(source));
10695           }
10696           function eq(value, other) {
10697             return value === other || value !== value && other !== other;
10698           }
10699           var gt = createRelationalOperation(baseGt);
10700           var gte = createRelationalOperation(function(value, other) {
10701             return value >= other;
10702           });
10703           var isArguments = baseIsArguments(function() {
10704             return arguments;
10705           }()) ? baseIsArguments : function(value) {
10706             return isObjectLike2(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
10707           };
10708           var isArray2 = Array2.isArray;
10709           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
10710           function isArrayLike(value) {
10711             return value != null && isLength(value.length) && !isFunction(value);
10712           }
10713           function isArrayLikeObject(value) {
10714             return isObjectLike2(value) && isArrayLike(value);
10715           }
10716           function isBoolean(value) {
10717             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag;
10718           }
10719           var isBuffer = nativeIsBuffer || stubFalse;
10720           var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
10721           function isElement2(value) {
10722             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
10723           }
10724           function isEmpty(value) {
10725             if (value == null) {
10726               return true;
10727             }
10728             if (isArrayLike(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
10729               return !value.length;
10730             }
10731             var tag = getTag(value);
10732             if (tag == mapTag || tag == setTag) {
10733               return !value.size;
10734             }
10735             if (isPrototype(value)) {
10736               return !baseKeys(value).length;
10737             }
10738             for (var key in value) {
10739               if (hasOwnProperty2.call(value, key)) {
10740                 return false;
10741               }
10742             }
10743             return true;
10744           }
10745           function isEqual(value, other) {
10746             return baseIsEqual(value, other);
10747           }
10748           function isEqualWith(value, other, customizer) {
10749             customizer = typeof customizer == "function" ? customizer : undefined2;
10750             var result2 = customizer ? customizer(value, other) : undefined2;
10751             return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
10752           }
10753           function isError(value) {
10754             if (!isObjectLike2(value)) {
10755               return false;
10756             }
10757             var tag = baseGetTag2(value);
10758             return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
10759           }
10760           function isFinite2(value) {
10761             return typeof value == "number" && nativeIsFinite(value);
10762           }
10763           function isFunction(value) {
10764             if (!isObject2(value)) {
10765               return false;
10766             }
10767             var tag = baseGetTag2(value);
10768             return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
10769           }
10770           function isInteger(value) {
10771             return typeof value == "number" && value == toInteger(value);
10772           }
10773           function isLength(value) {
10774             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
10775           }
10776           function isObject2(value) {
10777             var type3 = typeof value;
10778             return value != null && (type3 == "object" || type3 == "function");
10779           }
10780           function isObjectLike2(value) {
10781             return value != null && typeof value == "object";
10782           }
10783           var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
10784           function isMatch(object, source) {
10785             return object === source || baseIsMatch(object, source, getMatchData(source));
10786           }
10787           function isMatchWith(object, source, customizer) {
10788             customizer = typeof customizer == "function" ? customizer : undefined2;
10789             return baseIsMatch(object, source, getMatchData(source), customizer);
10790           }
10791           function isNaN2(value) {
10792             return isNumber2(value) && value != +value;
10793           }
10794           function isNative(value) {
10795             if (isMaskable(value)) {
10796               throw new Error2(CORE_ERROR_TEXT);
10797             }
10798             return baseIsNative(value);
10799           }
10800           function isNull(value) {
10801             return value === null;
10802           }
10803           function isNil(value) {
10804             return value == null;
10805           }
10806           function isNumber2(value) {
10807             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag;
10808           }
10809           function isPlainObject(value) {
10810             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag) {
10811               return false;
10812             }
10813             var proto = getPrototype(value);
10814             if (proto === null) {
10815               return true;
10816             }
10817             var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor;
10818             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
10819           }
10820           var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
10821           function isSafeInteger(value) {
10822             return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
10823           }
10824           var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
10825           function isString(value) {
10826             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag;
10827           }
10828           function isSymbol2(value) {
10829             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag2;
10830           }
10831           var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
10832           function isUndefined(value) {
10833             return value === undefined2;
10834           }
10835           function isWeakMap(value) {
10836             return isObjectLike2(value) && getTag(value) == weakMapTag;
10837           }
10838           function isWeakSet(value) {
10839             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
10840           }
10841           var lt = createRelationalOperation(baseLt);
10842           var lte = createRelationalOperation(function(value, other) {
10843             return value <= other;
10844           });
10845           function toArray(value) {
10846             if (!value) {
10847               return [];
10848             }
10849             if (isArrayLike(value)) {
10850               return isString(value) ? stringToArray(value) : copyArray(value);
10851             }
10852             if (symIterator && value[symIterator]) {
10853               return iteratorToArray(value[symIterator]());
10854             }
10855             var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
10856             return func(value);
10857           }
10858           function toFinite(value) {
10859             if (!value) {
10860               return value === 0 ? value : 0;
10861             }
10862             value = toNumber2(value);
10863             if (value === INFINITY2 || value === -INFINITY2) {
10864               var sign2 = value < 0 ? -1 : 1;
10865               return sign2 * MAX_INTEGER;
10866             }
10867             return value === value ? value : 0;
10868           }
10869           function toInteger(value) {
10870             var result2 = toFinite(value), remainder = result2 % 1;
10871             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
10872           }
10873           function toLength(value) {
10874             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
10875           }
10876           function toNumber2(value) {
10877             if (typeof value == "number") {
10878               return value;
10879             }
10880             if (isSymbol2(value)) {
10881               return NAN2;
10882             }
10883             if (isObject2(value)) {
10884               var other = typeof value.valueOf == "function" ? value.valueOf() : value;
10885               value = isObject2(other) ? other + "" : other;
10886             }
10887             if (typeof value != "string") {
10888               return value === 0 ? value : +value;
10889             }
10890             value = baseTrim2(value);
10891             var isBinary = reIsBinary2.test(value);
10892             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
10893           }
10894           function toPlainObject(value) {
10895             return copyObject(value, keysIn(value));
10896           }
10897           function toSafeInteger(value) {
10898             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
10899           }
10900           function toString2(value) {
10901             return value == null ? "" : baseToString2(value);
10902           }
10903           var assign = createAssigner(function(object, source) {
10904             if (isPrototype(source) || isArrayLike(source)) {
10905               copyObject(source, keys(source), object);
10906               return;
10907             }
10908             for (var key in source) {
10909               if (hasOwnProperty2.call(source, key)) {
10910                 assignValue(object, key, source[key]);
10911               }
10912             }
10913           });
10914           var assignIn = createAssigner(function(object, source) {
10915             copyObject(source, keysIn(source), object);
10916           });
10917           var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
10918             copyObject(source, keysIn(source), object, customizer);
10919           });
10920           var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
10921             copyObject(source, keys(source), object, customizer);
10922           });
10923           var at = flatRest(baseAt);
10924           function create2(prototype, properties) {
10925             var result2 = baseCreate(prototype);
10926             return properties == null ? result2 : baseAssign(result2, properties);
10927           }
10928           var defaults2 = baseRest(function(object, sources) {
10929             object = Object2(object);
10930             var index = -1;
10931             var length = sources.length;
10932             var guard = length > 2 ? sources[2] : undefined2;
10933             if (guard && isIterateeCall(sources[0], sources[1], guard)) {
10934               length = 1;
10935             }
10936             while (++index < length) {
10937               var source = sources[index];
10938               var props = keysIn(source);
10939               var propsIndex = -1;
10940               var propsLength = props.length;
10941               while (++propsIndex < propsLength) {
10942                 var key = props[propsIndex];
10943                 var value = object[key];
10944                 if (value === undefined2 || eq(value, objectProto3[key]) && !hasOwnProperty2.call(object, key)) {
10945                   object[key] = source[key];
10946                 }
10947               }
10948             }
10949             return object;
10950           });
10951           var defaultsDeep = baseRest(function(args) {
10952             args.push(undefined2, customDefaultsMerge);
10953             return apply(mergeWith, undefined2, args);
10954           });
10955           function findKey(object, predicate) {
10956             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
10957           }
10958           function findLastKey(object, predicate) {
10959             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
10960           }
10961           function forIn(object, iteratee2) {
10962             return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
10963           }
10964           function forInRight(object, iteratee2) {
10965             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
10966           }
10967           function forOwn(object, iteratee2) {
10968             return object && baseForOwn(object, getIteratee(iteratee2, 3));
10969           }
10970           function forOwnRight(object, iteratee2) {
10971             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
10972           }
10973           function functions(object) {
10974             return object == null ? [] : baseFunctions(object, keys(object));
10975           }
10976           function functionsIn(object) {
10977             return object == null ? [] : baseFunctions(object, keysIn(object));
10978           }
10979           function get4(object, path, defaultValue) {
10980             var result2 = object == null ? undefined2 : baseGet(object, path);
10981             return result2 === undefined2 ? defaultValue : result2;
10982           }
10983           function has(object, path) {
10984             return object != null && hasPath(object, path, baseHas);
10985           }
10986           function hasIn(object, path) {
10987             return object != null && hasPath(object, path, baseHasIn);
10988           }
10989           var invert = createInverter(function(result2, value, key) {
10990             if (value != null && typeof value.toString != "function") {
10991               value = nativeObjectToString3.call(value);
10992             }
10993             result2[value] = key;
10994           }, constant(identity4));
10995           var invertBy = createInverter(function(result2, value, key) {
10996             if (value != null && typeof value.toString != "function") {
10997               value = nativeObjectToString3.call(value);
10998             }
10999             if (hasOwnProperty2.call(result2, value)) {
11000               result2[value].push(key);
11001             } else {
11002               result2[value] = [key];
11003             }
11004           }, getIteratee);
11005           var invoke = baseRest(baseInvoke);
11006           function keys(object) {
11007             return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
11008           }
11009           function keysIn(object) {
11010             return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
11011           }
11012           function mapKeys(object, iteratee2) {
11013             var result2 = {};
11014             iteratee2 = getIteratee(iteratee2, 3);
11015             baseForOwn(object, function(value, key, object2) {
11016               baseAssignValue(result2, iteratee2(value, key, object2), value);
11017             });
11018             return result2;
11019           }
11020           function mapValues(object, iteratee2) {
11021             var result2 = {};
11022             iteratee2 = getIteratee(iteratee2, 3);
11023             baseForOwn(object, function(value, key, object2) {
11024               baseAssignValue(result2, key, iteratee2(value, key, object2));
11025             });
11026             return result2;
11027           }
11028           var merge3 = createAssigner(function(object, source, srcIndex) {
11029             baseMerge(object, source, srcIndex);
11030           });
11031           var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
11032             baseMerge(object, source, srcIndex, customizer);
11033           });
11034           var omit = flatRest(function(object, paths) {
11035             var result2 = {};
11036             if (object == null) {
11037               return result2;
11038             }
11039             var isDeep = false;
11040             paths = arrayMap2(paths, function(path) {
11041               path = castPath(path, object);
11042               isDeep || (isDeep = path.length > 1);
11043               return path;
11044             });
11045             copyObject(object, getAllKeysIn(object), result2);
11046             if (isDeep) {
11047               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
11048             }
11049             var length = paths.length;
11050             while (length--) {
11051               baseUnset(result2, paths[length]);
11052             }
11053             return result2;
11054           });
11055           function omitBy(object, predicate) {
11056             return pickBy(object, negate(getIteratee(predicate)));
11057           }
11058           var pick = flatRest(function(object, paths) {
11059             return object == null ? {} : basePick(object, paths);
11060           });
11061           function pickBy(object, predicate) {
11062             if (object == null) {
11063               return {};
11064             }
11065             var props = arrayMap2(getAllKeysIn(object), function(prop) {
11066               return [prop];
11067             });
11068             predicate = getIteratee(predicate);
11069             return basePickBy(object, props, function(value, path) {
11070               return predicate(value, path[0]);
11071             });
11072           }
11073           function result(object, path, defaultValue) {
11074             path = castPath(path, object);
11075             var index = -1, length = path.length;
11076             if (!length) {
11077               length = 1;
11078               object = undefined2;
11079             }
11080             while (++index < length) {
11081               var value = object == null ? undefined2 : object[toKey(path[index])];
11082               if (value === undefined2) {
11083                 index = length;
11084                 value = defaultValue;
11085               }
11086               object = isFunction(value) ? value.call(object) : value;
11087             }
11088             return object;
11089           }
11090           function set3(object, path, value) {
11091             return object == null ? object : baseSet(object, path, value);
11092           }
11093           function setWith(object, path, value, customizer) {
11094             customizer = typeof customizer == "function" ? customizer : undefined2;
11095             return object == null ? object : baseSet(object, path, value, customizer);
11096           }
11097           var toPairs = createToPairs(keys);
11098           var toPairsIn = createToPairs(keysIn);
11099           function transform2(object, iteratee2, accumulator) {
11100             var isArr = isArray2(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
11101             iteratee2 = getIteratee(iteratee2, 4);
11102             if (accumulator == null) {
11103               var Ctor = object && object.constructor;
11104               if (isArrLike) {
11105                 accumulator = isArr ? new Ctor() : [];
11106               } else if (isObject2(object)) {
11107                 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
11108               } else {
11109                 accumulator = {};
11110               }
11111             }
11112             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
11113               return iteratee2(accumulator, value, index, object2);
11114             });
11115             return accumulator;
11116           }
11117           function unset(object, path) {
11118             return object == null ? true : baseUnset(object, path);
11119           }
11120           function update(object, path, updater) {
11121             return object == null ? object : baseUpdate(object, path, castFunction(updater));
11122           }
11123           function updateWith(object, path, updater, customizer) {
11124             customizer = typeof customizer == "function" ? customizer : undefined2;
11125             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
11126           }
11127           function values(object) {
11128             return object == null ? [] : baseValues(object, keys(object));
11129           }
11130           function valuesIn(object) {
11131             return object == null ? [] : baseValues(object, keysIn(object));
11132           }
11133           function clamp3(number3, lower2, upper) {
11134             if (upper === undefined2) {
11135               upper = lower2;
11136               lower2 = undefined2;
11137             }
11138             if (upper !== undefined2) {
11139               upper = toNumber2(upper);
11140               upper = upper === upper ? upper : 0;
11141             }
11142             if (lower2 !== undefined2) {
11143               lower2 = toNumber2(lower2);
11144               lower2 = lower2 === lower2 ? lower2 : 0;
11145             }
11146             return baseClamp(toNumber2(number3), lower2, upper);
11147           }
11148           function inRange(number3, start2, end) {
11149             start2 = toFinite(start2);
11150             if (end === undefined2) {
11151               end = start2;
11152               start2 = 0;
11153             } else {
11154               end = toFinite(end);
11155             }
11156             number3 = toNumber2(number3);
11157             return baseInRange(number3, start2, end);
11158           }
11159           function random(lower2, upper, floating) {
11160             if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
11161               upper = floating = undefined2;
11162             }
11163             if (floating === undefined2) {
11164               if (typeof upper == "boolean") {
11165                 floating = upper;
11166                 upper = undefined2;
11167               } else if (typeof lower2 == "boolean") {
11168                 floating = lower2;
11169                 lower2 = undefined2;
11170               }
11171             }
11172             if (lower2 === undefined2 && upper === undefined2) {
11173               lower2 = 0;
11174               upper = 1;
11175             } else {
11176               lower2 = toFinite(lower2);
11177               if (upper === undefined2) {
11178                 upper = lower2;
11179                 lower2 = 0;
11180               } else {
11181                 upper = toFinite(upper);
11182               }
11183             }
11184             if (lower2 > upper) {
11185               var temp = lower2;
11186               lower2 = upper;
11187               upper = temp;
11188             }
11189             if (floating || lower2 % 1 || upper % 1) {
11190               var rand = nativeRandom();
11191               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
11192             }
11193             return baseRandom(lower2, upper);
11194           }
11195           var camelCase = createCompounder(function(result2, word, index) {
11196             word = word.toLowerCase();
11197             return result2 + (index ? capitalize(word) : word);
11198           });
11199           function capitalize(string) {
11200             return upperFirst(toString2(string).toLowerCase());
11201           }
11202           function deburr(string) {
11203             string = toString2(string);
11204             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
11205           }
11206           function endsWith(string, target, position) {
11207             string = toString2(string);
11208             target = baseToString2(target);
11209             var length = string.length;
11210             position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
11211             var end = position;
11212             position -= target.length;
11213             return position >= 0 && string.slice(position, end) == target;
11214           }
11215           function escape6(string) {
11216             string = toString2(string);
11217             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
11218           }
11219           function escapeRegExp(string) {
11220             string = toString2(string);
11221             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
11222           }
11223           var kebabCase = createCompounder(function(result2, word, index) {
11224             return result2 + (index ? "-" : "") + word.toLowerCase();
11225           });
11226           var lowerCase = createCompounder(function(result2, word, index) {
11227             return result2 + (index ? " " : "") + word.toLowerCase();
11228           });
11229           var lowerFirst = createCaseFirst("toLowerCase");
11230           function pad2(string, length, chars) {
11231             string = toString2(string);
11232             length = toInteger(length);
11233             var strLength = length ? stringSize(string) : 0;
11234             if (!length || strLength >= length) {
11235               return string;
11236             }
11237             var mid = (length - strLength) / 2;
11238             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
11239           }
11240           function padEnd(string, length, chars) {
11241             string = toString2(string);
11242             length = toInteger(length);
11243             var strLength = length ? stringSize(string) : 0;
11244             return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
11245           }
11246           function padStart(string, length, chars) {
11247             string = toString2(string);
11248             length = toInteger(length);
11249             var strLength = length ? stringSize(string) : 0;
11250             return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
11251           }
11252           function parseInt2(string, radix, guard) {
11253             if (guard || radix == null) {
11254               radix = 0;
11255             } else if (radix) {
11256               radix = +radix;
11257             }
11258             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
11259           }
11260           function repeat(string, n2, guard) {
11261             if (guard ? isIterateeCall(string, n2, guard) : n2 === undefined2) {
11262               n2 = 1;
11263             } else {
11264               n2 = toInteger(n2);
11265             }
11266             return baseRepeat(toString2(string), n2);
11267           }
11268           function replace() {
11269             var args = arguments, string = toString2(args[0]);
11270             return args.length < 3 ? string : string.replace(args[1], args[2]);
11271           }
11272           var snakeCase = createCompounder(function(result2, word, index) {
11273             return result2 + (index ? "_" : "") + word.toLowerCase();
11274           });
11275           function split(string, separator, limit) {
11276             if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
11277               separator = limit = undefined2;
11278             }
11279             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
11280             if (!limit) {
11281               return [];
11282             }
11283             string = toString2(string);
11284             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
11285               separator = baseToString2(separator);
11286               if (!separator && hasUnicode(string)) {
11287                 return castSlice(stringToArray(string), 0, limit);
11288               }
11289             }
11290             return string.split(separator, limit);
11291           }
11292           var startCase = createCompounder(function(result2, word, index) {
11293             return result2 + (index ? " " : "") + upperFirst(word);
11294           });
11295           function startsWith(string, target, position) {
11296             string = toString2(string);
11297             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
11298             target = baseToString2(target);
11299             return string.slice(position, position + target.length) == target;
11300           }
11301           function template(string, options2, guard) {
11302             var settings = lodash.templateSettings;
11303             if (guard && isIterateeCall(string, options2, guard)) {
11304               options2 = undefined2;
11305             }
11306             string = toString2(string);
11307             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
11308             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
11309             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
11310             var reDelimiters = RegExp2(
11311               (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
11312               "g"
11313             );
11314             var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
11315             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
11316               interpolateValue || (interpolateValue = esTemplateValue);
11317               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
11318               if (escapeValue) {
11319                 isEscaping = true;
11320                 source += "' +\n__e(" + escapeValue + ") +\n'";
11321               }
11322               if (evaluateValue) {
11323                 isEvaluating = true;
11324                 source += "';\n" + evaluateValue + ";\n__p += '";
11325               }
11326               if (interpolateValue) {
11327                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
11328               }
11329               index = offset + match.length;
11330               return match;
11331             });
11332             source += "';\n";
11333             var variable = hasOwnProperty2.call(options2, "variable") && options2.variable;
11334             if (!variable) {
11335               source = "with (obj) {\n" + source + "\n}\n";
11336             } else if (reForbiddenIdentifierChars.test(variable)) {
11337               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
11338             }
11339             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
11340             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}";
11341             var result2 = attempt(function() {
11342               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
11343             });
11344             result2.source = source;
11345             if (isError(result2)) {
11346               throw result2;
11347             }
11348             return result2;
11349           }
11350           function toLower(value) {
11351             return toString2(value).toLowerCase();
11352           }
11353           function toUpper(value) {
11354             return toString2(value).toUpperCase();
11355           }
11356           function trim(string, chars, guard) {
11357             string = toString2(string);
11358             if (string && (guard || chars === undefined2)) {
11359               return baseTrim2(string);
11360             }
11361             if (!string || !(chars = baseToString2(chars))) {
11362               return string;
11363             }
11364             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
11365             return castSlice(strSymbols, start2, end).join("");
11366           }
11367           function trimEnd(string, chars, guard) {
11368             string = toString2(string);
11369             if (string && (guard || chars === undefined2)) {
11370               return string.slice(0, trimmedEndIndex2(string) + 1);
11371             }
11372             if (!string || !(chars = baseToString2(chars))) {
11373               return string;
11374             }
11375             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
11376             return castSlice(strSymbols, 0, end).join("");
11377           }
11378           function trimStart(string, chars, guard) {
11379             string = toString2(string);
11380             if (string && (guard || chars === undefined2)) {
11381               return string.replace(reTrimStart2, "");
11382             }
11383             if (!string || !(chars = baseToString2(chars))) {
11384               return string;
11385             }
11386             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
11387             return castSlice(strSymbols, start2).join("");
11388           }
11389           function truncate(string, options2) {
11390             var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
11391             if (isObject2(options2)) {
11392               var separator = "separator" in options2 ? options2.separator : separator;
11393               length = "length" in options2 ? toInteger(options2.length) : length;
11394               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
11395             }
11396             string = toString2(string);
11397             var strLength = string.length;
11398             if (hasUnicode(string)) {
11399               var strSymbols = stringToArray(string);
11400               strLength = strSymbols.length;
11401             }
11402             if (length >= strLength) {
11403               return string;
11404             }
11405             var end = length - stringSize(omission);
11406             if (end < 1) {
11407               return omission;
11408             }
11409             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
11410             if (separator === undefined2) {
11411               return result2 + omission;
11412             }
11413             if (strSymbols) {
11414               end += result2.length - end;
11415             }
11416             if (isRegExp(separator)) {
11417               if (string.slice(end).search(separator)) {
11418                 var match, substring = result2;
11419                 if (!separator.global) {
11420                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
11421                 }
11422                 separator.lastIndex = 0;
11423                 while (match = separator.exec(substring)) {
11424                   var newEnd = match.index;
11425                 }
11426                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
11427               }
11428             } else if (string.indexOf(baseToString2(separator), end) != end) {
11429               var index = result2.lastIndexOf(separator);
11430               if (index > -1) {
11431                 result2 = result2.slice(0, index);
11432               }
11433             }
11434             return result2 + omission;
11435           }
11436           function unescape4(string) {
11437             string = toString2(string);
11438             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
11439           }
11440           var upperCase = createCompounder(function(result2, word, index) {
11441             return result2 + (index ? " " : "") + word.toUpperCase();
11442           });
11443           var upperFirst = createCaseFirst("toUpperCase");
11444           function words(string, pattern, guard) {
11445             string = toString2(string);
11446             pattern = guard ? undefined2 : pattern;
11447             if (pattern === undefined2) {
11448               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
11449             }
11450             return string.match(pattern) || [];
11451           }
11452           var attempt = baseRest(function(func, args) {
11453             try {
11454               return apply(func, undefined2, args);
11455             } catch (e) {
11456               return isError(e) ? e : new Error2(e);
11457             }
11458           });
11459           var bindAll = flatRest(function(object, methodNames) {
11460             arrayEach(methodNames, function(key) {
11461               key = toKey(key);
11462               baseAssignValue(object, key, bind(object[key], object));
11463             });
11464             return object;
11465           });
11466           function cond(pairs) {
11467             var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
11468             pairs = !length ? [] : arrayMap2(pairs, function(pair2) {
11469               if (typeof pair2[1] != "function") {
11470                 throw new TypeError2(FUNC_ERROR_TEXT3);
11471               }
11472               return [toIteratee(pair2[0]), pair2[1]];
11473             });
11474             return baseRest(function(args) {
11475               var index = -1;
11476               while (++index < length) {
11477                 var pair2 = pairs[index];
11478                 if (apply(pair2[0], this, args)) {
11479                   return apply(pair2[1], this, args);
11480                 }
11481               }
11482             });
11483           }
11484           function conforms(source) {
11485             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
11486           }
11487           function constant(value) {
11488             return function() {
11489               return value;
11490             };
11491           }
11492           function defaultTo(value, defaultValue) {
11493             return value == null || value !== value ? defaultValue : value;
11494           }
11495           var flow = createFlow();
11496           var flowRight = createFlow(true);
11497           function identity4(value) {
11498             return value;
11499           }
11500           function iteratee(func) {
11501             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
11502           }
11503           function matches(source) {
11504             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
11505           }
11506           function matchesProperty(path, srcValue) {
11507             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
11508           }
11509           var method = baseRest(function(path, args) {
11510             return function(object) {
11511               return baseInvoke(object, path, args);
11512             };
11513           });
11514           var methodOf = baseRest(function(object, args) {
11515             return function(path) {
11516               return baseInvoke(object, path, args);
11517             };
11518           });
11519           function mixin(object, source, options2) {
11520             var props = keys(source), methodNames = baseFunctions(source, props);
11521             if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
11522               options2 = source;
11523               source = object;
11524               object = this;
11525               methodNames = baseFunctions(source, keys(source));
11526             }
11527             var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction(object);
11528             arrayEach(methodNames, function(methodName) {
11529               var func = source[methodName];
11530               object[methodName] = func;
11531               if (isFunc) {
11532                 object.prototype[methodName] = function() {
11533                   var chainAll = this.__chain__;
11534                   if (chain2 || chainAll) {
11535                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
11536                     actions.push({ "func": func, "args": arguments, "thisArg": object });
11537                     result2.__chain__ = chainAll;
11538                     return result2;
11539                   }
11540                   return func.apply(object, arrayPush([this.value()], arguments));
11541                 };
11542               }
11543             });
11544             return object;
11545           }
11546           function noConflict() {
11547             if (root3._ === this) {
11548               root3._ = oldDash;
11549             }
11550             return this;
11551           }
11552           function noop3() {
11553           }
11554           function nthArg(n2) {
11555             n2 = toInteger(n2);
11556             return baseRest(function(args) {
11557               return baseNth(args, n2);
11558             });
11559           }
11560           var over = createOver(arrayMap2);
11561           var overEvery = createOver(arrayEvery);
11562           var overSome = createOver(arraySome);
11563           function property(path) {
11564             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
11565           }
11566           function propertyOf(object) {
11567             return function(path) {
11568               return object == null ? undefined2 : baseGet(object, path);
11569             };
11570           }
11571           var range3 = createRange();
11572           var rangeRight = createRange(true);
11573           function stubArray() {
11574             return [];
11575           }
11576           function stubFalse() {
11577             return false;
11578           }
11579           function stubObject() {
11580             return {};
11581           }
11582           function stubString() {
11583             return "";
11584           }
11585           function stubTrue() {
11586             return true;
11587           }
11588           function times(n2, iteratee2) {
11589             n2 = toInteger(n2);
11590             if (n2 < 1 || n2 > MAX_SAFE_INTEGER) {
11591               return [];
11592             }
11593             var index = MAX_ARRAY_LENGTH, length = nativeMin2(n2, MAX_ARRAY_LENGTH);
11594             iteratee2 = getIteratee(iteratee2);
11595             n2 -= MAX_ARRAY_LENGTH;
11596             var result2 = baseTimes(length, iteratee2);
11597             while (++index < n2) {
11598               iteratee2(index);
11599             }
11600             return result2;
11601           }
11602           function toPath(value) {
11603             if (isArray2(value)) {
11604               return arrayMap2(value, toKey);
11605             }
11606             return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
11607           }
11608           function uniqueId(prefix) {
11609             var id2 = ++idCounter;
11610             return toString2(prefix) + id2;
11611           }
11612           var add = createMathOperation(function(augend, addend) {
11613             return augend + addend;
11614           }, 0);
11615           var ceil = createRound("ceil");
11616           var divide = createMathOperation(function(dividend, divisor) {
11617             return dividend / divisor;
11618           }, 1);
11619           var floor = createRound("floor");
11620           function max3(array2) {
11621             return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
11622           }
11623           function maxBy(array2, iteratee2) {
11624             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
11625           }
11626           function mean(array2) {
11627             return baseMean(array2, identity4);
11628           }
11629           function meanBy(array2, iteratee2) {
11630             return baseMean(array2, getIteratee(iteratee2, 2));
11631           }
11632           function min3(array2) {
11633             return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
11634           }
11635           function minBy(array2, iteratee2) {
11636             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
11637           }
11638           var multiply = createMathOperation(function(multiplier, multiplicand) {
11639             return multiplier * multiplicand;
11640           }, 1);
11641           var round = createRound("round");
11642           var subtract = createMathOperation(function(minuend, subtrahend) {
11643             return minuend - subtrahend;
11644           }, 0);
11645           function sum(array2) {
11646             return array2 && array2.length ? baseSum(array2, identity4) : 0;
11647           }
11648           function sumBy(array2, iteratee2) {
11649             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
11650           }
11651           lodash.after = after;
11652           lodash.ary = ary;
11653           lodash.assign = assign;
11654           lodash.assignIn = assignIn;
11655           lodash.assignInWith = assignInWith;
11656           lodash.assignWith = assignWith;
11657           lodash.at = at;
11658           lodash.before = before;
11659           lodash.bind = bind;
11660           lodash.bindAll = bindAll;
11661           lodash.bindKey = bindKey2;
11662           lodash.castArray = castArray;
11663           lodash.chain = chain;
11664           lodash.chunk = chunk;
11665           lodash.compact = compact;
11666           lodash.concat = concat;
11667           lodash.cond = cond;
11668           lodash.conforms = conforms;
11669           lodash.constant = constant;
11670           lodash.countBy = countBy;
11671           lodash.create = create2;
11672           lodash.curry = curry;
11673           lodash.curryRight = curryRight;
11674           lodash.debounce = debounce2;
11675           lodash.defaults = defaults2;
11676           lodash.defaultsDeep = defaultsDeep;
11677           lodash.defer = defer;
11678           lodash.delay = delay;
11679           lodash.difference = difference;
11680           lodash.differenceBy = differenceBy;
11681           lodash.differenceWith = differenceWith;
11682           lodash.drop = drop;
11683           lodash.dropRight = dropRight;
11684           lodash.dropRightWhile = dropRightWhile;
11685           lodash.dropWhile = dropWhile;
11686           lodash.fill = fill;
11687           lodash.filter = filter2;
11688           lodash.flatMap = flatMap;
11689           lodash.flatMapDeep = flatMapDeep;
11690           lodash.flatMapDepth = flatMapDepth;
11691           lodash.flatten = flatten2;
11692           lodash.flattenDeep = flattenDeep;
11693           lodash.flattenDepth = flattenDepth;
11694           lodash.flip = flip;
11695           lodash.flow = flow;
11696           lodash.flowRight = flowRight;
11697           lodash.fromPairs = fromPairs;
11698           lodash.functions = functions;
11699           lodash.functionsIn = functionsIn;
11700           lodash.groupBy = groupBy;
11701           lodash.initial = initial;
11702           lodash.intersection = intersection;
11703           lodash.intersectionBy = intersectionBy;
11704           lodash.intersectionWith = intersectionWith;
11705           lodash.invert = invert;
11706           lodash.invertBy = invertBy;
11707           lodash.invokeMap = invokeMap;
11708           lodash.iteratee = iteratee;
11709           lodash.keyBy = keyBy;
11710           lodash.keys = keys;
11711           lodash.keysIn = keysIn;
11712           lodash.map = map2;
11713           lodash.mapKeys = mapKeys;
11714           lodash.mapValues = mapValues;
11715           lodash.matches = matches;
11716           lodash.matchesProperty = matchesProperty;
11717           lodash.memoize = memoize;
11718           lodash.merge = merge3;
11719           lodash.mergeWith = mergeWith;
11720           lodash.method = method;
11721           lodash.methodOf = methodOf;
11722           lodash.mixin = mixin;
11723           lodash.negate = negate;
11724           lodash.nthArg = nthArg;
11725           lodash.omit = omit;
11726           lodash.omitBy = omitBy;
11727           lodash.once = once;
11728           lodash.orderBy = orderBy;
11729           lodash.over = over;
11730           lodash.overArgs = overArgs;
11731           lodash.overEvery = overEvery;
11732           lodash.overSome = overSome;
11733           lodash.partial = partial;
11734           lodash.partialRight = partialRight;
11735           lodash.partition = partition;
11736           lodash.pick = pick;
11737           lodash.pickBy = pickBy;
11738           lodash.property = property;
11739           lodash.propertyOf = propertyOf;
11740           lodash.pull = pull;
11741           lodash.pullAll = pullAll;
11742           lodash.pullAllBy = pullAllBy;
11743           lodash.pullAllWith = pullAllWith;
11744           lodash.pullAt = pullAt;
11745           lodash.range = range3;
11746           lodash.rangeRight = rangeRight;
11747           lodash.rearg = rearg;
11748           lodash.reject = reject;
11749           lodash.remove = remove2;
11750           lodash.rest = rest;
11751           lodash.reverse = reverse;
11752           lodash.sampleSize = sampleSize;
11753           lodash.set = set3;
11754           lodash.setWith = setWith;
11755           lodash.shuffle = shuffle;
11756           lodash.slice = slice;
11757           lodash.sortBy = sortBy;
11758           lodash.sortedUniq = sortedUniq;
11759           lodash.sortedUniqBy = sortedUniqBy;
11760           lodash.split = split;
11761           lodash.spread = spread;
11762           lodash.tail = tail;
11763           lodash.take = take;
11764           lodash.takeRight = takeRight;
11765           lodash.takeRightWhile = takeRightWhile;
11766           lodash.takeWhile = takeWhile;
11767           lodash.tap = tap;
11768           lodash.throttle = throttle2;
11769           lodash.thru = thru;
11770           lodash.toArray = toArray;
11771           lodash.toPairs = toPairs;
11772           lodash.toPairsIn = toPairsIn;
11773           lodash.toPath = toPath;
11774           lodash.toPlainObject = toPlainObject;
11775           lodash.transform = transform2;
11776           lodash.unary = unary;
11777           lodash.union = union;
11778           lodash.unionBy = unionBy;
11779           lodash.unionWith = unionWith;
11780           lodash.uniq = uniq;
11781           lodash.uniqBy = uniqBy;
11782           lodash.uniqWith = uniqWith;
11783           lodash.unset = unset;
11784           lodash.unzip = unzip;
11785           lodash.unzipWith = unzipWith;
11786           lodash.update = update;
11787           lodash.updateWith = updateWith;
11788           lodash.values = values;
11789           lodash.valuesIn = valuesIn;
11790           lodash.without = without;
11791           lodash.words = words;
11792           lodash.wrap = wrap2;
11793           lodash.xor = xor;
11794           lodash.xorBy = xorBy;
11795           lodash.xorWith = xorWith;
11796           lodash.zip = zip;
11797           lodash.zipObject = zipObject;
11798           lodash.zipObjectDeep = zipObjectDeep;
11799           lodash.zipWith = zipWith;
11800           lodash.entries = toPairs;
11801           lodash.entriesIn = toPairsIn;
11802           lodash.extend = assignIn;
11803           lodash.extendWith = assignInWith;
11804           mixin(lodash, lodash);
11805           lodash.add = add;
11806           lodash.attempt = attempt;
11807           lodash.camelCase = camelCase;
11808           lodash.capitalize = capitalize;
11809           lodash.ceil = ceil;
11810           lodash.clamp = clamp3;
11811           lodash.clone = clone;
11812           lodash.cloneDeep = cloneDeep;
11813           lodash.cloneDeepWith = cloneDeepWith;
11814           lodash.cloneWith = cloneWith;
11815           lodash.conformsTo = conformsTo;
11816           lodash.deburr = deburr;
11817           lodash.defaultTo = defaultTo;
11818           lodash.divide = divide;
11819           lodash.endsWith = endsWith;
11820           lodash.eq = eq;
11821           lodash.escape = escape6;
11822           lodash.escapeRegExp = escapeRegExp;
11823           lodash.every = every;
11824           lodash.find = find2;
11825           lodash.findIndex = findIndex;
11826           lodash.findKey = findKey;
11827           lodash.findLast = findLast;
11828           lodash.findLastIndex = findLastIndex;
11829           lodash.findLastKey = findLastKey;
11830           lodash.floor = floor;
11831           lodash.forEach = forEach;
11832           lodash.forEachRight = forEachRight;
11833           lodash.forIn = forIn;
11834           lodash.forInRight = forInRight;
11835           lodash.forOwn = forOwn;
11836           lodash.forOwnRight = forOwnRight;
11837           lodash.get = get4;
11838           lodash.gt = gt;
11839           lodash.gte = gte;
11840           lodash.has = has;
11841           lodash.hasIn = hasIn;
11842           lodash.head = head;
11843           lodash.identity = identity4;
11844           lodash.includes = includes;
11845           lodash.indexOf = indexOf;
11846           lodash.inRange = inRange;
11847           lodash.invoke = invoke;
11848           lodash.isArguments = isArguments;
11849           lodash.isArray = isArray2;
11850           lodash.isArrayBuffer = isArrayBuffer;
11851           lodash.isArrayLike = isArrayLike;
11852           lodash.isArrayLikeObject = isArrayLikeObject;
11853           lodash.isBoolean = isBoolean;
11854           lodash.isBuffer = isBuffer;
11855           lodash.isDate = isDate;
11856           lodash.isElement = isElement2;
11857           lodash.isEmpty = isEmpty;
11858           lodash.isEqual = isEqual;
11859           lodash.isEqualWith = isEqualWith;
11860           lodash.isError = isError;
11861           lodash.isFinite = isFinite2;
11862           lodash.isFunction = isFunction;
11863           lodash.isInteger = isInteger;
11864           lodash.isLength = isLength;
11865           lodash.isMap = isMap;
11866           lodash.isMatch = isMatch;
11867           lodash.isMatchWith = isMatchWith;
11868           lodash.isNaN = isNaN2;
11869           lodash.isNative = isNative;
11870           lodash.isNil = isNil;
11871           lodash.isNull = isNull;
11872           lodash.isNumber = isNumber2;
11873           lodash.isObject = isObject2;
11874           lodash.isObjectLike = isObjectLike2;
11875           lodash.isPlainObject = isPlainObject;
11876           lodash.isRegExp = isRegExp;
11877           lodash.isSafeInteger = isSafeInteger;
11878           lodash.isSet = isSet;
11879           lodash.isString = isString;
11880           lodash.isSymbol = isSymbol2;
11881           lodash.isTypedArray = isTypedArray;
11882           lodash.isUndefined = isUndefined;
11883           lodash.isWeakMap = isWeakMap;
11884           lodash.isWeakSet = isWeakSet;
11885           lodash.join = join;
11886           lodash.kebabCase = kebabCase;
11887           lodash.last = last;
11888           lodash.lastIndexOf = lastIndexOf;
11889           lodash.lowerCase = lowerCase;
11890           lodash.lowerFirst = lowerFirst;
11891           lodash.lt = lt;
11892           lodash.lte = lte;
11893           lodash.max = max3;
11894           lodash.maxBy = maxBy;
11895           lodash.mean = mean;
11896           lodash.meanBy = meanBy;
11897           lodash.min = min3;
11898           lodash.minBy = minBy;
11899           lodash.stubArray = stubArray;
11900           lodash.stubFalse = stubFalse;
11901           lodash.stubObject = stubObject;
11902           lodash.stubString = stubString;
11903           lodash.stubTrue = stubTrue;
11904           lodash.multiply = multiply;
11905           lodash.nth = nth;
11906           lodash.noConflict = noConflict;
11907           lodash.noop = noop3;
11908           lodash.now = now3;
11909           lodash.pad = pad2;
11910           lodash.padEnd = padEnd;
11911           lodash.padStart = padStart;
11912           lodash.parseInt = parseInt2;
11913           lodash.random = random;
11914           lodash.reduce = reduce;
11915           lodash.reduceRight = reduceRight;
11916           lodash.repeat = repeat;
11917           lodash.replace = replace;
11918           lodash.result = result;
11919           lodash.round = round;
11920           lodash.runInContext = runInContext2;
11921           lodash.sample = sample;
11922           lodash.size = size;
11923           lodash.snakeCase = snakeCase;
11924           lodash.some = some;
11925           lodash.sortedIndex = sortedIndex;
11926           lodash.sortedIndexBy = sortedIndexBy;
11927           lodash.sortedIndexOf = sortedIndexOf;
11928           lodash.sortedLastIndex = sortedLastIndex;
11929           lodash.sortedLastIndexBy = sortedLastIndexBy;
11930           lodash.sortedLastIndexOf = sortedLastIndexOf;
11931           lodash.startCase = startCase;
11932           lodash.startsWith = startsWith;
11933           lodash.subtract = subtract;
11934           lodash.sum = sum;
11935           lodash.sumBy = sumBy;
11936           lodash.template = template;
11937           lodash.times = times;
11938           lodash.toFinite = toFinite;
11939           lodash.toInteger = toInteger;
11940           lodash.toLength = toLength;
11941           lodash.toLower = toLower;
11942           lodash.toNumber = toNumber2;
11943           lodash.toSafeInteger = toSafeInteger;
11944           lodash.toString = toString2;
11945           lodash.toUpper = toUpper;
11946           lodash.trim = trim;
11947           lodash.trimEnd = trimEnd;
11948           lodash.trimStart = trimStart;
11949           lodash.truncate = truncate;
11950           lodash.unescape = unescape4;
11951           lodash.uniqueId = uniqueId;
11952           lodash.upperCase = upperCase;
11953           lodash.upperFirst = upperFirst;
11954           lodash.each = forEach;
11955           lodash.eachRight = forEachRight;
11956           lodash.first = head;
11957           mixin(lodash, function() {
11958             var source = {};
11959             baseForOwn(lodash, function(func, methodName) {
11960               if (!hasOwnProperty2.call(lodash.prototype, methodName)) {
11961                 source[methodName] = func;
11962               }
11963             });
11964             return source;
11965           }(), { "chain": false });
11966           lodash.VERSION = VERSION;
11967           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
11968             lodash[methodName].placeholder = lodash;
11969           });
11970           arrayEach(["drop", "take"], function(methodName, index) {
11971             LazyWrapper.prototype[methodName] = function(n2) {
11972               n2 = n2 === undefined2 ? 1 : nativeMax2(toInteger(n2), 0);
11973               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
11974               if (result2.__filtered__) {
11975                 result2.__takeCount__ = nativeMin2(n2, result2.__takeCount__);
11976               } else {
11977                 result2.__views__.push({
11978                   "size": nativeMin2(n2, MAX_ARRAY_LENGTH),
11979                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
11980                 });
11981               }
11982               return result2;
11983             };
11984             LazyWrapper.prototype[methodName + "Right"] = function(n2) {
11985               return this.reverse()[methodName](n2).reverse();
11986             };
11987           });
11988           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
11989             var type3 = index + 1, isFilter = type3 == LAZY_FILTER_FLAG || type3 == LAZY_WHILE_FLAG;
11990             LazyWrapper.prototype[methodName] = function(iteratee2) {
11991               var result2 = this.clone();
11992               result2.__iteratees__.push({
11993                 "iteratee": getIteratee(iteratee2, 3),
11994                 "type": type3
11995               });
11996               result2.__filtered__ = result2.__filtered__ || isFilter;
11997               return result2;
11998             };
11999           });
12000           arrayEach(["head", "last"], function(methodName, index) {
12001             var takeName = "take" + (index ? "Right" : "");
12002             LazyWrapper.prototype[methodName] = function() {
12003               return this[takeName](1).value()[0];
12004             };
12005           });
12006           arrayEach(["initial", "tail"], function(methodName, index) {
12007             var dropName = "drop" + (index ? "" : "Right");
12008             LazyWrapper.prototype[methodName] = function() {
12009               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
12010             };
12011           });
12012           LazyWrapper.prototype.compact = function() {
12013             return this.filter(identity4);
12014           };
12015           LazyWrapper.prototype.find = function(predicate) {
12016             return this.filter(predicate).head();
12017           };
12018           LazyWrapper.prototype.findLast = function(predicate) {
12019             return this.reverse().find(predicate);
12020           };
12021           LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
12022             if (typeof path == "function") {
12023               return new LazyWrapper(this);
12024             }
12025             return this.map(function(value) {
12026               return baseInvoke(value, path, args);
12027             });
12028           });
12029           LazyWrapper.prototype.reject = function(predicate) {
12030             return this.filter(negate(getIteratee(predicate)));
12031           };
12032           LazyWrapper.prototype.slice = function(start2, end) {
12033             start2 = toInteger(start2);
12034             var result2 = this;
12035             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
12036               return new LazyWrapper(result2);
12037             }
12038             if (start2 < 0) {
12039               result2 = result2.takeRight(-start2);
12040             } else if (start2) {
12041               result2 = result2.drop(start2);
12042             }
12043             if (end !== undefined2) {
12044               end = toInteger(end);
12045               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
12046             }
12047             return result2;
12048           };
12049           LazyWrapper.prototype.takeRightWhile = function(predicate) {
12050             return this.reverse().takeWhile(predicate).reverse();
12051           };
12052           LazyWrapper.prototype.toArray = function() {
12053             return this.take(MAX_ARRAY_LENGTH);
12054           };
12055           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12056             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);
12057             if (!lodashFunc) {
12058               return;
12059             }
12060             lodash.prototype[methodName] = function() {
12061               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
12062               var interceptor = function(value2) {
12063                 var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
12064                 return isTaker && chainAll ? result3[0] : result3;
12065               };
12066               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
12067                 isLazy = useLazy = false;
12068               }
12069               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
12070               if (!retUnwrapped && useLazy) {
12071                 value = onlyLazy ? value : new LazyWrapper(this);
12072                 var result2 = func.apply(value, args);
12073                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
12074                 return new LodashWrapper(result2, chainAll);
12075               }
12076               if (isUnwrapped && onlyLazy) {
12077                 return func.apply(this, args);
12078               }
12079               result2 = this.thru(interceptor);
12080               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
12081             };
12082           });
12083           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
12084             var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
12085             lodash.prototype[methodName] = function() {
12086               var args = arguments;
12087               if (retUnwrapped && !this.__chain__) {
12088                 var value = this.value();
12089                 return func.apply(isArray2(value) ? value : [], args);
12090               }
12091               return this[chainName](function(value2) {
12092                 return func.apply(isArray2(value2) ? value2 : [], args);
12093               });
12094             };
12095           });
12096           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12097             var lodashFunc = lodash[methodName];
12098             if (lodashFunc) {
12099               var key = lodashFunc.name + "";
12100               if (!hasOwnProperty2.call(realNames, key)) {
12101                 realNames[key] = [];
12102               }
12103               realNames[key].push({ "name": methodName, "func": lodashFunc });
12104             }
12105           });
12106           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
12107             "name": "wrapper",
12108             "func": undefined2
12109           }];
12110           LazyWrapper.prototype.clone = lazyClone;
12111           LazyWrapper.prototype.reverse = lazyReverse;
12112           LazyWrapper.prototype.value = lazyValue;
12113           lodash.prototype.at = wrapperAt;
12114           lodash.prototype.chain = wrapperChain;
12115           lodash.prototype.commit = wrapperCommit;
12116           lodash.prototype.next = wrapperNext;
12117           lodash.prototype.plant = wrapperPlant;
12118           lodash.prototype.reverse = wrapperReverse;
12119           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
12120           lodash.prototype.first = lodash.prototype.head;
12121           if (symIterator) {
12122             lodash.prototype[symIterator] = wrapperToIterator;
12123           }
12124           return lodash;
12125         };
12126         var _ = runInContext();
12127         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
12128           root3._ = _;
12129           define(function() {
12130             return _;
12131           });
12132         } else if (freeModule) {
12133           (freeModule.exports = _)._ = _;
12134           freeExports._ = _;
12135         } else {
12136           root3._ = _;
12137         }
12138       }).call(exports2);
12139     }
12140   });
12141
12142   // node_modules/rbush/rbush.min.js
12143   var require_rbush_min = __commonJS({
12144     "node_modules/rbush/rbush.min.js"(exports2, module2) {
12145       !function(t, i2) {
12146         "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = i2() : "function" == typeof define && define.amd ? define(i2) : (t = t || self).RBush = i2();
12147       }(exports2, function() {
12148         "use strict";
12149         function t(t2, r2, e3, a2, h2) {
12150           !function t3(n3, r3, e4, a3, h3) {
12151             for (; a3 > e4; ) {
12152               if (a3 - e4 > 600) {
12153                 var o2 = a3 - e4 + 1, s2 = r3 - e4 + 1, l2 = Math.log(o2), f3 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f3 * (o2 - f3) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e4, Math.floor(r3 - s2 * f3 / o2 + u2)), c2 = Math.min(a3, Math.floor(r3 + (o2 - s2) * f3 / o2 + u2));
12154                 t3(n3, r3, m2, c2, h3);
12155               }
12156               var p2 = n3[r3], d2 = e4, x = a3;
12157               for (i2(n3, e4, r3), h3(n3[a3], p2) > 0 && i2(n3, e4, a3); d2 < x; ) {
12158                 for (i2(n3, d2, x), d2++, x--; h3(n3[d2], p2) < 0; )
12159                   d2++;
12160                 for (; h3(n3[x], p2) > 0; )
12161                   x--;
12162               }
12163               0 === h3(n3[e4], p2) ? i2(n3, e4, x) : i2(n3, ++x, a3), x <= r3 && (e4 = x + 1), r3 <= x && (a3 = x - 1);
12164             }
12165           }(t2, r2, e3 || 0, a2 || t2.length - 1, h2 || n2);
12166         }
12167         function i2(t2, i3, n3) {
12168           var r2 = t2[i3];
12169           t2[i3] = t2[n3], t2[n3] = r2;
12170         }
12171         function n2(t2, i3) {
12172           return t2 < i3 ? -1 : t2 > i3 ? 1 : 0;
12173         }
12174         var r = function(t2) {
12175           void 0 === t2 && (t2 = 9), this._maxEntries = Math.max(4, t2), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
12176         };
12177         function e(t2, i3, n3) {
12178           if (!n3)
12179             return i3.indexOf(t2);
12180           for (var r2 = 0; r2 < i3.length; r2++)
12181             if (n3(t2, i3[r2]))
12182               return r2;
12183           return -1;
12184         }
12185         function a(t2, i3) {
12186           h(t2, 0, t2.children.length, i3, t2);
12187         }
12188         function h(t2, i3, n3, r2, e3) {
12189           e3 || (e3 = p(null)), e3.minX = 1 / 0, e3.minY = 1 / 0, e3.maxX = -1 / 0, e3.maxY = -1 / 0;
12190           for (var a2 = i3; a2 < n3; a2++) {
12191             var h2 = t2.children[a2];
12192             o(e3, t2.leaf ? r2(h2) : h2);
12193           }
12194           return e3;
12195         }
12196         function o(t2, i3) {
12197           return t2.minX = Math.min(t2.minX, i3.minX), t2.minY = Math.min(t2.minY, i3.minY), t2.maxX = Math.max(t2.maxX, i3.maxX), t2.maxY = Math.max(t2.maxY, i3.maxY), t2;
12198         }
12199         function s(t2, i3) {
12200           return t2.minX - i3.minX;
12201         }
12202         function l(t2, i3) {
12203           return t2.minY - i3.minY;
12204         }
12205         function f2(t2) {
12206           return (t2.maxX - t2.minX) * (t2.maxY - t2.minY);
12207         }
12208         function u(t2) {
12209           return t2.maxX - t2.minX + (t2.maxY - t2.minY);
12210         }
12211         function m(t2, i3) {
12212           return t2.minX <= i3.minX && t2.minY <= i3.minY && i3.maxX <= t2.maxX && i3.maxY <= t2.maxY;
12213         }
12214         function c(t2, i3) {
12215           return i3.minX <= t2.maxX && i3.minY <= t2.maxY && i3.maxX >= t2.minX && i3.maxY >= t2.minY;
12216         }
12217         function p(t2) {
12218           return { children: t2, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
12219         }
12220         function d(i3, n3, r2, e3, a2) {
12221           for (var h2 = [n3, r2]; h2.length; )
12222             if (!((r2 = h2.pop()) - (n3 = h2.pop()) <= e3)) {
12223               var o2 = n3 + Math.ceil((r2 - n3) / e3 / 2) * e3;
12224               t(i3, o2, n3, r2, a2), h2.push(n3, o2, o2, r2);
12225             }
12226         }
12227         return r.prototype.all = function() {
12228           return this._all(this.data, []);
12229         }, r.prototype.search = function(t2) {
12230           var i3 = this.data, n3 = [];
12231           if (!c(t2, i3))
12232             return n3;
12233           for (var r2 = this.toBBox, e3 = []; i3; ) {
12234             for (var a2 = 0; a2 < i3.children.length; a2++) {
12235               var h2 = i3.children[a2], o2 = i3.leaf ? r2(h2) : h2;
12236               c(t2, o2) && (i3.leaf ? n3.push(h2) : m(t2, o2) ? this._all(h2, n3) : e3.push(h2));
12237             }
12238             i3 = e3.pop();
12239           }
12240           return n3;
12241         }, r.prototype.collides = function(t2) {
12242           var i3 = this.data;
12243           if (!c(t2, i3))
12244             return false;
12245           for (var n3 = []; i3; ) {
12246             for (var r2 = 0; r2 < i3.children.length; r2++) {
12247               var e3 = i3.children[r2], a2 = i3.leaf ? this.toBBox(e3) : e3;
12248               if (c(t2, a2)) {
12249                 if (i3.leaf || m(t2, a2))
12250                   return true;
12251                 n3.push(e3);
12252               }
12253             }
12254             i3 = n3.pop();
12255           }
12256           return false;
12257         }, r.prototype.load = function(t2) {
12258           if (!t2 || !t2.length)
12259             return this;
12260           if (t2.length < this._minEntries) {
12261             for (var i3 = 0; i3 < t2.length; i3++)
12262               this.insert(t2[i3]);
12263             return this;
12264           }
12265           var n3 = this._build(t2.slice(), 0, t2.length - 1, 0);
12266           if (this.data.children.length)
12267             if (this.data.height === n3.height)
12268               this._splitRoot(this.data, n3);
12269             else {
12270               if (this.data.height < n3.height) {
12271                 var r2 = this.data;
12272                 this.data = n3, n3 = r2;
12273               }
12274               this._insert(n3, this.data.height - n3.height - 1, true);
12275             }
12276           else
12277             this.data = n3;
12278           return this;
12279         }, r.prototype.insert = function(t2) {
12280           return t2 && this._insert(t2, this.data.height - 1), this;
12281         }, r.prototype.clear = function() {
12282           return this.data = p([]), this;
12283         }, r.prototype.remove = function(t2, i3) {
12284           if (!t2)
12285             return this;
12286           for (var n3, r2, a2, h2 = this.data, o2 = this.toBBox(t2), s2 = [], l2 = []; h2 || s2.length; ) {
12287             if (h2 || (h2 = s2.pop(), r2 = s2[s2.length - 1], n3 = l2.pop(), a2 = true), h2.leaf) {
12288               var f3 = e(t2, h2.children, i3);
12289               if (-1 !== f3)
12290                 return h2.children.splice(f3, 1), s2.push(h2), this._condense(s2), this;
12291             }
12292             a2 || h2.leaf || !m(h2, o2) ? r2 ? (n3++, h2 = r2.children[n3], a2 = false) : h2 = null : (s2.push(h2), l2.push(n3), n3 = 0, r2 = h2, h2 = h2.children[0]);
12293           }
12294           return this;
12295         }, r.prototype.toBBox = function(t2) {
12296           return t2;
12297         }, r.prototype.compareMinX = function(t2, i3) {
12298           return t2.minX - i3.minX;
12299         }, r.prototype.compareMinY = function(t2, i3) {
12300           return t2.minY - i3.minY;
12301         }, r.prototype.toJSON = function() {
12302           return this.data;
12303         }, r.prototype.fromJSON = function(t2) {
12304           return this.data = t2, this;
12305         }, r.prototype._all = function(t2, i3) {
12306           for (var n3 = []; t2; )
12307             t2.leaf ? i3.push.apply(i3, t2.children) : n3.push.apply(n3, t2.children), t2 = n3.pop();
12308           return i3;
12309         }, r.prototype._build = function(t2, i3, n3, r2) {
12310           var e3, h2 = n3 - i3 + 1, o2 = this._maxEntries;
12311           if (h2 <= o2)
12312             return a(e3 = p(t2.slice(i3, n3 + 1)), this.toBBox), e3;
12313           r2 || (r2 = Math.ceil(Math.log(h2) / Math.log(o2)), o2 = Math.ceil(h2 / Math.pow(o2, r2 - 1))), (e3 = p([])).leaf = false, e3.height = r2;
12314           var s2 = Math.ceil(h2 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
12315           d(t2, i3, n3, l2, this.compareMinX);
12316           for (var f3 = i3; f3 <= n3; f3 += l2) {
12317             var u2 = Math.min(f3 + l2 - 1, n3);
12318             d(t2, f3, u2, s2, this.compareMinY);
12319             for (var m2 = f3; m2 <= u2; m2 += s2) {
12320               var c2 = Math.min(m2 + s2 - 1, u2);
12321               e3.children.push(this._build(t2, m2, c2, r2 - 1));
12322             }
12323           }
12324           return a(e3, this.toBBox), e3;
12325         }, r.prototype._chooseSubtree = function(t2, i3, n3, r2) {
12326           for (; r2.push(i3), !i3.leaf && r2.length - 1 !== n3; ) {
12327             for (var e3 = 1 / 0, a2 = 1 / 0, h2 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
12328               var s2 = i3.children[o2], l2 = f2(s2), u2 = (m2 = t2, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
12329               u2 < a2 ? (a2 = u2, e3 = l2 < e3 ? l2 : e3, h2 = s2) : u2 === a2 && l2 < e3 && (e3 = l2, h2 = s2);
12330             }
12331             i3 = h2 || i3.children[0];
12332           }
12333           var m2, c2;
12334           return i3;
12335         }, r.prototype._insert = function(t2, i3, n3) {
12336           var r2 = n3 ? t2 : this.toBBox(t2), e3 = [], a2 = this._chooseSubtree(r2, this.data, i3, e3);
12337           for (a2.children.push(t2), o(a2, r2); i3 >= 0 && e3[i3].children.length > this._maxEntries; )
12338             this._split(e3, i3), i3--;
12339           this._adjustParentBBoxes(r2, e3, i3);
12340         }, r.prototype._split = function(t2, i3) {
12341           var n3 = t2[i3], r2 = n3.children.length, e3 = this._minEntries;
12342           this._chooseSplitAxis(n3, e3, r2);
12343           var h2 = this._chooseSplitIndex(n3, e3, r2), o2 = p(n3.children.splice(h2, n3.children.length - h2));
12344           o2.height = n3.height, o2.leaf = n3.leaf, a(n3, this.toBBox), a(o2, this.toBBox), i3 ? t2[i3 - 1].children.push(o2) : this._splitRoot(n3, o2);
12345         }, r.prototype._splitRoot = function(t2, i3) {
12346           this.data = p([t2, i3]), this.data.height = t2.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
12347         }, r.prototype._chooseSplitIndex = function(t2, i3, n3) {
12348           for (var r2, e3, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n3 - i3; p2++) {
12349             var d2 = h(t2, 0, p2, this.toBBox), x = h(t2, p2, n3, this.toBBox), v = (e3 = d2, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e3.minX, a2.minX), s2 = Math.max(e3.minY, a2.minY), l2 = Math.min(e3.maxX, a2.maxX), u2 = Math.min(e3.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f2(d2) + f2(x);
12350             v < m2 ? (m2 = v, r2 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r2 = p2);
12351           }
12352           return r2 || n3 - i3;
12353         }, r.prototype._chooseSplitAxis = function(t2, i3, n3) {
12354           var r2 = t2.leaf ? this.compareMinX : s, e3 = t2.leaf ? this.compareMinY : l;
12355           this._allDistMargin(t2, i3, n3, r2) < this._allDistMargin(t2, i3, n3, e3) && t2.children.sort(r2);
12356         }, r.prototype._allDistMargin = function(t2, i3, n3, r2) {
12357           t2.children.sort(r2);
12358           for (var e3 = this.toBBox, a2 = h(t2, 0, i3, e3), s2 = h(t2, n3 - i3, n3, e3), l2 = u(a2) + u(s2), f3 = i3; f3 < n3 - i3; f3++) {
12359             var m2 = t2.children[f3];
12360             o(a2, t2.leaf ? e3(m2) : m2), l2 += u(a2);
12361           }
12362           for (var c2 = n3 - i3 - 1; c2 >= i3; c2--) {
12363             var p2 = t2.children[c2];
12364             o(s2, t2.leaf ? e3(p2) : p2), l2 += u(s2);
12365           }
12366           return l2;
12367         }, r.prototype._adjustParentBBoxes = function(t2, i3, n3) {
12368           for (var r2 = n3; r2 >= 0; r2--)
12369             o(i3[r2], t2);
12370         }, r.prototype._condense = function(t2) {
12371           for (var i3 = t2.length - 1, n3 = void 0; i3 >= 0; i3--)
12372             0 === t2[i3].children.length ? i3 > 0 ? (n3 = t2[i3 - 1].children).splice(n3.indexOf(t2[i3]), 1) : this.clear() : a(t2[i3], this.toBBox);
12373         }, r;
12374       });
12375     }
12376   });
12377
12378   // node_modules/ieee754/index.js
12379   var require_ieee754 = __commonJS({
12380     "node_modules/ieee754/index.js"(exports2) {
12381       exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
12382         var e, m;
12383         var eLen = nBytes * 8 - mLen - 1;
12384         var eMax = (1 << eLen) - 1;
12385         var eBias = eMax >> 1;
12386         var nBits = -7;
12387         var i2 = isLE ? nBytes - 1 : 0;
12388         var d = isLE ? -1 : 1;
12389         var s = buffer[offset + i2];
12390         i2 += d;
12391         e = s & (1 << -nBits) - 1;
12392         s >>= -nBits;
12393         nBits += eLen;
12394         for (; nBits > 0; e = e * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12395         }
12396         m = e & (1 << -nBits) - 1;
12397         e >>= -nBits;
12398         nBits += mLen;
12399         for (; nBits > 0; m = m * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
12400         }
12401         if (e === 0) {
12402           e = 1 - eBias;
12403         } else if (e === eMax) {
12404           return m ? NaN : (s ? -1 : 1) * Infinity;
12405         } else {
12406           m = m + Math.pow(2, mLen);
12407           e = e - eBias;
12408         }
12409         return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
12410       };
12411       exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
12412         var e, m, c;
12413         var eLen = nBytes * 8 - mLen - 1;
12414         var eMax = (1 << eLen) - 1;
12415         var eBias = eMax >> 1;
12416         var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
12417         var i2 = isLE ? 0 : nBytes - 1;
12418         var d = isLE ? 1 : -1;
12419         var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
12420         value = Math.abs(value);
12421         if (isNaN(value) || value === Infinity) {
12422           m = isNaN(value) ? 1 : 0;
12423           e = eMax;
12424         } else {
12425           e = Math.floor(Math.log(value) / Math.LN2);
12426           if (value * (c = Math.pow(2, -e)) < 1) {
12427             e--;
12428             c *= 2;
12429           }
12430           if (e + eBias >= 1) {
12431             value += rt / c;
12432           } else {
12433             value += rt * Math.pow(2, 1 - eBias);
12434           }
12435           if (value * c >= 2) {
12436             e++;
12437             c /= 2;
12438           }
12439           if (e + eBias >= eMax) {
12440             m = 0;
12441             e = eMax;
12442           } else if (e + eBias >= 1) {
12443             m = (value * c - 1) * Math.pow(2, mLen);
12444             e = e + eBias;
12445           } else {
12446             m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
12447             e = 0;
12448           }
12449         }
12450         for (; mLen >= 8; buffer[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {
12451         }
12452         e = e << mLen | m;
12453         eLen += mLen;
12454         for (; eLen > 0; buffer[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
12455         }
12456         buffer[offset + i2 - d] |= s * 128;
12457       };
12458     }
12459   });
12460
12461   // node_modules/pbf/index.js
12462   var require_pbf = __commonJS({
12463     "node_modules/pbf/index.js"(exports2, module2) {
12464       "use strict";
12465       module2.exports = Pbf;
12466       var ieee754 = require_ieee754();
12467       function Pbf(buf) {
12468         this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
12469         this.pos = 0;
12470         this.type = 0;
12471         this.length = this.buf.length;
12472       }
12473       Pbf.Varint = 0;
12474       Pbf.Fixed64 = 1;
12475       Pbf.Bytes = 2;
12476       Pbf.Fixed32 = 5;
12477       var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
12478       var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
12479       var TEXT_DECODER_MIN_LENGTH = 12;
12480       var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
12481       Pbf.prototype = {
12482         destroy: function() {
12483           this.buf = null;
12484         },
12485         readFields: function(readField, result, end) {
12486           end = end || this.length;
12487           while (this.pos < end) {
12488             var val = this.readVarint(), tag = val >> 3, startPos = this.pos;
12489             this.type = val & 7;
12490             readField(tag, result, this);
12491             if (this.pos === startPos)
12492               this.skip(val);
12493           }
12494           return result;
12495         },
12496         readMessage: function(readField, result) {
12497           return this.readFields(readField, result, this.readVarint() + this.pos);
12498         },
12499         readFixed32: function() {
12500           var val = readUInt32(this.buf, this.pos);
12501           this.pos += 4;
12502           return val;
12503         },
12504         readSFixed32: function() {
12505           var val = readInt32(this.buf, this.pos);
12506           this.pos += 4;
12507           return val;
12508         },
12509         readFixed64: function() {
12510           var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12511           this.pos += 8;
12512           return val;
12513         },
12514         readSFixed64: function() {
12515           var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12516           this.pos += 8;
12517           return val;
12518         },
12519         readFloat: function() {
12520           var val = ieee754.read(this.buf, this.pos, true, 23, 4);
12521           this.pos += 4;
12522           return val;
12523         },
12524         readDouble: function() {
12525           var val = ieee754.read(this.buf, this.pos, true, 52, 8);
12526           this.pos += 8;
12527           return val;
12528         },
12529         readVarint: function(isSigned) {
12530           var buf = this.buf, val, b;
12531           b = buf[this.pos++];
12532           val = b & 127;
12533           if (b < 128)
12534             return val;
12535           b = buf[this.pos++];
12536           val |= (b & 127) << 7;
12537           if (b < 128)
12538             return val;
12539           b = buf[this.pos++];
12540           val |= (b & 127) << 14;
12541           if (b < 128)
12542             return val;
12543           b = buf[this.pos++];
12544           val |= (b & 127) << 21;
12545           if (b < 128)
12546             return val;
12547           b = buf[this.pos];
12548           val |= (b & 15) << 28;
12549           return readVarintRemainder(val, isSigned, this);
12550         },
12551         readVarint64: function() {
12552           return this.readVarint(true);
12553         },
12554         readSVarint: function() {
12555           var num = this.readVarint();
12556           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
12557         },
12558         readBoolean: function() {
12559           return Boolean(this.readVarint());
12560         },
12561         readString: function() {
12562           var end = this.readVarint() + this.pos;
12563           var pos = this.pos;
12564           this.pos = end;
12565           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
12566             return readUtf8TextDecoder(this.buf, pos, end);
12567           }
12568           return readUtf8(this.buf, pos, end);
12569         },
12570         readBytes: function() {
12571           var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
12572           this.pos = end;
12573           return buffer;
12574         },
12575         readPackedVarint: function(arr, isSigned) {
12576           if (this.type !== Pbf.Bytes)
12577             return arr.push(this.readVarint(isSigned));
12578           var end = readPackedEnd(this);
12579           arr = arr || [];
12580           while (this.pos < end)
12581             arr.push(this.readVarint(isSigned));
12582           return arr;
12583         },
12584         readPackedSVarint: function(arr) {
12585           if (this.type !== Pbf.Bytes)
12586             return arr.push(this.readSVarint());
12587           var end = readPackedEnd(this);
12588           arr = arr || [];
12589           while (this.pos < end)
12590             arr.push(this.readSVarint());
12591           return arr;
12592         },
12593         readPackedBoolean: function(arr) {
12594           if (this.type !== Pbf.Bytes)
12595             return arr.push(this.readBoolean());
12596           var end = readPackedEnd(this);
12597           arr = arr || [];
12598           while (this.pos < end)
12599             arr.push(this.readBoolean());
12600           return arr;
12601         },
12602         readPackedFloat: function(arr) {
12603           if (this.type !== Pbf.Bytes)
12604             return arr.push(this.readFloat());
12605           var end = readPackedEnd(this);
12606           arr = arr || [];
12607           while (this.pos < end)
12608             arr.push(this.readFloat());
12609           return arr;
12610         },
12611         readPackedDouble: function(arr) {
12612           if (this.type !== Pbf.Bytes)
12613             return arr.push(this.readDouble());
12614           var end = readPackedEnd(this);
12615           arr = arr || [];
12616           while (this.pos < end)
12617             arr.push(this.readDouble());
12618           return arr;
12619         },
12620         readPackedFixed32: function(arr) {
12621           if (this.type !== Pbf.Bytes)
12622             return arr.push(this.readFixed32());
12623           var end = readPackedEnd(this);
12624           arr = arr || [];
12625           while (this.pos < end)
12626             arr.push(this.readFixed32());
12627           return arr;
12628         },
12629         readPackedSFixed32: function(arr) {
12630           if (this.type !== Pbf.Bytes)
12631             return arr.push(this.readSFixed32());
12632           var end = readPackedEnd(this);
12633           arr = arr || [];
12634           while (this.pos < end)
12635             arr.push(this.readSFixed32());
12636           return arr;
12637         },
12638         readPackedFixed64: function(arr) {
12639           if (this.type !== Pbf.Bytes)
12640             return arr.push(this.readFixed64());
12641           var end = readPackedEnd(this);
12642           arr = arr || [];
12643           while (this.pos < end)
12644             arr.push(this.readFixed64());
12645           return arr;
12646         },
12647         readPackedSFixed64: function(arr) {
12648           if (this.type !== Pbf.Bytes)
12649             return arr.push(this.readSFixed64());
12650           var end = readPackedEnd(this);
12651           arr = arr || [];
12652           while (this.pos < end)
12653             arr.push(this.readSFixed64());
12654           return arr;
12655         },
12656         skip: function(val) {
12657           var type3 = val & 7;
12658           if (type3 === Pbf.Varint)
12659             while (this.buf[this.pos++] > 127) {
12660             }
12661           else if (type3 === Pbf.Bytes)
12662             this.pos = this.readVarint() + this.pos;
12663           else if (type3 === Pbf.Fixed32)
12664             this.pos += 4;
12665           else if (type3 === Pbf.Fixed64)
12666             this.pos += 8;
12667           else
12668             throw new Error("Unimplemented type: " + type3);
12669         },
12670         writeTag: function(tag, type3) {
12671           this.writeVarint(tag << 3 | type3);
12672         },
12673         realloc: function(min3) {
12674           var length = this.length || 16;
12675           while (length < this.pos + min3)
12676             length *= 2;
12677           if (length !== this.length) {
12678             var buf = new Uint8Array(length);
12679             buf.set(this.buf);
12680             this.buf = buf;
12681             this.length = length;
12682           }
12683         },
12684         finish: function() {
12685           this.length = this.pos;
12686           this.pos = 0;
12687           return this.buf.subarray(0, this.length);
12688         },
12689         writeFixed32: function(val) {
12690           this.realloc(4);
12691           writeInt32(this.buf, val, this.pos);
12692           this.pos += 4;
12693         },
12694         writeSFixed32: function(val) {
12695           this.realloc(4);
12696           writeInt32(this.buf, val, this.pos);
12697           this.pos += 4;
12698         },
12699         writeFixed64: function(val) {
12700           this.realloc(8);
12701           writeInt32(this.buf, val & -1, this.pos);
12702           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12703           this.pos += 8;
12704         },
12705         writeSFixed64: function(val) {
12706           this.realloc(8);
12707           writeInt32(this.buf, val & -1, this.pos);
12708           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12709           this.pos += 8;
12710         },
12711         writeVarint: function(val) {
12712           val = +val || 0;
12713           if (val > 268435455 || val < 0) {
12714             writeBigVarint(val, this);
12715             return;
12716           }
12717           this.realloc(4);
12718           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
12719           if (val <= 127)
12720             return;
12721           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12722           if (val <= 127)
12723             return;
12724           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12725           if (val <= 127)
12726             return;
12727           this.buf[this.pos++] = val >>> 7 & 127;
12728         },
12729         writeSVarint: function(val) {
12730           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
12731         },
12732         writeBoolean: function(val) {
12733           this.writeVarint(Boolean(val));
12734         },
12735         writeString: function(str2) {
12736           str2 = String(str2);
12737           this.realloc(str2.length * 4);
12738           this.pos++;
12739           var startPos = this.pos;
12740           this.pos = writeUtf8(this.buf, str2, this.pos);
12741           var len = this.pos - startPos;
12742           if (len >= 128)
12743             makeRoomForExtraLength(startPos, len, this);
12744           this.pos = startPos - 1;
12745           this.writeVarint(len);
12746           this.pos += len;
12747         },
12748         writeFloat: function(val) {
12749           this.realloc(4);
12750           ieee754.write(this.buf, val, this.pos, true, 23, 4);
12751           this.pos += 4;
12752         },
12753         writeDouble: function(val) {
12754           this.realloc(8);
12755           ieee754.write(this.buf, val, this.pos, true, 52, 8);
12756           this.pos += 8;
12757         },
12758         writeBytes: function(buffer) {
12759           var len = buffer.length;
12760           this.writeVarint(len);
12761           this.realloc(len);
12762           for (var i2 = 0; i2 < len; i2++)
12763             this.buf[this.pos++] = buffer[i2];
12764         },
12765         writeRawMessage: function(fn, obj) {
12766           this.pos++;
12767           var startPos = this.pos;
12768           fn(obj, this);
12769           var len = this.pos - startPos;
12770           if (len >= 128)
12771             makeRoomForExtraLength(startPos, len, this);
12772           this.pos = startPos - 1;
12773           this.writeVarint(len);
12774           this.pos += len;
12775         },
12776         writeMessage: function(tag, fn, obj) {
12777           this.writeTag(tag, Pbf.Bytes);
12778           this.writeRawMessage(fn, obj);
12779         },
12780         writePackedVarint: function(tag, arr) {
12781           if (arr.length)
12782             this.writeMessage(tag, writePackedVarint, arr);
12783         },
12784         writePackedSVarint: function(tag, arr) {
12785           if (arr.length)
12786             this.writeMessage(tag, writePackedSVarint, arr);
12787         },
12788         writePackedBoolean: function(tag, arr) {
12789           if (arr.length)
12790             this.writeMessage(tag, writePackedBoolean, arr);
12791         },
12792         writePackedFloat: function(tag, arr) {
12793           if (arr.length)
12794             this.writeMessage(tag, writePackedFloat, arr);
12795         },
12796         writePackedDouble: function(tag, arr) {
12797           if (arr.length)
12798             this.writeMessage(tag, writePackedDouble, arr);
12799         },
12800         writePackedFixed32: function(tag, arr) {
12801           if (arr.length)
12802             this.writeMessage(tag, writePackedFixed32, arr);
12803         },
12804         writePackedSFixed32: function(tag, arr) {
12805           if (arr.length)
12806             this.writeMessage(tag, writePackedSFixed32, arr);
12807         },
12808         writePackedFixed64: function(tag, arr) {
12809           if (arr.length)
12810             this.writeMessage(tag, writePackedFixed64, arr);
12811         },
12812         writePackedSFixed64: function(tag, arr) {
12813           if (arr.length)
12814             this.writeMessage(tag, writePackedSFixed64, arr);
12815         },
12816         writeBytesField: function(tag, buffer) {
12817           this.writeTag(tag, Pbf.Bytes);
12818           this.writeBytes(buffer);
12819         },
12820         writeFixed32Field: function(tag, val) {
12821           this.writeTag(tag, Pbf.Fixed32);
12822           this.writeFixed32(val);
12823         },
12824         writeSFixed32Field: function(tag, val) {
12825           this.writeTag(tag, Pbf.Fixed32);
12826           this.writeSFixed32(val);
12827         },
12828         writeFixed64Field: function(tag, val) {
12829           this.writeTag(tag, Pbf.Fixed64);
12830           this.writeFixed64(val);
12831         },
12832         writeSFixed64Field: function(tag, val) {
12833           this.writeTag(tag, Pbf.Fixed64);
12834           this.writeSFixed64(val);
12835         },
12836         writeVarintField: function(tag, val) {
12837           this.writeTag(tag, Pbf.Varint);
12838           this.writeVarint(val);
12839         },
12840         writeSVarintField: function(tag, val) {
12841           this.writeTag(tag, Pbf.Varint);
12842           this.writeSVarint(val);
12843         },
12844         writeStringField: function(tag, str2) {
12845           this.writeTag(tag, Pbf.Bytes);
12846           this.writeString(str2);
12847         },
12848         writeFloatField: function(tag, val) {
12849           this.writeTag(tag, Pbf.Fixed32);
12850           this.writeFloat(val);
12851         },
12852         writeDoubleField: function(tag, val) {
12853           this.writeTag(tag, Pbf.Fixed64);
12854           this.writeDouble(val);
12855         },
12856         writeBooleanField: function(tag, val) {
12857           this.writeVarintField(tag, Boolean(val));
12858         }
12859       };
12860       function readVarintRemainder(l, s, p) {
12861         var buf = p.buf, h, b;
12862         b = buf[p.pos++];
12863         h = (b & 112) >> 4;
12864         if (b < 128)
12865           return toNum(l, h, s);
12866         b = buf[p.pos++];
12867         h |= (b & 127) << 3;
12868         if (b < 128)
12869           return toNum(l, h, s);
12870         b = buf[p.pos++];
12871         h |= (b & 127) << 10;
12872         if (b < 128)
12873           return toNum(l, h, s);
12874         b = buf[p.pos++];
12875         h |= (b & 127) << 17;
12876         if (b < 128)
12877           return toNum(l, h, s);
12878         b = buf[p.pos++];
12879         h |= (b & 127) << 24;
12880         if (b < 128)
12881           return toNum(l, h, s);
12882         b = buf[p.pos++];
12883         h |= (b & 1) << 31;
12884         if (b < 128)
12885           return toNum(l, h, s);
12886         throw new Error("Expected varint not more than 10 bytes");
12887       }
12888       function readPackedEnd(pbf) {
12889         return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
12890       }
12891       function toNum(low, high, isSigned) {
12892         if (isSigned) {
12893           return high * 4294967296 + (low >>> 0);
12894         }
12895         return (high >>> 0) * 4294967296 + (low >>> 0);
12896       }
12897       function writeBigVarint(val, pbf) {
12898         var low, high;
12899         if (val >= 0) {
12900           low = val % 4294967296 | 0;
12901           high = val / 4294967296 | 0;
12902         } else {
12903           low = ~(-val % 4294967296);
12904           high = ~(-val / 4294967296);
12905           if (low ^ 4294967295) {
12906             low = low + 1 | 0;
12907           } else {
12908             low = 0;
12909             high = high + 1 | 0;
12910           }
12911         }
12912         if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
12913           throw new Error("Given varint doesn't fit into 10 bytes");
12914         }
12915         pbf.realloc(10);
12916         writeBigVarintLow(low, high, pbf);
12917         writeBigVarintHigh(high, pbf);
12918       }
12919       function writeBigVarintLow(low, high, pbf) {
12920         pbf.buf[pbf.pos++] = low & 127 | 128;
12921         low >>>= 7;
12922         pbf.buf[pbf.pos++] = low & 127 | 128;
12923         low >>>= 7;
12924         pbf.buf[pbf.pos++] = low & 127 | 128;
12925         low >>>= 7;
12926         pbf.buf[pbf.pos++] = low & 127 | 128;
12927         low >>>= 7;
12928         pbf.buf[pbf.pos] = low & 127;
12929       }
12930       function writeBigVarintHigh(high, pbf) {
12931         var lsb = (high & 7) << 4;
12932         pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
12933         if (!high)
12934           return;
12935         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12936         if (!high)
12937           return;
12938         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12939         if (!high)
12940           return;
12941         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12942         if (!high)
12943           return;
12944         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
12945         if (!high)
12946           return;
12947         pbf.buf[pbf.pos++] = high & 127;
12948       }
12949       function makeRoomForExtraLength(startPos, len, pbf) {
12950         var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
12951         pbf.realloc(extraLen);
12952         for (var i2 = pbf.pos - 1; i2 >= startPos; i2--)
12953           pbf.buf[i2 + extraLen] = pbf.buf[i2];
12954       }
12955       function writePackedVarint(arr, pbf) {
12956         for (var i2 = 0; i2 < arr.length; i2++)
12957           pbf.writeVarint(arr[i2]);
12958       }
12959       function writePackedSVarint(arr, pbf) {
12960         for (var i2 = 0; i2 < arr.length; i2++)
12961           pbf.writeSVarint(arr[i2]);
12962       }
12963       function writePackedFloat(arr, pbf) {
12964         for (var i2 = 0; i2 < arr.length; i2++)
12965           pbf.writeFloat(arr[i2]);
12966       }
12967       function writePackedDouble(arr, pbf) {
12968         for (var i2 = 0; i2 < arr.length; i2++)
12969           pbf.writeDouble(arr[i2]);
12970       }
12971       function writePackedBoolean(arr, pbf) {
12972         for (var i2 = 0; i2 < arr.length; i2++)
12973           pbf.writeBoolean(arr[i2]);
12974       }
12975       function writePackedFixed32(arr, pbf) {
12976         for (var i2 = 0; i2 < arr.length; i2++)
12977           pbf.writeFixed32(arr[i2]);
12978       }
12979       function writePackedSFixed32(arr, pbf) {
12980         for (var i2 = 0; i2 < arr.length; i2++)
12981           pbf.writeSFixed32(arr[i2]);
12982       }
12983       function writePackedFixed64(arr, pbf) {
12984         for (var i2 = 0; i2 < arr.length; i2++)
12985           pbf.writeFixed64(arr[i2]);
12986       }
12987       function writePackedSFixed64(arr, pbf) {
12988         for (var i2 = 0; i2 < arr.length; i2++)
12989           pbf.writeSFixed64(arr[i2]);
12990       }
12991       function readUInt32(buf, pos) {
12992         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
12993       }
12994       function writeInt32(buf, val, pos) {
12995         buf[pos] = val;
12996         buf[pos + 1] = val >>> 8;
12997         buf[pos + 2] = val >>> 16;
12998         buf[pos + 3] = val >>> 24;
12999       }
13000       function readInt32(buf, pos) {
13001         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
13002       }
13003       function readUtf8(buf, pos, end) {
13004         var str2 = "";
13005         var i2 = pos;
13006         while (i2 < end) {
13007           var b0 = buf[i2];
13008           var c = null;
13009           var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
13010           if (i2 + bytesPerSequence > end)
13011             break;
13012           var b1, b2, b3;
13013           if (bytesPerSequence === 1) {
13014             if (b0 < 128) {
13015               c = b0;
13016             }
13017           } else if (bytesPerSequence === 2) {
13018             b1 = buf[i2 + 1];
13019             if ((b1 & 192) === 128) {
13020               c = (b0 & 31) << 6 | b1 & 63;
13021               if (c <= 127) {
13022                 c = null;
13023               }
13024             }
13025           } else if (bytesPerSequence === 3) {
13026             b1 = buf[i2 + 1];
13027             b2 = buf[i2 + 2];
13028             if ((b1 & 192) === 128 && (b2 & 192) === 128) {
13029               c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
13030               if (c <= 2047 || c >= 55296 && c <= 57343) {
13031                 c = null;
13032               }
13033             }
13034           } else if (bytesPerSequence === 4) {
13035             b1 = buf[i2 + 1];
13036             b2 = buf[i2 + 2];
13037             b3 = buf[i2 + 3];
13038             if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
13039               c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
13040               if (c <= 65535 || c >= 1114112) {
13041                 c = null;
13042               }
13043             }
13044           }
13045           if (c === null) {
13046             c = 65533;
13047             bytesPerSequence = 1;
13048           } else if (c > 65535) {
13049             c -= 65536;
13050             str2 += String.fromCharCode(c >>> 10 & 1023 | 55296);
13051             c = 56320 | c & 1023;
13052           }
13053           str2 += String.fromCharCode(c);
13054           i2 += bytesPerSequence;
13055         }
13056         return str2;
13057       }
13058       function readUtf8TextDecoder(buf, pos, end) {
13059         return utf8TextDecoder.decode(buf.subarray(pos, end));
13060       }
13061       function writeUtf8(buf, str2, pos) {
13062         for (var i2 = 0, c, lead; i2 < str2.length; i2++) {
13063           c = str2.charCodeAt(i2);
13064           if (c > 55295 && c < 57344) {
13065             if (lead) {
13066               if (c < 56320) {
13067                 buf[pos++] = 239;
13068                 buf[pos++] = 191;
13069                 buf[pos++] = 189;
13070                 lead = c;
13071                 continue;
13072               } else {
13073                 c = lead - 55296 << 10 | c - 56320 | 65536;
13074                 lead = null;
13075               }
13076             } else {
13077               if (c > 56319 || i2 + 1 === str2.length) {
13078                 buf[pos++] = 239;
13079                 buf[pos++] = 191;
13080                 buf[pos++] = 189;
13081               } else {
13082                 lead = c;
13083               }
13084               continue;
13085             }
13086           } else if (lead) {
13087             buf[pos++] = 239;
13088             buf[pos++] = 191;
13089             buf[pos++] = 189;
13090             lead = null;
13091           }
13092           if (c < 128) {
13093             buf[pos++] = c;
13094           } else {
13095             if (c < 2048) {
13096               buf[pos++] = c >> 6 | 192;
13097             } else {
13098               if (c < 65536) {
13099                 buf[pos++] = c >> 12 | 224;
13100               } else {
13101                 buf[pos++] = c >> 18 | 240;
13102                 buf[pos++] = c >> 12 & 63 | 128;
13103               }
13104               buf[pos++] = c >> 6 & 63 | 128;
13105             }
13106             buf[pos++] = c & 63 | 128;
13107           }
13108         }
13109         return pos;
13110       }
13111     }
13112   });
13113
13114   // node_modules/@mapbox/point-geometry/index.js
13115   var require_point_geometry = __commonJS({
13116     "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
13117       "use strict";
13118       module2.exports = Point;
13119       function Point(x, y) {
13120         this.x = x;
13121         this.y = y;
13122       }
13123       Point.prototype = {
13124         clone: function() {
13125           return new Point(this.x, this.y);
13126         },
13127         add: function(p) {
13128           return this.clone()._add(p);
13129         },
13130         sub: function(p) {
13131           return this.clone()._sub(p);
13132         },
13133         multByPoint: function(p) {
13134           return this.clone()._multByPoint(p);
13135         },
13136         divByPoint: function(p) {
13137           return this.clone()._divByPoint(p);
13138         },
13139         mult: function(k) {
13140           return this.clone()._mult(k);
13141         },
13142         div: function(k) {
13143           return this.clone()._div(k);
13144         },
13145         rotate: function(a) {
13146           return this.clone()._rotate(a);
13147         },
13148         rotateAround: function(a, p) {
13149           return this.clone()._rotateAround(a, p);
13150         },
13151         matMult: function(m) {
13152           return this.clone()._matMult(m);
13153         },
13154         unit: function() {
13155           return this.clone()._unit();
13156         },
13157         perp: function() {
13158           return this.clone()._perp();
13159         },
13160         round: function() {
13161           return this.clone()._round();
13162         },
13163         mag: function() {
13164           return Math.sqrt(this.x * this.x + this.y * this.y);
13165         },
13166         equals: function(other) {
13167           return this.x === other.x && this.y === other.y;
13168         },
13169         dist: function(p) {
13170           return Math.sqrt(this.distSqr(p));
13171         },
13172         distSqr: function(p) {
13173           var dx = p.x - this.x, dy = p.y - this.y;
13174           return dx * dx + dy * dy;
13175         },
13176         angle: function() {
13177           return Math.atan2(this.y, this.x);
13178         },
13179         angleTo: function(b) {
13180           return Math.atan2(this.y - b.y, this.x - b.x);
13181         },
13182         angleWith: function(b) {
13183           return this.angleWithSep(b.x, b.y);
13184         },
13185         angleWithSep: function(x, y) {
13186           return Math.atan2(
13187             this.x * y - this.y * x,
13188             this.x * x + this.y * y
13189           );
13190         },
13191         _matMult: function(m) {
13192           var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
13193           this.x = x;
13194           this.y = y;
13195           return this;
13196         },
13197         _add: function(p) {
13198           this.x += p.x;
13199           this.y += p.y;
13200           return this;
13201         },
13202         _sub: function(p) {
13203           this.x -= p.x;
13204           this.y -= p.y;
13205           return this;
13206         },
13207         _mult: function(k) {
13208           this.x *= k;
13209           this.y *= k;
13210           return this;
13211         },
13212         _div: function(k) {
13213           this.x /= k;
13214           this.y /= k;
13215           return this;
13216         },
13217         _multByPoint: function(p) {
13218           this.x *= p.x;
13219           this.y *= p.y;
13220           return this;
13221         },
13222         _divByPoint: function(p) {
13223           this.x /= p.x;
13224           this.y /= p.y;
13225           return this;
13226         },
13227         _unit: function() {
13228           this._div(this.mag());
13229           return this;
13230         },
13231         _perp: function() {
13232           var y = this.y;
13233           this.y = this.x;
13234           this.x = -y;
13235           return this;
13236         },
13237         _rotate: function(angle2) {
13238           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x = cos2 * this.x - sin2 * this.y, y = sin2 * this.x + cos2 * this.y;
13239           this.x = x;
13240           this.y = y;
13241           return this;
13242         },
13243         _rotateAround: function(angle2, p) {
13244           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x = p.x + cos2 * (this.x - p.x) - sin2 * (this.y - p.y), y = p.y + sin2 * (this.x - p.x) + cos2 * (this.y - p.y);
13245           this.x = x;
13246           this.y = y;
13247           return this;
13248         },
13249         _round: function() {
13250           this.x = Math.round(this.x);
13251           this.y = Math.round(this.y);
13252           return this;
13253         }
13254       };
13255       Point.convert = function(a) {
13256         if (a instanceof Point) {
13257           return a;
13258         }
13259         if (Array.isArray(a)) {
13260           return new Point(a[0], a[1]);
13261         }
13262         return a;
13263       };
13264     }
13265   });
13266
13267   // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
13268   var require_vectortilefeature = __commonJS({
13269     "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
13270       "use strict";
13271       var Point = require_point_geometry();
13272       module2.exports = VectorTileFeature;
13273       function VectorTileFeature(pbf, end, extent, keys, values) {
13274         this.properties = {};
13275         this.extent = extent;
13276         this.type = 0;
13277         this._pbf = pbf;
13278         this._geometry = -1;
13279         this._keys = keys;
13280         this._values = values;
13281         pbf.readFields(readFeature, this, end);
13282       }
13283       function readFeature(tag, feature3, pbf) {
13284         if (tag == 1)
13285           feature3.id = pbf.readVarint();
13286         else if (tag == 2)
13287           readTag(pbf, feature3);
13288         else if (tag == 3)
13289           feature3.type = pbf.readVarint();
13290         else if (tag == 4)
13291           feature3._geometry = pbf.pos;
13292       }
13293       function readTag(pbf, feature3) {
13294         var end = pbf.readVarint() + pbf.pos;
13295         while (pbf.pos < end) {
13296           var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
13297           feature3.properties[key] = value;
13298         }
13299       }
13300       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
13301       VectorTileFeature.prototype.loadGeometry = function() {
13302         var pbf = this._pbf;
13303         pbf.pos = this._geometry;
13304         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, lines = [], line;
13305         while (pbf.pos < end) {
13306           if (length <= 0) {
13307             var cmdLen = pbf.readVarint();
13308             cmd = cmdLen & 7;
13309             length = cmdLen >> 3;
13310           }
13311           length--;
13312           if (cmd === 1 || cmd === 2) {
13313             x += pbf.readSVarint();
13314             y += pbf.readSVarint();
13315             if (cmd === 1) {
13316               if (line)
13317                 lines.push(line);
13318               line = [];
13319             }
13320             line.push(new Point(x, y));
13321           } else if (cmd === 7) {
13322             if (line) {
13323               line.push(line[0].clone());
13324             }
13325           } else {
13326             throw new Error("unknown command " + cmd);
13327           }
13328         }
13329         if (line)
13330           lines.push(line);
13331         return lines;
13332       };
13333       VectorTileFeature.prototype.bbox = function() {
13334         var pbf = this._pbf;
13335         pbf.pos = this._geometry;
13336         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x = 0, y = 0, x12 = Infinity, x2 = -Infinity, y12 = Infinity, y2 = -Infinity;
13337         while (pbf.pos < end) {
13338           if (length <= 0) {
13339             var cmdLen = pbf.readVarint();
13340             cmd = cmdLen & 7;
13341             length = cmdLen >> 3;
13342           }
13343           length--;
13344           if (cmd === 1 || cmd === 2) {
13345             x += pbf.readSVarint();
13346             y += pbf.readSVarint();
13347             if (x < x12)
13348               x12 = x;
13349             if (x > x2)
13350               x2 = x;
13351             if (y < y12)
13352               y12 = y;
13353             if (y > y2)
13354               y2 = y;
13355           } else if (cmd !== 7) {
13356             throw new Error("unknown command " + cmd);
13357           }
13358         }
13359         return [x12, y12, x2, y2];
13360       };
13361       VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
13362         var size = this.extent * Math.pow(2, z), x05 = this.extent * x, y05 = this.extent * y, coords = this.loadGeometry(), type3 = VectorTileFeature.types[this.type], i2, j2;
13363         function project(line) {
13364           for (var j3 = 0; j3 < line.length; j3++) {
13365             var p = line[j3], y2 = 180 - (p.y + y05) * 360 / size;
13366             line[j3] = [
13367               (p.x + x05) * 360 / size - 180,
13368               360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90
13369             ];
13370           }
13371         }
13372         switch (this.type) {
13373           case 1:
13374             var points = [];
13375             for (i2 = 0; i2 < coords.length; i2++) {
13376               points[i2] = coords[i2][0];
13377             }
13378             coords = points;
13379             project(coords);
13380             break;
13381           case 2:
13382             for (i2 = 0; i2 < coords.length; i2++) {
13383               project(coords[i2]);
13384             }
13385             break;
13386           case 3:
13387             coords = classifyRings(coords);
13388             for (i2 = 0; i2 < coords.length; i2++) {
13389               for (j2 = 0; j2 < coords[i2].length; j2++) {
13390                 project(coords[i2][j2]);
13391               }
13392             }
13393             break;
13394         }
13395         if (coords.length === 1) {
13396           coords = coords[0];
13397         } else {
13398           type3 = "Multi" + type3;
13399         }
13400         var result = {
13401           type: "Feature",
13402           geometry: {
13403             type: type3,
13404             coordinates: coords
13405           },
13406           properties: this.properties
13407         };
13408         if ("id" in this) {
13409           result.id = this.id;
13410         }
13411         return result;
13412       };
13413       function classifyRings(rings) {
13414         var len = rings.length;
13415         if (len <= 1)
13416           return [rings];
13417         var polygons = [], polygon2, ccw;
13418         for (var i2 = 0; i2 < len; i2++) {
13419           var area = signedArea(rings[i2]);
13420           if (area === 0)
13421             continue;
13422           if (ccw === void 0)
13423             ccw = area < 0;
13424           if (ccw === area < 0) {
13425             if (polygon2)
13426               polygons.push(polygon2);
13427             polygon2 = [rings[i2]];
13428           } else {
13429             polygon2.push(rings[i2]);
13430           }
13431         }
13432         if (polygon2)
13433           polygons.push(polygon2);
13434         return polygons;
13435       }
13436       function signedArea(ring) {
13437         var sum = 0;
13438         for (var i2 = 0, len = ring.length, j2 = len - 1, p1, p2; i2 < len; j2 = i2++) {
13439           p1 = ring[i2];
13440           p2 = ring[j2];
13441           sum += (p2.x - p1.x) * (p1.y + p2.y);
13442         }
13443         return sum;
13444       }
13445     }
13446   });
13447
13448   // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
13449   var require_vectortilelayer = __commonJS({
13450     "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
13451       "use strict";
13452       var VectorTileFeature = require_vectortilefeature();
13453       module2.exports = VectorTileLayer;
13454       function VectorTileLayer(pbf, end) {
13455         this.version = 1;
13456         this.name = null;
13457         this.extent = 4096;
13458         this.length = 0;
13459         this._pbf = pbf;
13460         this._keys = [];
13461         this._values = [];
13462         this._features = [];
13463         pbf.readFields(readLayer, this, end);
13464         this.length = this._features.length;
13465       }
13466       function readLayer(tag, layer, pbf) {
13467         if (tag === 15)
13468           layer.version = pbf.readVarint();
13469         else if (tag === 1)
13470           layer.name = pbf.readString();
13471         else if (tag === 5)
13472           layer.extent = pbf.readVarint();
13473         else if (tag === 2)
13474           layer._features.push(pbf.pos);
13475         else if (tag === 3)
13476           layer._keys.push(pbf.readString());
13477         else if (tag === 4)
13478           layer._values.push(readValueMessage(pbf));
13479       }
13480       function readValueMessage(pbf) {
13481         var value = null, end = pbf.readVarint() + pbf.pos;
13482         while (pbf.pos < end) {
13483           var tag = pbf.readVarint() >> 3;
13484           value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
13485         }
13486         return value;
13487       }
13488       VectorTileLayer.prototype.feature = function(i2) {
13489         if (i2 < 0 || i2 >= this._features.length)
13490           throw new Error("feature index out of bounds");
13491         this._pbf.pos = this._features[i2];
13492         var end = this._pbf.readVarint() + this._pbf.pos;
13493         return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
13494       };
13495     }
13496   });
13497
13498   // node_modules/@mapbox/vector-tile/lib/vectortile.js
13499   var require_vectortile = __commonJS({
13500     "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
13501       "use strict";
13502       var VectorTileLayer = require_vectortilelayer();
13503       module2.exports = VectorTile2;
13504       function VectorTile2(pbf, end) {
13505         this.layers = pbf.readFields(readTile, {}, end);
13506       }
13507       function readTile(tag, layers, pbf) {
13508         if (tag === 3) {
13509           var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
13510           if (layer.length)
13511             layers[layer.name] = layer;
13512         }
13513       }
13514     }
13515   });
13516
13517   // node_modules/@mapbox/vector-tile/index.js
13518   var require_vector_tile = __commonJS({
13519     "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
13520       module2.exports.VectorTile = require_vectortile();
13521       module2.exports.VectorTileFeature = require_vectortilefeature();
13522       module2.exports.VectorTileLayer = require_vectortilelayer();
13523     }
13524   });
13525
13526   // node_modules/fast-json-stable-stringify/index.js
13527   var require_fast_json_stable_stringify = __commonJS({
13528     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
13529       "use strict";
13530       module2.exports = function(data, opts) {
13531         if (!opts)
13532           opts = {};
13533         if (typeof opts === "function")
13534           opts = { cmp: opts };
13535         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
13536         var cmp = opts.cmp && function(f2) {
13537           return function(node) {
13538             return function(a, b) {
13539               var aobj = { key: a, value: node[a] };
13540               var bobj = { key: b, value: node[b] };
13541               return f2(aobj, bobj);
13542             };
13543           };
13544         }(opts.cmp);
13545         var seen = [];
13546         return function stringify3(node) {
13547           if (node && node.toJSON && typeof node.toJSON === "function") {
13548             node = node.toJSON();
13549           }
13550           if (node === void 0)
13551             return;
13552           if (typeof node == "number")
13553             return isFinite(node) ? "" + node : "null";
13554           if (typeof node !== "object")
13555             return JSON.stringify(node);
13556           var i2, out;
13557           if (Array.isArray(node)) {
13558             out = "[";
13559             for (i2 = 0; i2 < node.length; i2++) {
13560               if (i2)
13561                 out += ",";
13562               out += stringify3(node[i2]) || "null";
13563             }
13564             return out + "]";
13565           }
13566           if (node === null)
13567             return "null";
13568           if (seen.indexOf(node) !== -1) {
13569             if (cycles)
13570               return JSON.stringify("__cycle__");
13571             throw new TypeError("Converting circular structure to JSON");
13572           }
13573           var seenIndex = seen.push(node) - 1;
13574           var keys = Object.keys(node).sort(cmp && cmp(node));
13575           out = "";
13576           for (i2 = 0; i2 < keys.length; i2++) {
13577             var key = keys[i2];
13578             var value = stringify3(node[key]);
13579             if (!value)
13580               continue;
13581             if (out)
13582               out += ",";
13583             out += JSON.stringify(key) + ":" + value;
13584           }
13585           seen.splice(seenIndex, 1);
13586           return "{" + out + "}";
13587         }(data);
13588       };
13589     }
13590   });
13591
13592   // node_modules/@mapbox/sexagesimal/index.js
13593   var require_sexagesimal = __commonJS({
13594     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
13595       module2.exports = element;
13596       module2.exports.pair = pair2;
13597       module2.exports.format = format2;
13598       module2.exports.formatPair = formatPair;
13599       module2.exports.coordToDMS = coordToDMS;
13600       function element(input, dims) {
13601         var result = search(input, dims);
13602         return result === null ? null : result.val;
13603       }
13604       function formatPair(input) {
13605         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
13606       }
13607       function format2(input, dim) {
13608         var dms = coordToDMS(input, dim);
13609         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
13610       }
13611       function coordToDMS(input, dim) {
13612         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
13613         var dir = dirs[input >= 0 ? 0 : 1];
13614         var abs3 = Math.abs(input);
13615         var whole = Math.floor(abs3);
13616         var fraction = abs3 - whole;
13617         var fractionMinutes = fraction * 60;
13618         var minutes = Math.floor(fractionMinutes);
13619         var seconds = Math.floor((fractionMinutes - minutes) * 60);
13620         return {
13621           whole,
13622           minutes,
13623           seconds,
13624           dir
13625         };
13626       }
13627       function search(input, dims) {
13628         if (!dims)
13629           dims = "NSEW";
13630         if (typeof input !== "string")
13631           return null;
13632         input = input.toUpperCase();
13633         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
13634         var m = input.match(regex);
13635         if (!m)
13636           return null;
13637         var matched = m[0];
13638         var dim;
13639         if (m[1] && m[5]) {
13640           dim = m[1];
13641           matched = matched.slice(0, -1);
13642         } else {
13643           dim = m[1] || m[5];
13644         }
13645         if (dim && dims.indexOf(dim) === -1)
13646           return null;
13647         var deg = m[2] ? parseFloat(m[2]) : 0;
13648         var min3 = m[3] ? parseFloat(m[3]) / 60 : 0;
13649         var sec = m[4] ? parseFloat(m[4]) / 3600 : 0;
13650         var sign2 = deg < 0 ? -1 : 1;
13651         if (dim === "S" || dim === "W")
13652           sign2 *= -1;
13653         return {
13654           val: (Math.abs(deg) + min3 + sec) * sign2,
13655           dim,
13656           matched,
13657           remain: input.slice(matched.length)
13658         };
13659       }
13660       function pair2(input, dims) {
13661         input = input.trim();
13662         var one2 = search(input, dims);
13663         if (!one2)
13664           return null;
13665         input = one2.remain.trim();
13666         var two = search(input, dims);
13667         if (!two || two.remain)
13668           return null;
13669         if (one2.dim) {
13670           return swapdim(one2.val, two.val, one2.dim);
13671         } else {
13672           return [one2.val, two.val];
13673         }
13674       }
13675       function swapdim(a, b, dim) {
13676         if (dim === "N" || dim === "S")
13677           return [a, b];
13678         if (dim === "W" || dim === "E")
13679           return [b, a];
13680       }
13681     }
13682   });
13683
13684   // node_modules/store/src/util.js
13685   var require_util = __commonJS({
13686     "node_modules/store/src/util.js"(exports2, module2) {
13687       var assign = make_assign();
13688       var create2 = make_create();
13689       var trim = make_trim();
13690       var Global = typeof window !== "undefined" ? window : global;
13691       module2.exports = {
13692         assign,
13693         create: create2,
13694         trim,
13695         bind,
13696         slice,
13697         each,
13698         map: map2,
13699         pluck,
13700         isList,
13701         isFunction,
13702         isObject: isObject2,
13703         Global
13704       };
13705       function make_assign() {
13706         if (Object.assign) {
13707           return Object.assign;
13708         } else {
13709           return function shimAssign(obj, props1, props2, etc) {
13710             for (var i2 = 1; i2 < arguments.length; i2++) {
13711               each(Object(arguments[i2]), function(val, key) {
13712                 obj[key] = val;
13713               });
13714             }
13715             return obj;
13716           };
13717         }
13718       }
13719       function make_create() {
13720         if (Object.create) {
13721           return function create3(obj, assignProps1, assignProps2, etc) {
13722             var assignArgsList = slice(arguments, 1);
13723             return assign.apply(this, [Object.create(obj)].concat(assignArgsList));
13724           };
13725         } else {
13726           let F2 = function() {
13727           };
13728           var F = F2;
13729           return function create3(obj, assignProps1, assignProps2, etc) {
13730             var assignArgsList = slice(arguments, 1);
13731             F2.prototype = obj;
13732             return assign.apply(this, [new F2()].concat(assignArgsList));
13733           };
13734         }
13735       }
13736       function make_trim() {
13737         if (String.prototype.trim) {
13738           return function trim2(str2) {
13739             return String.prototype.trim.call(str2);
13740           };
13741         } else {
13742           return function trim2(str2) {
13743             return str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
13744           };
13745         }
13746       }
13747       function bind(obj, fn) {
13748         return function() {
13749           return fn.apply(obj, Array.prototype.slice.call(arguments, 0));
13750         };
13751       }
13752       function slice(arr, index) {
13753         return Array.prototype.slice.call(arr, index || 0);
13754       }
13755       function each(obj, fn) {
13756         pluck(obj, function(val, key) {
13757           fn(val, key);
13758           return false;
13759         });
13760       }
13761       function map2(obj, fn) {
13762         var res = isList(obj) ? [] : {};
13763         pluck(obj, function(v, k) {
13764           res[k] = fn(v, k);
13765           return false;
13766         });
13767         return res;
13768       }
13769       function pluck(obj, fn) {
13770         if (isList(obj)) {
13771           for (var i2 = 0; i2 < obj.length; i2++) {
13772             if (fn(obj[i2], i2)) {
13773               return obj[i2];
13774             }
13775           }
13776         } else {
13777           for (var key in obj) {
13778             if (obj.hasOwnProperty(key)) {
13779               if (fn(obj[key], key)) {
13780                 return obj[key];
13781               }
13782             }
13783           }
13784         }
13785       }
13786       function isList(val) {
13787         return val != null && typeof val != "function" && typeof val.length == "number";
13788       }
13789       function isFunction(val) {
13790         return val && {}.toString.call(val) === "[object Function]";
13791       }
13792       function isObject2(val) {
13793         return val && {}.toString.call(val) === "[object Object]";
13794       }
13795     }
13796   });
13797
13798   // node_modules/store/src/store-engine.js
13799   var require_store_engine = __commonJS({
13800     "node_modules/store/src/store-engine.js"(exports2, module2) {
13801       var util = require_util();
13802       var slice = util.slice;
13803       var pluck = util.pluck;
13804       var each = util.each;
13805       var bind = util.bind;
13806       var create2 = util.create;
13807       var isList = util.isList;
13808       var isFunction = util.isFunction;
13809       var isObject2 = util.isObject;
13810       module2.exports = {
13811         createStore
13812       };
13813       var storeAPI = {
13814         version: "2.0.12",
13815         enabled: false,
13816         get: function(key, optionalDefaultValue) {
13817           var data = this.storage.read(this._namespacePrefix + key);
13818           return this._deserialize(data, optionalDefaultValue);
13819         },
13820         set: function(key, value) {
13821           if (value === void 0) {
13822             return this.remove(key);
13823           }
13824           this.storage.write(this._namespacePrefix + key, this._serialize(value));
13825           return value;
13826         },
13827         remove: function(key) {
13828           this.storage.remove(this._namespacePrefix + key);
13829         },
13830         each: function(callback) {
13831           var self2 = this;
13832           this.storage.each(function(val, namespacedKey) {
13833             callback.call(self2, self2._deserialize(val), (namespacedKey || "").replace(self2._namespaceRegexp, ""));
13834           });
13835         },
13836         clearAll: function() {
13837           this.storage.clearAll();
13838         },
13839         hasNamespace: function(namespace) {
13840           return this._namespacePrefix == "__storejs_" + namespace + "_";
13841         },
13842         createStore: function() {
13843           return createStore.apply(this, arguments);
13844         },
13845         addPlugin: function(plugin) {
13846           this._addPlugin(plugin);
13847         },
13848         namespace: function(namespace) {
13849           return createStore(this.storage, this.plugins, namespace);
13850         }
13851       };
13852       function _warn() {
13853         var _console = typeof console == "undefined" ? null : console;
13854         if (!_console) {
13855           return;
13856         }
13857         var fn = _console.warn ? _console.warn : _console.log;
13858         fn.apply(_console, arguments);
13859       }
13860       function createStore(storages, plugins, namespace) {
13861         if (!namespace) {
13862           namespace = "";
13863         }
13864         if (storages && !isList(storages)) {
13865           storages = [storages];
13866         }
13867         if (plugins && !isList(plugins)) {
13868           plugins = [plugins];
13869         }
13870         var namespacePrefix = namespace ? "__storejs_" + namespace + "_" : "";
13871         var namespaceRegexp = namespace ? new RegExp("^" + namespacePrefix) : null;
13872         var legalNamespaces = /^[a-zA-Z0-9_\-]*$/;
13873         if (!legalNamespaces.test(namespace)) {
13874           throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");
13875         }
13876         var _privateStoreProps = {
13877           _namespacePrefix: namespacePrefix,
13878           _namespaceRegexp: namespaceRegexp,
13879           _testStorage: function(storage) {
13880             try {
13881               var testStr = "__storejs__test__";
13882               storage.write(testStr, testStr);
13883               var ok = storage.read(testStr) === testStr;
13884               storage.remove(testStr);
13885               return ok;
13886             } catch (e) {
13887               return false;
13888             }
13889           },
13890           _assignPluginFnProp: function(pluginFnProp, propName) {
13891             var oldFn = this[propName];
13892             this[propName] = function pluginFn() {
13893               var args = slice(arguments, 0);
13894               var self2 = this;
13895               function super_fn() {
13896                 if (!oldFn) {
13897                   return;
13898                 }
13899                 each(arguments, function(arg, i2) {
13900                   args[i2] = arg;
13901                 });
13902                 return oldFn.apply(self2, args);
13903               }
13904               var newFnArgs = [super_fn].concat(args);
13905               return pluginFnProp.apply(self2, newFnArgs);
13906             };
13907           },
13908           _serialize: function(obj) {
13909             return JSON.stringify(obj);
13910           },
13911           _deserialize: function(strVal, defaultVal) {
13912             if (!strVal) {
13913               return defaultVal;
13914             }
13915             var val = "";
13916             try {
13917               val = JSON.parse(strVal);
13918             } catch (e) {
13919               val = strVal;
13920             }
13921             return val !== void 0 ? val : defaultVal;
13922           },
13923           _addStorage: function(storage) {
13924             if (this.enabled) {
13925               return;
13926             }
13927             if (this._testStorage(storage)) {
13928               this.storage = storage;
13929               this.enabled = true;
13930             }
13931           },
13932           _addPlugin: function(plugin) {
13933             var self2 = this;
13934             if (isList(plugin)) {
13935               each(plugin, function(plugin2) {
13936                 self2._addPlugin(plugin2);
13937               });
13938               return;
13939             }
13940             var seenPlugin = pluck(this.plugins, function(seenPlugin2) {
13941               return plugin === seenPlugin2;
13942             });
13943             if (seenPlugin) {
13944               return;
13945             }
13946             this.plugins.push(plugin);
13947             if (!isFunction(plugin)) {
13948               throw new Error("Plugins must be function values that return objects");
13949             }
13950             var pluginProperties = plugin.call(this);
13951             if (!isObject2(pluginProperties)) {
13952               throw new Error("Plugins must return an object of function properties");
13953             }
13954             each(pluginProperties, function(pluginFnProp, propName) {
13955               if (!isFunction(pluginFnProp)) {
13956                 throw new Error("Bad plugin property: " + propName + " from plugin " + plugin.name + ". Plugins should only return functions.");
13957               }
13958               self2._assignPluginFnProp(pluginFnProp, propName);
13959             });
13960           },
13961           addStorage: function(storage) {
13962             _warn("store.addStorage(storage) is deprecated. Use createStore([storages])");
13963             this._addStorage(storage);
13964           }
13965         };
13966         var store2 = create2(_privateStoreProps, storeAPI, {
13967           plugins: []
13968         });
13969         store2.raw = {};
13970         each(store2, function(prop, propName) {
13971           if (isFunction(prop)) {
13972             store2.raw[propName] = bind(store2, prop);
13973           }
13974         });
13975         each(storages, function(storage) {
13976           store2._addStorage(storage);
13977         });
13978         each(plugins, function(plugin) {
13979           store2._addPlugin(plugin);
13980         });
13981         return store2;
13982       }
13983     }
13984   });
13985
13986   // node_modules/store/storages/localStorage.js
13987   var require_localStorage = __commonJS({
13988     "node_modules/store/storages/localStorage.js"(exports2, module2) {
13989       var util = require_util();
13990       var Global = util.Global;
13991       module2.exports = {
13992         name: "localStorage",
13993         read,
13994         write,
13995         each,
13996         remove: remove2,
13997         clearAll
13998       };
13999       function localStorage2() {
14000         return Global.localStorage;
14001       }
14002       function read(key) {
14003         return localStorage2().getItem(key);
14004       }
14005       function write(key, data) {
14006         return localStorage2().setItem(key, data);
14007       }
14008       function each(fn) {
14009         for (var i2 = localStorage2().length - 1; i2 >= 0; i2--) {
14010           var key = localStorage2().key(i2);
14011           fn(read(key), key);
14012         }
14013       }
14014       function remove2(key) {
14015         return localStorage2().removeItem(key);
14016       }
14017       function clearAll() {
14018         return localStorage2().clear();
14019       }
14020     }
14021   });
14022
14023   // node_modules/store/storages/oldFF-globalStorage.js
14024   var require_oldFF_globalStorage = __commonJS({
14025     "node_modules/store/storages/oldFF-globalStorage.js"(exports2, module2) {
14026       var util = require_util();
14027       var Global = util.Global;
14028       module2.exports = {
14029         name: "oldFF-globalStorage",
14030         read,
14031         write,
14032         each,
14033         remove: remove2,
14034         clearAll
14035       };
14036       var globalStorage = Global.globalStorage;
14037       function read(key) {
14038         return globalStorage[key];
14039       }
14040       function write(key, data) {
14041         globalStorage[key] = data;
14042       }
14043       function each(fn) {
14044         for (var i2 = globalStorage.length - 1; i2 >= 0; i2--) {
14045           var key = globalStorage.key(i2);
14046           fn(globalStorage[key], key);
14047         }
14048       }
14049       function remove2(key) {
14050         return globalStorage.removeItem(key);
14051       }
14052       function clearAll() {
14053         each(function(key, _) {
14054           delete globalStorage[key];
14055         });
14056       }
14057     }
14058   });
14059
14060   // node_modules/store/storages/oldIE-userDataStorage.js
14061   var require_oldIE_userDataStorage = __commonJS({
14062     "node_modules/store/storages/oldIE-userDataStorage.js"(exports2, module2) {
14063       var util = require_util();
14064       var Global = util.Global;
14065       module2.exports = {
14066         name: "oldIE-userDataStorage",
14067         write,
14068         read,
14069         each,
14070         remove: remove2,
14071         clearAll
14072       };
14073       var storageName = "storejs";
14074       var doc = Global.document;
14075       var _withStorageEl = _makeIEStorageElFunction();
14076       var disable = (Global.navigator ? Global.navigator.userAgent : "").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);
14077       function write(unfixedKey, data) {
14078         if (disable) {
14079           return;
14080         }
14081         var fixedKey = fixKey(unfixedKey);
14082         _withStorageEl(function(storageEl) {
14083           storageEl.setAttribute(fixedKey, data);
14084           storageEl.save(storageName);
14085         });
14086       }
14087       function read(unfixedKey) {
14088         if (disable) {
14089           return;
14090         }
14091         var fixedKey = fixKey(unfixedKey);
14092         var res = null;
14093         _withStorageEl(function(storageEl) {
14094           res = storageEl.getAttribute(fixedKey);
14095         });
14096         return res;
14097       }
14098       function each(callback) {
14099         _withStorageEl(function(storageEl) {
14100           var attributes = storageEl.XMLDocument.documentElement.attributes;
14101           for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14102             var attr = attributes[i2];
14103             callback(storageEl.getAttribute(attr.name), attr.name);
14104           }
14105         });
14106       }
14107       function remove2(unfixedKey) {
14108         var fixedKey = fixKey(unfixedKey);
14109         _withStorageEl(function(storageEl) {
14110           storageEl.removeAttribute(fixedKey);
14111           storageEl.save(storageName);
14112         });
14113       }
14114       function clearAll() {
14115         _withStorageEl(function(storageEl) {
14116           var attributes = storageEl.XMLDocument.documentElement.attributes;
14117           storageEl.load(storageName);
14118           for (var i2 = attributes.length - 1; i2 >= 0; i2--) {
14119             storageEl.removeAttribute(attributes[i2].name);
14120           }
14121           storageEl.save(storageName);
14122         });
14123       }
14124       var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g");
14125       function fixKey(key) {
14126         return key.replace(/^\d/, "___$&").replace(forbiddenCharsRegex, "___");
14127       }
14128       function _makeIEStorageElFunction() {
14129         if (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {
14130           return null;
14131         }
14132         var scriptTag = "script", storageOwner, storageContainer, storageEl;
14133         try {
14134           storageContainer = new ActiveXObject("htmlfile");
14135           storageContainer.open();
14136           storageContainer.write("<" + scriptTag + ">document.w=window</" + scriptTag + '><iframe src="/favicon.ico"></iframe>');
14137           storageContainer.close();
14138           storageOwner = storageContainer.w.frames[0].document;
14139           storageEl = storageOwner.createElement("div");
14140         } catch (e) {
14141           storageEl = doc.createElement("div");
14142           storageOwner = doc.body;
14143         }
14144         return function(storeFunction) {
14145           var args = [].slice.call(arguments, 0);
14146           args.unshift(storageEl);
14147           storageOwner.appendChild(storageEl);
14148           storageEl.addBehavior("#default#userData");
14149           storageEl.load(storageName);
14150           storeFunction.apply(this, args);
14151           storageOwner.removeChild(storageEl);
14152           return;
14153         };
14154       }
14155     }
14156   });
14157
14158   // node_modules/store/storages/cookieStorage.js
14159   var require_cookieStorage = __commonJS({
14160     "node_modules/store/storages/cookieStorage.js"(exports2, module2) {
14161       var util = require_util();
14162       var Global = util.Global;
14163       var trim = util.trim;
14164       module2.exports = {
14165         name: "cookieStorage",
14166         read,
14167         write,
14168         each,
14169         remove: remove2,
14170         clearAll
14171       };
14172       var doc = Global.document;
14173       function read(key) {
14174         if (!key || !_has(key)) {
14175           return null;
14176         }
14177         var regexpStr = "(?:^|.*;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";
14178         return unescape(doc.cookie.replace(new RegExp(regexpStr), "$1"));
14179       }
14180       function each(callback) {
14181         var cookies = doc.cookie.split(/; ?/g);
14182         for (var i2 = cookies.length - 1; i2 >= 0; i2--) {
14183           if (!trim(cookies[i2])) {
14184             continue;
14185           }
14186           var kvp = cookies[i2].split("=");
14187           var key = unescape(kvp[0]);
14188           var val = unescape(kvp[1]);
14189           callback(val, key);
14190         }
14191       }
14192       function write(key, data) {
14193         if (!key) {
14194           return;
14195         }
14196         doc.cookie = escape(key) + "=" + escape(data) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
14197       }
14198       function remove2(key) {
14199         if (!key || !_has(key)) {
14200           return;
14201         }
14202         doc.cookie = escape(key) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
14203       }
14204       function clearAll() {
14205         each(function(_, key) {
14206           remove2(key);
14207         });
14208       }
14209       function _has(key) {
14210         return new RegExp("(?:^|;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(doc.cookie);
14211       }
14212     }
14213   });
14214
14215   // node_modules/store/storages/sessionStorage.js
14216   var require_sessionStorage = __commonJS({
14217     "node_modules/store/storages/sessionStorage.js"(exports2, module2) {
14218       var util = require_util();
14219       var Global = util.Global;
14220       module2.exports = {
14221         name: "sessionStorage",
14222         read,
14223         write,
14224         each,
14225         remove: remove2,
14226         clearAll
14227       };
14228       function sessionStorage() {
14229         return Global.sessionStorage;
14230       }
14231       function read(key) {
14232         return sessionStorage().getItem(key);
14233       }
14234       function write(key, data) {
14235         return sessionStorage().setItem(key, data);
14236       }
14237       function each(fn) {
14238         for (var i2 = sessionStorage().length - 1; i2 >= 0; i2--) {
14239           var key = sessionStorage().key(i2);
14240           fn(read(key), key);
14241         }
14242       }
14243       function remove2(key) {
14244         return sessionStorage().removeItem(key);
14245       }
14246       function clearAll() {
14247         return sessionStorage().clear();
14248       }
14249     }
14250   });
14251
14252   // node_modules/store/storages/memoryStorage.js
14253   var require_memoryStorage = __commonJS({
14254     "node_modules/store/storages/memoryStorage.js"(exports2, module2) {
14255       module2.exports = {
14256         name: "memoryStorage",
14257         read,
14258         write,
14259         each,
14260         remove: remove2,
14261         clearAll
14262       };
14263       var memoryStorage = {};
14264       function read(key) {
14265         return memoryStorage[key];
14266       }
14267       function write(key, data) {
14268         memoryStorage[key] = data;
14269       }
14270       function each(callback) {
14271         for (var key in memoryStorage) {
14272           if (memoryStorage.hasOwnProperty(key)) {
14273             callback(memoryStorage[key], key);
14274           }
14275         }
14276       }
14277       function remove2(key) {
14278         delete memoryStorage[key];
14279       }
14280       function clearAll(key) {
14281         memoryStorage = {};
14282       }
14283     }
14284   });
14285
14286   // node_modules/store/storages/all.js
14287   var require_all = __commonJS({
14288     "node_modules/store/storages/all.js"(exports2, module2) {
14289       module2.exports = [
14290         require_localStorage(),
14291         require_oldFF_globalStorage(),
14292         require_oldIE_userDataStorage(),
14293         require_cookieStorage(),
14294         require_sessionStorage(),
14295         require_memoryStorage()
14296       ];
14297     }
14298   });
14299
14300   // node_modules/store/plugins/lib/json2.js
14301   var require_json2 = __commonJS({
14302     "node_modules/store/plugins/lib/json2.js"(exports, module) {
14303       if (typeof JSON !== "object") {
14304         JSON = {};
14305       }
14306       (function() {
14307         "use strict";
14308         var rx_one = /^[\],:{}\s]*$/;
14309         var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
14310         var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
14311         var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
14312         var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14313         var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14314         function f(n2) {
14315           return n2 < 10 ? "0" + n2 : n2;
14316         }
14317         function this_value() {
14318           return this.valueOf();
14319         }
14320         if (typeof Date.prototype.toJSON !== "function") {
14321           Date.prototype.toJSON = function() {
14322             return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null;
14323           };
14324           Boolean.prototype.toJSON = this_value;
14325           Number.prototype.toJSON = this_value;
14326           String.prototype.toJSON = this_value;
14327         }
14328         var gap;
14329         var indent;
14330         var meta;
14331         var rep;
14332         function quote(string) {
14333           rx_escapable.lastIndex = 0;
14334           return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function(a) {
14335             var c = meta[a];
14336             return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14337           }) + '"' : '"' + string + '"';
14338         }
14339         function str(key, holder) {
14340           var i2;
14341           var k;
14342           var v;
14343           var length;
14344           var mind = gap;
14345           var partial;
14346           var value = holder[key];
14347           if (value && typeof value === "object" && typeof value.toJSON === "function") {
14348             value = value.toJSON(key);
14349           }
14350           if (typeof rep === "function") {
14351             value = rep.call(holder, key, value);
14352           }
14353           switch (typeof value) {
14354             case "string":
14355               return quote(value);
14356             case "number":
14357               return isFinite(value) ? String(value) : "null";
14358             case "boolean":
14359             case "null":
14360               return String(value);
14361             case "object":
14362               if (!value) {
14363                 return "null";
14364               }
14365               gap += indent;
14366               partial = [];
14367               if (Object.prototype.toString.apply(value) === "[object Array]") {
14368                 length = value.length;
14369                 for (i2 = 0; i2 < length; i2 += 1) {
14370                   partial[i2] = str(i2, value) || "null";
14371                 }
14372                 v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
14373                 gap = mind;
14374                 return v;
14375               }
14376               if (rep && typeof rep === "object") {
14377                 length = rep.length;
14378                 for (i2 = 0; i2 < length; i2 += 1) {
14379                   if (typeof rep[i2] === "string") {
14380                     k = rep[i2];
14381                     v = str(k, value);
14382                     if (v) {
14383                       partial.push(quote(k) + (gap ? ": " : ":") + v);
14384                     }
14385                   }
14386                 }
14387               } else {
14388                 for (k in value) {
14389                   if (Object.prototype.hasOwnProperty.call(value, k)) {
14390                     v = str(k, value);
14391                     if (v) {
14392                       partial.push(quote(k) + (gap ? ": " : ":") + v);
14393                     }
14394                   }
14395                 }
14396               }
14397               v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
14398               gap = mind;
14399               return v;
14400           }
14401         }
14402         if (typeof JSON.stringify !== "function") {
14403           meta = {
14404             "\b": "\\b",
14405             "   ": "\\t",
14406             "\n": "\\n",
14407             "\f": "\\f",
14408             "\r": "\\r",
14409             '"': '\\"',
14410             "\\": "\\\\"
14411           };
14412           JSON.stringify = function(value, replacer, space) {
14413             var i2;
14414             gap = "";
14415             indent = "";
14416             if (typeof space === "number") {
14417               for (i2 = 0; i2 < space; i2 += 1) {
14418                 indent += " ";
14419               }
14420             } else if (typeof space === "string") {
14421               indent = space;
14422             }
14423             rep = replacer;
14424             if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
14425               throw new Error("JSON.stringify");
14426             }
14427             return str("", { "": value });
14428           };
14429         }
14430         if (typeof JSON.parse !== "function") {
14431           JSON.parse = function(text, reviver) {
14432             var j;
14433             function walk(holder, key) {
14434               var k;
14435               var v;
14436               var value = holder[key];
14437               if (value && typeof value === "object") {
14438                 for (k in value) {
14439                   if (Object.prototype.hasOwnProperty.call(value, k)) {
14440                     v = walk(value, k);
14441                     if (v !== void 0) {
14442                       value[k] = v;
14443                     } else {
14444                       delete value[k];
14445                     }
14446                   }
14447                 }
14448               }
14449               return reviver.call(holder, key, value);
14450             }
14451             text = String(text);
14452             rx_dangerous.lastIndex = 0;
14453             if (rx_dangerous.test(text)) {
14454               text = text.replace(rx_dangerous, function(a) {
14455                 return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
14456               });
14457             }
14458             if (rx_one.test(
14459               text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, "")
14460             )) {
14461               j = eval("(" + text + ")");
14462               return typeof reviver === "function" ? walk({ "": j }, "") : j;
14463             }
14464             throw new SyntaxError("JSON.parse");
14465           };
14466         }
14467       })();
14468     }
14469   });
14470
14471   // node_modules/store/plugins/json2.js
14472   var require_json22 = __commonJS({
14473     "node_modules/store/plugins/json2.js"(exports2, module2) {
14474       module2.exports = json2Plugin;
14475       function json2Plugin() {
14476         require_json2();
14477         return {};
14478       }
14479     }
14480   });
14481
14482   // node_modules/store/dist/store.legacy.js
14483   var require_store_legacy = __commonJS({
14484     "node_modules/store/dist/store.legacy.js"(exports2, module2) {
14485       var engine = require_store_engine();
14486       var storages = require_all();
14487       var plugins = [require_json22()];
14488       module2.exports = engine.createStore(storages, plugins);
14489     }
14490   });
14491
14492   // node_modules/whatwg-fetch/fetch.js
14493   var global2 = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof global2 !== "undefined" && global2;
14494   var support = {
14495     searchParams: "URLSearchParams" in global2,
14496     iterable: "Symbol" in global2 && "iterator" in Symbol,
14497     blob: "FileReader" in global2 && "Blob" in global2 && function() {
14498       try {
14499         new Blob();
14500         return true;
14501       } catch (e) {
14502         return false;
14503       }
14504     }(),
14505     formData: "FormData" in global2,
14506     arrayBuffer: "ArrayBuffer" in global2
14507   };
14508   function isDataView(obj) {
14509     return obj && DataView.prototype.isPrototypeOf(obj);
14510   }
14511   if (support.arrayBuffer) {
14512     viewClasses = [
14513       "[object Int8Array]",
14514       "[object Uint8Array]",
14515       "[object Uint8ClampedArray]",
14516       "[object Int16Array]",
14517       "[object Uint16Array]",
14518       "[object Int32Array]",
14519       "[object Uint32Array]",
14520       "[object Float32Array]",
14521       "[object Float64Array]"
14522     ];
14523     isArrayBufferView = ArrayBuffer.isView || function(obj) {
14524       return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
14525     };
14526   }
14527   var viewClasses;
14528   var isArrayBufferView;
14529   function normalizeName(name) {
14530     if (typeof name !== "string") {
14531       name = String(name);
14532     }
14533     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
14534       throw new TypeError('Invalid character in header field name: "' + name + '"');
14535     }
14536     return name.toLowerCase();
14537   }
14538   function normalizeValue(value) {
14539     if (typeof value !== "string") {
14540       value = String(value);
14541     }
14542     return value;
14543   }
14544   function iteratorFor(items) {
14545     var iterator = {
14546       next: function() {
14547         var value = items.shift();
14548         return { done: value === void 0, value };
14549       }
14550     };
14551     if (support.iterable) {
14552       iterator[Symbol.iterator] = function() {
14553         return iterator;
14554       };
14555     }
14556     return iterator;
14557   }
14558   function Headers(headers) {
14559     this.map = {};
14560     if (headers instanceof Headers) {
14561       headers.forEach(function(value, name) {
14562         this.append(name, value);
14563       }, this);
14564     } else if (Array.isArray(headers)) {
14565       headers.forEach(function(header) {
14566         this.append(header[0], header[1]);
14567       }, this);
14568     } else if (headers) {
14569       Object.getOwnPropertyNames(headers).forEach(function(name) {
14570         this.append(name, headers[name]);
14571       }, this);
14572     }
14573   }
14574   Headers.prototype.append = function(name, value) {
14575     name = normalizeName(name);
14576     value = normalizeValue(value);
14577     var oldValue = this.map[name];
14578     this.map[name] = oldValue ? oldValue + ", " + value : value;
14579   };
14580   Headers.prototype["delete"] = function(name) {
14581     delete this.map[normalizeName(name)];
14582   };
14583   Headers.prototype.get = function(name) {
14584     name = normalizeName(name);
14585     return this.has(name) ? this.map[name] : null;
14586   };
14587   Headers.prototype.has = function(name) {
14588     return this.map.hasOwnProperty(normalizeName(name));
14589   };
14590   Headers.prototype.set = function(name, value) {
14591     this.map[normalizeName(name)] = normalizeValue(value);
14592   };
14593   Headers.prototype.forEach = function(callback, thisArg) {
14594     for (var name in this.map) {
14595       if (this.map.hasOwnProperty(name)) {
14596         callback.call(thisArg, this.map[name], name, this);
14597       }
14598     }
14599   };
14600   Headers.prototype.keys = function() {
14601     var items = [];
14602     this.forEach(function(value, name) {
14603       items.push(name);
14604     });
14605     return iteratorFor(items);
14606   };
14607   Headers.prototype.values = function() {
14608     var items = [];
14609     this.forEach(function(value) {
14610       items.push(value);
14611     });
14612     return iteratorFor(items);
14613   };
14614   Headers.prototype.entries = function() {
14615     var items = [];
14616     this.forEach(function(value, name) {
14617       items.push([name, value]);
14618     });
14619     return iteratorFor(items);
14620   };
14621   if (support.iterable) {
14622     Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
14623   }
14624   function consumed(body) {
14625     if (body.bodyUsed) {
14626       return Promise.reject(new TypeError("Already read"));
14627     }
14628     body.bodyUsed = true;
14629   }
14630   function fileReaderReady(reader) {
14631     return new Promise(function(resolve, reject) {
14632       reader.onload = function() {
14633         resolve(reader.result);
14634       };
14635       reader.onerror = function() {
14636         reject(reader.error);
14637       };
14638     });
14639   }
14640   function readBlobAsArrayBuffer(blob) {
14641     var reader = new FileReader();
14642     var promise = fileReaderReady(reader);
14643     reader.readAsArrayBuffer(blob);
14644     return promise;
14645   }
14646   function readBlobAsText(blob) {
14647     var reader = new FileReader();
14648     var promise = fileReaderReady(reader);
14649     reader.readAsText(blob);
14650     return promise;
14651   }
14652   function readArrayBufferAsText(buf) {
14653     var view = new Uint8Array(buf);
14654     var chars = new Array(view.length);
14655     for (var i2 = 0; i2 < view.length; i2++) {
14656       chars[i2] = String.fromCharCode(view[i2]);
14657     }
14658     return chars.join("");
14659   }
14660   function bufferClone(buf) {
14661     if (buf.slice) {
14662       return buf.slice(0);
14663     } else {
14664       var view = new Uint8Array(buf.byteLength);
14665       view.set(new Uint8Array(buf));
14666       return view.buffer;
14667     }
14668   }
14669   function Body() {
14670     this.bodyUsed = false;
14671     this._initBody = function(body) {
14672       this.bodyUsed = this.bodyUsed;
14673       this._bodyInit = body;
14674       if (!body) {
14675         this._bodyText = "";
14676       } else if (typeof body === "string") {
14677         this._bodyText = body;
14678       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
14679         this._bodyBlob = body;
14680       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
14681         this._bodyFormData = body;
14682       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14683         this._bodyText = body.toString();
14684       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
14685         this._bodyArrayBuffer = bufferClone(body.buffer);
14686         this._bodyInit = new Blob([this._bodyArrayBuffer]);
14687       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
14688         this._bodyArrayBuffer = bufferClone(body);
14689       } else {
14690         this._bodyText = body = Object.prototype.toString.call(body);
14691       }
14692       if (!this.headers.get("content-type")) {
14693         if (typeof body === "string") {
14694           this.headers.set("content-type", "text/plain;charset=UTF-8");
14695         } else if (this._bodyBlob && this._bodyBlob.type) {
14696           this.headers.set("content-type", this._bodyBlob.type);
14697         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14698           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
14699         }
14700       }
14701     };
14702     if (support.blob) {
14703       this.blob = function() {
14704         var rejected = consumed(this);
14705         if (rejected) {
14706           return rejected;
14707         }
14708         if (this._bodyBlob) {
14709           return Promise.resolve(this._bodyBlob);
14710         } else if (this._bodyArrayBuffer) {
14711           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
14712         } else if (this._bodyFormData) {
14713           throw new Error("could not read FormData body as blob");
14714         } else {
14715           return Promise.resolve(new Blob([this._bodyText]));
14716         }
14717       };
14718       this.arrayBuffer = function() {
14719         if (this._bodyArrayBuffer) {
14720           var isConsumed = consumed(this);
14721           if (isConsumed) {
14722             return isConsumed;
14723           }
14724           if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
14725             return Promise.resolve(
14726               this._bodyArrayBuffer.buffer.slice(
14727                 this._bodyArrayBuffer.byteOffset,
14728                 this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
14729               )
14730             );
14731           } else {
14732             return Promise.resolve(this._bodyArrayBuffer);
14733           }
14734         } else {
14735           return this.blob().then(readBlobAsArrayBuffer);
14736         }
14737       };
14738     }
14739     this.text = function() {
14740       var rejected = consumed(this);
14741       if (rejected) {
14742         return rejected;
14743       }
14744       if (this._bodyBlob) {
14745         return readBlobAsText(this._bodyBlob);
14746       } else if (this._bodyArrayBuffer) {
14747         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
14748       } else if (this._bodyFormData) {
14749         throw new Error("could not read FormData body as text");
14750       } else {
14751         return Promise.resolve(this._bodyText);
14752       }
14753     };
14754     if (support.formData) {
14755       this.formData = function() {
14756         return this.text().then(decode);
14757       };
14758     }
14759     this.json = function() {
14760       return this.text().then(JSON.parse);
14761     };
14762     return this;
14763   }
14764   var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
14765   function normalizeMethod(method) {
14766     var upcased = method.toUpperCase();
14767     return methods.indexOf(upcased) > -1 ? upcased : method;
14768   }
14769   function Request(input, options2) {
14770     if (!(this instanceof Request)) {
14771       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14772     }
14773     options2 = options2 || {};
14774     var body = options2.body;
14775     if (input instanceof Request) {
14776       if (input.bodyUsed) {
14777         throw new TypeError("Already read");
14778       }
14779       this.url = input.url;
14780       this.credentials = input.credentials;
14781       if (!options2.headers) {
14782         this.headers = new Headers(input.headers);
14783       }
14784       this.method = input.method;
14785       this.mode = input.mode;
14786       this.signal = input.signal;
14787       if (!body && input._bodyInit != null) {
14788         body = input._bodyInit;
14789         input.bodyUsed = true;
14790       }
14791     } else {
14792       this.url = String(input);
14793     }
14794     this.credentials = options2.credentials || this.credentials || "same-origin";
14795     if (options2.headers || !this.headers) {
14796       this.headers = new Headers(options2.headers);
14797     }
14798     this.method = normalizeMethod(options2.method || this.method || "GET");
14799     this.mode = options2.mode || this.mode || null;
14800     this.signal = options2.signal || this.signal;
14801     this.referrer = null;
14802     if ((this.method === "GET" || this.method === "HEAD") && body) {
14803       throw new TypeError("Body not allowed for GET or HEAD requests");
14804     }
14805     this._initBody(body);
14806     if (this.method === "GET" || this.method === "HEAD") {
14807       if (options2.cache === "no-store" || options2.cache === "no-cache") {
14808         var reParamSearch = /([?&])_=[^&]*/;
14809         if (reParamSearch.test(this.url)) {
14810           this.url = this.url.replace(reParamSearch, "$1_=" + new Date().getTime());
14811         } else {
14812           var reQueryString = /\?/;
14813           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + new Date().getTime();
14814         }
14815       }
14816     }
14817   }
14818   Request.prototype.clone = function() {
14819     return new Request(this, { body: this._bodyInit });
14820   };
14821   function decode(body) {
14822     var form = new FormData();
14823     body.trim().split("&").forEach(function(bytes) {
14824       if (bytes) {
14825         var split = bytes.split("=");
14826         var name = split.shift().replace(/\+/g, " ");
14827         var value = split.join("=").replace(/\+/g, " ");
14828         form.append(decodeURIComponent(name), decodeURIComponent(value));
14829       }
14830     });
14831     return form;
14832   }
14833   function parseHeaders(rawHeaders) {
14834     var headers = new Headers();
14835     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
14836     preProcessedHeaders.split("\r").map(function(header) {
14837       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
14838     }).forEach(function(line) {
14839       var parts = line.split(":");
14840       var key = parts.shift().trim();
14841       if (key) {
14842         var value = parts.join(":").trim();
14843         headers.append(key, value);
14844       }
14845     });
14846     return headers;
14847   }
14848   Body.call(Request.prototype);
14849   function Response(bodyInit, options2) {
14850     if (!(this instanceof Response)) {
14851       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14852     }
14853     if (!options2) {
14854       options2 = {};
14855     }
14856     this.type = "default";
14857     this.status = options2.status === void 0 ? 200 : options2.status;
14858     this.ok = this.status >= 200 && this.status < 300;
14859     this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
14860     this.headers = new Headers(options2.headers);
14861     this.url = options2.url || "";
14862     this._initBody(bodyInit);
14863   }
14864   Body.call(Response.prototype);
14865   Response.prototype.clone = function() {
14866     return new Response(this._bodyInit, {
14867       status: this.status,
14868       statusText: this.statusText,
14869       headers: new Headers(this.headers),
14870       url: this.url
14871     });
14872   };
14873   Response.error = function() {
14874     var response = new Response(null, { status: 0, statusText: "" });
14875     response.type = "error";
14876     return response;
14877   };
14878   var redirectStatuses = [301, 302, 303, 307, 308];
14879   Response.redirect = function(url, status) {
14880     if (redirectStatuses.indexOf(status) === -1) {
14881       throw new RangeError("Invalid status code");
14882     }
14883     return new Response(null, { status, headers: { location: url } });
14884   };
14885   var DOMException2 = global2.DOMException;
14886   try {
14887     new DOMException2();
14888   } catch (err) {
14889     DOMException2 = function(message, name) {
14890       this.message = message;
14891       this.name = name;
14892       var error = Error(message);
14893       this.stack = error.stack;
14894     };
14895     DOMException2.prototype = Object.create(Error.prototype);
14896     DOMException2.prototype.constructor = DOMException2;
14897   }
14898   function fetch2(input, init2) {
14899     return new Promise(function(resolve, reject) {
14900       var request3 = new Request(input, init2);
14901       if (request3.signal && request3.signal.aborted) {
14902         return reject(new DOMException2("Aborted", "AbortError"));
14903       }
14904       var xhr = new XMLHttpRequest();
14905       function abortXhr() {
14906         xhr.abort();
14907       }
14908       xhr.onload = function() {
14909         var options2 = {
14910           status: xhr.status,
14911           statusText: xhr.statusText,
14912           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
14913         };
14914         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
14915         var body = "response" in xhr ? xhr.response : xhr.responseText;
14916         setTimeout(function() {
14917           resolve(new Response(body, options2));
14918         }, 0);
14919       };
14920       xhr.onerror = function() {
14921         setTimeout(function() {
14922           reject(new TypeError("Network request failed"));
14923         }, 0);
14924       };
14925       xhr.ontimeout = function() {
14926         setTimeout(function() {
14927           reject(new TypeError("Network request failed"));
14928         }, 0);
14929       };
14930       xhr.onabort = function() {
14931         setTimeout(function() {
14932           reject(new DOMException2("Aborted", "AbortError"));
14933         }, 0);
14934       };
14935       function fixUrl(url) {
14936         try {
14937           return url === "" && global2.location.href ? global2.location.href : url;
14938         } catch (e) {
14939           return url;
14940         }
14941       }
14942       xhr.open(request3.method, fixUrl(request3.url), true);
14943       if (request3.credentials === "include") {
14944         xhr.withCredentials = true;
14945       } else if (request3.credentials === "omit") {
14946         xhr.withCredentials = false;
14947       }
14948       if ("responseType" in xhr) {
14949         if (support.blob) {
14950           xhr.responseType = "blob";
14951         } else if (support.arrayBuffer && request3.headers.get("Content-Type") && request3.headers.get("Content-Type").indexOf("application/octet-stream") !== -1) {
14952           xhr.responseType = "arraybuffer";
14953         }
14954       }
14955       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers)) {
14956         Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
14957           xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
14958         });
14959       } else {
14960         request3.headers.forEach(function(value, name) {
14961           xhr.setRequestHeader(name, value);
14962         });
14963       }
14964       if (request3.signal) {
14965         request3.signal.addEventListener("abort", abortXhr);
14966         xhr.onreadystatechange = function() {
14967           if (xhr.readyState === 4) {
14968             request3.signal.removeEventListener("abort", abortXhr);
14969           }
14970         };
14971       }
14972       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
14973     });
14974   }
14975   fetch2.polyfill = true;
14976   if (!global2.fetch) {
14977     global2.fetch = fetch2;
14978     global2.Headers = Headers;
14979     global2.Request = Request;
14980     global2.Response = Response;
14981   }
14982
14983   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
14984   (function(factory) {
14985     typeof define === "function" && define.amd ? define(factory) : factory();
14986   })(function() {
14987     "use strict";
14988     function _classCallCheck(instance, Constructor) {
14989       if (!(instance instanceof Constructor)) {
14990         throw new TypeError("Cannot call a class as a function");
14991       }
14992     }
14993     function _defineProperties(target, props) {
14994       for (var i2 = 0; i2 < props.length; i2++) {
14995         var descriptor = props[i2];
14996         descriptor.enumerable = descriptor.enumerable || false;
14997         descriptor.configurable = true;
14998         if ("value" in descriptor)
14999           descriptor.writable = true;
15000         Object.defineProperty(target, descriptor.key, descriptor);
15001       }
15002     }
15003     function _createClass(Constructor, protoProps, staticProps) {
15004       if (protoProps)
15005         _defineProperties(Constructor.prototype, protoProps);
15006       if (staticProps)
15007         _defineProperties(Constructor, staticProps);
15008       return Constructor;
15009     }
15010     function _inherits(subClass, superClass) {
15011       if (typeof superClass !== "function" && superClass !== null) {
15012         throw new TypeError("Super expression must either be null or a function");
15013       }
15014       subClass.prototype = Object.create(superClass && superClass.prototype, {
15015         constructor: {
15016           value: subClass,
15017           writable: true,
15018           configurable: true
15019         }
15020       });
15021       if (superClass)
15022         _setPrototypeOf(subClass, superClass);
15023     }
15024     function _getPrototypeOf(o) {
15025       _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
15026         return o2.__proto__ || Object.getPrototypeOf(o2);
15027       };
15028       return _getPrototypeOf(o);
15029     }
15030     function _setPrototypeOf(o, p) {
15031       _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
15032         o2.__proto__ = p2;
15033         return o2;
15034       };
15035       return _setPrototypeOf(o, p);
15036     }
15037     function _isNativeReflectConstruct() {
15038       if (typeof Reflect === "undefined" || !Reflect.construct)
15039         return false;
15040       if (Reflect.construct.sham)
15041         return false;
15042       if (typeof Proxy === "function")
15043         return true;
15044       try {
15045         Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
15046         }));
15047         return true;
15048       } catch (e) {
15049         return false;
15050       }
15051     }
15052     function _assertThisInitialized(self2) {
15053       if (self2 === void 0) {
15054         throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15055       }
15056       return self2;
15057     }
15058     function _possibleConstructorReturn(self2, call) {
15059       if (call && (typeof call === "object" || typeof call === "function")) {
15060         return call;
15061       }
15062       return _assertThisInitialized(self2);
15063     }
15064     function _createSuper(Derived) {
15065       var hasNativeReflectConstruct = _isNativeReflectConstruct();
15066       return function _createSuperInternal() {
15067         var Super = _getPrototypeOf(Derived), result;
15068         if (hasNativeReflectConstruct) {
15069           var NewTarget = _getPrototypeOf(this).constructor;
15070           result = Reflect.construct(Super, arguments, NewTarget);
15071         } else {
15072           result = Super.apply(this, arguments);
15073         }
15074         return _possibleConstructorReturn(this, result);
15075       };
15076     }
15077     function _superPropBase(object, property) {
15078       while (!Object.prototype.hasOwnProperty.call(object, property)) {
15079         object = _getPrototypeOf(object);
15080         if (object === null)
15081           break;
15082       }
15083       return object;
15084     }
15085     function _get(target, property, receiver) {
15086       if (typeof Reflect !== "undefined" && Reflect.get) {
15087         _get = Reflect.get;
15088       } else {
15089         _get = function _get2(target2, property2, receiver2) {
15090           var base = _superPropBase(target2, property2);
15091           if (!base)
15092             return;
15093           var desc = Object.getOwnPropertyDescriptor(base, property2);
15094           if (desc.get) {
15095             return desc.get.call(receiver2);
15096           }
15097           return desc.value;
15098         };
15099       }
15100       return _get(target, property, receiver || target);
15101     }
15102     var Emitter = /* @__PURE__ */ function() {
15103       function Emitter2() {
15104         _classCallCheck(this, Emitter2);
15105         Object.defineProperty(this, "listeners", {
15106           value: {},
15107           writable: true,
15108           configurable: true
15109         });
15110       }
15111       _createClass(Emitter2, [{
15112         key: "addEventListener",
15113         value: function addEventListener(type3, callback, options2) {
15114           if (!(type3 in this.listeners)) {
15115             this.listeners[type3] = [];
15116           }
15117           this.listeners[type3].push({
15118             callback,
15119             options: options2
15120           });
15121         }
15122       }, {
15123         key: "removeEventListener",
15124         value: function removeEventListener(type3, callback) {
15125           if (!(type3 in this.listeners)) {
15126             return;
15127           }
15128           var stack = this.listeners[type3];
15129           for (var i2 = 0, l = stack.length; i2 < l; i2++) {
15130             if (stack[i2].callback === callback) {
15131               stack.splice(i2, 1);
15132               return;
15133             }
15134           }
15135         }
15136       }, {
15137         key: "dispatchEvent",
15138         value: function dispatchEvent2(event) {
15139           if (!(event.type in this.listeners)) {
15140             return;
15141           }
15142           var stack = this.listeners[event.type];
15143           var stackToCall = stack.slice();
15144           for (var i2 = 0, l = stackToCall.length; i2 < l; i2++) {
15145             var listener = stackToCall[i2];
15146             try {
15147               listener.callback.call(this, event);
15148             } catch (e) {
15149               Promise.resolve().then(function() {
15150                 throw e;
15151               });
15152             }
15153             if (listener.options && listener.options.once) {
15154               this.removeEventListener(event.type, listener.callback);
15155             }
15156           }
15157           return !event.defaultPrevented;
15158         }
15159       }]);
15160       return Emitter2;
15161     }();
15162     var AbortSignal = /* @__PURE__ */ function(_Emitter) {
15163       _inherits(AbortSignal2, _Emitter);
15164       var _super = _createSuper(AbortSignal2);
15165       function AbortSignal2() {
15166         var _this;
15167         _classCallCheck(this, AbortSignal2);
15168         _this = _super.call(this);
15169         if (!_this.listeners) {
15170           Emitter.call(_assertThisInitialized(_this));
15171         }
15172         Object.defineProperty(_assertThisInitialized(_this), "aborted", {
15173           value: false,
15174           writable: true,
15175           configurable: true
15176         });
15177         Object.defineProperty(_assertThisInitialized(_this), "onabort", {
15178           value: null,
15179           writable: true,
15180           configurable: true
15181         });
15182         return _this;
15183       }
15184       _createClass(AbortSignal2, [{
15185         key: "toString",
15186         value: function toString2() {
15187           return "[object AbortSignal]";
15188         }
15189       }, {
15190         key: "dispatchEvent",
15191         value: function dispatchEvent2(event) {
15192           if (event.type === "abort") {
15193             this.aborted = true;
15194             if (typeof this.onabort === "function") {
15195               this.onabort.call(this, event);
15196             }
15197           }
15198           _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
15199         }
15200       }]);
15201       return AbortSignal2;
15202     }(Emitter);
15203     var AbortController2 = /* @__PURE__ */ function() {
15204       function AbortController3() {
15205         _classCallCheck(this, AbortController3);
15206         Object.defineProperty(this, "signal", {
15207           value: new AbortSignal(),
15208           writable: true,
15209           configurable: true
15210         });
15211       }
15212       _createClass(AbortController3, [{
15213         key: "abort",
15214         value: function abort() {
15215           var event;
15216           try {
15217             event = new Event("abort");
15218           } catch (e) {
15219             if (typeof document !== "undefined") {
15220               if (!document.createEvent) {
15221                 event = document.createEventObject();
15222                 event.type = "abort";
15223               } else {
15224                 event = document.createEvent("Event");
15225                 event.initEvent("abort", false, false);
15226               }
15227             } else {
15228               event = {
15229                 type: "abort",
15230                 bubbles: false,
15231                 cancelable: false
15232               };
15233             }
15234           }
15235           this.signal.dispatchEvent(event);
15236         }
15237       }, {
15238         key: "toString",
15239         value: function toString2() {
15240           return "[object AbortController]";
15241         }
15242       }]);
15243       return AbortController3;
15244     }();
15245     if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
15246       AbortController2.prototype[Symbol.toStringTag] = "AbortController";
15247       AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
15248     }
15249     function polyfillNeeded(self2) {
15250       if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15251         console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
15252         return true;
15253       }
15254       return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
15255     }
15256     function abortableFetchDecorator(patchTargets) {
15257       if ("function" === typeof patchTargets) {
15258         patchTargets = {
15259           fetch: patchTargets
15260         };
15261       }
15262       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;
15263       if (!polyfillNeeded({
15264         fetch: fetch3,
15265         Request: NativeRequest,
15266         AbortController: NativeAbortController,
15267         __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
15268       })) {
15269         return {
15270           fetch: fetch3,
15271           Request: Request2
15272         };
15273       }
15274       var Request2 = NativeRequest;
15275       if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15276         Request2 = function Request3(input, init2) {
15277           var signal;
15278           if (init2 && init2.signal) {
15279             signal = init2.signal;
15280             delete init2.signal;
15281           }
15282           var request3 = new NativeRequest(input, init2);
15283           if (signal) {
15284             Object.defineProperty(request3, "signal", {
15285               writable: false,
15286               enumerable: false,
15287               configurable: true,
15288               value: signal
15289             });
15290           }
15291           return request3;
15292         };
15293         Request2.prototype = NativeRequest.prototype;
15294       }
15295       var realFetch = fetch3;
15296       var abortableFetch = function abortableFetch2(input, init2) {
15297         var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
15298         if (signal) {
15299           var abortError;
15300           try {
15301             abortError = new DOMException("Aborted", "AbortError");
15302           } catch (err) {
15303             abortError = new Error("Aborted");
15304             abortError.name = "AbortError";
15305           }
15306           if (signal.aborted) {
15307             return Promise.reject(abortError);
15308           }
15309           var cancellation = new Promise(function(_, reject) {
15310             signal.addEventListener("abort", function() {
15311               return reject(abortError);
15312             }, {
15313               once: true
15314             });
15315           });
15316           if (init2 && init2.signal) {
15317             delete init2.signal;
15318           }
15319           return Promise.race([cancellation, realFetch(input, init2)]);
15320         }
15321         return realFetch(input, init2);
15322       };
15323       return {
15324         fetch: abortableFetch,
15325         Request: Request2
15326       };
15327     }
15328     (function(self2) {
15329       if (!polyfillNeeded(self2)) {
15330         return;
15331       }
15332       if (!self2.fetch) {
15333         console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
15334         return;
15335       }
15336       var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
15337       self2.fetch = fetch3;
15338       self2.Request = Request2;
15339       Object.defineProperty(self2, "AbortController", {
15340         writable: true,
15341         enumerable: false,
15342         configurable: true,
15343         value: AbortController2
15344       });
15345       Object.defineProperty(self2, "AbortSignal", {
15346         writable: true,
15347         enumerable: false,
15348         configurable: true,
15349         value: AbortSignal
15350       });
15351     })(typeof self !== "undefined" ? self : global);
15352   });
15353
15354   // modules/index.js
15355   var modules_exports = {};
15356   __export(modules_exports, {
15357     QAItem: () => QAItem,
15358     actionAddEntity: () => actionAddEntity,
15359     actionAddMember: () => actionAddMember,
15360     actionAddMidpoint: () => actionAddMidpoint,
15361     actionAddVertex: () => actionAddVertex,
15362     actionChangeMember: () => actionChangeMember,
15363     actionChangePreset: () => actionChangePreset,
15364     actionChangeTags: () => actionChangeTags,
15365     actionCircularize: () => actionCircularize,
15366     actionConnect: () => actionConnect,
15367     actionCopyEntities: () => actionCopyEntities,
15368     actionDeleteMember: () => actionDeleteMember,
15369     actionDeleteMultiple: () => actionDeleteMultiple,
15370     actionDeleteNode: () => actionDeleteNode,
15371     actionDeleteRelation: () => actionDeleteRelation,
15372     actionDeleteWay: () => actionDeleteWay,
15373     actionDiscardTags: () => actionDiscardTags,
15374     actionDisconnect: () => actionDisconnect,
15375     actionExtract: () => actionExtract,
15376     actionJoin: () => actionJoin,
15377     actionMerge: () => actionMerge,
15378     actionMergeNodes: () => actionMergeNodes,
15379     actionMergePolygon: () => actionMergePolygon,
15380     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
15381     actionMove: () => actionMove,
15382     actionMoveMember: () => actionMoveMember,
15383     actionMoveNode: () => actionMoveNode,
15384     actionNoop: () => actionNoop,
15385     actionOrthogonalize: () => actionOrthogonalize,
15386     actionReflect: () => actionReflect,
15387     actionRestrictTurn: () => actionRestrictTurn,
15388     actionReverse: () => actionReverse,
15389     actionRevert: () => actionRevert,
15390     actionRotate: () => actionRotate,
15391     actionScale: () => actionScale,
15392     actionSplit: () => actionSplit,
15393     actionStraightenNodes: () => actionStraightenNodes,
15394     actionStraightenWay: () => actionStraightenWay,
15395     actionUnrestrictTurn: () => actionUnrestrictTurn,
15396     actionUpgradeTags: () => actionUpgradeTags,
15397     behaviorAddWay: () => behaviorAddWay,
15398     behaviorBreathe: () => behaviorBreathe,
15399     behaviorDrag: () => behaviorDrag,
15400     behaviorDraw: () => behaviorDraw,
15401     behaviorDrawWay: () => behaviorDrawWay,
15402     behaviorEdit: () => behaviorEdit,
15403     behaviorHash: () => behaviorHash,
15404     behaviorHover: () => behaviorHover,
15405     behaviorLasso: () => behaviorLasso,
15406     behaviorOperation: () => behaviorOperation,
15407     behaviorPaste: () => behaviorPaste,
15408     behaviorSelect: () => behaviorSelect,
15409     coreContext: () => coreContext,
15410     coreDifference: () => coreDifference,
15411     coreFileFetcher: () => coreFileFetcher,
15412     coreGraph: () => coreGraph,
15413     coreHistory: () => coreHistory,
15414     coreLocalizer: () => coreLocalizer,
15415     coreLocations: () => coreLocations,
15416     coreTree: () => coreTree,
15417     coreUploader: () => coreUploader,
15418     coreValidator: () => coreValidator,
15419     d3: () => d3,
15420     debug: () => debug,
15421     fileFetcher: () => _mainFileFetcher,
15422     geoAngle: () => geoAngle,
15423     geoChooseEdge: () => geoChooseEdge,
15424     geoEdgeEqual: () => geoEdgeEqual,
15425     geoExtent: () => geoExtent,
15426     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
15427     geoHasLineIntersections: () => geoHasLineIntersections,
15428     geoHasSelfIntersections: () => geoHasSelfIntersections,
15429     geoLatToMeters: () => geoLatToMeters,
15430     geoLineIntersection: () => geoLineIntersection,
15431     geoLonToMeters: () => geoLonToMeters,
15432     geoMetersToLat: () => geoMetersToLat,
15433     geoMetersToLon: () => geoMetersToLon,
15434     geoMetersToOffset: () => geoMetersToOffset,
15435     geoOffsetToMeters: () => geoOffsetToMeters,
15436     geoOrthoCalcScore: () => geoOrthoCalcScore,
15437     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
15438     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
15439     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
15440     geoPathHasIntersections: () => geoPathHasIntersections,
15441     geoPathIntersections: () => geoPathIntersections,
15442     geoPathLength: () => geoPathLength,
15443     geoPointInPolygon: () => geoPointInPolygon,
15444     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
15445     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
15446     geoRawMercator: () => geoRawMercator,
15447     geoRotate: () => geoRotate,
15448     geoScaleToZoom: () => geoScaleToZoom,
15449     geoSphericalClosestNode: () => geoSphericalClosestNode,
15450     geoSphericalDistance: () => geoSphericalDistance,
15451     geoVecAdd: () => geoVecAdd,
15452     geoVecAngle: () => geoVecAngle,
15453     geoVecCross: () => geoVecCross,
15454     geoVecDot: () => geoVecDot,
15455     geoVecEqual: () => geoVecEqual,
15456     geoVecFloor: () => geoVecFloor,
15457     geoVecInterp: () => geoVecInterp,
15458     geoVecLength: () => geoVecLength,
15459     geoVecLengthSquare: () => geoVecLengthSquare,
15460     geoVecNormalize: () => geoVecNormalize,
15461     geoVecNormalizedDot: () => geoVecNormalizedDot,
15462     geoVecProject: () => geoVecProject,
15463     geoVecScale: () => geoVecScale,
15464     geoVecSubtract: () => geoVecSubtract,
15465     geoViewportEdge: () => geoViewportEdge,
15466     geoZoomToScale: () => geoZoomToScale,
15467     localizer: () => _mainLocalizer,
15468     locationManager: () => _mainLocations,
15469     modeAddArea: () => modeAddArea,
15470     modeAddLine: () => modeAddLine,
15471     modeAddNote: () => modeAddNote,
15472     modeAddPoint: () => modeAddPoint,
15473     modeBrowse: () => modeBrowse,
15474     modeDragNode: () => modeDragNode,
15475     modeDragNote: () => modeDragNote,
15476     modeDrawArea: () => modeDrawArea,
15477     modeDrawLine: () => modeDrawLine,
15478     modeMove: () => modeMove,
15479     modeRotate: () => modeRotate,
15480     modeSave: () => modeSave,
15481     modeSelect: () => modeSelect,
15482     modeSelectData: () => modeSelectData,
15483     modeSelectError: () => modeSelectError,
15484     modeSelectNote: () => modeSelectNote,
15485     operationCircularize: () => operationCircularize,
15486     operationContinue: () => operationContinue,
15487     operationCopy: () => operationCopy,
15488     operationDelete: () => operationDelete,
15489     operationDisconnect: () => operationDisconnect,
15490     operationDowngrade: () => operationDowngrade,
15491     operationExtract: () => operationExtract,
15492     operationMerge: () => operationMerge,
15493     operationMove: () => operationMove,
15494     operationOrthogonalize: () => operationOrthogonalize,
15495     operationPaste: () => operationPaste,
15496     operationReflectLong: () => operationReflectLong,
15497     operationReflectShort: () => operationReflectShort,
15498     operationReverse: () => operationReverse,
15499     operationRotate: () => operationRotate,
15500     operationSplit: () => operationSplit,
15501     operationStraighten: () => operationStraighten,
15502     osmAreaKeys: () => osmAreaKeys,
15503     osmChangeset: () => osmChangeset,
15504     osmEntity: () => osmEntity,
15505     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
15506     osmInferRestriction: () => osmInferRestriction,
15507     osmIntersection: () => osmIntersection,
15508     osmIsInterestingTag: () => osmIsInterestingTag,
15509     osmIsOldMultipolygonOuterMember: () => osmIsOldMultipolygonOuterMember,
15510     osmJoinWays: () => osmJoinWays,
15511     osmLanes: () => osmLanes,
15512     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
15513     osmNode: () => osmNode,
15514     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
15515     osmNote: () => osmNote,
15516     osmOldMultipolygonOuterMember: () => osmOldMultipolygonOuterMember,
15517     osmOldMultipolygonOuterMemberOfRelation: () => osmOldMultipolygonOuterMemberOfRelation,
15518     osmOneWayTags: () => osmOneWayTags,
15519     osmPavedTags: () => osmPavedTags,
15520     osmPointTags: () => osmPointTags,
15521     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
15522     osmRelation: () => osmRelation,
15523     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
15524     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
15525     osmSetAreaKeys: () => osmSetAreaKeys,
15526     osmSetPointTags: () => osmSetPointTags,
15527     osmSetVertexTags: () => osmSetVertexTags,
15528     osmTagSuggestingArea: () => osmTagSuggestingArea,
15529     osmTurn: () => osmTurn,
15530     osmVertexTags: () => osmVertexTags,
15531     osmWay: () => osmWay,
15532     prefs: () => corePreferences,
15533     presetCategory: () => presetCategory,
15534     presetCollection: () => presetCollection,
15535     presetField: () => presetField,
15536     presetIndex: () => presetIndex,
15537     presetManager: () => _mainPresetIndex,
15538     presetPreset: () => presetPreset,
15539     rendererBackground: () => rendererBackground,
15540     rendererBackgroundSource: () => rendererBackgroundSource,
15541     rendererFeatures: () => rendererFeatures,
15542     rendererMap: () => rendererMap,
15543     rendererPhotos: () => rendererPhotos,
15544     rendererTileLayer: () => rendererTileLayer,
15545     serviceImproveOSM: () => improveOSM_default,
15546     serviceKartaview: () => kartaview_default,
15547     serviceKeepRight: () => keepRight_default,
15548     serviceMapRules: () => maprules_default,
15549     serviceMapillary: () => mapillary_default,
15550     serviceNominatim: () => nominatim_default,
15551     serviceNsi: () => nsi_default,
15552     serviceOsm: () => osm_default,
15553     serviceOsmWikibase: () => osm_wikibase_default,
15554     serviceOsmose: () => osmose_default,
15555     serviceStreetside: () => streetside_default,
15556     serviceTaginfo: () => taginfo_default,
15557     serviceVectorTile: () => vector_tile_default,
15558     serviceWikidata: () => wikidata_default,
15559     serviceWikipedia: () => wikipedia_default,
15560     services: () => services,
15561     svgAreas: () => svgAreas,
15562     svgData: () => svgData,
15563     svgDebug: () => svgDebug,
15564     svgDefs: () => svgDefs,
15565     svgGeolocate: () => svgGeolocate,
15566     svgIcon: () => svgIcon,
15567     svgKartaviewImages: () => svgKartaviewImages,
15568     svgKeepRight: () => svgKeepRight,
15569     svgLabels: () => svgLabels,
15570     svgLayers: () => svgLayers,
15571     svgLines: () => svgLines,
15572     svgMapillaryImages: () => svgMapillaryImages,
15573     svgMapillarySigns: () => svgMapillarySigns,
15574     svgMarkerSegments: () => svgMarkerSegments,
15575     svgMidpoints: () => svgMidpoints,
15576     svgNotes: () => svgNotes,
15577     svgOsm: () => svgOsm,
15578     svgPassiveVertex: () => svgPassiveVertex,
15579     svgPath: () => svgPath,
15580     svgPointTransform: () => svgPointTransform,
15581     svgPoints: () => svgPoints,
15582     svgRelationMemberTags: () => svgRelationMemberTags,
15583     svgSegmentWay: () => svgSegmentWay,
15584     svgStreetside: () => svgStreetside,
15585     svgTagClasses: () => svgTagClasses,
15586     svgTagPattern: () => svgTagPattern,
15587     svgTouch: () => svgTouch,
15588     svgTurns: () => svgTurns,
15589     svgVertices: () => svgVertices,
15590     t: () => _t,
15591     uiAccount: () => uiAccount,
15592     uiAttribution: () => uiAttribution,
15593     uiChangesetEditor: () => uiChangesetEditor,
15594     uiCmd: () => uiCmd,
15595     uiCombobox: () => uiCombobox,
15596     uiCommit: () => uiCommit,
15597     uiCommitWarnings: () => uiCommitWarnings,
15598     uiConfirm: () => uiConfirm,
15599     uiConflicts: () => uiConflicts,
15600     uiContributors: () => uiContributors,
15601     uiCurtain: () => uiCurtain,
15602     uiDataEditor: () => uiDataEditor,
15603     uiDataHeader: () => uiDataHeader,
15604     uiDisclosure: () => uiDisclosure,
15605     uiEditMenu: () => uiEditMenu,
15606     uiEntityEditor: () => uiEntityEditor,
15607     uiFeatureInfo: () => uiFeatureInfo,
15608     uiFeatureList: () => uiFeatureList,
15609     uiField: () => uiField,
15610     uiFieldAccess: () => uiFieldAccess,
15611     uiFieldAddress: () => uiFieldAddress,
15612     uiFieldCheck: () => uiFieldCheck,
15613     uiFieldCombo: () => uiFieldCombo,
15614     uiFieldCycleway: () => uiFieldCycleway,
15615     uiFieldDefaultCheck: () => uiFieldCheck,
15616     uiFieldEmail: () => uiFieldText,
15617     uiFieldHelp: () => uiFieldHelp,
15618     uiFieldIdentifier: () => uiFieldText,
15619     uiFieldLanes: () => uiFieldLanes,
15620     uiFieldLocalized: () => uiFieldLocalized,
15621     uiFieldManyCombo: () => uiFieldCombo,
15622     uiFieldMultiCombo: () => uiFieldCombo,
15623     uiFieldNetworkCombo: () => uiFieldCombo,
15624     uiFieldNumber: () => uiFieldText,
15625     uiFieldOnewayCheck: () => uiFieldCheck,
15626     uiFieldRadio: () => uiFieldRadio,
15627     uiFieldRestrictions: () => uiFieldRestrictions,
15628     uiFieldRoadheight: () => uiFieldRoadheight,
15629     uiFieldRoadspeed: () => uiFieldRoadspeed,
15630     uiFieldSemiCombo: () => uiFieldCombo,
15631     uiFieldStructureRadio: () => uiFieldRadio,
15632     uiFieldTel: () => uiFieldText,
15633     uiFieldText: () => uiFieldText,
15634     uiFieldTextarea: () => uiFieldTextarea,
15635     uiFieldTypeCombo: () => uiFieldCombo,
15636     uiFieldUrl: () => uiFieldText,
15637     uiFieldWikidata: () => uiFieldWikidata,
15638     uiFieldWikipedia: () => uiFieldWikipedia,
15639     uiFields: () => uiFields,
15640     uiFlash: () => uiFlash,
15641     uiFormFields: () => uiFormFields,
15642     uiFullScreen: () => uiFullScreen,
15643     uiGeolocate: () => uiGeolocate,
15644     uiImproveOsmComments: () => uiImproveOsmComments,
15645     uiImproveOsmDetails: () => uiImproveOsmDetails,
15646     uiImproveOsmEditor: () => uiImproveOsmEditor,
15647     uiImproveOsmHeader: () => uiImproveOsmHeader,
15648     uiInfo: () => uiInfo,
15649     uiInfoPanels: () => uiInfoPanels,
15650     uiInit: () => uiInit,
15651     uiInspector: () => uiInspector,
15652     uiIntro: () => uiIntro,
15653     uiIssuesInfo: () => uiIssuesInfo,
15654     uiKeepRightDetails: () => uiKeepRightDetails,
15655     uiKeepRightEditor: () => uiKeepRightEditor,
15656     uiKeepRightHeader: () => uiKeepRightHeader,
15657     uiLasso: () => uiLasso,
15658     uiLoading: () => uiLoading,
15659     uiMapInMap: () => uiMapInMap,
15660     uiModal: () => uiModal,
15661     uiNoteComments: () => uiNoteComments,
15662     uiNoteEditor: () => uiNoteEditor,
15663     uiNoteHeader: () => uiNoteHeader,
15664     uiNoteReport: () => uiNoteReport,
15665     uiNotice: () => uiNotice,
15666     uiPaneBackground: () => uiPaneBackground,
15667     uiPaneHelp: () => uiPaneHelp,
15668     uiPaneIssues: () => uiPaneIssues,
15669     uiPaneMapData: () => uiPaneMapData,
15670     uiPanePreferences: () => uiPanePreferences,
15671     uiPanelBackground: () => uiPanelBackground,
15672     uiPanelHistory: () => uiPanelHistory,
15673     uiPanelLocation: () => uiPanelLocation,
15674     uiPanelMeasurement: () => uiPanelMeasurement,
15675     uiPopover: () => uiPopover,
15676     uiPresetIcon: () => uiPresetIcon,
15677     uiPresetList: () => uiPresetList,
15678     uiRestore: () => uiRestore,
15679     uiScale: () => uiScale,
15680     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
15681     uiSectionBackgroundList: () => uiSectionBackgroundList,
15682     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
15683     uiSectionChanges: () => uiSectionChanges,
15684     uiSectionDataLayers: () => uiSectionDataLayers,
15685     uiSectionEntityIssues: () => uiSectionEntityIssues,
15686     uiSectionFeatureType: () => uiSectionFeatureType,
15687     uiSectionMapFeatures: () => uiSectionMapFeatures,
15688     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
15689     uiSectionOverlayList: () => uiSectionOverlayList,
15690     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
15691     uiSectionPresetFields: () => uiSectionPresetFields,
15692     uiSectionPrivacy: () => uiSectionPrivacy,
15693     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
15694     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
15695     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
15696     uiSectionSelectionList: () => uiSectionSelectionList,
15697     uiSectionValidationIssues: () => uiSectionValidationIssues,
15698     uiSectionValidationOptions: () => uiSectionValidationOptions,
15699     uiSectionValidationRules: () => uiSectionValidationRules,
15700     uiSectionValidationStatus: () => uiSectionValidationStatus,
15701     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
15702     uiSettingsCustomData: () => uiSettingsCustomData,
15703     uiSidebar: () => uiSidebar,
15704     uiSourceSwitch: () => uiSourceSwitch,
15705     uiSpinner: () => uiSpinner,
15706     uiSplash: () => uiSplash,
15707     uiStatus: () => uiStatus,
15708     uiSuccess: () => uiSuccess,
15709     uiTagReference: () => uiTagReference,
15710     uiToggle: () => uiToggle,
15711     uiTooltip: () => uiTooltip,
15712     uiVersion: () => uiVersion,
15713     uiViewOnKeepRight: () => uiViewOnKeepRight,
15714     uiViewOnOSM: () => uiViewOnOSM,
15715     uiZoom: () => uiZoom,
15716     utilAesDecrypt: () => utilAesDecrypt,
15717     utilAesEncrypt: () => utilAesEncrypt,
15718     utilArrayChunk: () => utilArrayChunk,
15719     utilArrayDifference: () => utilArrayDifference,
15720     utilArrayFlatten: () => utilArrayFlatten,
15721     utilArrayGroupBy: () => utilArrayGroupBy,
15722     utilArrayIdentical: () => utilArrayIdentical,
15723     utilArrayIntersection: () => utilArrayIntersection,
15724     utilArrayUnion: () => utilArrayUnion,
15725     utilArrayUniq: () => utilArrayUniq,
15726     utilArrayUniqBy: () => utilArrayUniqBy,
15727     utilAsyncMap: () => utilAsyncMap,
15728     utilCleanTags: () => utilCleanTags,
15729     utilCombinedTags: () => utilCombinedTags,
15730     utilCompareIDs: () => utilCompareIDs,
15731     utilDeepMemberSelector: () => utilDeepMemberSelector,
15732     utilDetect: () => utilDetect,
15733     utilDisplayLabel: () => utilDisplayLabel,
15734     utilDisplayName: () => utilDisplayName,
15735     utilDisplayNameForPath: () => utilDisplayNameForPath,
15736     utilDisplayType: () => utilDisplayType,
15737     utilEditDistance: () => utilEditDistance,
15738     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
15739     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
15740     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
15741     utilEntityRoot: () => utilEntityRoot,
15742     utilEntitySelector: () => utilEntitySelector,
15743     utilFastMouse: () => utilFastMouse,
15744     utilFunctor: () => utilFunctor,
15745     utilGetAllNodes: () => utilGetAllNodes,
15746     utilGetSetValue: () => utilGetSetValue,
15747     utilHashcode: () => utilHashcode,
15748     utilHighlightEntities: () => utilHighlightEntities,
15749     utilKeybinding: () => utilKeybinding,
15750     utilNoAuto: () => utilNoAuto,
15751     utilObjectOmit: () => utilObjectOmit,
15752     utilOldestID: () => utilOldestID,
15753     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
15754     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
15755     utilQsString: () => utilQsString,
15756     utilRebind: () => utilRebind,
15757     utilSafeClassName: () => utilSafeClassName,
15758     utilSessionMutex: () => utilSessionMutex,
15759     utilSetTransform: () => utilSetTransform,
15760     utilStringQs: () => utilStringQs,
15761     utilTagDiff: () => utilTagDiff,
15762     utilTagText: () => utilTagText,
15763     utilTiler: () => utilTiler,
15764     utilTotalExtent: () => utilTotalExtent,
15765     utilTriggerEvent: () => utilTriggerEvent,
15766     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
15767     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
15768     utilUniqueDomId: () => utilUniqueDomId,
15769     utilWrap: () => utilWrap,
15770     validationAlmostJunction: () => validationAlmostJunction,
15771     validationCloseNodes: () => validationCloseNodes,
15772     validationCrossingWays: () => validationCrossingWays,
15773     validationDisconnectedWay: () => validationDisconnectedWay,
15774     validationFormatting: () => validationFormatting,
15775     validationHelpRequest: () => validationHelpRequest,
15776     validationImpossibleOneway: () => validationImpossibleOneway,
15777     validationIncompatibleSource: () => validationIncompatibleSource,
15778     validationMaprules: () => validationMaprules,
15779     validationMismatchedGeometry: () => validationMismatchedGeometry,
15780     validationMissingRole: () => validationMissingRole,
15781     validationMissingTag: () => validationMissingTag,
15782     validationOutdatedTags: () => validationOutdatedTags,
15783     validationPrivateData: () => validationPrivateData,
15784     validationSuspiciousName: () => validationSuspiciousName,
15785     validationUnsquareWay: () => validationUnsquareWay
15786   });
15787
15788   // modules/actions/add_entity.js
15789   function actionAddEntity(way) {
15790     return function(graph) {
15791       return graph.replace(way);
15792     };
15793   }
15794
15795   // modules/actions/reverse.js
15796   function actionReverse(entityID, options2) {
15797     var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
15798     var numeric = /^([+\-]?)(?=[\d.])/;
15799     var directionKey = /direction$/;
15800     var turn_lanes = /^turn:lanes:?/;
15801     var keyReplacements = [
15802       [/:right$/, ":left"],
15803       [/:left$/, ":right"],
15804       [/:forward$/, ":backward"],
15805       [/:backward$/, ":forward"],
15806       [/:right:/, ":left:"],
15807       [/:left:/, ":right:"],
15808       [/:forward:/, ":backward:"],
15809       [/:backward:/, ":forward:"]
15810     ];
15811     var valueReplacements = {
15812       left: "right",
15813       right: "left",
15814       up: "down",
15815       down: "up",
15816       forward: "backward",
15817       backward: "forward",
15818       forwards: "backward",
15819       backwards: "forward"
15820     };
15821     var roleReplacements = {
15822       forward: "backward",
15823       backward: "forward",
15824       forwards: "backward",
15825       backwards: "forward"
15826     };
15827     var onewayReplacements = {
15828       yes: "-1",
15829       "1": "-1",
15830       "-1": "yes"
15831     };
15832     var compassReplacements = {
15833       N: "S",
15834       NNE: "SSW",
15835       NE: "SW",
15836       ENE: "WSW",
15837       E: "W",
15838       ESE: "WNW",
15839       SE: "NW",
15840       SSE: "NNW",
15841       S: "N",
15842       SSW: "NNE",
15843       SW: "NE",
15844       WSW: "ENE",
15845       W: "E",
15846       WNW: "ESE",
15847       NW: "SE",
15848       NNW: "SSE"
15849     };
15850     function reverseKey(key) {
15851       for (var i2 = 0; i2 < keyReplacements.length; ++i2) {
15852         var replacement = keyReplacements[i2];
15853         if (replacement[0].test(key)) {
15854           return key.replace(replacement[0], replacement[1]);
15855         }
15856       }
15857       return key;
15858     }
15859     function reverseValue(key, value, includeAbsolute) {
15860       if (ignoreKey.test(key))
15861         return value;
15862       if (turn_lanes.test(key)) {
15863         return value;
15864       } else if (key === "incline" && numeric.test(value)) {
15865         return value.replace(numeric, function(_, sign2) {
15866           return sign2 === "-" ? "" : "-";
15867         });
15868       } else if (options2 && options2.reverseOneway && key === "oneway") {
15869         return onewayReplacements[value] || value;
15870       } else if (includeAbsolute && directionKey.test(key)) {
15871         if (compassReplacements[value])
15872           return compassReplacements[value];
15873         var degrees3 = parseFloat(value);
15874         if (typeof degrees3 === "number" && !isNaN(degrees3)) {
15875           if (degrees3 < 180) {
15876             degrees3 += 180;
15877           } else {
15878             degrees3 -= 180;
15879           }
15880           return degrees3.toString();
15881         }
15882       }
15883       return valueReplacements[value] || value;
15884     }
15885     function reverseNodeTags(graph, nodeIDs) {
15886       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
15887         var node = graph.hasEntity(nodeIDs[i2]);
15888         if (!node || !Object.keys(node.tags).length)
15889           continue;
15890         var tags = {};
15891         for (var key in node.tags) {
15892           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID);
15893         }
15894         graph = graph.replace(node.update({ tags }));
15895       }
15896       return graph;
15897     }
15898     function reverseWay(graph, way) {
15899       var nodes = way.nodes.slice().reverse();
15900       var tags = {};
15901       var role;
15902       for (var key in way.tags) {
15903         tags[reverseKey(key)] = reverseValue(key, way.tags[key]);
15904       }
15905       graph.parentRelations(way).forEach(function(relation) {
15906         relation.members.forEach(function(member, index) {
15907           if (member.id === way.id && (role = roleReplacements[member.role])) {
15908             relation = relation.updateMember({ role }, index);
15909             graph = graph.replace(relation);
15910           }
15911         });
15912       });
15913       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
15914     }
15915     var action = function(graph) {
15916       var entity = graph.entity(entityID);
15917       if (entity.type === "way") {
15918         return reverseWay(graph, entity);
15919       }
15920       return reverseNodeTags(graph, [entityID]);
15921     };
15922     action.disabled = function(graph) {
15923       var entity = graph.hasEntity(entityID);
15924       if (!entity || entity.type === "way")
15925         return false;
15926       for (var key in entity.tags) {
15927         var value = entity.tags[key];
15928         if (reverseKey(key) !== key || reverseValue(key, value, true) !== value) {
15929           return false;
15930         }
15931       }
15932       return "nondirectional_node";
15933     };
15934     action.entityID = function() {
15935       return entityID;
15936     };
15937     return action;
15938   }
15939
15940   // modules/osm/tags.js
15941   function osmIsInterestingTag(key) {
15942     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && key.indexOf("tiger:") !== 0;
15943   }
15944   var osmLifecyclePrefixes = {
15945     proposed: true,
15946     planned: true,
15947     construction: true,
15948     disused: true,
15949     abandoned: true,
15950     was: true,
15951     dismantled: true,
15952     razed: true,
15953     demolished: true,
15954     destroyed: true,
15955     removed: true,
15956     obliterated: true,
15957     intermittent: true
15958   };
15959   function osmRemoveLifecyclePrefix(key) {
15960     const keySegments = key.split(":");
15961     if (keySegments.length === 1)
15962       return key;
15963     if (keySegments[0] in osmLifecyclePrefixes) {
15964       return key.slice(keySegments[0].length + 1);
15965     }
15966     return key;
15967   }
15968   var osmAreaKeys = {};
15969   function osmSetAreaKeys(value) {
15970     osmAreaKeys = value;
15971   }
15972   var osmAreaKeysExceptions = {
15973     highway: {
15974       elevator: true,
15975       rest_area: true,
15976       services: true
15977     },
15978     public_transport: {
15979       platform: true
15980     },
15981     railway: {
15982       platform: true,
15983       roundhouse: true,
15984       station: true,
15985       traverser: true,
15986       turntable: true,
15987       wash: true
15988     },
15989     waterway: {
15990       dam: true
15991     }
15992   };
15993   function osmTagSuggestingArea(tags) {
15994     if (tags.area === "yes")
15995       return { area: "yes" };
15996     if (tags.area === "no")
15997       return null;
15998     var returnTags = {};
15999     for (var realKey in tags) {
16000       const key = osmRemoveLifecyclePrefix(realKey);
16001       if (key in osmAreaKeys && !(tags[key] in osmAreaKeys[key])) {
16002         returnTags[realKey] = tags[realKey];
16003         return returnTags;
16004       }
16005       if (key in osmAreaKeysExceptions && tags[key] in osmAreaKeysExceptions[key]) {
16006         returnTags[realKey] = tags[realKey];
16007         return returnTags;
16008       }
16009     }
16010     return null;
16011   }
16012   var osmPointTags = {};
16013   function osmSetPointTags(value) {
16014     osmPointTags = value;
16015   }
16016   var osmVertexTags = {};
16017   function osmSetVertexTags(value) {
16018     osmVertexTags = value;
16019   }
16020   function osmNodeGeometriesForTags(nodeTags) {
16021     var geometries = {};
16022     for (var key in nodeTags) {
16023       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
16024         geometries.point = true;
16025       }
16026       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
16027         geometries.vertex = true;
16028       }
16029       if (geometries.point && geometries.vertex)
16030         break;
16031     }
16032     return geometries;
16033   }
16034   var osmOneWayTags = {
16035     "aerialway": {
16036       "chair_lift": true,
16037       "drag_lift": true,
16038       "j-bar": true,
16039       "magic_carpet": true,
16040       "mixed_lift": true,
16041       "platter": true,
16042       "rope_tow": true,
16043       "t-bar": true,
16044       "zip_line": true
16045     },
16046     "highway": {
16047       "motorway": true
16048     },
16049     "junction": {
16050       "circular": true,
16051       "roundabout": true
16052     },
16053     "man_made": {
16054       "goods_conveyor": true,
16055       "piste:halfpipe": true
16056     },
16057     "piste:type": {
16058       "downhill": true,
16059       "sled": true,
16060       "yes": true
16061     },
16062     "seamark:type": {
16063       "separation_lane": true,
16064       "separation_roundabout": true
16065     },
16066     "waterway": {
16067       "canal": true,
16068       "ditch": true,
16069       "drain": true,
16070       "fish_pass": true,
16071       "river": true,
16072       "stream": true,
16073       "tidal_channel": true
16074     }
16075   };
16076   var osmPavedTags = {
16077     "surface": {
16078       "paved": true,
16079       "asphalt": true,
16080       "concrete": true,
16081       "chipseal": true,
16082       "concrete:lanes": true,
16083       "concrete:plates": true
16084     },
16085     "tracktype": {
16086       "grade1": true
16087     }
16088   };
16089   var osmSemipavedTags = {
16090     "surface": {
16091       "cobblestone": true,
16092       "cobblestone:flattened": true,
16093       "unhewn_cobblestone": true,
16094       "sett": true,
16095       "paving_stones": true,
16096       "metal": true,
16097       "wood": true
16098     }
16099   };
16100   var osmRightSideIsInsideTags = {
16101     "natural": {
16102       "cliff": true,
16103       "coastline": "coastline"
16104     },
16105     "barrier": {
16106       "retaining_wall": true,
16107       "kerb": true,
16108       "guard_rail": true,
16109       "city_wall": true
16110     },
16111     "man_made": {
16112       "embankment": true
16113     },
16114     "waterway": {
16115       "weir": true
16116     }
16117   };
16118   var osmRoutableHighwayTagValues = {
16119     motorway: true,
16120     trunk: true,
16121     primary: true,
16122     secondary: true,
16123     tertiary: true,
16124     residential: true,
16125     motorway_link: true,
16126     trunk_link: true,
16127     primary_link: true,
16128     secondary_link: true,
16129     tertiary_link: true,
16130     unclassified: true,
16131     road: true,
16132     service: true,
16133     track: true,
16134     living_street: true,
16135     bus_guideway: true,
16136     path: true,
16137     footway: true,
16138     cycleway: true,
16139     bridleway: true,
16140     pedestrian: true,
16141     corridor: true,
16142     steps: true
16143   };
16144   var osmPathHighwayTagValues = {
16145     path: true,
16146     footway: true,
16147     cycleway: true,
16148     bridleway: true,
16149     pedestrian: true,
16150     corridor: true,
16151     steps: true
16152   };
16153   var osmRailwayTrackTagValues = {
16154     rail: true,
16155     light_rail: true,
16156     tram: true,
16157     subway: true,
16158     monorail: true,
16159     funicular: true,
16160     miniature: true,
16161     narrow_gauge: true,
16162     disused: true,
16163     preserved: true
16164   };
16165   var osmFlowingWaterwayTagValues = {
16166     canal: true,
16167     ditch: true,
16168     drain: true,
16169     fish_pass: true,
16170     river: true,
16171     stream: true,
16172     tidal_channel: true
16173   };
16174
16175   // node_modules/d3-array/src/ascending.js
16176   function ascending(a, b) {
16177     return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
16178   }
16179
16180   // node_modules/d3-array/src/descending.js
16181   function descending(a, b) {
16182     return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
16183   }
16184
16185   // node_modules/d3-array/src/bisector.js
16186   function bisector(f2) {
16187     let compare1, compare2, delta;
16188     if (f2.length !== 2) {
16189       compare1 = ascending;
16190       compare2 = (d, x) => ascending(f2(d), x);
16191       delta = (d, x) => f2(d) - x;
16192     } else {
16193       compare1 = f2 === ascending || f2 === descending ? f2 : zero;
16194       compare2 = f2;
16195       delta = f2;
16196     }
16197     function left(a, x, lo = 0, hi = a.length) {
16198       if (lo < hi) {
16199         if (compare1(x, x) !== 0)
16200           return hi;
16201         do {
16202           const mid = lo + hi >>> 1;
16203           if (compare2(a[mid], x) < 0)
16204             lo = mid + 1;
16205           else
16206             hi = mid;
16207         } while (lo < hi);
16208       }
16209       return lo;
16210     }
16211     function right(a, x, lo = 0, hi = a.length) {
16212       if (lo < hi) {
16213         if (compare1(x, x) !== 0)
16214           return hi;
16215         do {
16216           const mid = lo + hi >>> 1;
16217           if (compare2(a[mid], x) <= 0)
16218             lo = mid + 1;
16219           else
16220             hi = mid;
16221         } while (lo < hi);
16222       }
16223       return lo;
16224     }
16225     function center(a, x, lo = 0, hi = a.length) {
16226       const i2 = left(a, x, lo, hi - 1);
16227       return i2 > lo && delta(a[i2 - 1], x) > -delta(a[i2], x) ? i2 - 1 : i2;
16228     }
16229     return { left, center, right };
16230   }
16231   function zero() {
16232     return 0;
16233   }
16234
16235   // node_modules/d3-array/src/number.js
16236   function number(x) {
16237     return x === null ? NaN : +x;
16238   }
16239   function* numbers(values, valueof) {
16240     if (valueof === void 0) {
16241       for (let value of values) {
16242         if (value != null && (value = +value) >= value) {
16243           yield value;
16244         }
16245       }
16246     } else {
16247       let index = -1;
16248       for (let value of values) {
16249         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
16250           yield value;
16251         }
16252       }
16253     }
16254   }
16255
16256   // node_modules/d3-array/src/bisect.js
16257   var ascendingBisect = bisector(ascending);
16258   var bisectRight = ascendingBisect.right;
16259   var bisectLeft = ascendingBisect.left;
16260   var bisectCenter = bisector(number).center;
16261   var bisect_default = bisectRight;
16262
16263   // node_modules/d3-array/src/fsum.js
16264   var Adder = class {
16265     constructor() {
16266       this._partials = new Float64Array(32);
16267       this._n = 0;
16268     }
16269     add(x) {
16270       const p = this._partials;
16271       let i2 = 0;
16272       for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
16273         const y = p[j2], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
16274         if (lo)
16275           p[i2++] = lo;
16276         x = hi;
16277       }
16278       p[i2] = x;
16279       this._n = i2 + 1;
16280       return this;
16281     }
16282     valueOf() {
16283       const p = this._partials;
16284       let n2 = this._n, x, y, lo, hi = 0;
16285       if (n2 > 0) {
16286         hi = p[--n2];
16287         while (n2 > 0) {
16288           x = hi;
16289           y = p[--n2];
16290           hi = x + y;
16291           lo = y - (hi - x);
16292           if (lo)
16293             break;
16294         }
16295         if (n2 > 0 && (lo < 0 && p[n2 - 1] < 0 || lo > 0 && p[n2 - 1] > 0)) {
16296           y = lo * 2;
16297           x = hi + y;
16298           if (y == x - hi)
16299             hi = x;
16300         }
16301       }
16302       return hi;
16303     }
16304   };
16305
16306   // node_modules/d3-array/src/sort.js
16307   function compareDefined(compare = ascending) {
16308     if (compare === ascending)
16309       return ascendingDefined;
16310     if (typeof compare !== "function")
16311       throw new TypeError("compare is not a function");
16312     return (a, b) => {
16313       const x = compare(a, b);
16314       if (x || x === 0)
16315         return x;
16316       return (compare(b, b) === 0) - (compare(a, a) === 0);
16317     };
16318   }
16319   function ascendingDefined(a, b) {
16320     return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
16321   }
16322
16323   // node_modules/d3-array/src/ticks.js
16324   var e10 = Math.sqrt(50);
16325   var e5 = Math.sqrt(10);
16326   var e2 = Math.sqrt(2);
16327   function ticks(start2, stop, count) {
16328     var reverse, i2 = -1, n2, ticks2, step;
16329     stop = +stop, start2 = +start2, count = +count;
16330     if (start2 === stop && count > 0)
16331       return [start2];
16332     if (reverse = stop < start2)
16333       n2 = start2, start2 = stop, stop = n2;
16334     if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step))
16335       return [];
16336     if (step > 0) {
16337       let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
16338       if (r0 * step < start2)
16339         ++r0;
16340       if (r1 * step > stop)
16341         --r1;
16342       ticks2 = new Array(n2 = r1 - r0 + 1);
16343       while (++i2 < n2)
16344         ticks2[i2] = (r0 + i2) * step;
16345     } else {
16346       step = -step;
16347       let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
16348       if (r0 / step < start2)
16349         ++r0;
16350       if (r1 / step > stop)
16351         --r1;
16352       ticks2 = new Array(n2 = r1 - r0 + 1);
16353       while (++i2 < n2)
16354         ticks2[i2] = (r0 + i2) / step;
16355     }
16356     if (reverse)
16357       ticks2.reverse();
16358     return ticks2;
16359   }
16360   function tickIncrement(start2, stop, count) {
16361     var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
16362     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);
16363   }
16364   function tickStep(start2, stop, count) {
16365     var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
16366     if (error >= e10)
16367       step1 *= 10;
16368     else if (error >= e5)
16369       step1 *= 5;
16370     else if (error >= e2)
16371       step1 *= 2;
16372     return stop < start2 ? -step1 : step1;
16373   }
16374
16375   // node_modules/d3-array/src/max.js
16376   function max(values, valueof) {
16377     let max3;
16378     if (valueof === void 0) {
16379       for (const value of values) {
16380         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
16381           max3 = value;
16382         }
16383       }
16384     } else {
16385       let index = -1;
16386       for (let value of values) {
16387         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
16388           max3 = value;
16389         }
16390       }
16391     }
16392     return max3;
16393   }
16394
16395   // node_modules/d3-array/src/min.js
16396   function min(values, valueof) {
16397     let min3;
16398     if (valueof === void 0) {
16399       for (const value of values) {
16400         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
16401           min3 = value;
16402         }
16403       }
16404     } else {
16405       let index = -1;
16406       for (let value of values) {
16407         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
16408           min3 = value;
16409         }
16410       }
16411     }
16412     return min3;
16413   }
16414
16415   // node_modules/d3-array/src/quickselect.js
16416   function quickselect(array2, k, left = 0, right = array2.length - 1, compare) {
16417     compare = compare === void 0 ? ascendingDefined : compareDefined(compare);
16418     while (right > left) {
16419       if (right - left > 600) {
16420         const n2 = right - left + 1;
16421         const m = k - left + 1;
16422         const z = Math.log(n2);
16423         const s = 0.5 * Math.exp(2 * z / 3);
16424         const sd = 0.5 * Math.sqrt(z * s * (n2 - s) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
16425         const newLeft = Math.max(left, Math.floor(k - m * s / n2 + sd));
16426         const newRight = Math.min(right, Math.floor(k + (n2 - m) * s / n2 + sd));
16427         quickselect(array2, k, newLeft, newRight, compare);
16428       }
16429       const t = array2[k];
16430       let i2 = left;
16431       let j2 = right;
16432       swap(array2, left, k);
16433       if (compare(array2[right], t) > 0)
16434         swap(array2, left, right);
16435       while (i2 < j2) {
16436         swap(array2, i2, j2), ++i2, --j2;
16437         while (compare(array2[i2], t) < 0)
16438           ++i2;
16439         while (compare(array2[j2], t) > 0)
16440           --j2;
16441       }
16442       if (compare(array2[left], t) === 0)
16443         swap(array2, left, j2);
16444       else
16445         ++j2, swap(array2, j2, right);
16446       if (j2 <= k)
16447         left = j2 + 1;
16448       if (k <= j2)
16449         right = j2 - 1;
16450     }
16451     return array2;
16452   }
16453   function swap(array2, i2, j2) {
16454     const t = array2[i2];
16455     array2[i2] = array2[j2];
16456     array2[j2] = t;
16457   }
16458
16459   // node_modules/d3-array/src/quantile.js
16460   function quantile(values, p, valueof) {
16461     values = Float64Array.from(numbers(values, valueof));
16462     if (!(n2 = values.length))
16463       return;
16464     if ((p = +p) <= 0 || n2 < 2)
16465       return min(values);
16466     if (p >= 1)
16467       return max(values);
16468     var n2, i2 = (n2 - 1) * p, i0 = Math.floor(i2), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
16469     return value0 + (value1 - value0) * (i2 - i0);
16470   }
16471
16472   // node_modules/d3-array/src/median.js
16473   function median(values, valueof) {
16474     return quantile(values, 0.5, valueof);
16475   }
16476
16477   // node_modules/d3-array/src/merge.js
16478   function* flatten(arrays) {
16479     for (const array2 of arrays) {
16480       yield* array2;
16481     }
16482   }
16483   function merge(arrays) {
16484     return Array.from(flatten(arrays));
16485   }
16486
16487   // node_modules/d3-array/src/range.js
16488   function range(start2, stop, step) {
16489     start2 = +start2, stop = +stop, step = (n2 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n2 < 3 ? 1 : +step;
16490     var i2 = -1, n2 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n2);
16491     while (++i2 < n2) {
16492       range3[i2] = start2 + i2 * step;
16493     }
16494     return range3;
16495   }
16496
16497   // node_modules/d3-geo/src/math.js
16498   var epsilon = 1e-6;
16499   var epsilon2 = 1e-12;
16500   var pi = Math.PI;
16501   var halfPi = pi / 2;
16502   var quarterPi = pi / 4;
16503   var tau = pi * 2;
16504   var degrees = 180 / pi;
16505   var radians = pi / 180;
16506   var abs = Math.abs;
16507   var atan = Math.atan;
16508   var atan2 = Math.atan2;
16509   var cos = Math.cos;
16510   var exp = Math.exp;
16511   var log = Math.log;
16512   var sin = Math.sin;
16513   var sign = Math.sign || function(x) {
16514     return x > 0 ? 1 : x < 0 ? -1 : 0;
16515   };
16516   var sqrt = Math.sqrt;
16517   var tan = Math.tan;
16518   function acos(x) {
16519     return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
16520   }
16521   function asin(x) {
16522     return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
16523   }
16524
16525   // node_modules/d3-geo/src/noop.js
16526   function noop() {
16527   }
16528
16529   // node_modules/d3-geo/src/stream.js
16530   function streamGeometry(geometry, stream) {
16531     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
16532       streamGeometryType[geometry.type](geometry, stream);
16533     }
16534   }
16535   var streamObjectType = {
16536     Feature: function(object, stream) {
16537       streamGeometry(object.geometry, stream);
16538     },
16539     FeatureCollection: function(object, stream) {
16540       var features2 = object.features, i2 = -1, n2 = features2.length;
16541       while (++i2 < n2)
16542         streamGeometry(features2[i2].geometry, stream);
16543     }
16544   };
16545   var streamGeometryType = {
16546     Sphere: function(object, stream) {
16547       stream.sphere();
16548     },
16549     Point: function(object, stream) {
16550       object = object.coordinates;
16551       stream.point(object[0], object[1], object[2]);
16552     },
16553     MultiPoint: function(object, stream) {
16554       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16555       while (++i2 < n2)
16556         object = coordinates[i2], stream.point(object[0], object[1], object[2]);
16557     },
16558     LineString: function(object, stream) {
16559       streamLine(object.coordinates, stream, 0);
16560     },
16561     MultiLineString: function(object, stream) {
16562       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16563       while (++i2 < n2)
16564         streamLine(coordinates[i2], stream, 0);
16565     },
16566     Polygon: function(object, stream) {
16567       streamPolygon(object.coordinates, stream);
16568     },
16569     MultiPolygon: function(object, stream) {
16570       var coordinates = object.coordinates, i2 = -1, n2 = coordinates.length;
16571       while (++i2 < n2)
16572         streamPolygon(coordinates[i2], stream);
16573     },
16574     GeometryCollection: function(object, stream) {
16575       var geometries = object.geometries, i2 = -1, n2 = geometries.length;
16576       while (++i2 < n2)
16577         streamGeometry(geometries[i2], stream);
16578     }
16579   };
16580   function streamLine(coordinates, stream, closed) {
16581     var i2 = -1, n2 = coordinates.length - closed, coordinate;
16582     stream.lineStart();
16583     while (++i2 < n2)
16584       coordinate = coordinates[i2], stream.point(coordinate[0], coordinate[1], coordinate[2]);
16585     stream.lineEnd();
16586   }
16587   function streamPolygon(coordinates, stream) {
16588     var i2 = -1, n2 = coordinates.length;
16589     stream.polygonStart();
16590     while (++i2 < n2)
16591       streamLine(coordinates[i2], stream, 1);
16592     stream.polygonEnd();
16593   }
16594   function stream_default(object, stream) {
16595     if (object && streamObjectType.hasOwnProperty(object.type)) {
16596       streamObjectType[object.type](object, stream);
16597     } else {
16598       streamGeometry(object, stream);
16599     }
16600   }
16601
16602   // node_modules/d3-geo/src/area.js
16603   var areaRingSum = new Adder();
16604   var areaSum = new Adder();
16605   var lambda00;
16606   var phi00;
16607   var lambda0;
16608   var cosPhi0;
16609   var sinPhi0;
16610   var areaStream = {
16611     point: noop,
16612     lineStart: noop,
16613     lineEnd: noop,
16614     polygonStart: function() {
16615       areaRingSum = new Adder();
16616       areaStream.lineStart = areaRingStart;
16617       areaStream.lineEnd = areaRingEnd;
16618     },
16619     polygonEnd: function() {
16620       var areaRing = +areaRingSum;
16621       areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
16622       this.lineStart = this.lineEnd = this.point = noop;
16623     },
16624     sphere: function() {
16625       areaSum.add(tau);
16626     }
16627   };
16628   function areaRingStart() {
16629     areaStream.point = areaPointFirst;
16630   }
16631   function areaRingEnd() {
16632     areaPoint(lambda00, phi00);
16633   }
16634   function areaPointFirst(lambda, phi) {
16635     areaStream.point = areaPoint;
16636     lambda00 = lambda, phi00 = phi;
16637     lambda *= radians, phi *= radians;
16638     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
16639   }
16640   function areaPoint(lambda, phi) {
16641     lambda *= radians, phi *= radians;
16642     phi = phi / 2 + quarterPi;
16643     var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * cos(adLambda), v = k * sdLambda * sin(adLambda);
16644     areaRingSum.add(atan2(v, u));
16645     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
16646   }
16647   function area_default(object) {
16648     areaSum = new Adder();
16649     stream_default(object, areaStream);
16650     return areaSum * 2;
16651   }
16652
16653   // node_modules/d3-geo/src/cartesian.js
16654   function spherical(cartesian2) {
16655     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
16656   }
16657   function cartesian(spherical2) {
16658     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
16659     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
16660   }
16661   function cartesianDot(a, b) {
16662     return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
16663   }
16664   function cartesianCross(a, b) {
16665     return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
16666   }
16667   function cartesianAddInPlace(a, b) {
16668     a[0] += b[0], a[1] += b[1], a[2] += b[2];
16669   }
16670   function cartesianScale(vector, k) {
16671     return [vector[0] * k, vector[1] * k, vector[2] * k];
16672   }
16673   function cartesianNormalizeInPlace(d) {
16674     var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
16675     d[0] /= l, d[1] /= l, d[2] /= l;
16676   }
16677
16678   // node_modules/d3-geo/src/bounds.js
16679   var lambda02;
16680   var phi0;
16681   var lambda1;
16682   var phi1;
16683   var lambda2;
16684   var lambda002;
16685   var phi002;
16686   var p0;
16687   var deltaSum;
16688   var ranges;
16689   var range2;
16690   var boundsStream = {
16691     point: boundsPoint,
16692     lineStart: boundsLineStart,
16693     lineEnd: boundsLineEnd,
16694     polygonStart: function() {
16695       boundsStream.point = boundsRingPoint;
16696       boundsStream.lineStart = boundsRingStart;
16697       boundsStream.lineEnd = boundsRingEnd;
16698       deltaSum = new Adder();
16699       areaStream.polygonStart();
16700     },
16701     polygonEnd: function() {
16702       areaStream.polygonEnd();
16703       boundsStream.point = boundsPoint;
16704       boundsStream.lineStart = boundsLineStart;
16705       boundsStream.lineEnd = boundsLineEnd;
16706       if (areaRingSum < 0)
16707         lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16708       else if (deltaSum > epsilon)
16709         phi1 = 90;
16710       else if (deltaSum < -epsilon)
16711         phi0 = -90;
16712       range2[0] = lambda02, range2[1] = lambda1;
16713     },
16714     sphere: function() {
16715       lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16716     }
16717   };
16718   function boundsPoint(lambda, phi) {
16719     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16720     if (phi < phi0)
16721       phi0 = phi;
16722     if (phi > phi1)
16723       phi1 = phi;
16724   }
16725   function linePoint(lambda, phi) {
16726     var p = cartesian([lambda * radians, phi * radians]);
16727     if (p0) {
16728       var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
16729       cartesianNormalizeInPlace(inflection);
16730       inflection = spherical(inflection);
16731       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
16732       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16733         phii = inflection[1] * degrees;
16734         if (phii > phi1)
16735           phi1 = phii;
16736       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16737         phii = -inflection[1] * degrees;
16738         if (phii < phi0)
16739           phi0 = phii;
16740       } else {
16741         if (phi < phi0)
16742           phi0 = phi;
16743         if (phi > phi1)
16744           phi1 = phi;
16745       }
16746       if (antimeridian) {
16747         if (lambda < lambda2) {
16748           if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16749             lambda1 = lambda;
16750         } else {
16751           if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16752             lambda02 = lambda;
16753         }
16754       } else {
16755         if (lambda1 >= lambda02) {
16756           if (lambda < lambda02)
16757             lambda02 = lambda;
16758           if (lambda > lambda1)
16759             lambda1 = lambda;
16760         } else {
16761           if (lambda > lambda2) {
16762             if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16763               lambda1 = lambda;
16764           } else {
16765             if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16766               lambda02 = lambda;
16767           }
16768         }
16769       }
16770     } else {
16771       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16772     }
16773     if (phi < phi0)
16774       phi0 = phi;
16775     if (phi > phi1)
16776       phi1 = phi;
16777     p0 = p, lambda2 = lambda;
16778   }
16779   function boundsLineStart() {
16780     boundsStream.point = linePoint;
16781   }
16782   function boundsLineEnd() {
16783     range2[0] = lambda02, range2[1] = lambda1;
16784     boundsStream.point = boundsPoint;
16785     p0 = null;
16786   }
16787   function boundsRingPoint(lambda, phi) {
16788     if (p0) {
16789       var delta = lambda - lambda2;
16790       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
16791     } else {
16792       lambda002 = lambda, phi002 = phi;
16793     }
16794     areaStream.point(lambda, phi);
16795     linePoint(lambda, phi);
16796   }
16797   function boundsRingStart() {
16798     areaStream.lineStart();
16799   }
16800   function boundsRingEnd() {
16801     boundsRingPoint(lambda002, phi002);
16802     areaStream.lineEnd();
16803     if (abs(deltaSum) > epsilon)
16804       lambda02 = -(lambda1 = 180);
16805     range2[0] = lambda02, range2[1] = lambda1;
16806     p0 = null;
16807   }
16808   function angle(lambda04, lambda12) {
16809     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
16810   }
16811   function rangeCompare(a, b) {
16812     return a[0] - b[0];
16813   }
16814   function rangeContains(range3, x) {
16815     return range3[0] <= range3[1] ? range3[0] <= x && x <= range3[1] : x < range3[0] || range3[1] < x;
16816   }
16817   function bounds_default(feature3) {
16818     var i2, n2, a, b, merged, deltaMax, delta;
16819     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
16820     ranges = [];
16821     stream_default(feature3, boundsStream);
16822     if (n2 = ranges.length) {
16823       ranges.sort(rangeCompare);
16824       for (i2 = 1, a = ranges[0], merged = [a]; i2 < n2; ++i2) {
16825         b = ranges[i2];
16826         if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {
16827           if (angle(a[0], b[1]) > angle(a[0], a[1]))
16828             a[1] = b[1];
16829           if (angle(b[0], a[1]) > angle(a[0], a[1]))
16830             a[0] = b[0];
16831         } else {
16832           merged.push(a = b);
16833         }
16834       }
16835       for (deltaMax = -Infinity, n2 = merged.length - 1, i2 = 0, a = merged[n2]; i2 <= n2; a = b, ++i2) {
16836         b = merged[i2];
16837         if ((delta = angle(a[1], b[0])) > deltaMax)
16838           deltaMax = delta, lambda02 = b[0], lambda1 = a[1];
16839       }
16840     }
16841     ranges = range2 = null;
16842     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
16843   }
16844
16845   // node_modules/d3-geo/src/compose.js
16846   function compose_default(a, b) {
16847     function compose(x, y) {
16848       return x = a(x, y), b(x[0], x[1]);
16849     }
16850     if (a.invert && b.invert)
16851       compose.invert = function(x, y) {
16852         return x = b.invert(x, y), x && a.invert(x[0], x[1]);
16853       };
16854     return compose;
16855   }
16856
16857   // node_modules/d3-geo/src/rotation.js
16858   function rotationIdentity(lambda, phi) {
16859     return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
16860   }
16861   rotationIdentity.invert = rotationIdentity;
16862   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
16863     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
16864   }
16865   function forwardRotationLambda(deltaLambda) {
16866     return function(lambda, phi) {
16867       return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
16868     };
16869   }
16870   function rotationLambda(deltaLambda) {
16871     var rotation = forwardRotationLambda(deltaLambda);
16872     rotation.invert = forwardRotationLambda(-deltaLambda);
16873     return rotation;
16874   }
16875   function rotationPhiGamma(deltaPhi, deltaGamma) {
16876     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
16877     function rotation(lambda, phi) {
16878       var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
16879       return [
16880         atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
16881         asin(k * cosDeltaGamma + y * sinDeltaGamma)
16882       ];
16883     }
16884     rotation.invert = function(lambda, phi) {
16885       var cosPhi = cos(phi), x = cos(lambda) * cosPhi, y = sin(lambda) * cosPhi, z = sin(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
16886       return [
16887         atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
16888         asin(k * cosDeltaPhi - x * sinDeltaPhi)
16889       ];
16890     };
16891     return rotation;
16892   }
16893   function rotation_default(rotate) {
16894     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
16895     function forward(coordinates) {
16896       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
16897       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16898     }
16899     forward.invert = function(coordinates) {
16900       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
16901       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16902     };
16903     return forward;
16904   }
16905
16906   // node_modules/d3-geo/src/circle.js
16907   function circleStream(stream, radius, delta, direction, t0, t1) {
16908     if (!delta)
16909       return;
16910     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
16911     if (t0 == null) {
16912       t0 = radius + direction * tau;
16913       t1 = radius - step / 2;
16914     } else {
16915       t0 = circleRadius(cosRadius, t0);
16916       t1 = circleRadius(cosRadius, t1);
16917       if (direction > 0 ? t0 < t1 : t0 > t1)
16918         t0 += direction * tau;
16919     }
16920     for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
16921       point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
16922       stream.point(point[0], point[1]);
16923     }
16924   }
16925   function circleRadius(cosRadius, point) {
16926     point = cartesian(point), point[0] -= cosRadius;
16927     cartesianNormalizeInPlace(point);
16928     var radius = acos(-point[1]);
16929     return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
16930   }
16931
16932   // node_modules/d3-geo/src/clip/buffer.js
16933   function buffer_default() {
16934     var lines = [], line;
16935     return {
16936       point: function(x, y, m) {
16937         line.push([x, y, m]);
16938       },
16939       lineStart: function() {
16940         lines.push(line = []);
16941       },
16942       lineEnd: noop,
16943       rejoin: function() {
16944         if (lines.length > 1)
16945           lines.push(lines.pop().concat(lines.shift()));
16946       },
16947       result: function() {
16948         var result = lines;
16949         lines = [];
16950         line = null;
16951         return result;
16952       }
16953     };
16954   }
16955
16956   // node_modules/d3-geo/src/pointEqual.js
16957   function pointEqual_default(a, b) {
16958     return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;
16959   }
16960
16961   // node_modules/d3-geo/src/clip/rejoin.js
16962   function Intersection(point, points, other, entry) {
16963     this.x = point;
16964     this.z = points;
16965     this.o = other;
16966     this.e = entry;
16967     this.v = false;
16968     this.n = this.p = null;
16969   }
16970   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
16971     var subject = [], clip = [], i2, n2;
16972     segments.forEach(function(segment) {
16973       if ((n3 = segment.length - 1) <= 0)
16974         return;
16975       var n3, p02 = segment[0], p1 = segment[n3], x;
16976       if (pointEqual_default(p02, p1)) {
16977         if (!p02[2] && !p1[2]) {
16978           stream.lineStart();
16979           for (i2 = 0; i2 < n3; ++i2)
16980             stream.point((p02 = segment[i2])[0], p02[1]);
16981           stream.lineEnd();
16982           return;
16983         }
16984         p1[0] += 2 * epsilon;
16985       }
16986       subject.push(x = new Intersection(p02, segment, null, true));
16987       clip.push(x.o = new Intersection(p02, null, x, false));
16988       subject.push(x = new Intersection(p1, segment, null, false));
16989       clip.push(x.o = new Intersection(p1, null, x, true));
16990     });
16991     if (!subject.length)
16992       return;
16993     clip.sort(compareIntersection2);
16994     link(subject);
16995     link(clip);
16996     for (i2 = 0, n2 = clip.length; i2 < n2; ++i2) {
16997       clip[i2].e = startInside = !startInside;
16998     }
16999     var start2 = subject[0], points, point;
17000     while (1) {
17001       var current = start2, isSubject = true;
17002       while (current.v)
17003         if ((current = current.n) === start2)
17004           return;
17005       points = current.z;
17006       stream.lineStart();
17007       do {
17008         current.v = current.o.v = true;
17009         if (current.e) {
17010           if (isSubject) {
17011             for (i2 = 0, n2 = points.length; i2 < n2; ++i2)
17012               stream.point((point = points[i2])[0], point[1]);
17013           } else {
17014             interpolate(current.x, current.n.x, 1, stream);
17015           }
17016           current = current.n;
17017         } else {
17018           if (isSubject) {
17019             points = current.p.z;
17020             for (i2 = points.length - 1; i2 >= 0; --i2)
17021               stream.point((point = points[i2])[0], point[1]);
17022           } else {
17023             interpolate(current.x, current.p.x, -1, stream);
17024           }
17025           current = current.p;
17026         }
17027         current = current.o;
17028         points = current.z;
17029         isSubject = !isSubject;
17030       } while (!current.v);
17031       stream.lineEnd();
17032     }
17033   }
17034   function link(array2) {
17035     if (!(n2 = array2.length))
17036       return;
17037     var n2, i2 = 0, a = array2[0], b;
17038     while (++i2 < n2) {
17039       a.n = b = array2[i2];
17040       b.p = a;
17041       a = b;
17042     }
17043     a.n = b = array2[0];
17044     b.p = a;
17045   }
17046
17047   // node_modules/d3-geo/src/polygonContains.js
17048   function longitude(point) {
17049     return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
17050   }
17051   function polygonContains_default(polygon2, point) {
17052     var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
17053     var sum = new Adder();
17054     if (sinPhi === 1)
17055       phi = halfPi + epsilon;
17056     else if (sinPhi === -1)
17057       phi = -halfPi - epsilon;
17058     for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
17059       if (!(m = (ring = polygon2[i2]).length))
17060         continue;
17061       var ring, m, point0 = ring[m - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
17062       for (var j2 = 0; j2 < m; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
17063         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, k = sinPhi03 * sinPhi1;
17064         sum.add(atan2(k * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k * cos(absDelta)));
17065         angle2 += antimeridian ? delta + sign2 * tau : delta;
17066         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
17067           var arc = cartesianCross(cartesian(point0), cartesian(point1));
17068           cartesianNormalizeInPlace(arc);
17069           var intersection = cartesianCross(normal, arc);
17070           cartesianNormalizeInPlace(intersection);
17071           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
17072           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
17073             winding += antimeridian ^ delta >= 0 ? 1 : -1;
17074           }
17075         }
17076       }
17077     }
17078     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
17079   }
17080
17081   // node_modules/d3-geo/src/clip/index.js
17082   function clip_default(pointVisible, clipLine, interpolate, start2) {
17083     return function(sink) {
17084       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
17085       var clip = {
17086         point,
17087         lineStart,
17088         lineEnd,
17089         polygonStart: function() {
17090           clip.point = pointRing;
17091           clip.lineStart = ringStart;
17092           clip.lineEnd = ringEnd;
17093           segments = [];
17094           polygon2 = [];
17095         },
17096         polygonEnd: function() {
17097           clip.point = point;
17098           clip.lineStart = lineStart;
17099           clip.lineEnd = lineEnd;
17100           segments = merge(segments);
17101           var startInside = polygonContains_default(polygon2, start2);
17102           if (segments.length) {
17103             if (!polygonStarted)
17104               sink.polygonStart(), polygonStarted = true;
17105             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
17106           } else if (startInside) {
17107             if (!polygonStarted)
17108               sink.polygonStart(), polygonStarted = true;
17109             sink.lineStart();
17110             interpolate(null, null, 1, sink);
17111             sink.lineEnd();
17112           }
17113           if (polygonStarted)
17114             sink.polygonEnd(), polygonStarted = false;
17115           segments = polygon2 = null;
17116         },
17117         sphere: function() {
17118           sink.polygonStart();
17119           sink.lineStart();
17120           interpolate(null, null, 1, sink);
17121           sink.lineEnd();
17122           sink.polygonEnd();
17123         }
17124       };
17125       function point(lambda, phi) {
17126         if (pointVisible(lambda, phi))
17127           sink.point(lambda, phi);
17128       }
17129       function pointLine(lambda, phi) {
17130         line.point(lambda, phi);
17131       }
17132       function lineStart() {
17133         clip.point = pointLine;
17134         line.lineStart();
17135       }
17136       function lineEnd() {
17137         clip.point = point;
17138         line.lineEnd();
17139       }
17140       function pointRing(lambda, phi) {
17141         ring.push([lambda, phi]);
17142         ringSink.point(lambda, phi);
17143       }
17144       function ringStart() {
17145         ringSink.lineStart();
17146         ring = [];
17147       }
17148       function ringEnd() {
17149         pointRing(ring[0][0], ring[0][1]);
17150         ringSink.lineEnd();
17151         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i2, n2 = ringSegments.length, m, segment, point2;
17152         ring.pop();
17153         polygon2.push(ring);
17154         ring = null;
17155         if (!n2)
17156           return;
17157         if (clean2 & 1) {
17158           segment = ringSegments[0];
17159           if ((m = segment.length - 1) > 0) {
17160             if (!polygonStarted)
17161               sink.polygonStart(), polygonStarted = true;
17162             sink.lineStart();
17163             for (i2 = 0; i2 < m; ++i2)
17164               sink.point((point2 = segment[i2])[0], point2[1]);
17165             sink.lineEnd();
17166           }
17167           return;
17168         }
17169         if (n2 > 1 && clean2 & 2)
17170           ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
17171         segments.push(ringSegments.filter(validSegment));
17172       }
17173       return clip;
17174     };
17175   }
17176   function validSegment(segment) {
17177     return segment.length > 1;
17178   }
17179   function compareIntersection(a, b) {
17180     return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);
17181   }
17182
17183   // node_modules/d3-geo/src/clip/antimeridian.js
17184   var antimeridian_default = clip_default(
17185     function() {
17186       return true;
17187     },
17188     clipAntimeridianLine,
17189     clipAntimeridianInterpolate,
17190     [-pi, -halfPi]
17191   );
17192   function clipAntimeridianLine(stream) {
17193     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
17194     return {
17195       lineStart: function() {
17196         stream.lineStart();
17197         clean2 = 1;
17198       },
17199       point: function(lambda12, phi12) {
17200         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
17201         if (abs(delta - pi) < epsilon) {
17202           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
17203           stream.point(sign0, phi02);
17204           stream.lineEnd();
17205           stream.lineStart();
17206           stream.point(sign1, phi02);
17207           stream.point(lambda12, phi02);
17208           clean2 = 0;
17209         } else if (sign0 !== sign1 && delta >= pi) {
17210           if (abs(lambda04 - sign0) < epsilon)
17211             lambda04 -= sign0 * epsilon;
17212           if (abs(lambda12 - sign1) < epsilon)
17213             lambda12 -= sign1 * epsilon;
17214           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
17215           stream.point(sign0, phi02);
17216           stream.lineEnd();
17217           stream.lineStart();
17218           stream.point(sign1, phi02);
17219           clean2 = 0;
17220         }
17221         stream.point(lambda04 = lambda12, phi02 = phi12);
17222         sign0 = sign1;
17223       },
17224       lineEnd: function() {
17225         stream.lineEnd();
17226         lambda04 = phi02 = NaN;
17227       },
17228       clean: function() {
17229         return 2 - clean2;
17230       }
17231     };
17232   }
17233   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
17234     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
17235     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;
17236   }
17237   function clipAntimeridianInterpolate(from, to, direction, stream) {
17238     var phi;
17239     if (from == null) {
17240       phi = direction * halfPi;
17241       stream.point(-pi, phi);
17242       stream.point(0, phi);
17243       stream.point(pi, phi);
17244       stream.point(pi, 0);
17245       stream.point(pi, -phi);
17246       stream.point(0, -phi);
17247       stream.point(-pi, -phi);
17248       stream.point(-pi, 0);
17249       stream.point(-pi, phi);
17250     } else if (abs(from[0] - to[0]) > epsilon) {
17251       var lambda = from[0] < to[0] ? pi : -pi;
17252       phi = direction * lambda / 2;
17253       stream.point(-lambda, phi);
17254       stream.point(0, phi);
17255       stream.point(lambda, phi);
17256     } else {
17257       stream.point(to[0], to[1]);
17258     }
17259   }
17260
17261   // node_modules/d3-geo/src/clip/circle.js
17262   function circle_default(radius) {
17263     var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
17264     function interpolate(from, to, direction, stream) {
17265       circleStream(stream, radius, delta, direction, from, to);
17266     }
17267     function visible(lambda, phi) {
17268       return cos(lambda) * cos(phi) > cr;
17269     }
17270     function clipLine(stream) {
17271       var point0, c0, v0, v00, clean2;
17272       return {
17273         lineStart: function() {
17274           v00 = v0 = false;
17275           clean2 = 1;
17276         },
17277         point: function(lambda, phi) {
17278           var point1 = [lambda, phi], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
17279           if (!point0 && (v00 = v0 = v))
17280             stream.lineStart();
17281           if (v !== v0) {
17282             point2 = intersect2(point0, point1);
17283             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
17284               point1[2] = 1;
17285           }
17286           if (v !== v0) {
17287             clean2 = 0;
17288             if (v) {
17289               stream.lineStart();
17290               point2 = intersect2(point1, point0);
17291               stream.point(point2[0], point2[1]);
17292             } else {
17293               point2 = intersect2(point0, point1);
17294               stream.point(point2[0], point2[1], 2);
17295               stream.lineEnd();
17296             }
17297             point0 = point2;
17298           } else if (notHemisphere && point0 && smallRadius ^ v) {
17299             var t;
17300             if (!(c & c0) && (t = intersect2(point1, point0, true))) {
17301               clean2 = 0;
17302               if (smallRadius) {
17303                 stream.lineStart();
17304                 stream.point(t[0][0], t[0][1]);
17305                 stream.point(t[1][0], t[1][1]);
17306                 stream.lineEnd();
17307               } else {
17308                 stream.point(t[1][0], t[1][1]);
17309                 stream.lineEnd();
17310                 stream.lineStart();
17311                 stream.point(t[0][0], t[0][1], 3);
17312               }
17313             }
17314           }
17315           if (v && (!point0 || !pointEqual_default(point0, point1))) {
17316             stream.point(point1[0], point1[1]);
17317           }
17318           point0 = point1, v0 = v, c0 = c;
17319         },
17320         lineEnd: function() {
17321           if (v0)
17322             stream.lineEnd();
17323           point0 = null;
17324         },
17325         clean: function() {
17326           return clean2 | (v00 && v0) << 1;
17327         }
17328       };
17329     }
17330     function intersect2(a, b, two) {
17331       var pa = cartesian(a), pb = cartesian(b);
17332       var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
17333       if (!determinant)
17334         return !two && a;
17335       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1), B = cartesianScale(n2, c2);
17336       cartesianAddInPlace(A, B);
17337       var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1);
17338       if (t2 < 0)
17339         return;
17340       var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu);
17341       cartesianAddInPlace(q, A);
17342       q = spherical(q);
17343       if (!two)
17344         return q;
17345       var lambda04 = a[0], lambda12 = b[0], phi02 = a[1], phi12 = b[1], z;
17346       if (lambda12 < lambda04)
17347         z = lambda04, lambda04 = lambda12, lambda12 = z;
17348       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
17349       if (!polar && phi12 < phi02)
17350         z = phi02, phi02 = phi12, phi12 = z;
17351       if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs(q[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi ^ (lambda04 <= q[0] && q[0] <= lambda12)) {
17352         var q1 = cartesianScale(u, (-w + t) / uu);
17353         cartesianAddInPlace(q1, A);
17354         return [q, spherical(q1)];
17355       }
17356     }
17357     function code(lambda, phi) {
17358       var r = smallRadius ? radius : pi - radius, code2 = 0;
17359       if (lambda < -r)
17360         code2 |= 1;
17361       else if (lambda > r)
17362         code2 |= 2;
17363       if (phi < -r)
17364         code2 |= 4;
17365       else if (phi > r)
17366         code2 |= 8;
17367       return code2;
17368     }
17369     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
17370   }
17371
17372   // node_modules/d3-geo/src/clip/line.js
17373   function line_default(a, b, x05, y05, x12, y12) {
17374     var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
17375     r = x05 - ax;
17376     if (!dx && r > 0)
17377       return;
17378     r /= dx;
17379     if (dx < 0) {
17380       if (r < t0)
17381         return;
17382       if (r < t1)
17383         t1 = r;
17384     } else if (dx > 0) {
17385       if (r > t1)
17386         return;
17387       if (r > t0)
17388         t0 = r;
17389     }
17390     r = x12 - ax;
17391     if (!dx && r < 0)
17392       return;
17393     r /= dx;
17394     if (dx < 0) {
17395       if (r > t1)
17396         return;
17397       if (r > t0)
17398         t0 = r;
17399     } else if (dx > 0) {
17400       if (r < t0)
17401         return;
17402       if (r < t1)
17403         t1 = r;
17404     }
17405     r = y05 - ay;
17406     if (!dy && r > 0)
17407       return;
17408     r /= dy;
17409     if (dy < 0) {
17410       if (r < t0)
17411         return;
17412       if (r < t1)
17413         t1 = r;
17414     } else if (dy > 0) {
17415       if (r > t1)
17416         return;
17417       if (r > t0)
17418         t0 = r;
17419     }
17420     r = y12 - ay;
17421     if (!dy && r < 0)
17422       return;
17423     r /= dy;
17424     if (dy < 0) {
17425       if (r > t1)
17426         return;
17427       if (r > t0)
17428         t0 = r;
17429     } else if (dy > 0) {
17430       if (r < t0)
17431         return;
17432       if (r < t1)
17433         t1 = r;
17434     }
17435     if (t0 > 0)
17436       a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
17437     if (t1 < 1)
17438       b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
17439     return true;
17440   }
17441
17442   // node_modules/d3-geo/src/clip/rectangle.js
17443   var clipMax = 1e9;
17444   var clipMin = -clipMax;
17445   function clipRectangle(x05, y05, x12, y12) {
17446     function visible(x, y) {
17447       return x05 <= x && x <= x12 && y05 <= y && y <= y12;
17448     }
17449     function interpolate(from, to, direction, stream) {
17450       var a = 0, a1 = 0;
17451       if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
17452         do
17453           stream.point(a === 0 || a === 3 ? x05 : x12, a > 1 ? y12 : y05);
17454         while ((a = (a + direction + 4) % 4) !== a1);
17455       } else {
17456         stream.point(to[0], to[1]);
17457       }
17458     }
17459     function corner(p, direction) {
17460       return abs(p[0] - x05) < epsilon ? direction > 0 ? 0 : 3 : abs(p[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p[1] - y05) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
17461     }
17462     function compareIntersection2(a, b) {
17463       return comparePoint(a.x, b.x);
17464     }
17465     function comparePoint(a, b) {
17466       var ca = corner(a, 1), cb = corner(b, 1);
17467       return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
17468     }
17469     return function(stream) {
17470       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
17471       var clipStream = {
17472         point,
17473         lineStart,
17474         lineEnd,
17475         polygonStart,
17476         polygonEnd
17477       };
17478       function point(x, y) {
17479         if (visible(x, y))
17480           activeStream.point(x, y);
17481       }
17482       function polygonInside() {
17483         var winding = 0;
17484         for (var i2 = 0, n2 = polygon2.length; i2 < n2; ++i2) {
17485           for (var ring2 = polygon2[i2], j2 = 1, m = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j2 < m; ++j2) {
17486             a0 = b0, a1 = b1, point2 = ring2[j2], b0 = point2[0], b1 = point2[1];
17487             if (a1 <= y12) {
17488               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0))
17489                 ++winding;
17490             } else {
17491               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0))
17492                 --winding;
17493             }
17494           }
17495         }
17496         return winding;
17497       }
17498       function polygonStart() {
17499         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
17500       }
17501       function polygonEnd() {
17502         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
17503         if (cleanInside || visible2) {
17504           stream.polygonStart();
17505           if (cleanInside) {
17506             stream.lineStart();
17507             interpolate(null, null, 1, stream);
17508             stream.lineEnd();
17509           }
17510           if (visible2) {
17511             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
17512           }
17513           stream.polygonEnd();
17514         }
17515         activeStream = stream, segments = polygon2 = ring = null;
17516       }
17517       function lineStart() {
17518         clipStream.point = linePoint2;
17519         if (polygon2)
17520           polygon2.push(ring = []);
17521         first = true;
17522         v_ = false;
17523         x_ = y_ = NaN;
17524       }
17525       function lineEnd() {
17526         if (segments) {
17527           linePoint2(x__, y__);
17528           if (v__ && v_)
17529             bufferStream.rejoin();
17530           segments.push(bufferStream.result());
17531         }
17532         clipStream.point = point;
17533         if (v_)
17534           activeStream.lineEnd();
17535       }
17536       function linePoint2(x, y) {
17537         var v = visible(x, y);
17538         if (polygon2)
17539           ring.push([x, y]);
17540         if (first) {
17541           x__ = x, y__ = y, v__ = v;
17542           first = false;
17543           if (v) {
17544             activeStream.lineStart();
17545             activeStream.point(x, y);
17546           }
17547         } else {
17548           if (v && v_)
17549             activeStream.point(x, y);
17550           else {
17551             var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];
17552             if (line_default(a, b, x05, y05, x12, y12)) {
17553               if (!v_) {
17554                 activeStream.lineStart();
17555                 activeStream.point(a[0], a[1]);
17556               }
17557               activeStream.point(b[0], b[1]);
17558               if (!v)
17559                 activeStream.lineEnd();
17560               clean2 = false;
17561             } else if (v) {
17562               activeStream.lineStart();
17563               activeStream.point(x, y);
17564               clean2 = false;
17565             }
17566           }
17567         }
17568         x_ = x, y_ = y, v_ = v;
17569       }
17570       return clipStream;
17571     };
17572   }
17573
17574   // node_modules/d3-geo/src/length.js
17575   var lengthSum;
17576   var lambda03;
17577   var sinPhi02;
17578   var cosPhi02;
17579   var lengthStream = {
17580     sphere: noop,
17581     point: noop,
17582     lineStart: lengthLineStart,
17583     lineEnd: noop,
17584     polygonStart: noop,
17585     polygonEnd: noop
17586   };
17587   function lengthLineStart() {
17588     lengthStream.point = lengthPointFirst;
17589     lengthStream.lineEnd = lengthLineEnd;
17590   }
17591   function lengthLineEnd() {
17592     lengthStream.point = lengthStream.lineEnd = noop;
17593   }
17594   function lengthPointFirst(lambda, phi) {
17595     lambda *= radians, phi *= radians;
17596     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
17597     lengthStream.point = lengthPoint;
17598   }
17599   function lengthPoint(lambda, phi) {
17600     lambda *= radians, phi *= radians;
17601     var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda03), cosDelta = cos(delta), sinDelta = sin(delta), x = cosPhi * sinDelta, y = cosPhi02 * sinPhi - sinPhi02 * cosPhi * cosDelta, z = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
17602     lengthSum.add(atan2(sqrt(x * x + y * y), z));
17603     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
17604   }
17605   function length_default(object) {
17606     lengthSum = new Adder();
17607     stream_default(object, lengthStream);
17608     return +lengthSum;
17609   }
17610
17611   // node_modules/d3-geo/src/identity.js
17612   var identity_default = (x) => x;
17613
17614   // node_modules/d3-geo/src/path/area.js
17615   var areaSum2 = new Adder();
17616   var areaRingSum2 = new Adder();
17617   var x00;
17618   var y00;
17619   var x0;
17620   var y0;
17621   var areaStream2 = {
17622     point: noop,
17623     lineStart: noop,
17624     lineEnd: noop,
17625     polygonStart: function() {
17626       areaStream2.lineStart = areaRingStart2;
17627       areaStream2.lineEnd = areaRingEnd2;
17628     },
17629     polygonEnd: function() {
17630       areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
17631       areaSum2.add(abs(areaRingSum2));
17632       areaRingSum2 = new Adder();
17633     },
17634     result: function() {
17635       var area = areaSum2 / 2;
17636       areaSum2 = new Adder();
17637       return area;
17638     }
17639   };
17640   function areaRingStart2() {
17641     areaStream2.point = areaPointFirst2;
17642   }
17643   function areaPointFirst2(x, y) {
17644     areaStream2.point = areaPoint2;
17645     x00 = x0 = x, y00 = y0 = y;
17646   }
17647   function areaPoint2(x, y) {
17648     areaRingSum2.add(y0 * x - x0 * y);
17649     x0 = x, y0 = y;
17650   }
17651   function areaRingEnd2() {
17652     areaPoint2(x00, y00);
17653   }
17654   var area_default2 = areaStream2;
17655
17656   // node_modules/d3-geo/src/path/bounds.js
17657   var x02 = Infinity;
17658   var y02 = x02;
17659   var x1 = -x02;
17660   var y1 = x1;
17661   var boundsStream2 = {
17662     point: boundsPoint2,
17663     lineStart: noop,
17664     lineEnd: noop,
17665     polygonStart: noop,
17666     polygonEnd: noop,
17667     result: function() {
17668       var bounds = [[x02, y02], [x1, y1]];
17669       x1 = y1 = -(y02 = x02 = Infinity);
17670       return bounds;
17671     }
17672   };
17673   function boundsPoint2(x, y) {
17674     if (x < x02)
17675       x02 = x;
17676     if (x > x1)
17677       x1 = x;
17678     if (y < y02)
17679       y02 = y;
17680     if (y > y1)
17681       y1 = y;
17682   }
17683   var bounds_default2 = boundsStream2;
17684
17685   // node_modules/d3-geo/src/path/centroid.js
17686   var X0 = 0;
17687   var Y0 = 0;
17688   var Z0 = 0;
17689   var X1 = 0;
17690   var Y1 = 0;
17691   var Z1 = 0;
17692   var X2 = 0;
17693   var Y2 = 0;
17694   var Z2 = 0;
17695   var x002;
17696   var y002;
17697   var x03;
17698   var y03;
17699   var centroidStream = {
17700     point: centroidPoint,
17701     lineStart: centroidLineStart,
17702     lineEnd: centroidLineEnd,
17703     polygonStart: function() {
17704       centroidStream.lineStart = centroidRingStart;
17705       centroidStream.lineEnd = centroidRingEnd;
17706     },
17707     polygonEnd: function() {
17708       centroidStream.point = centroidPoint;
17709       centroidStream.lineStart = centroidLineStart;
17710       centroidStream.lineEnd = centroidLineEnd;
17711     },
17712     result: function() {
17713       var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
17714       X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
17715       return centroid;
17716     }
17717   };
17718   function centroidPoint(x, y) {
17719     X0 += x;
17720     Y0 += y;
17721     ++Z0;
17722   }
17723   function centroidLineStart() {
17724     centroidStream.point = centroidPointFirstLine;
17725   }
17726   function centroidPointFirstLine(x, y) {
17727     centroidStream.point = centroidPointLine;
17728     centroidPoint(x03 = x, y03 = y);
17729   }
17730   function centroidPointLine(x, y) {
17731     var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
17732     X1 += z * (x03 + x) / 2;
17733     Y1 += z * (y03 + y) / 2;
17734     Z1 += z;
17735     centroidPoint(x03 = x, y03 = y);
17736   }
17737   function centroidLineEnd() {
17738     centroidStream.point = centroidPoint;
17739   }
17740   function centroidRingStart() {
17741     centroidStream.point = centroidPointFirstRing;
17742   }
17743   function centroidRingEnd() {
17744     centroidPointRing(x002, y002);
17745   }
17746   function centroidPointFirstRing(x, y) {
17747     centroidStream.point = centroidPointRing;
17748     centroidPoint(x002 = x03 = x, y002 = y03 = y);
17749   }
17750   function centroidPointRing(x, y) {
17751     var dx = x - x03, dy = y - y03, z = sqrt(dx * dx + dy * dy);
17752     X1 += z * (x03 + x) / 2;
17753     Y1 += z * (y03 + y) / 2;
17754     Z1 += z;
17755     z = y03 * x - x03 * y;
17756     X2 += z * (x03 + x);
17757     Y2 += z * (y03 + y);
17758     Z2 += z * 3;
17759     centroidPoint(x03 = x, y03 = y);
17760   }
17761   var centroid_default = centroidStream;
17762
17763   // node_modules/d3-geo/src/path/context.js
17764   function PathContext(context) {
17765     this._context = context;
17766   }
17767   PathContext.prototype = {
17768     _radius: 4.5,
17769     pointRadius: function(_) {
17770       return this._radius = _, this;
17771     },
17772     polygonStart: function() {
17773       this._line = 0;
17774     },
17775     polygonEnd: function() {
17776       this._line = NaN;
17777     },
17778     lineStart: function() {
17779       this._point = 0;
17780     },
17781     lineEnd: function() {
17782       if (this._line === 0)
17783         this._context.closePath();
17784       this._point = NaN;
17785     },
17786     point: function(x, y) {
17787       switch (this._point) {
17788         case 0: {
17789           this._context.moveTo(x, y);
17790           this._point = 1;
17791           break;
17792         }
17793         case 1: {
17794           this._context.lineTo(x, y);
17795           break;
17796         }
17797         default: {
17798           this._context.moveTo(x + this._radius, y);
17799           this._context.arc(x, y, this._radius, 0, tau);
17800           break;
17801         }
17802       }
17803     },
17804     result: noop
17805   };
17806
17807   // node_modules/d3-geo/src/path/measure.js
17808   var lengthSum2 = new Adder();
17809   var lengthRing;
17810   var x003;
17811   var y003;
17812   var x04;
17813   var y04;
17814   var lengthStream2 = {
17815     point: noop,
17816     lineStart: function() {
17817       lengthStream2.point = lengthPointFirst2;
17818     },
17819     lineEnd: function() {
17820       if (lengthRing)
17821         lengthPoint2(x003, y003);
17822       lengthStream2.point = noop;
17823     },
17824     polygonStart: function() {
17825       lengthRing = true;
17826     },
17827     polygonEnd: function() {
17828       lengthRing = null;
17829     },
17830     result: function() {
17831       var length = +lengthSum2;
17832       lengthSum2 = new Adder();
17833       return length;
17834     }
17835   };
17836   function lengthPointFirst2(x, y) {
17837     lengthStream2.point = lengthPoint2;
17838     x003 = x04 = x, y003 = y04 = y;
17839   }
17840   function lengthPoint2(x, y) {
17841     x04 -= x, y04 -= y;
17842     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
17843     x04 = x, y04 = y;
17844   }
17845   var measure_default = lengthStream2;
17846
17847   // node_modules/d3-geo/src/path/string.js
17848   function PathString() {
17849     this._string = [];
17850   }
17851   PathString.prototype = {
17852     _radius: 4.5,
17853     _circle: circle(4.5),
17854     pointRadius: function(_) {
17855       if ((_ = +_) !== this._radius)
17856         this._radius = _, this._circle = null;
17857       return this;
17858     },
17859     polygonStart: function() {
17860       this._line = 0;
17861     },
17862     polygonEnd: function() {
17863       this._line = NaN;
17864     },
17865     lineStart: function() {
17866       this._point = 0;
17867     },
17868     lineEnd: function() {
17869       if (this._line === 0)
17870         this._string.push("Z");
17871       this._point = NaN;
17872     },
17873     point: function(x, y) {
17874       switch (this._point) {
17875         case 0: {
17876           this._string.push("M", x, ",", y);
17877           this._point = 1;
17878           break;
17879         }
17880         case 1: {
17881           this._string.push("L", x, ",", y);
17882           break;
17883         }
17884         default: {
17885           if (this._circle == null)
17886             this._circle = circle(this._radius);
17887           this._string.push("M", x, ",", y, this._circle);
17888           break;
17889         }
17890       }
17891     },
17892     result: function() {
17893       if (this._string.length) {
17894         var result = this._string.join("");
17895         this._string = [];
17896         return result;
17897       } else {
17898         return null;
17899       }
17900     }
17901   };
17902   function circle(radius) {
17903     return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
17904   }
17905
17906   // node_modules/d3-geo/src/path/index.js
17907   function path_default(projection2, context) {
17908     var pointRadius = 4.5, projectionStream, contextStream;
17909     function path(object) {
17910       if (object) {
17911         if (typeof pointRadius === "function")
17912           contextStream.pointRadius(+pointRadius.apply(this, arguments));
17913         stream_default(object, projectionStream(contextStream));
17914       }
17915       return contextStream.result();
17916     }
17917     path.area = function(object) {
17918       stream_default(object, projectionStream(area_default2));
17919       return area_default2.result();
17920     };
17921     path.measure = function(object) {
17922       stream_default(object, projectionStream(measure_default));
17923       return measure_default.result();
17924     };
17925     path.bounds = function(object) {
17926       stream_default(object, projectionStream(bounds_default2));
17927       return bounds_default2.result();
17928     };
17929     path.centroid = function(object) {
17930       stream_default(object, projectionStream(centroid_default));
17931       return centroid_default.result();
17932     };
17933     path.projection = function(_) {
17934       return arguments.length ? (projectionStream = _ == null ? (projection2 = null, identity_default) : (projection2 = _).stream, path) : projection2;
17935     };
17936     path.context = function(_) {
17937       if (!arguments.length)
17938         return context;
17939       contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _);
17940       if (typeof pointRadius !== "function")
17941         contextStream.pointRadius(pointRadius);
17942       return path;
17943     };
17944     path.pointRadius = function(_) {
17945       if (!arguments.length)
17946         return pointRadius;
17947       pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
17948       return path;
17949     };
17950     return path.projection(projection2).context(context);
17951   }
17952
17953   // node_modules/d3-geo/src/transform.js
17954   function transform_default(methods2) {
17955     return {
17956       stream: transformer(methods2)
17957     };
17958   }
17959   function transformer(methods2) {
17960     return function(stream) {
17961       var s = new TransformStream();
17962       for (var key in methods2)
17963         s[key] = methods2[key];
17964       s.stream = stream;
17965       return s;
17966     };
17967   }
17968   function TransformStream() {
17969   }
17970   TransformStream.prototype = {
17971     constructor: TransformStream,
17972     point: function(x, y) {
17973       this.stream.point(x, y);
17974     },
17975     sphere: function() {
17976       this.stream.sphere();
17977     },
17978     lineStart: function() {
17979       this.stream.lineStart();
17980     },
17981     lineEnd: function() {
17982       this.stream.lineEnd();
17983     },
17984     polygonStart: function() {
17985       this.stream.polygonStart();
17986     },
17987     polygonEnd: function() {
17988       this.stream.polygonEnd();
17989     }
17990   };
17991
17992   // node_modules/d3-geo/src/projection/fit.js
17993   function fit(projection2, fitBounds, object) {
17994     var clip = projection2.clipExtent && projection2.clipExtent();
17995     projection2.scale(150).translate([0, 0]);
17996     if (clip != null)
17997       projection2.clipExtent(null);
17998     stream_default(object, projection2.stream(bounds_default2));
17999     fitBounds(bounds_default2.result());
18000     if (clip != null)
18001       projection2.clipExtent(clip);
18002     return projection2;
18003   }
18004   function fitExtent(projection2, extent, object) {
18005     return fit(projection2, function(b) {
18006       var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
18007       projection2.scale(150 * k).translate([x, y]);
18008     }, object);
18009   }
18010   function fitSize(projection2, size, object) {
18011     return fitExtent(projection2, [[0, 0], size], object);
18012   }
18013   function fitWidth(projection2, width, object) {
18014     return fit(projection2, function(b) {
18015       var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1];
18016       projection2.scale(150 * k).translate([x, y]);
18017     }, object);
18018   }
18019   function fitHeight(projection2, height, object) {
18020     return fit(projection2, function(b) {
18021       var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2;
18022       projection2.scale(150 * k).translate([x, y]);
18023     }, object);
18024   }
18025
18026   // node_modules/d3-geo/src/projection/resample.js
18027   var maxDepth = 16;
18028   var cosMinDistance = cos(30 * radians);
18029   function resample_default(project, delta2) {
18030     return +delta2 ? resample(project, delta2) : resampleNone(project);
18031   }
18032   function resampleNone(project) {
18033     return transformer({
18034       point: function(x, y) {
18035         x = project(x, y);
18036         this.stream.point(x[0], x[1]);
18037       }
18038     });
18039   }
18040   function resample(project, delta2) {
18041     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
18042       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
18043       if (d2 > 4 * delta2 && depth--) {
18044         var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda22 = abs(abs(c) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b, a), p = project(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
18045         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
18046           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a /= m, b /= m, c, depth, stream);
18047           stream.point(x2, y2);
18048           resampleLineTo(x2, y2, lambda22, a, b, c, x12, y12, lambda12, a1, b1, c1, depth, stream);
18049         }
18050       }
18051     }
18052     return function(stream) {
18053       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
18054       var resampleStream = {
18055         point,
18056         lineStart,
18057         lineEnd,
18058         polygonStart: function() {
18059           stream.polygonStart();
18060           resampleStream.lineStart = ringStart;
18061         },
18062         polygonEnd: function() {
18063           stream.polygonEnd();
18064           resampleStream.lineStart = lineStart;
18065         }
18066       };
18067       function point(x, y) {
18068         x = project(x, y);
18069         stream.point(x[0], x[1]);
18070       }
18071       function lineStart() {
18072         x05 = NaN;
18073         resampleStream.point = linePoint2;
18074         stream.lineStart();
18075       }
18076       function linePoint2(lambda, phi) {
18077         var c = cartesian([lambda, phi]), p = project(lambda, phi);
18078         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x05 = p[0], y05 = p[1], lambda04 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
18079         stream.point(x05, y05);
18080       }
18081       function lineEnd() {
18082         resampleStream.point = point;
18083         stream.lineEnd();
18084       }
18085       function ringStart() {
18086         lineStart();
18087         resampleStream.point = ringPoint;
18088         resampleStream.lineEnd = ringEnd;
18089       }
18090       function ringPoint(lambda, phi) {
18091         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
18092         resampleStream.point = linePoint2;
18093       }
18094       function ringEnd() {
18095         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
18096         resampleStream.lineEnd = lineEnd;
18097         lineEnd();
18098       }
18099       return resampleStream;
18100     };
18101   }
18102
18103   // node_modules/d3-geo/src/projection/index.js
18104   var transformRadians = transformer({
18105     point: function(x, y) {
18106       this.stream.point(x * radians, y * radians);
18107     }
18108   });
18109   function transformRotate(rotate) {
18110     return transformer({
18111       point: function(x, y) {
18112         var r = rotate(x, y);
18113         return this.stream.point(r[0], r[1]);
18114       }
18115     });
18116   }
18117   function scaleTranslate(k, dx, dy, sx, sy) {
18118     function transform2(x, y) {
18119       x *= sx;
18120       y *= sy;
18121       return [dx + k * x, dy - k * y];
18122     }
18123     transform2.invert = function(x, y) {
18124       return [(x - dx) / k * sx, (dy - y) / k * sy];
18125     };
18126     return transform2;
18127   }
18128   function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {
18129     if (!alpha)
18130       return scaleTranslate(k, dx, dy, sx, sy);
18131     var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k;
18132     function transform2(x, y) {
18133       x *= sx;
18134       y *= sy;
18135       return [a * x - b * y + dx, dy - b * x - a * y];
18136     }
18137     transform2.invert = function(x, y) {
18138       return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];
18139     };
18140     return transform2;
18141   }
18142   function projection(project) {
18143     return projectionMutator(function() {
18144       return project;
18145     })();
18146   }
18147   function projectionMutator(projectAt) {
18148     var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = antimeridian_default, x05 = null, y05, x12, y12, postclip = identity_default, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
18149     function projection2(point) {
18150       return projectRotateTransform(point[0] * radians, point[1] * radians);
18151     }
18152     function invert(point) {
18153       point = projectRotateTransform.invert(point[0], point[1]);
18154       return point && [point[0] * degrees, point[1] * degrees];
18155     }
18156     projection2.stream = function(stream) {
18157       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
18158     };
18159     projection2.preclip = function(_) {
18160       return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;
18161     };
18162     projection2.postclip = function(_) {
18163       return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18164     };
18165     projection2.clipAngle = function(_) {
18166       return arguments.length ? (preclip = +_ ? circle_default(theta = _ * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
18167     };
18168     projection2.clipExtent = function(_) {
18169       return arguments.length ? (postclip = _ == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18170     };
18171     projection2.scale = function(_) {
18172       return arguments.length ? (k = +_, recenter()) : k;
18173     };
18174     projection2.translate = function(_) {
18175       return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
18176     };
18177     projection2.center = function(_) {
18178       return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
18179     };
18180     projection2.rotate = function(_) {
18181       return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
18182     };
18183     projection2.angle = function(_) {
18184       return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;
18185     };
18186     projection2.reflectX = function(_) {
18187       return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
18188     };
18189     projection2.reflectY = function(_) {
18190       return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
18191     };
18192     projection2.precision = function(_) {
18193       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
18194     };
18195     projection2.fitExtent = function(extent, object) {
18196       return fitExtent(projection2, extent, object);
18197     };
18198     projection2.fitSize = function(size, object) {
18199       return fitSize(projection2, size, object);
18200     };
18201     projection2.fitWidth = function(width, object) {
18202       return fitWidth(projection2, width, object);
18203     };
18204     projection2.fitHeight = function(height, object) {
18205       return fitHeight(projection2, height, object);
18206     };
18207     function recenter() {
18208       var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);
18209       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
18210       projectTransform = compose_default(project, transform2);
18211       projectRotateTransform = compose_default(rotate, projectTransform);
18212       projectResample = resample_default(projectTransform, delta2);
18213       return reset();
18214     }
18215     function reset() {
18216       cache = cacheStream = null;
18217       return projection2;
18218     }
18219     return function() {
18220       project = projectAt.apply(this, arguments);
18221       projection2.invert = project.invert && invert;
18222       return recenter();
18223     };
18224   }
18225
18226   // node_modules/d3-geo/src/projection/mercator.js
18227   function mercatorRaw(lambda, phi) {
18228     return [lambda, log(tan((halfPi + phi) / 2))];
18229   }
18230   mercatorRaw.invert = function(x, y) {
18231     return [x, 2 * atan(exp(y)) - halfPi];
18232   };
18233   function mercator_default() {
18234     return mercatorProjection(mercatorRaw).scale(961 / tau);
18235   }
18236   function mercatorProjection(project) {
18237     var m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x05 = null, y05, x12, y12;
18238     m.scale = function(_) {
18239       return arguments.length ? (scale(_), reclip()) : scale();
18240     };
18241     m.translate = function(_) {
18242       return arguments.length ? (translate(_), reclip()) : translate();
18243     };
18244     m.center = function(_) {
18245       return arguments.length ? (center(_), reclip()) : center();
18246     };
18247     m.clipExtent = function(_) {
18248       return arguments.length ? (_ == null ? x05 = y05 = x12 = y12 = null : (x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18249     };
18250     function reclip() {
18251       var k = pi * scale(), t = m(rotation_default(m.rotate()).invert([0, 0]));
18252       return clipExtent(x05 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x05), y05], [Math.min(t[0] + k, x12), y12]] : [[x05, Math.max(t[1] - k, y05)], [x12, Math.min(t[1] + k, y12)]]);
18253     }
18254     return reclip();
18255   }
18256
18257   // node_modules/d3-geo/src/projection/identity.js
18258   function identity_default2() {
18259     var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x05 = null, y05, x12, y12, kx = 1, ky = 1, transform2 = transformer({
18260       point: function(x, y) {
18261         var p = projection2([x, y]);
18262         this.stream.point(p[0], p[1]);
18263       }
18264     }), postclip = identity_default, cache, cacheStream;
18265     function reset() {
18266       kx = k * sx;
18267       ky = k * sy;
18268       cache = cacheStream = null;
18269       return projection2;
18270     }
18271     function projection2(p) {
18272       var x = p[0] * kx, y = p[1] * ky;
18273       if (alpha) {
18274         var t = y * ca - x * sa;
18275         x = x * ca + y * sa;
18276         y = t;
18277       }
18278       return [x + tx, y + ty];
18279     }
18280     projection2.invert = function(p) {
18281       var x = p[0] - tx, y = p[1] - ty;
18282       if (alpha) {
18283         var t = y * ca + x * sa;
18284         x = x * ca - y * sa;
18285         y = t;
18286       }
18287       return [x / kx, y / ky];
18288     };
18289     projection2.stream = function(stream) {
18290       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
18291     };
18292     projection2.postclip = function(_) {
18293       return arguments.length ? (postclip = _, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18294     };
18295     projection2.clipExtent = function(_) {
18296       return arguments.length ? (postclip = _ == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_[0][0], y05 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18297     };
18298     projection2.scale = function(_) {
18299       return arguments.length ? (k = +_, reset()) : k;
18300     };
18301     projection2.translate = function(_) {
18302       return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];
18303     };
18304     projection2.angle = function(_) {
18305       return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
18306     };
18307     projection2.reflectX = function(_) {
18308       return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;
18309     };
18310     projection2.reflectY = function(_) {
18311       return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;
18312     };
18313     projection2.fitExtent = function(extent, object) {
18314       return fitExtent(projection2, extent, object);
18315     };
18316     projection2.fitSize = function(size, object) {
18317       return fitSize(projection2, size, object);
18318     };
18319     projection2.fitWidth = function(width, object) {
18320       return fitWidth(projection2, width, object);
18321     };
18322     projection2.fitHeight = function(height, object) {
18323       return fitHeight(projection2, height, object);
18324     };
18325     return projection2;
18326   }
18327
18328   // modules/geo/geo.js
18329   var TAU = 2 * Math.PI;
18330   var EQUATORIAL_RADIUS = 6356752314245179e-9;
18331   var POLAR_RADIUS = 6378137;
18332   function geoLatToMeters(dLat) {
18333     return dLat * (TAU * POLAR_RADIUS / 360);
18334   }
18335   function geoLonToMeters(dLon, atLat) {
18336     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
18337   }
18338   function geoMetersToLat(m) {
18339     return m / (TAU * POLAR_RADIUS / 360);
18340   }
18341   function geoMetersToLon(m, atLat) {
18342     return Math.abs(atLat) >= 90 ? 0 : m / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
18343   }
18344   function geoMetersToOffset(meters, tileSize) {
18345     tileSize = tileSize || 256;
18346     return [
18347       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
18348       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
18349     ];
18350   }
18351   function geoOffsetToMeters(offset, tileSize) {
18352     tileSize = tileSize || 256;
18353     return [
18354       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
18355       -offset[1] * TAU * POLAR_RADIUS / tileSize
18356     ];
18357   }
18358   function geoSphericalDistance(a, b) {
18359     var x = geoLonToMeters(a[0] - b[0], (a[1] + b[1]) / 2);
18360     var y = geoLatToMeters(a[1] - b[1]);
18361     return Math.sqrt(x * x + y * y);
18362   }
18363   function geoScaleToZoom(k, tileSize) {
18364     tileSize = tileSize || 256;
18365     var log2ts = Math.log(tileSize) * Math.LOG2E;
18366     return Math.log(k * TAU) / Math.LN2 - log2ts;
18367   }
18368   function geoZoomToScale(z, tileSize) {
18369     tileSize = tileSize || 256;
18370     return tileSize * Math.pow(2, z) / TAU;
18371   }
18372   function geoSphericalClosestNode(nodes, point) {
18373     var minDistance = Infinity, distance;
18374     var indexOfMin;
18375     for (var i2 in nodes) {
18376       distance = geoSphericalDistance(nodes[i2].loc, point);
18377       if (distance < minDistance) {
18378         minDistance = distance;
18379         indexOfMin = i2;
18380       }
18381     }
18382     if (indexOfMin !== void 0) {
18383       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
18384     } else {
18385       return null;
18386     }
18387   }
18388
18389   // modules/geo/extent.js
18390   function geoExtent(min3, max3) {
18391     if (!(this instanceof geoExtent)) {
18392       return new geoExtent(min3, max3);
18393     } else if (min3 instanceof geoExtent) {
18394       return min3;
18395     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
18396       this[0] = min3[0];
18397       this[1] = min3[1];
18398     } else {
18399       this[0] = min3 || [Infinity, Infinity];
18400       this[1] = max3 || min3 || [-Infinity, -Infinity];
18401     }
18402   }
18403   geoExtent.prototype = new Array(2);
18404   Object.assign(geoExtent.prototype, {
18405     equals: function(obj) {
18406       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];
18407     },
18408     extend: function(obj) {
18409       if (!(obj instanceof geoExtent))
18410         obj = new geoExtent(obj);
18411       return geoExtent(
18412         [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
18413         [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
18414       );
18415     },
18416     _extend: function(extent) {
18417       this[0][0] = Math.min(extent[0][0], this[0][0]);
18418       this[0][1] = Math.min(extent[0][1], this[0][1]);
18419       this[1][0] = Math.max(extent[1][0], this[1][0]);
18420       this[1][1] = Math.max(extent[1][1], this[1][1]);
18421     },
18422     area: function() {
18423       return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
18424     },
18425     center: function() {
18426       return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
18427     },
18428     rectangle: function() {
18429       return [this[0][0], this[0][1], this[1][0], this[1][1]];
18430     },
18431     bbox: function() {
18432       return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
18433     },
18434     polygon: function() {
18435       return [
18436         [this[0][0], this[0][1]],
18437         [this[0][0], this[1][1]],
18438         [this[1][0], this[1][1]],
18439         [this[1][0], this[0][1]],
18440         [this[0][0], this[0][1]]
18441       ];
18442     },
18443     contains: function(obj) {
18444       if (!(obj instanceof geoExtent))
18445         obj = new geoExtent(obj);
18446       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];
18447     },
18448     intersects: function(obj) {
18449       if (!(obj instanceof geoExtent))
18450         obj = new geoExtent(obj);
18451       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];
18452     },
18453     intersection: function(obj) {
18454       if (!this.intersects(obj))
18455         return new geoExtent();
18456       return new geoExtent(
18457         [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
18458         [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
18459       );
18460     },
18461     percentContainedIn: function(obj) {
18462       if (!(obj instanceof geoExtent))
18463         obj = new geoExtent(obj);
18464       var a1 = this.intersection(obj).area();
18465       var a2 = this.area();
18466       if (a1 === Infinity || a2 === Infinity) {
18467         return 0;
18468       } else if (a1 === 0 || a2 === 0) {
18469         if (obj.contains(this)) {
18470           return 1;
18471         }
18472         return 0;
18473       } else {
18474         return a1 / a2;
18475       }
18476     },
18477     padByMeters: function(meters) {
18478       var dLat = geoMetersToLat(meters);
18479       var dLon = geoMetersToLon(meters, this.center()[1]);
18480       return geoExtent(
18481         [this[0][0] - dLon, this[0][1] - dLat],
18482         [this[1][0] + dLon, this[1][1] + dLat]
18483       );
18484     },
18485     toParam: function() {
18486       return this.rectangle().join(",");
18487     }
18488   });
18489
18490   // node_modules/d3-polygon/src/area.js
18491   function area_default3(polygon2) {
18492     var i2 = -1, n2 = polygon2.length, a, b = polygon2[n2 - 1], area = 0;
18493     while (++i2 < n2) {
18494       a = b;
18495       b = polygon2[i2];
18496       area += a[1] * b[0] - a[0] * b[1];
18497     }
18498     return area / 2;
18499   }
18500
18501   // node_modules/d3-polygon/src/centroid.js
18502   function centroid_default2(polygon2) {
18503     var i2 = -1, n2 = polygon2.length, x = 0, y = 0, a, b = polygon2[n2 - 1], c, k = 0;
18504     while (++i2 < n2) {
18505       a = b;
18506       b = polygon2[i2];
18507       k += c = a[0] * b[1] - b[0] * a[1];
18508       x += (a[0] + b[0]) * c;
18509       y += (a[1] + b[1]) * c;
18510     }
18511     return k *= 3, [x / k, y / k];
18512   }
18513
18514   // node_modules/d3-polygon/src/cross.js
18515   function cross_default(a, b, c) {
18516     return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
18517   }
18518
18519   // node_modules/d3-polygon/src/hull.js
18520   function lexicographicOrder(a, b) {
18521     return a[0] - b[0] || a[1] - b[1];
18522   }
18523   function computeUpperHullIndexes(points) {
18524     const n2 = points.length, indexes = [0, 1];
18525     let size = 2, i2;
18526     for (i2 = 2; i2 < n2; ++i2) {
18527       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i2]) <= 0)
18528         --size;
18529       indexes[size++] = i2;
18530     }
18531     return indexes.slice(0, size);
18532   }
18533   function hull_default(points) {
18534     if ((n2 = points.length) < 3)
18535       return null;
18536     var i2, n2, sortedPoints = new Array(n2), flippedPoints = new Array(n2);
18537     for (i2 = 0; i2 < n2; ++i2)
18538       sortedPoints[i2] = [+points[i2][0], +points[i2][1], i2];
18539     sortedPoints.sort(lexicographicOrder);
18540     for (i2 = 0; i2 < n2; ++i2)
18541       flippedPoints[i2] = [sortedPoints[i2][0], -sortedPoints[i2][1]];
18542     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
18543     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
18544     for (i2 = upperIndexes.length - 1; i2 >= 0; --i2)
18545       hull.push(points[sortedPoints[upperIndexes[i2]][2]]);
18546     for (i2 = +skipLeft; i2 < lowerIndexes.length - skipRight; ++i2)
18547       hull.push(points[sortedPoints[lowerIndexes[i2]][2]]);
18548     return hull;
18549   }
18550
18551   // modules/geo/vector.js
18552   function geoVecEqual(a, b, epsilon3) {
18553     if (epsilon3) {
18554       return Math.abs(a[0] - b[0]) <= epsilon3 && Math.abs(a[1] - b[1]) <= epsilon3;
18555     } else {
18556       return a[0] === b[0] && a[1] === b[1];
18557     }
18558   }
18559   function geoVecAdd(a, b) {
18560     return [a[0] + b[0], a[1] + b[1]];
18561   }
18562   function geoVecSubtract(a, b) {
18563     return [a[0] - b[0], a[1] - b[1]];
18564   }
18565   function geoVecScale(a, mag) {
18566     return [a[0] * mag, a[1] * mag];
18567   }
18568   function geoVecFloor(a) {
18569     return [Math.floor(a[0]), Math.floor(a[1])];
18570   }
18571   function geoVecInterp(a, b, t) {
18572     return [
18573       a[0] + (b[0] - a[0]) * t,
18574       a[1] + (b[1] - a[1]) * t
18575     ];
18576   }
18577   function geoVecLength(a, b) {
18578     return Math.sqrt(geoVecLengthSquare(a, b));
18579   }
18580   function geoVecLengthSquare(a, b) {
18581     b = b || [0, 0];
18582     var x = a[0] - b[0];
18583     var y = a[1] - b[1];
18584     return x * x + y * y;
18585   }
18586   function geoVecNormalize(a) {
18587     var length = Math.sqrt(a[0] * a[0] + a[1] * a[1]);
18588     if (length !== 0) {
18589       return geoVecScale(a, 1 / length);
18590     }
18591     return [0, 0];
18592   }
18593   function geoVecAngle(a, b) {
18594     return Math.atan2(b[1] - a[1], b[0] - a[0]);
18595   }
18596   function geoVecDot(a, b, origin) {
18597     origin = origin || [0, 0];
18598     var p = geoVecSubtract(a, origin);
18599     var q = geoVecSubtract(b, origin);
18600     return p[0] * q[0] + p[1] * q[1];
18601   }
18602   function geoVecNormalizedDot(a, b, origin) {
18603     origin = origin || [0, 0];
18604     var p = geoVecNormalize(geoVecSubtract(a, origin));
18605     var q = geoVecNormalize(geoVecSubtract(b, origin));
18606     return geoVecDot(p, q);
18607   }
18608   function geoVecCross(a, b, origin) {
18609     origin = origin || [0, 0];
18610     var p = geoVecSubtract(a, origin);
18611     var q = geoVecSubtract(b, origin);
18612     return p[0] * q[1] - p[1] * q[0];
18613   }
18614   function geoVecProject(a, points) {
18615     var min3 = Infinity;
18616     var idx;
18617     var target;
18618     for (var i2 = 0; i2 < points.length - 1; i2++) {
18619       var o = points[i2];
18620       var s = geoVecSubtract(points[i2 + 1], o);
18621       var v = geoVecSubtract(a, o);
18622       var proj = geoVecDot(v, s) / geoVecDot(s, s);
18623       var p;
18624       if (proj < 0) {
18625         p = o;
18626       } else if (proj > 1) {
18627         p = points[i2 + 1];
18628       } else {
18629         p = [o[0] + proj * s[0], o[1] + proj * s[1]];
18630       }
18631       var dist = geoVecLength(p, a);
18632       if (dist < min3) {
18633         min3 = dist;
18634         idx = i2 + 1;
18635         target = p;
18636       }
18637     }
18638     if (idx !== void 0) {
18639       return { index: idx, distance: min3, target };
18640     } else {
18641       return null;
18642     }
18643   }
18644
18645   // modules/geo/geom.js
18646   function geoAngle(a, b, projection2) {
18647     return geoVecAngle(projection2(a.loc), projection2(b.loc));
18648   }
18649   function geoEdgeEqual(a, b) {
18650     return a[0] === b[0] && a[1] === b[1] || a[0] === b[1] && a[1] === b[0];
18651   }
18652   function geoRotate(points, angle2, around) {
18653     return points.map(function(point) {
18654       var radial = geoVecSubtract(point, around);
18655       return [
18656         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
18657         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
18658       ];
18659     });
18660   }
18661   function geoChooseEdge(nodes, point, projection2, activeID) {
18662     var dist = geoVecLength;
18663     var points = nodes.map(function(n2) {
18664       return projection2(n2.loc);
18665     });
18666     var ids = nodes.map(function(n2) {
18667       return n2.id;
18668     });
18669     var min3 = Infinity;
18670     var idx;
18671     var loc;
18672     for (var i2 = 0; i2 < points.length - 1; i2++) {
18673       if (ids[i2] === activeID || ids[i2 + 1] === activeID)
18674         continue;
18675       var o = points[i2];
18676       var s = geoVecSubtract(points[i2 + 1], o);
18677       var v = geoVecSubtract(point, o);
18678       var proj = geoVecDot(v, s) / geoVecDot(s, s);
18679       var p;
18680       if (proj < 0) {
18681         p = o;
18682       } else if (proj > 1) {
18683         p = points[i2 + 1];
18684       } else {
18685         p = [o[0] + proj * s[0], o[1] + proj * s[1]];
18686       }
18687       var d = dist(p, point);
18688       if (d < min3) {
18689         min3 = d;
18690         idx = i2 + 1;
18691         loc = projection2.invert(p);
18692       }
18693     }
18694     if (idx !== void 0) {
18695       return { index: idx, distance: min3, loc };
18696     } else {
18697       return null;
18698     }
18699   }
18700   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
18701     var actives = [];
18702     var inactives = [];
18703     var j2, k, n1, n2, segment;
18704     for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
18705       n1 = activeNodes[j2];
18706       n2 = activeNodes[j2 + 1];
18707       segment = [n1.loc, n2.loc];
18708       if (n1.id === activeID || n2.id === activeID) {
18709         actives.push(segment);
18710       }
18711     }
18712     for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
18713       n1 = inactiveNodes[j2];
18714       n2 = inactiveNodes[j2 + 1];
18715       segment = [n1.loc, n2.loc];
18716       inactives.push(segment);
18717     }
18718     for (j2 = 0; j2 < actives.length; j2++) {
18719       for (k = 0; k < inactives.length; k++) {
18720         var p = actives[j2];
18721         var q = inactives[k];
18722         var hit = geoLineIntersection(p, q);
18723         if (hit) {
18724           return true;
18725         }
18726       }
18727     }
18728     return false;
18729   }
18730   function geoHasSelfIntersections(nodes, activeID) {
18731     var actives = [];
18732     var inactives = [];
18733     var j2, k;
18734     for (j2 = 0; j2 < nodes.length - 1; j2++) {
18735       var n1 = nodes[j2];
18736       var n2 = nodes[j2 + 1];
18737       var segment = [n1.loc, n2.loc];
18738       if (n1.id === activeID || n2.id === activeID) {
18739         actives.push(segment);
18740       } else {
18741         inactives.push(segment);
18742       }
18743     }
18744     for (j2 = 0; j2 < actives.length; j2++) {
18745       for (k = 0; k < inactives.length; k++) {
18746         var p = actives[j2];
18747         var q = inactives[k];
18748         if (geoVecEqual(p[1], q[0]) || geoVecEqual(p[0], q[1]) || geoVecEqual(p[0], q[0]) || geoVecEqual(p[1], q[1])) {
18749           continue;
18750         }
18751         var hit = geoLineIntersection(p, q);
18752         if (hit) {
18753           var epsilon3 = 1e-8;
18754           if (geoVecEqual(p[1], hit, epsilon3) || geoVecEqual(p[0], hit, epsilon3) || geoVecEqual(q[1], hit, epsilon3) || geoVecEqual(q[0], hit, epsilon3)) {
18755             continue;
18756           } else {
18757             return true;
18758           }
18759         }
18760       }
18761     }
18762     return false;
18763   }
18764   function geoLineIntersection(a, b) {
18765     var p = [a[0][0], a[0][1]];
18766     var p2 = [a[1][0], a[1][1]];
18767     var q = [b[0][0], b[0][1]];
18768     var q2 = [b[1][0], b[1][1]];
18769     var r = geoVecSubtract(p2, p);
18770     var s = geoVecSubtract(q2, q);
18771     var uNumerator = geoVecCross(geoVecSubtract(q, p), r);
18772     var denominator = geoVecCross(r, s);
18773     if (uNumerator && denominator) {
18774       var u = uNumerator / denominator;
18775       var t = geoVecCross(geoVecSubtract(q, p), s) / denominator;
18776       if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
18777         return geoVecInterp(p, p2, t);
18778       }
18779     }
18780     return null;
18781   }
18782   function geoPathIntersections(path1, path2) {
18783     var intersections = [];
18784     for (var i2 = 0; i2 < path1.length - 1; i2++) {
18785       for (var j2 = 0; j2 < path2.length - 1; j2++) {
18786         var a = [path1[i2], path1[i2 + 1]];
18787         var b = [path2[j2], path2[j2 + 1]];
18788         var hit = geoLineIntersection(a, b);
18789         if (hit) {
18790           intersections.push(hit);
18791         }
18792       }
18793     }
18794     return intersections;
18795   }
18796   function geoPathHasIntersections(path1, path2) {
18797     for (var i2 = 0; i2 < path1.length - 1; i2++) {
18798       for (var j2 = 0; j2 < path2.length - 1; j2++) {
18799         var a = [path1[i2], path1[i2 + 1]];
18800         var b = [path2[j2], path2[j2 + 1]];
18801         var hit = geoLineIntersection(a, b);
18802         if (hit) {
18803           return true;
18804         }
18805       }
18806     }
18807     return false;
18808   }
18809   function geoPointInPolygon(point, polygon2) {
18810     var x = point[0];
18811     var y = point[1];
18812     var inside = false;
18813     for (var i2 = 0, j2 = polygon2.length - 1; i2 < polygon2.length; j2 = i2++) {
18814       var xi = polygon2[i2][0];
18815       var yi = polygon2[i2][1];
18816       var xj = polygon2[j2][0];
18817       var yj = polygon2[j2][1];
18818       var intersect2 = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
18819       if (intersect2)
18820         inside = !inside;
18821     }
18822     return inside;
18823   }
18824   function geoPolygonContainsPolygon(outer, inner) {
18825     return inner.every(function(point) {
18826       return geoPointInPolygon(point, outer);
18827     });
18828   }
18829   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
18830     function testPoints(outer2, inner2) {
18831       return inner2.some(function(point) {
18832         return geoPointInPolygon(point, outer2);
18833       });
18834     }
18835     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
18836   }
18837   function geoGetSmallestSurroundingRectangle(points) {
18838     var hull = hull_default(points);
18839     var centroid = centroid_default2(hull);
18840     var minArea = Infinity;
18841     var ssrExtent = [];
18842     var ssrAngle = 0;
18843     var c1 = hull[0];
18844     for (var i2 = 0; i2 <= hull.length - 1; i2++) {
18845       var c2 = i2 === hull.length - 1 ? hull[0] : hull[i2 + 1];
18846       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
18847       var poly = geoRotate(hull, -angle2, centroid);
18848       var extent = poly.reduce(function(extent2, point) {
18849         return extent2.extend(geoExtent(point));
18850       }, geoExtent());
18851       var area = extent.area();
18852       if (area < minArea) {
18853         minArea = area;
18854         ssrExtent = extent;
18855         ssrAngle = angle2;
18856       }
18857       c1 = c2;
18858     }
18859     return {
18860       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
18861       angle: ssrAngle
18862     };
18863   }
18864   function geoPathLength(path) {
18865     var length = 0;
18866     for (var i2 = 0; i2 < path.length - 1; i2++) {
18867       length += geoVecLength(path[i2], path[i2 + 1]);
18868     }
18869     return length;
18870   }
18871   function geoViewportEdge(point, dimensions) {
18872     var pad2 = [80, 20, 50, 20];
18873     var x = 0;
18874     var y = 0;
18875     if (point[0] > dimensions[0] - pad2[1]) {
18876       x = -10;
18877     }
18878     if (point[0] < pad2[3]) {
18879       x = 10;
18880     }
18881     if (point[1] > dimensions[1] - pad2[2]) {
18882       y = -10;
18883     }
18884     if (point[1] < pad2[0]) {
18885       y = 10;
18886     }
18887     if (x || y) {
18888       return [x, y];
18889     } else {
18890       return null;
18891     }
18892   }
18893
18894   // node_modules/d3-dispatch/src/dispatch.js
18895   var noop2 = { value: () => {
18896   } };
18897   function dispatch() {
18898     for (var i2 = 0, n2 = arguments.length, _ = {}, t; i2 < n2; ++i2) {
18899       if (!(t = arguments[i2] + "") || t in _ || /[\s.]/.test(t))
18900         throw new Error("illegal type: " + t);
18901       _[t] = [];
18902     }
18903     return new Dispatch(_);
18904   }
18905   function Dispatch(_) {
18906     this._ = _;
18907   }
18908   function parseTypenames(typenames, types) {
18909     return typenames.trim().split(/^|\s+/).map(function(t) {
18910       var name = "", i2 = t.indexOf(".");
18911       if (i2 >= 0)
18912         name = t.slice(i2 + 1), t = t.slice(0, i2);
18913       if (t && !types.hasOwnProperty(t))
18914         throw new Error("unknown type: " + t);
18915       return { type: t, name };
18916     });
18917   }
18918   Dispatch.prototype = dispatch.prototype = {
18919     constructor: Dispatch,
18920     on: function(typename, callback) {
18921       var _ = this._, T = parseTypenames(typename + "", _), t, i2 = -1, n2 = T.length;
18922       if (arguments.length < 2) {
18923         while (++i2 < n2)
18924           if ((t = (typename = T[i2]).type) && (t = get(_[t], typename.name)))
18925             return t;
18926         return;
18927       }
18928       if (callback != null && typeof callback !== "function")
18929         throw new Error("invalid callback: " + callback);
18930       while (++i2 < n2) {
18931         if (t = (typename = T[i2]).type)
18932           _[t] = set(_[t], typename.name, callback);
18933         else if (callback == null)
18934           for (t in _)
18935             _[t] = set(_[t], typename.name, null);
18936       }
18937       return this;
18938     },
18939     copy: function() {
18940       var copy2 = {}, _ = this._;
18941       for (var t in _)
18942         copy2[t] = _[t].slice();
18943       return new Dispatch(copy2);
18944     },
18945     call: function(type3, that) {
18946       if ((n2 = arguments.length - 2) > 0)
18947         for (var args = new Array(n2), i2 = 0, n2, t; i2 < n2; ++i2)
18948           args[i2] = arguments[i2 + 2];
18949       if (!this._.hasOwnProperty(type3))
18950         throw new Error("unknown type: " + type3);
18951       for (t = this._[type3], i2 = 0, n2 = t.length; i2 < n2; ++i2)
18952         t[i2].value.apply(that, args);
18953     },
18954     apply: function(type3, that, args) {
18955       if (!this._.hasOwnProperty(type3))
18956         throw new Error("unknown type: " + type3);
18957       for (var t = this._[type3], i2 = 0, n2 = t.length; i2 < n2; ++i2)
18958         t[i2].value.apply(that, args);
18959     }
18960   };
18961   function get(type3, name) {
18962     for (var i2 = 0, n2 = type3.length, c; i2 < n2; ++i2) {
18963       if ((c = type3[i2]).name === name) {
18964         return c.value;
18965       }
18966     }
18967   }
18968   function set(type3, name, callback) {
18969     for (var i2 = 0, n2 = type3.length; i2 < n2; ++i2) {
18970       if (type3[i2].name === name) {
18971         type3[i2] = noop2, type3 = type3.slice(0, i2).concat(type3.slice(i2 + 1));
18972         break;
18973       }
18974     }
18975     if (callback != null)
18976       type3.push({ name, value: callback });
18977     return type3;
18978   }
18979   var dispatch_default = dispatch;
18980
18981   // node_modules/d3-selection/src/namespaces.js
18982   var xhtml = "http://www.w3.org/1999/xhtml";
18983   var namespaces_default = {
18984     svg: "http://www.w3.org/2000/svg",
18985     xhtml,
18986     xlink: "http://www.w3.org/1999/xlink",
18987     xml: "http://www.w3.org/XML/1998/namespace",
18988     xmlns: "http://www.w3.org/2000/xmlns/"
18989   };
18990
18991   // node_modules/d3-selection/src/namespace.js
18992   function namespace_default(name) {
18993     var prefix = name += "", i2 = prefix.indexOf(":");
18994     if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns")
18995       name = name.slice(i2 + 1);
18996     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
18997   }
18998
18999   // node_modules/d3-selection/src/creator.js
19000   function creatorInherit(name) {
19001     return function() {
19002       var document2 = this.ownerDocument, uri = this.namespaceURI;
19003       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
19004     };
19005   }
19006   function creatorFixed(fullname) {
19007     return function() {
19008       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
19009     };
19010   }
19011   function creator_default(name) {
19012     var fullname = namespace_default(name);
19013     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
19014   }
19015
19016   // node_modules/d3-selection/src/selector.js
19017   function none() {
19018   }
19019   function selector_default(selector) {
19020     return selector == null ? none : function() {
19021       return this.querySelector(selector);
19022     };
19023   }
19024
19025   // node_modules/d3-selection/src/selection/select.js
19026   function select_default(select) {
19027     if (typeof select !== "function")
19028       select = selector_default(select);
19029     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19030       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
19031         if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
19032           if ("__data__" in node)
19033             subnode.__data__ = node.__data__;
19034           subgroup[i2] = subnode;
19035         }
19036       }
19037     }
19038     return new Selection(subgroups, this._parents);
19039   }
19040
19041   // node_modules/d3-selection/src/array.js
19042   function array(x) {
19043     return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
19044   }
19045
19046   // node_modules/d3-selection/src/selectorAll.js
19047   function empty() {
19048     return [];
19049   }
19050   function selectorAll_default(selector) {
19051     return selector == null ? empty : function() {
19052       return this.querySelectorAll(selector);
19053     };
19054   }
19055
19056   // node_modules/d3-selection/src/selection/selectAll.js
19057   function arrayAll(select) {
19058     return function() {
19059       return array(select.apply(this, arguments));
19060     };
19061   }
19062   function selectAll_default(select) {
19063     if (typeof select === "function")
19064       select = arrayAll(select);
19065     else
19066       select = selectorAll_default(select);
19067     for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
19068       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
19069         if (node = group[i2]) {
19070           subgroups.push(select.call(node, node.__data__, i2, group));
19071           parents.push(node);
19072         }
19073       }
19074     }
19075     return new Selection(subgroups, parents);
19076   }
19077
19078   // node_modules/d3-selection/src/matcher.js
19079   function matcher_default(selector) {
19080     return function() {
19081       return this.matches(selector);
19082     };
19083   }
19084   function childMatcher(selector) {
19085     return function(node) {
19086       return node.matches(selector);
19087     };
19088   }
19089
19090   // node_modules/d3-selection/src/selection/selectChild.js
19091   var find = Array.prototype.find;
19092   function childFind(match) {
19093     return function() {
19094       return find.call(this.children, match);
19095     };
19096   }
19097   function childFirst() {
19098     return this.firstElementChild;
19099   }
19100   function selectChild_default(match) {
19101     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
19102   }
19103
19104   // node_modules/d3-selection/src/selection/selectChildren.js
19105   var filter = Array.prototype.filter;
19106   function children() {
19107     return Array.from(this.children);
19108   }
19109   function childrenFilter(match) {
19110     return function() {
19111       return filter.call(this.children, match);
19112     };
19113   }
19114   function selectChildren_default(match) {
19115     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
19116   }
19117
19118   // node_modules/d3-selection/src/selection/filter.js
19119   function filter_default(match) {
19120     if (typeof match !== "function")
19121       match = matcher_default(match);
19122     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19123       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
19124         if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
19125           subgroup.push(node);
19126         }
19127       }
19128     }
19129     return new Selection(subgroups, this._parents);
19130   }
19131
19132   // node_modules/d3-selection/src/selection/sparse.js
19133   function sparse_default(update) {
19134     return new Array(update.length);
19135   }
19136
19137   // node_modules/d3-selection/src/selection/enter.js
19138   function enter_default() {
19139     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
19140   }
19141   function EnterNode(parent, datum2) {
19142     this.ownerDocument = parent.ownerDocument;
19143     this.namespaceURI = parent.namespaceURI;
19144     this._next = null;
19145     this._parent = parent;
19146     this.__data__ = datum2;
19147   }
19148   EnterNode.prototype = {
19149     constructor: EnterNode,
19150     appendChild: function(child) {
19151       return this._parent.insertBefore(child, this._next);
19152     },
19153     insertBefore: function(child, next) {
19154       return this._parent.insertBefore(child, next);
19155     },
19156     querySelector: function(selector) {
19157       return this._parent.querySelector(selector);
19158     },
19159     querySelectorAll: function(selector) {
19160       return this._parent.querySelectorAll(selector);
19161     }
19162   };
19163
19164   // node_modules/d3-selection/src/constant.js
19165   function constant_default(x) {
19166     return function() {
19167       return x;
19168     };
19169   }
19170
19171   // node_modules/d3-selection/src/selection/data.js
19172   function bindIndex(parent, group, enter, update, exit, data) {
19173     var i2 = 0, node, groupLength = group.length, dataLength = data.length;
19174     for (; i2 < dataLength; ++i2) {
19175       if (node = group[i2]) {
19176         node.__data__ = data[i2];
19177         update[i2] = node;
19178       } else {
19179         enter[i2] = new EnterNode(parent, data[i2]);
19180       }
19181     }
19182     for (; i2 < groupLength; ++i2) {
19183       if (node = group[i2]) {
19184         exit[i2] = node;
19185       }
19186     }
19187   }
19188   function bindKey(parent, group, enter, update, exit, data, key) {
19189     var i2, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
19190     for (i2 = 0; i2 < groupLength; ++i2) {
19191       if (node = group[i2]) {
19192         keyValues[i2] = keyValue = key.call(node, node.__data__, i2, group) + "";
19193         if (nodeByKeyValue.has(keyValue)) {
19194           exit[i2] = node;
19195         } else {
19196           nodeByKeyValue.set(keyValue, node);
19197         }
19198       }
19199     }
19200     for (i2 = 0; i2 < dataLength; ++i2) {
19201       keyValue = key.call(parent, data[i2], i2, data) + "";
19202       if (node = nodeByKeyValue.get(keyValue)) {
19203         update[i2] = node;
19204         node.__data__ = data[i2];
19205         nodeByKeyValue.delete(keyValue);
19206       } else {
19207         enter[i2] = new EnterNode(parent, data[i2]);
19208       }
19209     }
19210     for (i2 = 0; i2 < groupLength; ++i2) {
19211       if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
19212         exit[i2] = node;
19213       }
19214     }
19215   }
19216   function datum(node) {
19217     return node.__data__;
19218   }
19219   function data_default(value, key) {
19220     if (!arguments.length)
19221       return Array.from(this, datum);
19222     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
19223     if (typeof value !== "function")
19224       value = constant_default(value);
19225     for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j2 = 0; j2 < m; ++j2) {
19226       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);
19227       bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
19228       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
19229         if (previous = enterGroup[i0]) {
19230           if (i0 >= i1)
19231             i1 = i0 + 1;
19232           while (!(next = updateGroup[i1]) && ++i1 < dataLength)
19233             ;
19234           previous._next = next || null;
19235         }
19236       }
19237     }
19238     update = new Selection(update, parents);
19239     update._enter = enter;
19240     update._exit = exit;
19241     return update;
19242   }
19243   function arraylike(data) {
19244     return typeof data === "object" && "length" in data ? data : Array.from(data);
19245   }
19246
19247   // node_modules/d3-selection/src/selection/exit.js
19248   function exit_default() {
19249     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
19250   }
19251
19252   // node_modules/d3-selection/src/selection/join.js
19253   function join_default(onenter, onupdate, onexit) {
19254     var enter = this.enter(), update = this, exit = this.exit();
19255     if (typeof onenter === "function") {
19256       enter = onenter(enter);
19257       if (enter)
19258         enter = enter.selection();
19259     } else {
19260       enter = enter.append(onenter + "");
19261     }
19262     if (onupdate != null) {
19263       update = onupdate(update);
19264       if (update)
19265         update = update.selection();
19266     }
19267     if (onexit == null)
19268       exit.remove();
19269     else
19270       onexit(exit);
19271     return enter && update ? enter.merge(update).order() : update;
19272   }
19273
19274   // node_modules/d3-selection/src/selection/merge.js
19275   function merge_default(context) {
19276     var selection2 = context.selection ? context.selection() : context;
19277     for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) {
19278       for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19279         if (node = group0[i2] || group1[i2]) {
19280           merge3[i2] = node;
19281         }
19282       }
19283     }
19284     for (; j2 < m0; ++j2) {
19285       merges[j2] = groups0[j2];
19286     }
19287     return new Selection(merges, this._parents);
19288   }
19289
19290   // node_modules/d3-selection/src/selection/order.js
19291   function order_default() {
19292     for (var groups = this._groups, j2 = -1, m = groups.length; ++j2 < m; ) {
19293       for (var group = groups[j2], i2 = group.length - 1, next = group[i2], node; --i2 >= 0; ) {
19294         if (node = group[i2]) {
19295           if (next && node.compareDocumentPosition(next) ^ 4)
19296             next.parentNode.insertBefore(node, next);
19297           next = node;
19298         }
19299       }
19300     }
19301     return this;
19302   }
19303
19304   // node_modules/d3-selection/src/selection/sort.js
19305   function sort_default(compare) {
19306     if (!compare)
19307       compare = ascending2;
19308     function compareNode(a, b) {
19309       return a && b ? compare(a.__data__, b.__data__) : !a - !b;
19310     }
19311     for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
19312       for (var group = groups[j2], n2 = group.length, sortgroup = sortgroups[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
19313         if (node = group[i2]) {
19314           sortgroup[i2] = node;
19315         }
19316       }
19317       sortgroup.sort(compareNode);
19318     }
19319     return new Selection(sortgroups, this._parents).order();
19320   }
19321   function ascending2(a, b) {
19322     return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
19323   }
19324
19325   // node_modules/d3-selection/src/selection/call.js
19326   function call_default() {
19327     var callback = arguments[0];
19328     arguments[0] = this;
19329     callback.apply(null, arguments);
19330     return this;
19331   }
19332
19333   // node_modules/d3-selection/src/selection/nodes.js
19334   function nodes_default() {
19335     return Array.from(this);
19336   }
19337
19338   // node_modules/d3-selection/src/selection/node.js
19339   function node_default() {
19340     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19341       for (var group = groups[j2], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
19342         var node = group[i2];
19343         if (node)
19344           return node;
19345       }
19346     }
19347     return null;
19348   }
19349
19350   // node_modules/d3-selection/src/selection/size.js
19351   function size_default() {
19352     let size = 0;
19353     for (const node of this)
19354       ++size;
19355     return size;
19356   }
19357
19358   // node_modules/d3-selection/src/selection/empty.js
19359   function empty_default() {
19360     return !this.node();
19361   }
19362
19363   // node_modules/d3-selection/src/selection/each.js
19364   function each_default(callback) {
19365     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19366       for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
19367         if (node = group[i2])
19368           callback.call(node, node.__data__, i2, group);
19369       }
19370     }
19371     return this;
19372   }
19373
19374   // node_modules/d3-selection/src/selection/attr.js
19375   function attrRemove(name) {
19376     return function() {
19377       this.removeAttribute(name);
19378     };
19379   }
19380   function attrRemoveNS(fullname) {
19381     return function() {
19382       this.removeAttributeNS(fullname.space, fullname.local);
19383     };
19384   }
19385   function attrConstant(name, value) {
19386     return function() {
19387       this.setAttribute(name, value);
19388     };
19389   }
19390   function attrConstantNS(fullname, value) {
19391     return function() {
19392       this.setAttributeNS(fullname.space, fullname.local, value);
19393     };
19394   }
19395   function attrFunction(name, value) {
19396     return function() {
19397       var v = value.apply(this, arguments);
19398       if (v == null)
19399         this.removeAttribute(name);
19400       else
19401         this.setAttribute(name, v);
19402     };
19403   }
19404   function attrFunctionNS(fullname, value) {
19405     return function() {
19406       var v = value.apply(this, arguments);
19407       if (v == null)
19408         this.removeAttributeNS(fullname.space, fullname.local);
19409       else
19410         this.setAttributeNS(fullname.space, fullname.local, v);
19411     };
19412   }
19413   function attr_default(name, value) {
19414     var fullname = namespace_default(name);
19415     if (arguments.length < 2) {
19416       var node = this.node();
19417       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
19418     }
19419     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
19420   }
19421
19422   // node_modules/d3-selection/src/window.js
19423   function window_default(node) {
19424     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
19425   }
19426
19427   // node_modules/d3-selection/src/selection/style.js
19428   function styleRemove(name) {
19429     return function() {
19430       this.style.removeProperty(name);
19431     };
19432   }
19433   function styleConstant(name, value, priority) {
19434     return function() {
19435       this.style.setProperty(name, value, priority);
19436     };
19437   }
19438   function styleFunction(name, value, priority) {
19439     return function() {
19440       var v = value.apply(this, arguments);
19441       if (v == null)
19442         this.style.removeProperty(name);
19443       else
19444         this.style.setProperty(name, v, priority);
19445     };
19446   }
19447   function style_default(name, value, priority) {
19448     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
19449   }
19450   function styleValue(node, name) {
19451     return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
19452   }
19453
19454   // node_modules/d3-selection/src/selection/property.js
19455   function propertyRemove(name) {
19456     return function() {
19457       delete this[name];
19458     };
19459   }
19460   function propertyConstant(name, value) {
19461     return function() {
19462       this[name] = value;
19463     };
19464   }
19465   function propertyFunction(name, value) {
19466     return function() {
19467       var v = value.apply(this, arguments);
19468       if (v == null)
19469         delete this[name];
19470       else
19471         this[name] = v;
19472     };
19473   }
19474   function property_default(name, value) {
19475     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
19476   }
19477
19478   // node_modules/d3-selection/src/selection/classed.js
19479   function classArray(string) {
19480     return string.trim().split(/^|\s+/);
19481   }
19482   function classList(node) {
19483     return node.classList || new ClassList(node);
19484   }
19485   function ClassList(node) {
19486     this._node = node;
19487     this._names = classArray(node.getAttribute("class") || "");
19488   }
19489   ClassList.prototype = {
19490     add: function(name) {
19491       var i2 = this._names.indexOf(name);
19492       if (i2 < 0) {
19493         this._names.push(name);
19494         this._node.setAttribute("class", this._names.join(" "));
19495       }
19496     },
19497     remove: function(name) {
19498       var i2 = this._names.indexOf(name);
19499       if (i2 >= 0) {
19500         this._names.splice(i2, 1);
19501         this._node.setAttribute("class", this._names.join(" "));
19502       }
19503     },
19504     contains: function(name) {
19505       return this._names.indexOf(name) >= 0;
19506     }
19507   };
19508   function classedAdd(node, names) {
19509     var list = classList(node), i2 = -1, n2 = names.length;
19510     while (++i2 < n2)
19511       list.add(names[i2]);
19512   }
19513   function classedRemove(node, names) {
19514     var list = classList(node), i2 = -1, n2 = names.length;
19515     while (++i2 < n2)
19516       list.remove(names[i2]);
19517   }
19518   function classedTrue(names) {
19519     return function() {
19520       classedAdd(this, names);
19521     };
19522   }
19523   function classedFalse(names) {
19524     return function() {
19525       classedRemove(this, names);
19526     };
19527   }
19528   function classedFunction(names, value) {
19529     return function() {
19530       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
19531     };
19532   }
19533   function classed_default(name, value) {
19534     var names = classArray(name + "");
19535     if (arguments.length < 2) {
19536       var list = classList(this.node()), i2 = -1, n2 = names.length;
19537       while (++i2 < n2)
19538         if (!list.contains(names[i2]))
19539           return false;
19540       return true;
19541     }
19542     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
19543   }
19544
19545   // node_modules/d3-selection/src/selection/text.js
19546   function textRemove() {
19547     this.textContent = "";
19548   }
19549   function textConstant(value) {
19550     return function() {
19551       this.textContent = value;
19552     };
19553   }
19554   function textFunction(value) {
19555     return function() {
19556       var v = value.apply(this, arguments);
19557       this.textContent = v == null ? "" : v;
19558     };
19559   }
19560   function text_default(value) {
19561     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
19562   }
19563
19564   // node_modules/d3-selection/src/selection/html.js
19565   function htmlRemove() {
19566     this.innerHTML = "";
19567   }
19568   function htmlConstant(value) {
19569     return function() {
19570       this.innerHTML = value;
19571     };
19572   }
19573   function htmlFunction(value) {
19574     return function() {
19575       var v = value.apply(this, arguments);
19576       this.innerHTML = v == null ? "" : v;
19577     };
19578   }
19579   function html_default(value) {
19580     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
19581   }
19582
19583   // node_modules/d3-selection/src/selection/raise.js
19584   function raise() {
19585     if (this.nextSibling)
19586       this.parentNode.appendChild(this);
19587   }
19588   function raise_default() {
19589     return this.each(raise);
19590   }
19591
19592   // node_modules/d3-selection/src/selection/lower.js
19593   function lower() {
19594     if (this.previousSibling)
19595       this.parentNode.insertBefore(this, this.parentNode.firstChild);
19596   }
19597   function lower_default() {
19598     return this.each(lower);
19599   }
19600
19601   // node_modules/d3-selection/src/selection/append.js
19602   function append_default(name) {
19603     var create2 = typeof name === "function" ? name : creator_default(name);
19604     return this.select(function() {
19605       return this.appendChild(create2.apply(this, arguments));
19606     });
19607   }
19608
19609   // node_modules/d3-selection/src/selection/insert.js
19610   function constantNull() {
19611     return null;
19612   }
19613   function insert_default(name, before) {
19614     var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
19615     return this.select(function() {
19616       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
19617     });
19618   }
19619
19620   // node_modules/d3-selection/src/selection/remove.js
19621   function remove() {
19622     var parent = this.parentNode;
19623     if (parent)
19624       parent.removeChild(this);
19625   }
19626   function remove_default() {
19627     return this.each(remove);
19628   }
19629
19630   // node_modules/d3-selection/src/selection/clone.js
19631   function selection_cloneShallow() {
19632     var clone = this.cloneNode(false), parent = this.parentNode;
19633     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19634   }
19635   function selection_cloneDeep() {
19636     var clone = this.cloneNode(true), parent = this.parentNode;
19637     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
19638   }
19639   function clone_default(deep) {
19640     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
19641   }
19642
19643   // node_modules/d3-selection/src/selection/datum.js
19644   function datum_default(value) {
19645     return arguments.length ? this.property("__data__", value) : this.node().__data__;
19646   }
19647
19648   // node_modules/d3-selection/src/selection/on.js
19649   function contextListener(listener) {
19650     return function(event) {
19651       listener.call(this, event, this.__data__);
19652     };
19653   }
19654   function parseTypenames2(typenames) {
19655     return typenames.trim().split(/^|\s+/).map(function(t) {
19656       var name = "", i2 = t.indexOf(".");
19657       if (i2 >= 0)
19658         name = t.slice(i2 + 1), t = t.slice(0, i2);
19659       return { type: t, name };
19660     });
19661   }
19662   function onRemove(typename) {
19663     return function() {
19664       var on = this.__on;
19665       if (!on)
19666         return;
19667       for (var j2 = 0, i2 = -1, m = on.length, o; j2 < m; ++j2) {
19668         if (o = on[j2], (!typename.type || o.type === typename.type) && o.name === typename.name) {
19669           this.removeEventListener(o.type, o.listener, o.options);
19670         } else {
19671           on[++i2] = o;
19672         }
19673       }
19674       if (++i2)
19675         on.length = i2;
19676       else
19677         delete this.__on;
19678     };
19679   }
19680   function onAdd(typename, value, options2) {
19681     return function() {
19682       var on = this.__on, o, listener = contextListener(value);
19683       if (on)
19684         for (var j2 = 0, m = on.length; j2 < m; ++j2) {
19685           if ((o = on[j2]).type === typename.type && o.name === typename.name) {
19686             this.removeEventListener(o.type, o.listener, o.options);
19687             this.addEventListener(o.type, o.listener = listener, o.options = options2);
19688             o.value = value;
19689             return;
19690           }
19691         }
19692       this.addEventListener(typename.type, listener, options2);
19693       o = { type: typename.type, name: typename.name, value, listener, options: options2 };
19694       if (!on)
19695         this.__on = [o];
19696       else
19697         on.push(o);
19698     };
19699   }
19700   function on_default(typename, value, options2) {
19701     var typenames = parseTypenames2(typename + ""), i2, n2 = typenames.length, t;
19702     if (arguments.length < 2) {
19703       var on = this.node().__on;
19704       if (on)
19705         for (var j2 = 0, m = on.length, o; j2 < m; ++j2) {
19706           for (i2 = 0, o = on[j2]; i2 < n2; ++i2) {
19707             if ((t = typenames[i2]).type === o.type && t.name === o.name) {
19708               return o.value;
19709             }
19710           }
19711         }
19712       return;
19713     }
19714     on = value ? onAdd : onRemove;
19715     for (i2 = 0; i2 < n2; ++i2)
19716       this.each(on(typenames[i2], value, options2));
19717     return this;
19718   }
19719
19720   // node_modules/d3-selection/src/selection/dispatch.js
19721   function dispatchEvent(node, type3, params) {
19722     var window2 = window_default(node), event = window2.CustomEvent;
19723     if (typeof event === "function") {
19724       event = new event(type3, params);
19725     } else {
19726       event = window2.document.createEvent("Event");
19727       if (params)
19728         event.initEvent(type3, params.bubbles, params.cancelable), event.detail = params.detail;
19729       else
19730         event.initEvent(type3, false, false);
19731     }
19732     node.dispatchEvent(event);
19733   }
19734   function dispatchConstant(type3, params) {
19735     return function() {
19736       return dispatchEvent(this, type3, params);
19737     };
19738   }
19739   function dispatchFunction(type3, params) {
19740     return function() {
19741       return dispatchEvent(this, type3, params.apply(this, arguments));
19742     };
19743   }
19744   function dispatch_default2(type3, params) {
19745     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type3, params));
19746   }
19747
19748   // node_modules/d3-selection/src/selection/iterator.js
19749   function* iterator_default() {
19750     for (var groups = this._groups, j2 = 0, m = groups.length; j2 < m; ++j2) {
19751       for (var group = groups[j2], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
19752         if (node = group[i2])
19753           yield node;
19754       }
19755     }
19756   }
19757
19758   // node_modules/d3-selection/src/selection/index.js
19759   var root = [null];
19760   function Selection(groups, parents) {
19761     this._groups = groups;
19762     this._parents = parents;
19763   }
19764   function selection() {
19765     return new Selection([[document.documentElement]], root);
19766   }
19767   function selection_selection() {
19768     return this;
19769   }
19770   Selection.prototype = selection.prototype = {
19771     constructor: Selection,
19772     select: select_default,
19773     selectAll: selectAll_default,
19774     selectChild: selectChild_default,
19775     selectChildren: selectChildren_default,
19776     filter: filter_default,
19777     data: data_default,
19778     enter: enter_default,
19779     exit: exit_default,
19780     join: join_default,
19781     merge: merge_default,
19782     selection: selection_selection,
19783     order: order_default,
19784     sort: sort_default,
19785     call: call_default,
19786     nodes: nodes_default,
19787     node: node_default,
19788     size: size_default,
19789     empty: empty_default,
19790     each: each_default,
19791     attr: attr_default,
19792     style: style_default,
19793     property: property_default,
19794     classed: classed_default,
19795     text: text_default,
19796     html: html_default,
19797     raise: raise_default,
19798     lower: lower_default,
19799     append: append_default,
19800     insert: insert_default,
19801     remove: remove_default,
19802     clone: clone_default,
19803     datum: datum_default,
19804     on: on_default,
19805     dispatch: dispatch_default2,
19806     [Symbol.iterator]: iterator_default
19807   };
19808   var selection_default = selection;
19809
19810   // node_modules/d3-selection/src/select.js
19811   function select_default2(selector) {
19812     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
19813   }
19814
19815   // node_modules/d3-selection/src/sourceEvent.js
19816   function sourceEvent_default(event) {
19817     let sourceEvent;
19818     while (sourceEvent = event.sourceEvent)
19819       event = sourceEvent;
19820     return event;
19821   }
19822
19823   // node_modules/d3-selection/src/pointer.js
19824   function pointer_default(event, node) {
19825     event = sourceEvent_default(event);
19826     if (node === void 0)
19827       node = event.currentTarget;
19828     if (node) {
19829       var svg2 = node.ownerSVGElement || node;
19830       if (svg2.createSVGPoint) {
19831         var point = svg2.createSVGPoint();
19832         point.x = event.clientX, point.y = event.clientY;
19833         point = point.matrixTransform(node.getScreenCTM().inverse());
19834         return [point.x, point.y];
19835       }
19836       if (node.getBoundingClientRect) {
19837         var rect = node.getBoundingClientRect();
19838         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
19839       }
19840     }
19841     return [event.pageX, event.pageY];
19842   }
19843
19844   // node_modules/d3-selection/src/selectAll.js
19845   function selectAll_default2(selector) {
19846     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
19847   }
19848
19849   // node_modules/d3-drag/src/noevent.js
19850   var nonpassive = { passive: false };
19851   var nonpassivecapture = { capture: true, passive: false };
19852   function nopropagation(event) {
19853     event.stopImmediatePropagation();
19854   }
19855   function noevent_default(event) {
19856     event.preventDefault();
19857     event.stopImmediatePropagation();
19858   }
19859
19860   // node_modules/d3-drag/src/nodrag.js
19861   function nodrag_default(view) {
19862     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
19863     if ("onselectstart" in root3) {
19864       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
19865     } else {
19866       root3.__noselect = root3.style.MozUserSelect;
19867       root3.style.MozUserSelect = "none";
19868     }
19869   }
19870   function yesdrag(view, noclick) {
19871     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
19872     if (noclick) {
19873       selection2.on("click.drag", noevent_default, nonpassivecapture);
19874       setTimeout(function() {
19875         selection2.on("click.drag", null);
19876       }, 0);
19877     }
19878     if ("onselectstart" in root3) {
19879       selection2.on("selectstart.drag", null);
19880     } else {
19881       root3.style.MozUserSelect = root3.__noselect;
19882       delete root3.__noselect;
19883     }
19884   }
19885
19886   // node_modules/d3-drag/src/constant.js
19887   var constant_default2 = (x) => () => x;
19888
19889   // node_modules/d3-drag/src/event.js
19890   function DragEvent(type3, {
19891     sourceEvent,
19892     subject,
19893     target,
19894     identifier,
19895     active,
19896     x,
19897     y,
19898     dx,
19899     dy,
19900     dispatch: dispatch10
19901   }) {
19902     Object.defineProperties(this, {
19903       type: { value: type3, enumerable: true, configurable: true },
19904       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
19905       subject: { value: subject, enumerable: true, configurable: true },
19906       target: { value: target, enumerable: true, configurable: true },
19907       identifier: { value: identifier, enumerable: true, configurable: true },
19908       active: { value: active, enumerable: true, configurable: true },
19909       x: { value: x, enumerable: true, configurable: true },
19910       y: { value: y, enumerable: true, configurable: true },
19911       dx: { value: dx, enumerable: true, configurable: true },
19912       dy: { value: dy, enumerable: true, configurable: true },
19913       _: { value: dispatch10 }
19914     });
19915   }
19916   DragEvent.prototype.on = function() {
19917     var value = this._.on.apply(this._, arguments);
19918     return value === this._ ? this : value;
19919   };
19920
19921   // node_modules/d3-drag/src/drag.js
19922   function defaultFilter(event) {
19923     return !event.ctrlKey && !event.button;
19924   }
19925   function defaultContainer() {
19926     return this.parentNode;
19927   }
19928   function defaultSubject(event, d) {
19929     return d == null ? { x: event.x, y: event.y } : d;
19930   }
19931   function defaultTouchable() {
19932     return navigator.maxTouchPoints || "ontouchstart" in this;
19933   }
19934   function drag_default() {
19935     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
19936     function drag(selection2) {
19937       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)");
19938     }
19939     function mousedowned(event, d) {
19940       if (touchending || !filter2.call(this, event, d))
19941         return;
19942       var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse");
19943       if (!gesture)
19944         return;
19945       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
19946       nodrag_default(event.view);
19947       nopropagation(event);
19948       mousemoving = false;
19949       mousedownx = event.clientX;
19950       mousedowny = event.clientY;
19951       gesture("start", event);
19952     }
19953     function mousemoved(event) {
19954       noevent_default(event);
19955       if (!mousemoving) {
19956         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
19957         mousemoving = dx * dx + dy * dy > clickDistance2;
19958       }
19959       gestures.mouse("drag", event);
19960     }
19961     function mouseupped(event) {
19962       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
19963       yesdrag(event.view, mousemoving);
19964       noevent_default(event);
19965       gestures.mouse("end", event);
19966     }
19967     function touchstarted(event, d) {
19968       if (!filter2.call(this, event, d))
19969         return;
19970       var touches = event.changedTouches, c = container.call(this, event, d), n2 = touches.length, i2, gesture;
19971       for (i2 = 0; i2 < n2; ++i2) {
19972         if (gesture = beforestart(this, c, event, d, touches[i2].identifier, touches[i2])) {
19973           nopropagation(event);
19974           gesture("start", event, touches[i2]);
19975         }
19976       }
19977     }
19978     function touchmoved(event) {
19979       var touches = event.changedTouches, n2 = touches.length, i2, gesture;
19980       for (i2 = 0; i2 < n2; ++i2) {
19981         if (gesture = gestures[touches[i2].identifier]) {
19982           noevent_default(event);
19983           gesture("drag", event, touches[i2]);
19984         }
19985       }
19986     }
19987     function touchended(event) {
19988       var touches = event.changedTouches, n2 = touches.length, i2, gesture;
19989       if (touchending)
19990         clearTimeout(touchending);
19991       touchending = setTimeout(function() {
19992         touchending = null;
19993       }, 500);
19994       for (i2 = 0; i2 < n2; ++i2) {
19995         if (gesture = gestures[touches[i2].identifier]) {
19996           nopropagation(event);
19997           gesture("end", event, touches[i2]);
19998         }
19999       }
20000     }
20001     function beforestart(that, container2, event, d, identifier, touch) {
20002       var dispatch10 = listeners.copy(), p = pointer_default(touch || event, container2), dx, dy, s;
20003       if ((s = subject.call(that, new DragEvent("beforestart", {
20004         sourceEvent: event,
20005         target: drag,
20006         identifier,
20007         active,
20008         x: p[0],
20009         y: p[1],
20010         dx: 0,
20011         dy: 0,
20012         dispatch: dispatch10
20013       }), d)) == null)
20014         return;
20015       dx = s.x - p[0] || 0;
20016       dy = s.y - p[1] || 0;
20017       return function gesture(type3, event2, touch2) {
20018         var p02 = p, n2;
20019         switch (type3) {
20020           case "start":
20021             gestures[identifier] = gesture, n2 = active++;
20022             break;
20023           case "end":
20024             delete gestures[identifier], --active;
20025           case "drag":
20026             p = pointer_default(touch2 || event2, container2), n2 = active;
20027             break;
20028         }
20029         dispatch10.call(
20030           type3,
20031           that,
20032           new DragEvent(type3, {
20033             sourceEvent: event2,
20034             subject: s,
20035             target: drag,
20036             identifier,
20037             active: n2,
20038             x: p[0] + dx,
20039             y: p[1] + dy,
20040             dx: p[0] - p02[0],
20041             dy: p[1] - p02[1],
20042             dispatch: dispatch10
20043           }),
20044           d
20045         );
20046       };
20047     }
20048     drag.filter = function(_) {
20049       return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default2(!!_), drag) : filter2;
20050     };
20051     drag.container = function(_) {
20052       return arguments.length ? (container = typeof _ === "function" ? _ : constant_default2(_), drag) : container;
20053     };
20054     drag.subject = function(_) {
20055       return arguments.length ? (subject = typeof _ === "function" ? _ : constant_default2(_), drag) : subject;
20056     };
20057     drag.touchable = function(_) {
20058       return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default2(!!_), drag) : touchable;
20059     };
20060     drag.on = function() {
20061       var value = listeners.on.apply(listeners, arguments);
20062       return value === listeners ? drag : value;
20063     };
20064     drag.clickDistance = function(_) {
20065       return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
20066     };
20067     return drag;
20068   }
20069
20070   // node_modules/d3-color/src/define.js
20071   function define_default(constructor, factory, prototype) {
20072     constructor.prototype = factory.prototype = prototype;
20073     prototype.constructor = constructor;
20074   }
20075   function extend(parent, definition) {
20076     var prototype = Object.create(parent.prototype);
20077     for (var key in definition)
20078       prototype[key] = definition[key];
20079     return prototype;
20080   }
20081
20082   // node_modules/d3-color/src/color.js
20083   function Color() {
20084   }
20085   var darker = 0.7;
20086   var brighter = 1 / darker;
20087   var reI = "\\s*([+-]?\\d+)\\s*";
20088   var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
20089   var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
20090   var reHex = /^#([0-9a-f]{3,8})$/;
20091   var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
20092   var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
20093   var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
20094   var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
20095   var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
20096   var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
20097   var named = {
20098     aliceblue: 15792383,
20099     antiquewhite: 16444375,
20100     aqua: 65535,
20101     aquamarine: 8388564,
20102     azure: 15794175,
20103     beige: 16119260,
20104     bisque: 16770244,
20105     black: 0,
20106     blanchedalmond: 16772045,
20107     blue: 255,
20108     blueviolet: 9055202,
20109     brown: 10824234,
20110     burlywood: 14596231,
20111     cadetblue: 6266528,
20112     chartreuse: 8388352,
20113     chocolate: 13789470,
20114     coral: 16744272,
20115     cornflowerblue: 6591981,
20116     cornsilk: 16775388,
20117     crimson: 14423100,
20118     cyan: 65535,
20119     darkblue: 139,
20120     darkcyan: 35723,
20121     darkgoldenrod: 12092939,
20122     darkgray: 11119017,
20123     darkgreen: 25600,
20124     darkgrey: 11119017,
20125     darkkhaki: 12433259,
20126     darkmagenta: 9109643,
20127     darkolivegreen: 5597999,
20128     darkorange: 16747520,
20129     darkorchid: 10040012,
20130     darkred: 9109504,
20131     darksalmon: 15308410,
20132     darkseagreen: 9419919,
20133     darkslateblue: 4734347,
20134     darkslategray: 3100495,
20135     darkslategrey: 3100495,
20136     darkturquoise: 52945,
20137     darkviolet: 9699539,
20138     deeppink: 16716947,
20139     deepskyblue: 49151,
20140     dimgray: 6908265,
20141     dimgrey: 6908265,
20142     dodgerblue: 2003199,
20143     firebrick: 11674146,
20144     floralwhite: 16775920,
20145     forestgreen: 2263842,
20146     fuchsia: 16711935,
20147     gainsboro: 14474460,
20148     ghostwhite: 16316671,
20149     gold: 16766720,
20150     goldenrod: 14329120,
20151     gray: 8421504,
20152     green: 32768,
20153     greenyellow: 11403055,
20154     grey: 8421504,
20155     honeydew: 15794160,
20156     hotpink: 16738740,
20157     indianred: 13458524,
20158     indigo: 4915330,
20159     ivory: 16777200,
20160     khaki: 15787660,
20161     lavender: 15132410,
20162     lavenderblush: 16773365,
20163     lawngreen: 8190976,
20164     lemonchiffon: 16775885,
20165     lightblue: 11393254,
20166     lightcoral: 15761536,
20167     lightcyan: 14745599,
20168     lightgoldenrodyellow: 16448210,
20169     lightgray: 13882323,
20170     lightgreen: 9498256,
20171     lightgrey: 13882323,
20172     lightpink: 16758465,
20173     lightsalmon: 16752762,
20174     lightseagreen: 2142890,
20175     lightskyblue: 8900346,
20176     lightslategray: 7833753,
20177     lightslategrey: 7833753,
20178     lightsteelblue: 11584734,
20179     lightyellow: 16777184,
20180     lime: 65280,
20181     limegreen: 3329330,
20182     linen: 16445670,
20183     magenta: 16711935,
20184     maroon: 8388608,
20185     mediumaquamarine: 6737322,
20186     mediumblue: 205,
20187     mediumorchid: 12211667,
20188     mediumpurple: 9662683,
20189     mediumseagreen: 3978097,
20190     mediumslateblue: 8087790,
20191     mediumspringgreen: 64154,
20192     mediumturquoise: 4772300,
20193     mediumvioletred: 13047173,
20194     midnightblue: 1644912,
20195     mintcream: 16121850,
20196     mistyrose: 16770273,
20197     moccasin: 16770229,
20198     navajowhite: 16768685,
20199     navy: 128,
20200     oldlace: 16643558,
20201     olive: 8421376,
20202     olivedrab: 7048739,
20203     orange: 16753920,
20204     orangered: 16729344,
20205     orchid: 14315734,
20206     palegoldenrod: 15657130,
20207     palegreen: 10025880,
20208     paleturquoise: 11529966,
20209     palevioletred: 14381203,
20210     papayawhip: 16773077,
20211     peachpuff: 16767673,
20212     peru: 13468991,
20213     pink: 16761035,
20214     plum: 14524637,
20215     powderblue: 11591910,
20216     purple: 8388736,
20217     rebeccapurple: 6697881,
20218     red: 16711680,
20219     rosybrown: 12357519,
20220     royalblue: 4286945,
20221     saddlebrown: 9127187,
20222     salmon: 16416882,
20223     sandybrown: 16032864,
20224     seagreen: 3050327,
20225     seashell: 16774638,
20226     sienna: 10506797,
20227     silver: 12632256,
20228     skyblue: 8900331,
20229     slateblue: 6970061,
20230     slategray: 7372944,
20231     slategrey: 7372944,
20232     snow: 16775930,
20233     springgreen: 65407,
20234     steelblue: 4620980,
20235     tan: 13808780,
20236     teal: 32896,
20237     thistle: 14204888,
20238     tomato: 16737095,
20239     turquoise: 4251856,
20240     violet: 15631086,
20241     wheat: 16113331,
20242     white: 16777215,
20243     whitesmoke: 16119285,
20244     yellow: 16776960,
20245     yellowgreen: 10145074
20246   };
20247   define_default(Color, color, {
20248     copy(channels) {
20249       return Object.assign(new this.constructor(), this, channels);
20250     },
20251     displayable() {
20252       return this.rgb().displayable();
20253     },
20254     hex: color_formatHex,
20255     formatHex: color_formatHex,
20256     formatHex8: color_formatHex8,
20257     formatHsl: color_formatHsl,
20258     formatRgb: color_formatRgb,
20259     toString: color_formatRgb
20260   });
20261   function color_formatHex() {
20262     return this.rgb().formatHex();
20263   }
20264   function color_formatHex8() {
20265     return this.rgb().formatHex8();
20266   }
20267   function color_formatHsl() {
20268     return hslConvert(this).formatHsl();
20269   }
20270   function color_formatRgb() {
20271     return this.rgb().formatRgb();
20272   }
20273   function color(format2) {
20274     var m, l;
20275     format2 = (format2 + "").trim().toLowerCase();
20276     return (m = reHex.exec(format2)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format2)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format2)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format2)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format2)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
20277   }
20278   function rgbn(n2) {
20279     return new Rgb(n2 >> 16 & 255, n2 >> 8 & 255, n2 & 255, 1);
20280   }
20281   function rgba(r, g, b, a) {
20282     if (a <= 0)
20283       r = g = b = NaN;
20284     return new Rgb(r, g, b, a);
20285   }
20286   function rgbConvert(o) {
20287     if (!(o instanceof Color))
20288       o = color(o);
20289     if (!o)
20290       return new Rgb();
20291     o = o.rgb();
20292     return new Rgb(o.r, o.g, o.b, o.opacity);
20293   }
20294   function rgb(r, g, b, opacity) {
20295     return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
20296   }
20297   function Rgb(r, g, b, opacity) {
20298     this.r = +r;
20299     this.g = +g;
20300     this.b = +b;
20301     this.opacity = +opacity;
20302   }
20303   define_default(Rgb, rgb, extend(Color, {
20304     brighter(k) {
20305       k = k == null ? brighter : Math.pow(brighter, k);
20306       return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20307     },
20308     darker(k) {
20309       k = k == null ? darker : Math.pow(darker, k);
20310       return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
20311     },
20312     rgb() {
20313       return this;
20314     },
20315     clamp() {
20316       return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
20317     },
20318     displayable() {
20319       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);
20320     },
20321     hex: rgb_formatHex,
20322     formatHex: rgb_formatHex,
20323     formatHex8: rgb_formatHex8,
20324     formatRgb: rgb_formatRgb,
20325     toString: rgb_formatRgb
20326   }));
20327   function rgb_formatHex() {
20328     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
20329   }
20330   function rgb_formatHex8() {
20331     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
20332   }
20333   function rgb_formatRgb() {
20334     const a = clampa(this.opacity);
20335     return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
20336   }
20337   function clampa(opacity) {
20338     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
20339   }
20340   function clampi(value) {
20341     return Math.max(0, Math.min(255, Math.round(value) || 0));
20342   }
20343   function hex(value) {
20344     value = clampi(value);
20345     return (value < 16 ? "0" : "") + value.toString(16);
20346   }
20347   function hsla(h, s, l, a) {
20348     if (a <= 0)
20349       h = s = l = NaN;
20350     else if (l <= 0 || l >= 1)
20351       h = s = NaN;
20352     else if (s <= 0)
20353       h = NaN;
20354     return new Hsl(h, s, l, a);
20355   }
20356   function hslConvert(o) {
20357     if (o instanceof Hsl)
20358       return new Hsl(o.h, o.s, o.l, o.opacity);
20359     if (!(o instanceof Color))
20360       o = color(o);
20361     if (!o)
20362       return new Hsl();
20363     if (o instanceof Hsl)
20364       return o;
20365     o = o.rgb();
20366     var r = o.r / 255, g = o.g / 255, b = o.b / 255, min3 = Math.min(r, g, b), max3 = Math.max(r, g, b), h = NaN, s = max3 - min3, l = (max3 + min3) / 2;
20367     if (s) {
20368       if (r === max3)
20369         h = (g - b) / s + (g < b) * 6;
20370       else if (g === max3)
20371         h = (b - r) / s + 2;
20372       else
20373         h = (r - g) / s + 4;
20374       s /= l < 0.5 ? max3 + min3 : 2 - max3 - min3;
20375       h *= 60;
20376     } else {
20377       s = l > 0 && l < 1 ? 0 : h;
20378     }
20379     return new Hsl(h, s, l, o.opacity);
20380   }
20381   function hsl(h, s, l, opacity) {
20382     return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
20383   }
20384   function Hsl(h, s, l, opacity) {
20385     this.h = +h;
20386     this.s = +s;
20387     this.l = +l;
20388     this.opacity = +opacity;
20389   }
20390   define_default(Hsl, hsl, extend(Color, {
20391     brighter(k) {
20392       k = k == null ? brighter : Math.pow(brighter, k);
20393       return new Hsl(this.h, this.s, this.l * k, this.opacity);
20394     },
20395     darker(k) {
20396       k = k == null ? darker : Math.pow(darker, k);
20397       return new Hsl(this.h, this.s, this.l * k, this.opacity);
20398     },
20399     rgb() {
20400       var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
20401       return new Rgb(
20402         hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
20403         hsl2rgb(h, m1, m2),
20404         hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
20405         this.opacity
20406       );
20407     },
20408     clamp() {
20409       return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
20410     },
20411     displayable() {
20412       return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
20413     },
20414     formatHsl() {
20415       const a = clampa(this.opacity);
20416       return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
20417     }
20418   }));
20419   function clamph(value) {
20420     value = (value || 0) % 360;
20421     return value < 0 ? value + 360 : value;
20422   }
20423   function clampt(value) {
20424     return Math.max(0, Math.min(1, value || 0));
20425   }
20426   function hsl2rgb(h, m1, m2) {
20427     return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
20428   }
20429
20430   // node_modules/d3-interpolate/src/basis.js
20431   function basis(t1, v0, v1, v2, v3) {
20432     var t2 = t1 * t1, t3 = t2 * t1;
20433     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;
20434   }
20435   function basis_default(values) {
20436     var n2 = values.length - 1;
20437     return function(t) {
20438       var i2 = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n2 - 1) : Math.floor(t * n2), v1 = values[i2], v2 = values[i2 + 1], v0 = i2 > 0 ? values[i2 - 1] : 2 * v1 - v2, v3 = i2 < n2 - 1 ? values[i2 + 2] : 2 * v2 - v1;
20439       return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20440     };
20441   }
20442
20443   // node_modules/d3-interpolate/src/basisClosed.js
20444   function basisClosed_default(values) {
20445     var n2 = values.length;
20446     return function(t) {
20447       var i2 = Math.floor(((t %= 1) < 0 ? ++t : t) * n2), v0 = values[(i2 + n2 - 1) % n2], v1 = values[i2 % n2], v2 = values[(i2 + 1) % n2], v3 = values[(i2 + 2) % n2];
20448       return basis((t - i2 / n2) * n2, v0, v1, v2, v3);
20449     };
20450   }
20451
20452   // node_modules/d3-interpolate/src/constant.js
20453   var constant_default3 = (x) => () => x;
20454
20455   // node_modules/d3-interpolate/src/color.js
20456   function linear(a, d) {
20457     return function(t) {
20458       return a + t * d;
20459     };
20460   }
20461   function exponential(a, b, y) {
20462     return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
20463       return Math.pow(a + t * b, y);
20464     };
20465   }
20466   function gamma(y) {
20467     return (y = +y) === 1 ? nogamma : function(a, b) {
20468       return b - a ? exponential(a, b, y) : constant_default3(isNaN(a) ? b : a);
20469     };
20470   }
20471   function nogamma(a, b) {
20472     var d = b - a;
20473     return d ? linear(a, d) : constant_default3(isNaN(a) ? b : a);
20474   }
20475
20476   // node_modules/d3-interpolate/src/rgb.js
20477   var rgb_default = function rgbGamma(y) {
20478     var color2 = gamma(y);
20479     function rgb2(start2, end) {
20480       var r = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g = color2(start2.g, end.g), b = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
20481       return function(t) {
20482         start2.r = r(t);
20483         start2.g = g(t);
20484         start2.b = b(t);
20485         start2.opacity = opacity(t);
20486         return start2 + "";
20487       };
20488     }
20489     rgb2.gamma = rgbGamma;
20490     return rgb2;
20491   }(1);
20492   function rgbSpline(spline) {
20493     return function(colors) {
20494       var n2 = colors.length, r = new Array(n2), g = new Array(n2), b = new Array(n2), i2, color2;
20495       for (i2 = 0; i2 < n2; ++i2) {
20496         color2 = rgb(colors[i2]);
20497         r[i2] = color2.r || 0;
20498         g[i2] = color2.g || 0;
20499         b[i2] = color2.b || 0;
20500       }
20501       r = spline(r);
20502       g = spline(g);
20503       b = spline(b);
20504       color2.opacity = 1;
20505       return function(t) {
20506         color2.r = r(t);
20507         color2.g = g(t);
20508         color2.b = b(t);
20509         return color2 + "";
20510       };
20511     };
20512   }
20513   var rgbBasis = rgbSpline(basis_default);
20514   var rgbBasisClosed = rgbSpline(basisClosed_default);
20515
20516   // node_modules/d3-interpolate/src/numberArray.js
20517   function numberArray_default(a, b) {
20518     if (!b)
20519       b = [];
20520     var n2 = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i2;
20521     return function(t) {
20522       for (i2 = 0; i2 < n2; ++i2)
20523         c[i2] = a[i2] * (1 - t) + b[i2] * t;
20524       return c;
20525     };
20526   }
20527   function isNumberArray(x) {
20528     return ArrayBuffer.isView(x) && !(x instanceof DataView);
20529   }
20530
20531   // node_modules/d3-interpolate/src/array.js
20532   function genericArray(a, b) {
20533     var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i2;
20534     for (i2 = 0; i2 < na; ++i2)
20535       x[i2] = value_default(a[i2], b[i2]);
20536     for (; i2 < nb; ++i2)
20537       c[i2] = b[i2];
20538     return function(t) {
20539       for (i2 = 0; i2 < na; ++i2)
20540         c[i2] = x[i2](t);
20541       return c;
20542     };
20543   }
20544
20545   // node_modules/d3-interpolate/src/date.js
20546   function date_default(a, b) {
20547     var d = new Date();
20548     return a = +a, b = +b, function(t) {
20549       return d.setTime(a * (1 - t) + b * t), d;
20550     };
20551   }
20552
20553   // node_modules/d3-interpolate/src/number.js
20554   function number_default(a, b) {
20555     return a = +a, b = +b, function(t) {
20556       return a * (1 - t) + b * t;
20557     };
20558   }
20559
20560   // node_modules/d3-interpolate/src/object.js
20561   function object_default(a, b) {
20562     var i2 = {}, c = {}, k;
20563     if (a === null || typeof a !== "object")
20564       a = {};
20565     if (b === null || typeof b !== "object")
20566       b = {};
20567     for (k in b) {
20568       if (k in a) {
20569         i2[k] = value_default(a[k], b[k]);
20570       } else {
20571         c[k] = b[k];
20572       }
20573     }
20574     return function(t) {
20575       for (k in i2)
20576         c[k] = i2[k](t);
20577       return c;
20578     };
20579   }
20580
20581   // node_modules/d3-interpolate/src/string.js
20582   var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
20583   var reB = new RegExp(reA.source, "g");
20584   function zero2(b) {
20585     return function() {
20586       return b;
20587     };
20588   }
20589   function one(b) {
20590     return function(t) {
20591       return b(t) + "";
20592     };
20593   }
20594   function string_default(a, b) {
20595     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i2 = -1, s = [], q = [];
20596     a = a + "", b = b + "";
20597     while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
20598       if ((bs = bm.index) > bi) {
20599         bs = b.slice(bi, bs);
20600         if (s[i2])
20601           s[i2] += bs;
20602         else
20603           s[++i2] = bs;
20604       }
20605       if ((am = am[0]) === (bm = bm[0])) {
20606         if (s[i2])
20607           s[i2] += bm;
20608         else
20609           s[++i2] = bm;
20610       } else {
20611         s[++i2] = null;
20612         q.push({ i: i2, x: number_default(am, bm) });
20613       }
20614       bi = reB.lastIndex;
20615     }
20616     if (bi < b.length) {
20617       bs = b.slice(bi);
20618       if (s[i2])
20619         s[i2] += bs;
20620       else
20621         s[++i2] = bs;
20622     }
20623     return s.length < 2 ? q[0] ? one(q[0].x) : zero2(b) : (b = q.length, function(t) {
20624       for (var i3 = 0, o; i3 < b; ++i3)
20625         s[(o = q[i3]).i] = o.x(t);
20626       return s.join("");
20627     });
20628   }
20629
20630   // node_modules/d3-interpolate/src/value.js
20631   function value_default(a, b) {
20632     var t = typeof b, c;
20633     return b == null || t === "boolean" ? constant_default3(b) : (t === "number" ? number_default : t === "string" ? (c = color(b)) ? (b = c, rgb_default) : string_default : b instanceof color ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object_default : number_default)(a, b);
20634   }
20635
20636   // node_modules/d3-interpolate/src/round.js
20637   function round_default(a, b) {
20638     return a = +a, b = +b, function(t) {
20639       return Math.round(a * (1 - t) + b * t);
20640     };
20641   }
20642
20643   // node_modules/d3-interpolate/src/transform/decompose.js
20644   var degrees2 = 180 / Math.PI;
20645   var identity = {
20646     translateX: 0,
20647     translateY: 0,
20648     rotate: 0,
20649     skewX: 0,
20650     scaleX: 1,
20651     scaleY: 1
20652   };
20653   function decompose_default(a, b, c, d, e, f2) {
20654     var scaleX, scaleY, skewX;
20655     if (scaleX = Math.sqrt(a * a + b * b))
20656       a /= scaleX, b /= scaleX;
20657     if (skewX = a * c + b * d)
20658       c -= a * skewX, d -= b * skewX;
20659     if (scaleY = Math.sqrt(c * c + d * d))
20660       c /= scaleY, d /= scaleY, skewX /= scaleY;
20661     if (a * d < b * c)
20662       a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
20663     return {
20664       translateX: e,
20665       translateY: f2,
20666       rotate: Math.atan2(b, a) * degrees2,
20667       skewX: Math.atan(skewX) * degrees2,
20668       scaleX,
20669       scaleY
20670     };
20671   }
20672
20673   // node_modules/d3-interpolate/src/transform/parse.js
20674   var svgNode;
20675   function parseCss(value) {
20676     const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
20677     return m.isIdentity ? identity : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);
20678   }
20679   function parseSvg(value) {
20680     if (value == null)
20681       return identity;
20682     if (!svgNode)
20683       svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
20684     svgNode.setAttribute("transform", value);
20685     if (!(value = svgNode.transform.baseVal.consolidate()))
20686       return identity;
20687     value = value.matrix;
20688     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
20689   }
20690
20691   // node_modules/d3-interpolate/src/transform/index.js
20692   function interpolateTransform(parse, pxComma, pxParen, degParen) {
20693     function pop(s) {
20694       return s.length ? s.pop() + " " : "";
20695     }
20696     function translate(xa, ya, xb, yb, s, q) {
20697       if (xa !== xb || ya !== yb) {
20698         var i2 = s.push("translate(", null, pxComma, null, pxParen);
20699         q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
20700       } else if (xb || yb) {
20701         s.push("translate(" + xb + pxComma + yb + pxParen);
20702       }
20703     }
20704     function rotate(a, b, s, q) {
20705       if (a !== b) {
20706         if (a - b > 180)
20707           b += 360;
20708         else if (b - a > 180)
20709           a += 360;
20710         q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a, b) });
20711       } else if (b) {
20712         s.push(pop(s) + "rotate(" + b + degParen);
20713       }
20714     }
20715     function skewX(a, b, s, q) {
20716       if (a !== b) {
20717         q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a, b) });
20718       } else if (b) {
20719         s.push(pop(s) + "skewX(" + b + degParen);
20720       }
20721     }
20722     function scale(xa, ya, xb, yb, s, q) {
20723       if (xa !== xb || ya !== yb) {
20724         var i2 = s.push(pop(s) + "scale(", null, ",", null, ")");
20725         q.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) });
20726       } else if (xb !== 1 || yb !== 1) {
20727         s.push(pop(s) + "scale(" + xb + "," + yb + ")");
20728       }
20729     }
20730     return function(a, b) {
20731       var s = [], q = [];
20732       a = parse(a), b = parse(b);
20733       translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
20734       rotate(a.rotate, b.rotate, s, q);
20735       skewX(a.skewX, b.skewX, s, q);
20736       scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
20737       a = b = null;
20738       return function(t) {
20739         var i2 = -1, n2 = q.length, o;
20740         while (++i2 < n2)
20741           s[(o = q[i2]).i] = o.x(t);
20742         return s.join("");
20743       };
20744     };
20745   }
20746   var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
20747   var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
20748
20749   // node_modules/d3-interpolate/src/zoom.js
20750   var epsilon22 = 1e-12;
20751   function cosh(x) {
20752     return ((x = Math.exp(x)) + 1 / x) / 2;
20753   }
20754   function sinh(x) {
20755     return ((x = Math.exp(x)) - 1 / x) / 2;
20756   }
20757   function tanh(x) {
20758     return ((x = Math.exp(2 * x)) - 1) / (x + 1);
20759   }
20760   var zoom_default = function zoomRho(rho, rho2, rho4) {
20761     function zoom(p02, p1) {
20762       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, i2, S;
20763       if (d2 < epsilon22) {
20764         S = Math.log(w1 / w0) / rho;
20765         i2 = function(t) {
20766           return [
20767             ux0 + t * dx,
20768             uy0 + t * dy,
20769             w0 * Math.exp(rho * t * S)
20770           ];
20771         };
20772       } else {
20773         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);
20774         S = (r1 - r0) / rho;
20775         i2 = function(t) {
20776           var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
20777           return [
20778             ux0 + u * dx,
20779             uy0 + u * dy,
20780             w0 * coshr0 / cosh(rho * s + r0)
20781           ];
20782         };
20783       }
20784       i2.duration = S * 1e3 * rho / Math.SQRT2;
20785       return i2;
20786     }
20787     zoom.rho = function(_) {
20788       var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
20789       return zoomRho(_1, _2, _4);
20790     };
20791     return zoom;
20792   }(Math.SQRT2, 2, 4);
20793
20794   // node_modules/d3-interpolate/src/quantize.js
20795   function quantize_default(interpolator, n2) {
20796     var samples = new Array(n2);
20797     for (var i2 = 0; i2 < n2; ++i2)
20798       samples[i2] = interpolator(i2 / (n2 - 1));
20799     return samples;
20800   }
20801
20802   // node_modules/d3-timer/src/timer.js
20803   var frame = 0;
20804   var timeout = 0;
20805   var interval = 0;
20806   var pokeDelay = 1e3;
20807   var taskHead;
20808   var taskTail;
20809   var clockLast = 0;
20810   var clockNow = 0;
20811   var clockSkew = 0;
20812   var clock = typeof performance === "object" && performance.now ? performance : Date;
20813   var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
20814     setTimeout(f2, 17);
20815   };
20816   function now() {
20817     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
20818   }
20819   function clearNow() {
20820     clockNow = 0;
20821   }
20822   function Timer() {
20823     this._call = this._time = this._next = null;
20824   }
20825   Timer.prototype = timer.prototype = {
20826     constructor: Timer,
20827     restart: function(callback, delay, time) {
20828       if (typeof callback !== "function")
20829         throw new TypeError("callback is not a function");
20830       time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
20831       if (!this._next && taskTail !== this) {
20832         if (taskTail)
20833           taskTail._next = this;
20834         else
20835           taskHead = this;
20836         taskTail = this;
20837       }
20838       this._call = callback;
20839       this._time = time;
20840       sleep();
20841     },
20842     stop: function() {
20843       if (this._call) {
20844         this._call = null;
20845         this._time = Infinity;
20846         sleep();
20847       }
20848     }
20849   };
20850   function timer(callback, delay, time) {
20851     var t = new Timer();
20852     t.restart(callback, delay, time);
20853     return t;
20854   }
20855   function timerFlush() {
20856     now();
20857     ++frame;
20858     var t = taskHead, e;
20859     while (t) {
20860       if ((e = clockNow - t._time) >= 0)
20861         t._call.call(void 0, e);
20862       t = t._next;
20863     }
20864     --frame;
20865   }
20866   function wake() {
20867     clockNow = (clockLast = clock.now()) + clockSkew;
20868     frame = timeout = 0;
20869     try {
20870       timerFlush();
20871     } finally {
20872       frame = 0;
20873       nap();
20874       clockNow = 0;
20875     }
20876   }
20877   function poke() {
20878     var now3 = clock.now(), delay = now3 - clockLast;
20879     if (delay > pokeDelay)
20880       clockSkew -= delay, clockLast = now3;
20881   }
20882   function nap() {
20883     var t0, t1 = taskHead, t2, time = Infinity;
20884     while (t1) {
20885       if (t1._call) {
20886         if (time > t1._time)
20887           time = t1._time;
20888         t0 = t1, t1 = t1._next;
20889       } else {
20890         t2 = t1._next, t1._next = null;
20891         t1 = t0 ? t0._next = t2 : taskHead = t2;
20892       }
20893     }
20894     taskTail = t0;
20895     sleep(time);
20896   }
20897   function sleep(time) {
20898     if (frame)
20899       return;
20900     if (timeout)
20901       timeout = clearTimeout(timeout);
20902     var delay = time - clockNow;
20903     if (delay > 24) {
20904       if (time < Infinity)
20905         timeout = setTimeout(wake, time - clock.now() - clockSkew);
20906       if (interval)
20907         interval = clearInterval(interval);
20908     } else {
20909       if (!interval)
20910         clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
20911       frame = 1, setFrame(wake);
20912     }
20913   }
20914
20915   // node_modules/d3-timer/src/timeout.js
20916   function timeout_default(callback, delay, time) {
20917     var t = new Timer();
20918     delay = delay == null ? 0 : +delay;
20919     t.restart((elapsed) => {
20920       t.stop();
20921       callback(elapsed + delay);
20922     }, delay, time);
20923     return t;
20924   }
20925
20926   // node_modules/d3-transition/src/transition/schedule.js
20927   var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
20928   var emptyTween = [];
20929   var CREATED = 0;
20930   var SCHEDULED = 1;
20931   var STARTING = 2;
20932   var STARTED = 3;
20933   var RUNNING = 4;
20934   var ENDING = 5;
20935   var ENDED = 6;
20936   function schedule_default(node, name, id2, index, group, timing) {
20937     var schedules = node.__transition;
20938     if (!schedules)
20939       node.__transition = {};
20940     else if (id2 in schedules)
20941       return;
20942     create(node, id2, {
20943       name,
20944       index,
20945       group,
20946       on: emptyOn,
20947       tween: emptyTween,
20948       time: timing.time,
20949       delay: timing.delay,
20950       duration: timing.duration,
20951       ease: timing.ease,
20952       timer: null,
20953       state: CREATED
20954     });
20955   }
20956   function init(node, id2) {
20957     var schedule = get2(node, id2);
20958     if (schedule.state > CREATED)
20959       throw new Error("too late; already scheduled");
20960     return schedule;
20961   }
20962   function set2(node, id2) {
20963     var schedule = get2(node, id2);
20964     if (schedule.state > STARTED)
20965       throw new Error("too late; already running");
20966     return schedule;
20967   }
20968   function get2(node, id2) {
20969     var schedule = node.__transition;
20970     if (!schedule || !(schedule = schedule[id2]))
20971       throw new Error("transition not found");
20972     return schedule;
20973   }
20974   function create(node, id2, self2) {
20975     var schedules = node.__transition, tween;
20976     schedules[id2] = self2;
20977     self2.timer = timer(schedule, 0, self2.time);
20978     function schedule(elapsed) {
20979       self2.state = SCHEDULED;
20980       self2.timer.restart(start2, self2.delay, self2.time);
20981       if (self2.delay <= elapsed)
20982         start2(elapsed - self2.delay);
20983     }
20984     function start2(elapsed) {
20985       var i2, j2, n2, o;
20986       if (self2.state !== SCHEDULED)
20987         return stop();
20988       for (i2 in schedules) {
20989         o = schedules[i2];
20990         if (o.name !== self2.name)
20991           continue;
20992         if (o.state === STARTED)
20993           return timeout_default(start2);
20994         if (o.state === RUNNING) {
20995           o.state = ENDED;
20996           o.timer.stop();
20997           o.on.call("interrupt", node, node.__data__, o.index, o.group);
20998           delete schedules[i2];
20999         } else if (+i2 < id2) {
21000           o.state = ENDED;
21001           o.timer.stop();
21002           o.on.call("cancel", node, node.__data__, o.index, o.group);
21003           delete schedules[i2];
21004         }
21005       }
21006       timeout_default(function() {
21007         if (self2.state === STARTED) {
21008           self2.state = RUNNING;
21009           self2.timer.restart(tick, self2.delay, self2.time);
21010           tick(elapsed);
21011         }
21012       });
21013       self2.state = STARTING;
21014       self2.on.call("start", node, node.__data__, self2.index, self2.group);
21015       if (self2.state !== STARTING)
21016         return;
21017       self2.state = STARTED;
21018       tween = new Array(n2 = self2.tween.length);
21019       for (i2 = 0, j2 = -1; i2 < n2; ++i2) {
21020         if (o = self2.tween[i2].value.call(node, node.__data__, self2.index, self2.group)) {
21021           tween[++j2] = o;
21022         }
21023       }
21024       tween.length = j2 + 1;
21025     }
21026     function tick(elapsed) {
21027       var t = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i2 = -1, n2 = tween.length;
21028       while (++i2 < n2) {
21029         tween[i2].call(node, t);
21030       }
21031       if (self2.state === ENDING) {
21032         self2.on.call("end", node, node.__data__, self2.index, self2.group);
21033         stop();
21034       }
21035     }
21036     function stop() {
21037       self2.state = ENDED;
21038       self2.timer.stop();
21039       delete schedules[id2];
21040       for (var i2 in schedules)
21041         return;
21042       delete node.__transition;
21043     }
21044   }
21045
21046   // node_modules/d3-transition/src/interrupt.js
21047   function interrupt_default(node, name) {
21048     var schedules = node.__transition, schedule, active, empty2 = true, i2;
21049     if (!schedules)
21050       return;
21051     name = name == null ? null : name + "";
21052     for (i2 in schedules) {
21053       if ((schedule = schedules[i2]).name !== name) {
21054         empty2 = false;
21055         continue;
21056       }
21057       active = schedule.state > STARTING && schedule.state < ENDING;
21058       schedule.state = ENDED;
21059       schedule.timer.stop();
21060       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
21061       delete schedules[i2];
21062     }
21063     if (empty2)
21064       delete node.__transition;
21065   }
21066
21067   // node_modules/d3-transition/src/selection/interrupt.js
21068   function interrupt_default2(name) {
21069     return this.each(function() {
21070       interrupt_default(this, name);
21071     });
21072   }
21073
21074   // node_modules/d3-transition/src/transition/tween.js
21075   function tweenRemove(id2, name) {
21076     var tween0, tween1;
21077     return function() {
21078       var schedule = set2(this, id2), tween = schedule.tween;
21079       if (tween !== tween0) {
21080         tween1 = tween0 = tween;
21081         for (var i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
21082           if (tween1[i2].name === name) {
21083             tween1 = tween1.slice();
21084             tween1.splice(i2, 1);
21085             break;
21086           }
21087         }
21088       }
21089       schedule.tween = tween1;
21090     };
21091   }
21092   function tweenFunction(id2, name, value) {
21093     var tween0, tween1;
21094     if (typeof value !== "function")
21095       throw new Error();
21096     return function() {
21097       var schedule = set2(this, id2), tween = schedule.tween;
21098       if (tween !== tween0) {
21099         tween1 = (tween0 = tween).slice();
21100         for (var t = { name, value }, i2 = 0, n2 = tween1.length; i2 < n2; ++i2) {
21101           if (tween1[i2].name === name) {
21102             tween1[i2] = t;
21103             break;
21104           }
21105         }
21106         if (i2 === n2)
21107           tween1.push(t);
21108       }
21109       schedule.tween = tween1;
21110     };
21111   }
21112   function tween_default(name, value) {
21113     var id2 = this._id;
21114     name += "";
21115     if (arguments.length < 2) {
21116       var tween = get2(this.node(), id2).tween;
21117       for (var i2 = 0, n2 = tween.length, t; i2 < n2; ++i2) {
21118         if ((t = tween[i2]).name === name) {
21119           return t.value;
21120         }
21121       }
21122       return null;
21123     }
21124     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
21125   }
21126   function tweenValue(transition2, name, value) {
21127     var id2 = transition2._id;
21128     transition2.each(function() {
21129       var schedule = set2(this, id2);
21130       (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
21131     });
21132     return function(node) {
21133       return get2(node, id2).value[name];
21134     };
21135   }
21136
21137   // node_modules/d3-transition/src/transition/interpolate.js
21138   function interpolate_default(a, b) {
21139     var c;
21140     return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c = color(b)) ? (b = c, rgb_default) : string_default)(a, b);
21141   }
21142
21143   // node_modules/d3-transition/src/transition/attr.js
21144   function attrRemove2(name) {
21145     return function() {
21146       this.removeAttribute(name);
21147     };
21148   }
21149   function attrRemoveNS2(fullname) {
21150     return function() {
21151       this.removeAttributeNS(fullname.space, fullname.local);
21152     };
21153   }
21154   function attrConstant2(name, interpolate, value1) {
21155     var string00, string1 = value1 + "", interpolate0;
21156     return function() {
21157       var string0 = this.getAttribute(name);
21158       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21159     };
21160   }
21161   function attrConstantNS2(fullname, interpolate, value1) {
21162     var string00, string1 = value1 + "", interpolate0;
21163     return function() {
21164       var string0 = this.getAttributeNS(fullname.space, fullname.local);
21165       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21166     };
21167   }
21168   function attrFunction2(name, interpolate, value) {
21169     var string00, string10, interpolate0;
21170     return function() {
21171       var string0, value1 = value(this), string1;
21172       if (value1 == null)
21173         return void this.removeAttribute(name);
21174       string0 = this.getAttribute(name);
21175       string1 = value1 + "";
21176       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21177     };
21178   }
21179   function attrFunctionNS2(fullname, interpolate, value) {
21180     var string00, string10, interpolate0;
21181     return function() {
21182       var string0, value1 = value(this), string1;
21183       if (value1 == null)
21184         return void this.removeAttributeNS(fullname.space, fullname.local);
21185       string0 = this.getAttributeNS(fullname.space, fullname.local);
21186       string1 = value1 + "";
21187       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21188     };
21189   }
21190   function attr_default2(name, value) {
21191     var fullname = namespace_default(name), i2 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
21192     return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i2, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i2, value));
21193   }
21194
21195   // node_modules/d3-transition/src/transition/attrTween.js
21196   function attrInterpolate(name, i2) {
21197     return function(t) {
21198       this.setAttribute(name, i2.call(this, t));
21199     };
21200   }
21201   function attrInterpolateNS(fullname, i2) {
21202     return function(t) {
21203       this.setAttributeNS(fullname.space, fullname.local, i2.call(this, t));
21204     };
21205   }
21206   function attrTweenNS(fullname, value) {
21207     var t0, i0;
21208     function tween() {
21209       var i2 = value.apply(this, arguments);
21210       if (i2 !== i0)
21211         t0 = (i0 = i2) && attrInterpolateNS(fullname, i2);
21212       return t0;
21213     }
21214     tween._value = value;
21215     return tween;
21216   }
21217   function attrTween(name, value) {
21218     var t0, i0;
21219     function tween() {
21220       var i2 = value.apply(this, arguments);
21221       if (i2 !== i0)
21222         t0 = (i0 = i2) && attrInterpolate(name, i2);
21223       return t0;
21224     }
21225     tween._value = value;
21226     return tween;
21227   }
21228   function attrTween_default(name, value) {
21229     var key = "attr." + name;
21230     if (arguments.length < 2)
21231       return (key = this.tween(key)) && key._value;
21232     if (value == null)
21233       return this.tween(key, null);
21234     if (typeof value !== "function")
21235       throw new Error();
21236     var fullname = namespace_default(name);
21237     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
21238   }
21239
21240   // node_modules/d3-transition/src/transition/delay.js
21241   function delayFunction(id2, value) {
21242     return function() {
21243       init(this, id2).delay = +value.apply(this, arguments);
21244     };
21245   }
21246   function delayConstant(id2, value) {
21247     return value = +value, function() {
21248       init(this, id2).delay = value;
21249     };
21250   }
21251   function delay_default(value) {
21252     var id2 = this._id;
21253     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
21254   }
21255
21256   // node_modules/d3-transition/src/transition/duration.js
21257   function durationFunction(id2, value) {
21258     return function() {
21259       set2(this, id2).duration = +value.apply(this, arguments);
21260     };
21261   }
21262   function durationConstant(id2, value) {
21263     return value = +value, function() {
21264       set2(this, id2).duration = value;
21265     };
21266   }
21267   function duration_default(value) {
21268     var id2 = this._id;
21269     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
21270   }
21271
21272   // node_modules/d3-transition/src/transition/ease.js
21273   function easeConstant(id2, value) {
21274     if (typeof value !== "function")
21275       throw new Error();
21276     return function() {
21277       set2(this, id2).ease = value;
21278     };
21279   }
21280   function ease_default(value) {
21281     var id2 = this._id;
21282     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
21283   }
21284
21285   // node_modules/d3-transition/src/transition/easeVarying.js
21286   function easeVarying(id2, value) {
21287     return function() {
21288       var v = value.apply(this, arguments);
21289       if (typeof v !== "function")
21290         throw new Error();
21291       set2(this, id2).ease = v;
21292     };
21293   }
21294   function easeVarying_default(value) {
21295     if (typeof value !== "function")
21296       throw new Error();
21297     return this.each(easeVarying(this._id, value));
21298   }
21299
21300   // node_modules/d3-transition/src/transition/filter.js
21301   function filter_default2(match) {
21302     if (typeof match !== "function")
21303       match = matcher_default(match);
21304     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21305       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = [], node, i2 = 0; i2 < n2; ++i2) {
21306         if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
21307           subgroup.push(node);
21308         }
21309       }
21310     }
21311     return new Transition(subgroups, this._parents, this._name, this._id);
21312   }
21313
21314   // node_modules/d3-transition/src/transition/merge.js
21315   function merge_default2(transition2) {
21316     if (transition2._id !== this._id)
21317       throw new Error();
21318     for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m; ++j2) {
21319       for (var group0 = groups0[j2], group1 = groups1[j2], n2 = group0.length, merge3 = merges[j2] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
21320         if (node = group0[i2] || group1[i2]) {
21321           merge3[i2] = node;
21322         }
21323       }
21324     }
21325     for (; j2 < m0; ++j2) {
21326       merges[j2] = groups0[j2];
21327     }
21328     return new Transition(merges, this._parents, this._name, this._id);
21329   }
21330
21331   // node_modules/d3-transition/src/transition/on.js
21332   function start(name) {
21333     return (name + "").trim().split(/^|\s+/).every(function(t) {
21334       var i2 = t.indexOf(".");
21335       if (i2 >= 0)
21336         t = t.slice(0, i2);
21337       return !t || t === "start";
21338     });
21339   }
21340   function onFunction(id2, name, listener) {
21341     var on0, on1, sit = start(name) ? init : set2;
21342     return function() {
21343       var schedule = sit(this, id2), on = schedule.on;
21344       if (on !== on0)
21345         (on1 = (on0 = on).copy()).on(name, listener);
21346       schedule.on = on1;
21347     };
21348   }
21349   function on_default2(name, listener) {
21350     var id2 = this._id;
21351     return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
21352   }
21353
21354   // node_modules/d3-transition/src/transition/remove.js
21355   function removeFunction(id2) {
21356     return function() {
21357       var parent = this.parentNode;
21358       for (var i2 in this.__transition)
21359         if (+i2 !== id2)
21360           return;
21361       if (parent)
21362         parent.removeChild(this);
21363     };
21364   }
21365   function remove_default2() {
21366     return this.on("end.remove", removeFunction(this._id));
21367   }
21368
21369   // node_modules/d3-transition/src/transition/select.js
21370   function select_default3(select) {
21371     var name = this._name, id2 = this._id;
21372     if (typeof select !== "function")
21373       select = selector_default(select);
21374     for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j2 = 0; j2 < m; ++j2) {
21375       for (var group = groups[j2], n2 = group.length, subgroup = subgroups[j2] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
21376         if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
21377           if ("__data__" in node)
21378             subnode.__data__ = node.__data__;
21379           subgroup[i2] = subnode;
21380           schedule_default(subgroup[i2], name, id2, i2, subgroup, get2(node, id2));
21381         }
21382       }
21383     }
21384     return new Transition(subgroups, this._parents, name, id2);
21385   }
21386
21387   // node_modules/d3-transition/src/transition/selectAll.js
21388   function selectAll_default3(select) {
21389     var name = this._name, id2 = this._id;
21390     if (typeof select !== "function")
21391       select = selectorAll_default(select);
21392     for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m; ++j2) {
21393       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21394         if (node = group[i2]) {
21395           for (var children2 = select.call(node, node.__data__, i2, group), child, inherit2 = get2(node, id2), k = 0, l = children2.length; k < l; ++k) {
21396             if (child = children2[k]) {
21397               schedule_default(child, name, id2, k, children2, inherit2);
21398             }
21399           }
21400           subgroups.push(children2);
21401           parents.push(node);
21402         }
21403       }
21404     }
21405     return new Transition(subgroups, parents, name, id2);
21406   }
21407
21408   // node_modules/d3-transition/src/transition/selection.js
21409   var Selection2 = selection_default.prototype.constructor;
21410   function selection_default2() {
21411     return new Selection2(this._groups, this._parents);
21412   }
21413
21414   // node_modules/d3-transition/src/transition/style.js
21415   function styleNull(name, interpolate) {
21416     var string00, string10, interpolate0;
21417     return function() {
21418       var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
21419       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
21420     };
21421   }
21422   function styleRemove2(name) {
21423     return function() {
21424       this.style.removeProperty(name);
21425     };
21426   }
21427   function styleConstant2(name, interpolate, value1) {
21428     var string00, string1 = value1 + "", interpolate0;
21429     return function() {
21430       var string0 = styleValue(this, name);
21431       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21432     };
21433   }
21434   function styleFunction2(name, interpolate, value) {
21435     var string00, string10, interpolate0;
21436     return function() {
21437       var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
21438       if (value1 == null)
21439         string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
21440       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21441     };
21442   }
21443   function styleMaybeRemove(id2, name) {
21444     var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
21445     return function() {
21446       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
21447       if (on !== on0 || listener0 !== listener)
21448         (on1 = (on0 = on).copy()).on(event, listener0 = listener);
21449       schedule.on = on1;
21450     };
21451   }
21452   function style_default2(name, value, priority) {
21453     var i2 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
21454     return value == null ? this.styleTween(name, styleNull(name, i2)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i2, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i2, value), priority).on("end.style." + name, null);
21455   }
21456
21457   // node_modules/d3-transition/src/transition/styleTween.js
21458   function styleInterpolate(name, i2, priority) {
21459     return function(t) {
21460       this.style.setProperty(name, i2.call(this, t), priority);
21461     };
21462   }
21463   function styleTween(name, value, priority) {
21464     var t, i0;
21465     function tween() {
21466       var i2 = value.apply(this, arguments);
21467       if (i2 !== i0)
21468         t = (i0 = i2) && styleInterpolate(name, i2, priority);
21469       return t;
21470     }
21471     tween._value = value;
21472     return tween;
21473   }
21474   function styleTween_default(name, value, priority) {
21475     var key = "style." + (name += "");
21476     if (arguments.length < 2)
21477       return (key = this.tween(key)) && key._value;
21478     if (value == null)
21479       return this.tween(key, null);
21480     if (typeof value !== "function")
21481       throw new Error();
21482     return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
21483   }
21484
21485   // node_modules/d3-transition/src/transition/text.js
21486   function textConstant2(value) {
21487     return function() {
21488       this.textContent = value;
21489     };
21490   }
21491   function textFunction2(value) {
21492     return function() {
21493       var value1 = value(this);
21494       this.textContent = value1 == null ? "" : value1;
21495     };
21496   }
21497   function text_default2(value) {
21498     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
21499   }
21500
21501   // node_modules/d3-transition/src/transition/textTween.js
21502   function textInterpolate(i2) {
21503     return function(t) {
21504       this.textContent = i2.call(this, t);
21505     };
21506   }
21507   function textTween(value) {
21508     var t0, i0;
21509     function tween() {
21510       var i2 = value.apply(this, arguments);
21511       if (i2 !== i0)
21512         t0 = (i0 = i2) && textInterpolate(i2);
21513       return t0;
21514     }
21515     tween._value = value;
21516     return tween;
21517   }
21518   function textTween_default(value) {
21519     var key = "text";
21520     if (arguments.length < 1)
21521       return (key = this.tween(key)) && key._value;
21522     if (value == null)
21523       return this.tween(key, null);
21524     if (typeof value !== "function")
21525       throw new Error();
21526     return this.tween(key, textTween(value));
21527   }
21528
21529   // node_modules/d3-transition/src/transition/transition.js
21530   function transition_default() {
21531     var name = this._name, id0 = this._id, id1 = newId();
21532     for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
21533       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21534         if (node = group[i2]) {
21535           var inherit2 = get2(node, id0);
21536           schedule_default(node, name, id1, i2, group, {
21537             time: inherit2.time + inherit2.delay + inherit2.duration,
21538             delay: 0,
21539             duration: inherit2.duration,
21540             ease: inherit2.ease
21541           });
21542         }
21543       }
21544     }
21545     return new Transition(groups, this._parents, name, id1);
21546   }
21547
21548   // node_modules/d3-transition/src/transition/end.js
21549   function end_default() {
21550     var on0, on1, that = this, id2 = that._id, size = that.size();
21551     return new Promise(function(resolve, reject) {
21552       var cancel = { value: reject }, end = { value: function() {
21553         if (--size === 0)
21554           resolve();
21555       } };
21556       that.each(function() {
21557         var schedule = set2(this, id2), on = schedule.on;
21558         if (on !== on0) {
21559           on1 = (on0 = on).copy();
21560           on1._.cancel.push(cancel);
21561           on1._.interrupt.push(cancel);
21562           on1._.end.push(end);
21563         }
21564         schedule.on = on1;
21565       });
21566       if (size === 0)
21567         resolve();
21568     });
21569   }
21570
21571   // node_modules/d3-transition/src/transition/index.js
21572   var id = 0;
21573   function Transition(groups, parents, name, id2) {
21574     this._groups = groups;
21575     this._parents = parents;
21576     this._name = name;
21577     this._id = id2;
21578   }
21579   function transition(name) {
21580     return selection_default().transition(name);
21581   }
21582   function newId() {
21583     return ++id;
21584   }
21585   var selection_prototype = selection_default.prototype;
21586   Transition.prototype = transition.prototype = {
21587     constructor: Transition,
21588     select: select_default3,
21589     selectAll: selectAll_default3,
21590     selectChild: selection_prototype.selectChild,
21591     selectChildren: selection_prototype.selectChildren,
21592     filter: filter_default2,
21593     merge: merge_default2,
21594     selection: selection_default2,
21595     transition: transition_default,
21596     call: selection_prototype.call,
21597     nodes: selection_prototype.nodes,
21598     node: selection_prototype.node,
21599     size: selection_prototype.size,
21600     empty: selection_prototype.empty,
21601     each: selection_prototype.each,
21602     on: on_default2,
21603     attr: attr_default2,
21604     attrTween: attrTween_default,
21605     style: style_default2,
21606     styleTween: styleTween_default,
21607     text: text_default2,
21608     textTween: textTween_default,
21609     remove: remove_default2,
21610     tween: tween_default,
21611     delay: delay_default,
21612     duration: duration_default,
21613     ease: ease_default,
21614     easeVarying: easeVarying_default,
21615     end: end_default,
21616     [Symbol.iterator]: selection_prototype[Symbol.iterator]
21617   };
21618
21619   // node_modules/d3-ease/src/linear.js
21620   var linear2 = (t) => +t;
21621
21622   // node_modules/d3-ease/src/cubic.js
21623   function cubicInOut(t) {
21624     return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
21625   }
21626
21627   // node_modules/d3-transition/src/selection/transition.js
21628   var defaultTiming = {
21629     time: null,
21630     delay: 0,
21631     duration: 250,
21632     ease: cubicInOut
21633   };
21634   function inherit(node, id2) {
21635     var timing;
21636     while (!(timing = node.__transition) || !(timing = timing[id2])) {
21637       if (!(node = node.parentNode)) {
21638         throw new Error(`transition ${id2} not found`);
21639       }
21640     }
21641     return timing;
21642   }
21643   function transition_default2(name) {
21644     var id2, timing;
21645     if (name instanceof Transition) {
21646       id2 = name._id, name = name._name;
21647     } else {
21648       id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
21649     }
21650     for (var groups = this._groups, m = groups.length, j2 = 0; j2 < m; ++j2) {
21651       for (var group = groups[j2], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
21652         if (node = group[i2]) {
21653           schedule_default(node, name, id2, i2, group, timing || inherit(node, id2));
21654         }
21655       }
21656     }
21657     return new Transition(groups, this._parents, name, id2);
21658   }
21659
21660   // node_modules/d3-transition/src/selection/index.js
21661   selection_default.prototype.interrupt = interrupt_default2;
21662   selection_default.prototype.transition = transition_default2;
21663
21664   // node_modules/d3-zoom/src/constant.js
21665   var constant_default4 = (x) => () => x;
21666
21667   // node_modules/d3-zoom/src/event.js
21668   function ZoomEvent(type3, {
21669     sourceEvent,
21670     target,
21671     transform: transform2,
21672     dispatch: dispatch10
21673   }) {
21674     Object.defineProperties(this, {
21675       type: { value: type3, enumerable: true, configurable: true },
21676       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
21677       target: { value: target, enumerable: true, configurable: true },
21678       transform: { value: transform2, enumerable: true, configurable: true },
21679       _: { value: dispatch10 }
21680     });
21681   }
21682
21683   // node_modules/d3-zoom/src/transform.js
21684   function Transform(k, x, y) {
21685     this.k = k;
21686     this.x = x;
21687     this.y = y;
21688   }
21689   Transform.prototype = {
21690     constructor: Transform,
21691     scale: function(k) {
21692       return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
21693     },
21694     translate: function(x, y) {
21695       return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
21696     },
21697     apply: function(point) {
21698       return [point[0] * this.k + this.x, point[1] * this.k + this.y];
21699     },
21700     applyX: function(x) {
21701       return x * this.k + this.x;
21702     },
21703     applyY: function(y) {
21704       return y * this.k + this.y;
21705     },
21706     invert: function(location) {
21707       return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
21708     },
21709     invertX: function(x) {
21710       return (x - this.x) / this.k;
21711     },
21712     invertY: function(y) {
21713       return (y - this.y) / this.k;
21714     },
21715     rescaleX: function(x) {
21716       return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
21717     },
21718     rescaleY: function(y) {
21719       return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
21720     },
21721     toString: function() {
21722       return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
21723     }
21724   };
21725   var identity2 = new Transform(1, 0, 0);
21726   transform.prototype = Transform.prototype;
21727   function transform(node) {
21728     while (!node.__zoom)
21729       if (!(node = node.parentNode))
21730         return identity2;
21731     return node.__zoom;
21732   }
21733
21734   // node_modules/d3-zoom/src/noevent.js
21735   function nopropagation2(event) {
21736     event.stopImmediatePropagation();
21737   }
21738   function noevent_default2(event) {
21739     event.preventDefault();
21740     event.stopImmediatePropagation();
21741   }
21742
21743   // node_modules/d3-zoom/src/zoom.js
21744   function defaultFilter2(event) {
21745     return (!event.ctrlKey || event.type === "wheel") && !event.button;
21746   }
21747   function defaultExtent() {
21748     var e = this;
21749     if (e instanceof SVGElement) {
21750       e = e.ownerSVGElement || e;
21751       if (e.hasAttribute("viewBox")) {
21752         e = e.viewBox.baseVal;
21753         return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
21754       }
21755       return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
21756     }
21757     return [[0, 0], [e.clientWidth, e.clientHeight]];
21758   }
21759   function defaultTransform() {
21760     return this.__zoom || identity2;
21761   }
21762   function defaultWheelDelta(event) {
21763     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
21764   }
21765   function defaultTouchable2() {
21766     return navigator.maxTouchPoints || "ontouchstart" in this;
21767   }
21768   function defaultConstrain(transform2, extent, translateExtent) {
21769     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];
21770     return transform2.translate(
21771       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
21772       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
21773     );
21774   }
21775   function zoom_default2() {
21776     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;
21777     function zoom(selection2) {
21778       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)");
21779     }
21780     zoom.transform = function(collection, transform2, point, event) {
21781       var selection2 = collection.selection ? collection.selection() : collection;
21782       selection2.property("__zoom", defaultTransform);
21783       if (collection !== selection2) {
21784         schedule(collection, transform2, point, event);
21785       } else {
21786         selection2.interrupt().each(function() {
21787           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
21788         });
21789       }
21790     };
21791     zoom.scaleBy = function(selection2, k, p, event) {
21792       zoom.scaleTo(selection2, function() {
21793         var k0 = this.__zoom.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
21794         return k0 * k1;
21795       }, p, event);
21796     };
21797     zoom.scaleTo = function(selection2, k, p, event) {
21798       zoom.transform(selection2, function() {
21799         var e = extent.apply(this, arguments), t0 = this.__zoom, p02 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p02), k1 = typeof k === "function" ? k.apply(this, arguments) : k;
21800         return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
21801       }, p, event);
21802     };
21803     zoom.translateBy = function(selection2, x, y, event) {
21804       zoom.transform(selection2, function() {
21805         return constrain(this.__zoom.translate(
21806           typeof x === "function" ? x.apply(this, arguments) : x,
21807           typeof y === "function" ? y.apply(this, arguments) : y
21808         ), extent.apply(this, arguments), translateExtent);
21809       }, null, event);
21810     };
21811     zoom.translateTo = function(selection2, x, y, p, event) {
21812       zoom.transform(selection2, function() {
21813         var e = extent.apply(this, arguments), t = this.__zoom, p02 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
21814         return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(
21815           typeof x === "function" ? -x.apply(this, arguments) : -x,
21816           typeof y === "function" ? -y.apply(this, arguments) : -y
21817         ), e, translateExtent);
21818       }, p, event);
21819     };
21820     function scale(transform2, k) {
21821       k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
21822       return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
21823     }
21824     function translate(transform2, p02, p1) {
21825       var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
21826       return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
21827     }
21828     function centroid(extent2) {
21829       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
21830     }
21831     function schedule(transition2, transform2, point, event) {
21832       transition2.on("start.zoom", function() {
21833         gesture(this, arguments).event(event).start();
21834       }).on("interrupt.zoom end.zoom", function() {
21835         gesture(this, arguments).event(event).end();
21836       }).tween("zoom", function() {
21837         var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i2 = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
21838         return function(t) {
21839           if (t === 1)
21840             t = b;
21841           else {
21842             var l = i2(t), k = w / l[2];
21843             t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
21844           }
21845           g.zoom(null, t);
21846         };
21847       });
21848     }
21849     function gesture(that, args, clean2) {
21850       return !clean2 && that.__zooming || new Gesture(that, args);
21851     }
21852     function Gesture(that, args) {
21853       this.that = that;
21854       this.args = args;
21855       this.active = 0;
21856       this.sourceEvent = null;
21857       this.extent = extent.apply(that, args);
21858       this.taps = 0;
21859     }
21860     Gesture.prototype = {
21861       event: function(event) {
21862         if (event)
21863           this.sourceEvent = event;
21864         return this;
21865       },
21866       start: function() {
21867         if (++this.active === 1) {
21868           this.that.__zooming = this;
21869           this.emit("start");
21870         }
21871         return this;
21872       },
21873       zoom: function(key, transform2) {
21874         if (this.mouse && key !== "mouse")
21875           this.mouse[1] = transform2.invert(this.mouse[0]);
21876         if (this.touch0 && key !== "touch")
21877           this.touch0[1] = transform2.invert(this.touch0[0]);
21878         if (this.touch1 && key !== "touch")
21879           this.touch1[1] = transform2.invert(this.touch1[0]);
21880         this.that.__zoom = transform2;
21881         this.emit("zoom");
21882         return this;
21883       },
21884       end: function() {
21885         if (--this.active === 0) {
21886           delete this.that.__zooming;
21887           this.emit("end");
21888         }
21889         return this;
21890       },
21891       emit: function(type3) {
21892         var d = select_default2(this.that).datum();
21893         listeners.call(
21894           type3,
21895           this.that,
21896           new ZoomEvent(type3, {
21897             sourceEvent: this.sourceEvent,
21898             target: zoom,
21899             type: type3,
21900             transform: this.that.__zoom,
21901             dispatch: listeners
21902           }),
21903           d
21904         );
21905       }
21906     };
21907     function wheeled(event, ...args) {
21908       if (!filter2.apply(this, arguments))
21909         return;
21910       var g = gesture(this, args).event(event), t = this.__zoom, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = pointer_default(event);
21911       if (g.wheel) {
21912         if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
21913           g.mouse[1] = t.invert(g.mouse[0] = p);
21914         }
21915         clearTimeout(g.wheel);
21916       } else if (t.k === k)
21917         return;
21918       else {
21919         g.mouse = [p, t.invert(p)];
21920         interrupt_default(this);
21921         g.start();
21922       }
21923       noevent_default2(event);
21924       g.wheel = setTimeout(wheelidled, wheelDelay);
21925       g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
21926       function wheelidled() {
21927         g.wheel = null;
21928         g.end();
21929       }
21930     }
21931     function mousedowned(event, ...args) {
21932       if (touchending || !filter2.apply(this, arguments))
21933         return;
21934       var currentTarget = event.currentTarget, g = gesture(this, args, true).event(event), v = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p = pointer_default(event, currentTarget), x05 = event.clientX, y05 = event.clientY;
21935       nodrag_default(event.view);
21936       nopropagation2(event);
21937       g.mouse = [p, this.__zoom.invert(p)];
21938       interrupt_default(this);
21939       g.start();
21940       function mousemoved(event2) {
21941         noevent_default2(event2);
21942         if (!g.moved) {
21943           var dx = event2.clientX - x05, dy = event2.clientY - y05;
21944           g.moved = dx * dx + dy * dy > clickDistance2;
21945         }
21946         g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer_default(event2, currentTarget), g.mouse[1]), g.extent, translateExtent));
21947       }
21948       function mouseupped(event2) {
21949         v.on("mousemove.zoom mouseup.zoom", null);
21950         yesdrag(event2.view, g.moved);
21951         noevent_default2(event2);
21952         g.event(event2).end();
21953       }
21954     }
21955     function dblclicked(event, ...args) {
21956       if (!filter2.apply(this, arguments))
21957         return;
21958       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);
21959       noevent_default2(event);
21960       if (duration > 0)
21961         select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
21962       else
21963         select_default2(this).call(zoom.transform, t1, p02, event);
21964     }
21965     function touchstarted(event, ...args) {
21966       if (!filter2.apply(this, arguments))
21967         return;
21968       var touches = event.touches, n2 = touches.length, g = gesture(this, args, event.changedTouches.length === n2).event(event), started, i2, t, p;
21969       nopropagation2(event);
21970       for (i2 = 0; i2 < n2; ++i2) {
21971         t = touches[i2], p = pointer_default(t, this);
21972         p = [p, this.__zoom.invert(p), t.identifier];
21973         if (!g.touch0)
21974           g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
21975         else if (!g.touch1 && g.touch0[2] !== p[2])
21976           g.touch1 = p, g.taps = 0;
21977       }
21978       if (touchstarting)
21979         touchstarting = clearTimeout(touchstarting);
21980       if (started) {
21981         if (g.taps < 2)
21982           touchfirst = p[0], touchstarting = setTimeout(function() {
21983             touchstarting = null;
21984           }, touchDelay);
21985         interrupt_default(this);
21986         g.start();
21987       }
21988     }
21989     function touchmoved(event, ...args) {
21990       if (!this.__zooming)
21991         return;
21992       var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t, p, l;
21993       noevent_default2(event);
21994       for (i2 = 0; i2 < n2; ++i2) {
21995         t = touches[i2], p = pointer_default(t, this);
21996         if (g.touch0 && g.touch0[2] === t.identifier)
21997           g.touch0[0] = p;
21998         else if (g.touch1 && g.touch1[2] === t.identifier)
21999           g.touch1[0] = p;
22000       }
22001       t = g.that.__zoom;
22002       if (g.touch1) {
22003         var p02 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.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;
22004         t = scale(t, Math.sqrt(dp / dl));
22005         p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
22006         l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
22007       } else if (g.touch0)
22008         p = g.touch0[0], l = g.touch0[1];
22009       else
22010         return;
22011       g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
22012     }
22013     function touchended(event, ...args) {
22014       if (!this.__zooming)
22015         return;
22016       var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i2, t;
22017       nopropagation2(event);
22018       if (touchending)
22019         clearTimeout(touchending);
22020       touchending = setTimeout(function() {
22021         touchending = null;
22022       }, touchDelay);
22023       for (i2 = 0; i2 < n2; ++i2) {
22024         t = touches[i2];
22025         if (g.touch0 && g.touch0[2] === t.identifier)
22026           delete g.touch0;
22027         else if (g.touch1 && g.touch1[2] === t.identifier)
22028           delete g.touch1;
22029       }
22030       if (g.touch1 && !g.touch0)
22031         g.touch0 = g.touch1, delete g.touch1;
22032       if (g.touch0)
22033         g.touch0[1] = this.__zoom.invert(g.touch0[0]);
22034       else {
22035         g.end();
22036         if (g.taps === 2) {
22037           t = pointer_default(t, this);
22038           if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
22039             var p = select_default2(this).on("dblclick.zoom");
22040             if (p)
22041               p.apply(this, arguments);
22042           }
22043         }
22044       }
22045     }
22046     zoom.wheelDelta = function(_) {
22047       return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant_default4(+_), zoom) : wheelDelta;
22048     };
22049     zoom.filter = function(_) {
22050       return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : filter2;
22051     };
22052     zoom.touchable = function(_) {
22053       return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default4(!!_), zoom) : touchable;
22054     };
22055     zoom.extent = function(_) {
22056       return arguments.length ? (extent = typeof _ === "function" ? _ : constant_default4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
22057     };
22058     zoom.scaleExtent = function(_) {
22059       return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
22060     };
22061     zoom.translateExtent = function(_) {
22062       return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
22063     };
22064     zoom.constrain = function(_) {
22065       return arguments.length ? (constrain = _, zoom) : constrain;
22066     };
22067     zoom.duration = function(_) {
22068       return arguments.length ? (duration = +_, zoom) : duration;
22069     };
22070     zoom.interpolate = function(_) {
22071       return arguments.length ? (interpolate = _, zoom) : interpolate;
22072     };
22073     zoom.on = function() {
22074       var value = listeners.on.apply(listeners, arguments);
22075       return value === listeners ? zoom : value;
22076     };
22077     zoom.clickDistance = function(_) {
22078       return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
22079     };
22080     zoom.tapDistance = function(_) {
22081       return arguments.length ? (tapDistance = +_, zoom) : tapDistance;
22082     };
22083     return zoom;
22084   }
22085
22086   // modules/geo/raw_mercator.js
22087   function geoRawMercator() {
22088     var project = mercatorRaw;
22089     var k = 512 / Math.PI;
22090     var x = 0;
22091     var y = 0;
22092     var clipExtent = [[0, 0], [0, 0]];
22093     function projection2(point) {
22094       point = project(point[0] * Math.PI / 180, point[1] * Math.PI / 180);
22095       return [point[0] * k + x, y - point[1] * k];
22096     }
22097     projection2.invert = function(point) {
22098       point = project.invert((point[0] - x) / k, (y - point[1]) / k);
22099       return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
22100     };
22101     projection2.scale = function(_) {
22102       if (!arguments.length)
22103         return k;
22104       k = +_;
22105       return projection2;
22106     };
22107     projection2.translate = function(_) {
22108       if (!arguments.length)
22109         return [x, y];
22110       x = +_[0];
22111       y = +_[1];
22112       return projection2;
22113     };
22114     projection2.clipExtent = function(_) {
22115       if (!arguments.length)
22116         return clipExtent;
22117       clipExtent = _;
22118       return projection2;
22119     };
22120     projection2.transform = function(obj) {
22121       if (!arguments.length)
22122         return identity2.translate(x, y).scale(k);
22123       x = +obj.x;
22124       y = +obj.y;
22125       k = +obj.k;
22126       return projection2;
22127     };
22128     projection2.stream = transform_default({
22129       point: function(x2, y2) {
22130         var vec = projection2([x2, y2]);
22131         this.stream.point(vec[0], vec[1]);
22132       }
22133     }).stream;
22134     return projection2;
22135   }
22136
22137   // modules/geo/ortho.js
22138   function geoOrthoNormalizedDotProduct(a, b, origin) {
22139     if (geoVecEqual(origin, a) || geoVecEqual(origin, b)) {
22140       return 1;
22141     }
22142     return geoVecNormalizedDot(a, b, origin);
22143   }
22144   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
22145     var val = Math.abs(dotp);
22146     if (val < epsilon3) {
22147       return 0;
22148     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
22149       return 0;
22150     } else if (val < lowerThreshold || val > upperThreshold) {
22151       return dotp;
22152     } else {
22153       return null;
22154     }
22155   }
22156   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
22157     var score = 0;
22158     var first = isClosed ? 0 : 1;
22159     var last = isClosed ? points.length : points.length - 1;
22160     var coords = points.map(function(p) {
22161       return p.coord;
22162     });
22163     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22164     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22165     for (var i2 = first; i2 < last; i2++) {
22166       var a = coords[(i2 - 1 + coords.length) % coords.length];
22167       var origin = coords[i2];
22168       var b = coords[(i2 + 1) % coords.length];
22169       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold);
22170       if (dotp === null)
22171         continue;
22172       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
22173     }
22174     return score;
22175   }
22176   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
22177     var max3 = -Infinity;
22178     var first = isClosed ? 0 : 1;
22179     var last = isClosed ? coords.length : coords.length - 1;
22180     for (var i2 = first; i2 < last; i2++) {
22181       var a = coords[(i2 - 1 + coords.length) % coords.length];
22182       var origin = coords[i2];
22183       var b = coords[(i2 + 1) % coords.length];
22184       var normalizedDotP = geoOrthoNormalizedDotProduct(a, b, origin);
22185       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
22186       if (angle2 > 45)
22187         angle2 = 90 - angle2;
22188       if (angle2 >= lessThan)
22189         continue;
22190       if (angle2 > max3)
22191         max3 = angle2;
22192     }
22193     if (max3 === -Infinity)
22194       return null;
22195     return max3;
22196   }
22197   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
22198     var score = null;
22199     var first = isClosed ? 0 : 1;
22200     var last = isClosed ? coords.length : coords.length - 1;
22201     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22202     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22203     for (var i2 = first; i2 < last; i2++) {
22204       var a = coords[(i2 - 1 + coords.length) % coords.length];
22205       var origin = coords[i2];
22206       var b = coords[(i2 + 1) % coords.length];
22207       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a, b, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
22208       if (dotp === null)
22209         continue;
22210       if (Math.abs(dotp) > 0)
22211         return 1;
22212       score = 0;
22213     }
22214     return score;
22215   }
22216
22217   // modules/util/array.js
22218   function utilArrayIdentical(a, b) {
22219     if (a === b)
22220       return true;
22221     var i2 = a.length;
22222     if (i2 !== b.length)
22223       return false;
22224     while (i2--) {
22225       if (a[i2] !== b[i2])
22226         return false;
22227     }
22228     return true;
22229   }
22230   function utilArrayDifference(a, b) {
22231     var other = new Set(b);
22232     return Array.from(new Set(a)).filter(function(v) {
22233       return !other.has(v);
22234     });
22235   }
22236   function utilArrayIntersection(a, b) {
22237     var other = new Set(b);
22238     return Array.from(new Set(a)).filter(function(v) {
22239       return other.has(v);
22240     });
22241   }
22242   function utilArrayUnion(a, b) {
22243     var result = new Set(a);
22244     b.forEach(function(v) {
22245       result.add(v);
22246     });
22247     return Array.from(result);
22248   }
22249   function utilArrayUniq(a) {
22250     return Array.from(new Set(a));
22251   }
22252   function utilArrayChunk(a, chunkSize) {
22253     if (!chunkSize || chunkSize < 0)
22254       return [a.slice()];
22255     var result = new Array(Math.ceil(a.length / chunkSize));
22256     return Array.from(result, function(item, i2) {
22257       return a.slice(i2 * chunkSize, i2 * chunkSize + chunkSize);
22258     });
22259   }
22260   function utilArrayFlatten(a) {
22261     return a.reduce(function(acc, val) {
22262       return acc.concat(val);
22263     }, []);
22264   }
22265   function utilArrayGroupBy(a, key) {
22266     return a.reduce(function(acc, item) {
22267       var group = typeof key === "function" ? key(item) : item[key];
22268       (acc[group] = acc[group] || []).push(item);
22269       return acc;
22270     }, {});
22271   }
22272   function utilArrayUniqBy(a, key) {
22273     var seen = /* @__PURE__ */ new Set();
22274     return a.reduce(function(acc, item) {
22275       var val = typeof key === "function" ? key(item) : item[key];
22276       if (val && !seen.has(val)) {
22277         seen.add(val);
22278         acc.push(item);
22279       }
22280       return acc;
22281     }, []);
22282   }
22283
22284   // modules/util/util.js
22285   var import_diacritics = __toESM(require_diacritics());
22286
22287   // modules/util/svg_paths_rtl_fix.js
22288   var import_alif_toolkit = __toESM(require_lib());
22289   var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
22290   function fixRTLTextForSvg(inputText) {
22291     var ret = "", rtlBuffer = [];
22292     var arabicRegex = /[\u0600-\u06FF]/g;
22293     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
22294     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
22295     var thaanaVowel = /[\u07A6-\u07B0]/;
22296     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
22297     if (arabicRegex.test(inputText)) {
22298       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
22299     }
22300     for (var n2 = 0; n2 < inputText.length; n2++) {
22301       var c = inputText[n2];
22302       if (arabicMath.test(c)) {
22303         ret += rtlBuffer.reverse().join("");
22304         rtlBuffer = [c];
22305       } else {
22306         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
22307           ret += rtlBuffer.reverse().join("");
22308           rtlBuffer = [];
22309         }
22310         if ((thaanaVowel.test(c) || hebrewSign.test(c) || arabicDiacritics.test(c)) && rtlBuffer.length) {
22311           rtlBuffer[rtlBuffer.length - 1] += c;
22312         } else if (rtlRegex.test(c) || c.charCodeAt(0) >= 64336 && c.charCodeAt(0) <= 65023 || c.charCodeAt(0) >= 65136 && c.charCodeAt(0) <= 65279) {
22313           rtlBuffer.push(c);
22314         } else if (c === " " && rtlBuffer.length) {
22315           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
22316         } else {
22317           ret += rtlBuffer.reverse().join("") + c;
22318           rtlBuffer = [];
22319         }
22320       }
22321     }
22322     ret += rtlBuffer.reverse().join("");
22323     return ret;
22324   }
22325
22326   // modules/core/preferences.js
22327   var _storage;
22328   try {
22329     _storage = localStorage;
22330   } catch (e) {
22331   }
22332   _storage = _storage || (() => {
22333     let s = {};
22334     return {
22335       getItem: (k) => s[k],
22336       setItem: (k, v) => s[k] = v,
22337       removeItem: (k) => delete s[k]
22338     };
22339   })();
22340   var _listeners = {};
22341   function corePreferences(k, v) {
22342     try {
22343       if (v === void 0)
22344         return _storage.getItem(k);
22345       else if (v === null)
22346         _storage.removeItem(k);
22347       else
22348         _storage.setItem(k, v);
22349       if (_listeners[k]) {
22350         _listeners[k].forEach((handler) => handler(v));
22351       }
22352       return true;
22353     } catch (e) {
22354       if (typeof console !== "undefined") {
22355         console.error("localStorage quota exceeded");
22356       }
22357       return false;
22358     }
22359   }
22360   corePreferences.onChange = function(k, handler) {
22361     _listeners[k] = _listeners[k] || [];
22362     _listeners[k].push(handler);
22363   };
22364
22365   // modules/core/file_fetcher.js
22366   var import_vparse = __toESM(require_vparse());
22367
22368   // package.json
22369   var package_default = {
22370     name: "iD",
22371     version: "2.22.0",
22372     description: "A friendly editor for OpenStreetMap",
22373     main: "dist/iD.min.js",
22374     repository: "github:openstreetmap/iD",
22375     homepage: "https://github.com/openstreetmap/iD",
22376     bugs: "https://github.com/openstreetmap/iD/issues",
22377     keywords: [
22378       "editor",
22379       "openstreetmap"
22380     ],
22381     license: "ISC",
22382     scripts: {
22383       all: "run-s clean build dist",
22384       build: "run-s build:css build:data build:js",
22385       "build:css": "node scripts/build_css.js",
22386       "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
22387       "build:stats": "esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html",
22388       "build:js": "node config/esbuild.config.mjs",
22389       "build:js:watch": "node config/esbuild.config.mjs --watch",
22390       clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
22391       dist: "run-p dist:**",
22392       "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
22393       "dist:pannellum": "shx mkdir -p dist/pannellum-streetside && shx cp -R node_modules/pannellum/build/* dist/pannellum-streetside/",
22394       "dist:min": "node config/esbuild.config.min.mjs",
22395       "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
22396       "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',
22397       "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
22398       "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',
22399       "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg",
22400       "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/mapillary_sprite_source/package_objects/*.svg",
22401       "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@ideditor/temaki/icons/*.svg',
22402       imagery: "node scripts/update_imagery.js",
22403       lint: "eslint scripts test/spec modules",
22404       "lint:fix": "eslint scripts test/spec modules --fix",
22405       start: "run-s build:js start:server",
22406       "start:watch": "run-p build:js:watch start:server",
22407       "start:server": "node scripts/server.js",
22408       test: "npm-run-all -s lint build test:spec",
22409       "test:spec": "karma start karma.conf.js",
22410       translations: "node scripts/update_locales.js"
22411     },
22412     dependencies: {
22413       "@ideditor/country-coder": "~5.0.3",
22414       "@ideditor/location-conflation": "~1.0.2",
22415       "@mapbox/geojson-area": "^0.2.2",
22416       "@mapbox/sexagesimal": "1.2.0",
22417       "@mapbox/vector-tile": "^1.3.1",
22418       "@tmcw/togeojson": "^5.2.1",
22419       "@turf/bbox-clip": "^6.0.0",
22420       "abortcontroller-polyfill": "^1.4.0",
22421       "aes-js": "^3.1.2",
22422       "alif-toolkit": "^1.2.9",
22423       "core-js-bundle": "^3.19.0",
22424       diacritics: "1.3.0",
22425       "fast-deep-equal": "~3.1.1",
22426       "fast-json-stable-stringify": "2.1.0",
22427       "lodash-es": "~4.17.15",
22428       marked: "~4.1.0",
22429       "node-diff3": "~3.1.0",
22430       "osm-auth": "~2.0.0",
22431       pannellum: "2.5.6",
22432       pbf: "^3.2.1",
22433       "polygon-clipping": "~0.15.1",
22434       rbush: "3.0.1",
22435       "whatwg-fetch": "^3.4.1",
22436       "which-polygon": "2.2.0"
22437     },
22438     devDependencies: {
22439       "@fortawesome/fontawesome-svg-core": "~6.2.0",
22440       "@fortawesome/free-brands-svg-icons": "~6.2.0",
22441       "@fortawesome/free-regular-svg-icons": "~6.2.0",
22442       "@fortawesome/free-solid-svg-icons": "~6.2.0",
22443       "@ideditor/temaki": "~5.1.0",
22444       "@mapbox/maki": "^8.0.0",
22445       autoprefixer: "^10.0.1",
22446       btoa: "^1.2.1",
22447       chai: "^4.3.4",
22448       chalk: "^4.1.2",
22449       "cldr-core": "^41.0.0",
22450       "cldr-localenames-full": "^41.0.0",
22451       "concat-files": "^0.1.1",
22452       d3: "~7.6.1",
22453       "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
22454       esbuild: "^0.15.7",
22455       "esbuild-visualizer": "^0.3.1",
22456       eslint: "^8.8.0",
22457       "fetch-mock": "^9.11.0",
22458       gaze: "^1.1.3",
22459       glob: "^8.0.3",
22460       happen: "^0.3.2",
22461       "js-yaml": "^4.0.0",
22462       "json-stringify-pretty-compact": "^3.0.0",
22463       karma: "^6.3.5",
22464       "karma-chrome-launcher": "^3.1.0",
22465       "karma-coverage": "2.1.1",
22466       "karma-mocha": "^2.0.1",
22467       "karma-remap-istanbul": "^0.6.0",
22468       mapillary_sprite_source: "^1.8.0",
22469       "mapillary-js": "4.1.1",
22470       minimist: "^1.2.3",
22471       mocha: "^10.0.0",
22472       "name-suggestion-index": "~6.0",
22473       "node-fetch": "^2.6.1",
22474       "npm-run-all": "^4.0.0",
22475       "osm-community-index": "~5.2.0",
22476       postcss: "^8.1.1",
22477       "postcss-selector-prepend": "^0.5.0",
22478       shelljs: "^0.8.0",
22479       shx: "^0.3.0",
22480       sinon: "^11.1.2",
22481       "sinon-chai": "^3.7.0",
22482       smash: "0.0",
22483       "static-server": "^2.2.1",
22484       "svg-sprite": "1.5.4",
22485       vparse: "~1.1.0"
22486     },
22487     engines: {
22488       node: ">=16.14"
22489     },
22490     browserslist: [
22491       "> 0.2%, last 6 major versions, Firefox ESR, maintained node versions"
22492     ]
22493   };
22494
22495   // modules/core/file_fetcher.js
22496   var _mainFileFetcher = coreFileFetcher();
22497   function coreFileFetcher() {
22498     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
22499     const v = (0, import_vparse.default)(ociVersion);
22500     const vMinor = `${v.major}.${v.minor}`;
22501     let _this = {};
22502     let _inflight4 = {};
22503     let _fileMap = {
22504       "address_formats": "data/address_formats.min.json",
22505       "deprecated": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/deprecated.min.json",
22506       "discarded": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/discarded.min.json",
22507       "imagery": "data/imagery.min.json",
22508       "intro_graph": "data/intro_graph.min.json",
22509       "keepRight": "data/keepRight.min.json",
22510       "languages": "data/languages.min.json",
22511       "locales": "locales/index.min.json",
22512       "oci_defaults": `https://cdn.jsdelivr.net/npm/osm-community-index@${vMinor}/dist/defaults.min.json`,
22513       "oci_features": `https://cdn.jsdelivr.net/npm/osm-community-index@${vMinor}/dist/featureCollection.min.json`,
22514       "oci_resources": `https://cdn.jsdelivr.net/npm/osm-community-index@${vMinor}/dist/resources.min.json`,
22515       "preset_categories": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/preset_categories.min.json",
22516       "preset_defaults": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/preset_defaults.min.json",
22517       "preset_fields": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/fields.min.json",
22518       "preset_presets": "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/presets.min.json",
22519       "phone_formats": "data/phone_formats.min.json",
22520       "qa_data": "data/qa_data.min.json",
22521       "shortcuts": "data/shortcuts.min.json",
22522       "territory_languages": "data/territory_languages.min.json",
22523       "wmf_sitematrix": "https://cdn.jsdelivr.net/npm/wmf-sitematrix@0.1/wikipedia.min.json"
22524     };
22525     let _cachedData = {};
22526     _this.cache = () => _cachedData;
22527     _this.get = (which) => {
22528       if (_cachedData[which]) {
22529         return Promise.resolve(_cachedData[which]);
22530       }
22531       const file = _fileMap[which];
22532       const url = file && _this.asset(file);
22533       if (!url) {
22534         return Promise.reject(`Unknown data file for "${which}"`);
22535       }
22536       let prom = _inflight4[url];
22537       if (!prom) {
22538         _inflight4[url] = prom = fetch(url).then((response) => {
22539           if (!response.ok || !response.json) {
22540             throw new Error(response.status + " " + response.statusText);
22541           }
22542           if (response.status === 204 || response.status === 205)
22543             return;
22544           return response.json();
22545         }).then((result) => {
22546           delete _inflight4[url];
22547           if (!result) {
22548             throw new Error(`No data loaded for "${which}"`);
22549           }
22550           _cachedData[which] = result;
22551           return result;
22552         }).catch((err) => {
22553           delete _inflight4[url];
22554           throw err;
22555         });
22556       }
22557       return prom;
22558     };
22559     _this.fileMap = function(val) {
22560       if (!arguments.length)
22561         return _fileMap;
22562       _fileMap = val;
22563       return _this;
22564     };
22565     let _assetPath = "";
22566     _this.assetPath = function(val) {
22567       if (!arguments.length)
22568         return _assetPath;
22569       _assetPath = val;
22570       return _this;
22571     };
22572     let _assetMap = {};
22573     _this.assetMap = function(val) {
22574       if (!arguments.length)
22575         return _assetMap;
22576       _assetMap = val;
22577       return _this;
22578     };
22579     _this.asset = (val) => {
22580       if (/^http(s)?:\/\//i.test(val))
22581         return val;
22582       const filename = _assetPath + val;
22583       return _assetMap[filename] || filename;
22584     };
22585     return _this;
22586   }
22587
22588   // node_modules/@ideditor/country-coder/dist/country-coder.mjs
22589   var import_which_polygon = __toESM(require_which_polygon(), 1);
22590   var type = "FeatureCollection";
22591   var features = [
22592     { 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]]]] } },
22593     { 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]]]] } },
22594     { 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]]]] } },
22595     { 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]]]] } },
22596     { 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]]]] } },
22597     { 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]]]] } },
22598     { 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]]]] } },
22599     { 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]]]] } },
22600     { 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]]]] } },
22601     { 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]]]] } },
22602     { 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]]]] } },
22603     { 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]]]] } },
22604     { 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]]]] } },
22605     { 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]]]] } },
22606     { 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]]]] } },
22607     { 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]]]] } },
22608     { 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]]]] } },
22609     { 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]]]] } },
22610     { 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]]]] } },
22611     { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
22612     { 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]]]] } },
22613     { 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.56434, 24.49266], [120.49232, 25.22863], [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]]]] } },
22614     { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
22615     { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
22616     { 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]]]] } },
22617     { 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]]]] } },
22618     { 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]]]] } },
22619     { 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]]]] } },
22620     { 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]]]] } },
22621     { 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]]]] } },
22622     { 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]]]] } },
22623     { 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]]]] } },
22624     { 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]]]] } },
22625     { 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]]]] } },
22626     { 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]]]] } },
22627     { 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]]]] } },
22628     { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
22629     { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
22630     { 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]]]] } },
22631     { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
22632     { 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]]]] } },
22633     { 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]]]] } },
22634     { 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]]]] } },
22635     { 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]]]] } },
22636     { 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]]]] } },
22637     { 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]]]] } },
22638     { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
22639     { 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]]]] } },
22640     { 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]]]] } },
22641     { 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]]]] } },
22642     { 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]]]] } },
22643     { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
22644     { 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]]]] } },
22645     { 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]]]] } },
22646     { 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]]]] } },
22647     { 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]]]] } },
22648     { 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]]]] } },
22649     { 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]]]] } },
22650     { 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]]]] } },
22651     { 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]]]] } },
22652     { 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]]]] } },
22653     { 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]]]] } },
22654     { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
22655     { 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]]]] } },
22656     { 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]]]] } },
22657     { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
22658     { 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]]]] } },
22659     { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
22660     { 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]]]] } },
22661     { 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]]]] } },
22662     { 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]]]] } },
22663     { 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]]]] } },
22664     { 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]]]] } },
22665     { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
22666     { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
22667     { 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]]]] } },
22668     { 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]]]] } },
22669     { 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]]]] } },
22670     { 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]]]] } },
22671     { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
22672     { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
22673     { 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]]]] } },
22674     { 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]]]] } },
22675     { 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]]]] } },
22676     { 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]]]] } },
22677     { 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]]]] } },
22678     { 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]]]] } },
22679     { 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]]]] } },
22680     { 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]]]] } },
22681     { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
22682     { 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]]]] } },
22683     { 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]]]] } },
22684     { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
22685     { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
22686     { 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]]]] } },
22687     { 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]]]] } },
22688     { 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]]]] } },
22689     { 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]]]] } },
22690     { 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]]]] } },
22691     { 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]]]] } },
22692     { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
22693     { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
22694     { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
22695     { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
22696     { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
22697     { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
22698     { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
22699     { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
22700     { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
22701     { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
22702     { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
22703     { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
22704     { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
22705     { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
22706     { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
22707     { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
22708     { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
22709     { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
22710     { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
22711     { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
22712     { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
22713     { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
22714     { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
22715     { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
22716     { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
22717     { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
22718     { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
22719     { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
22720     { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
22721     { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
22722     { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
22723     { type: "Feature", properties: { m49: "680", wikidata: "Q3405693", nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.65349, 49.15373], [-2.09454, 49.46288], [-2.36485, 49.48223]]]] } },
22724     { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
22725     { 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]]]] } },
22726     { 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]]]] } },
22727     { 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]]]] } },
22728     { 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]]]] } },
22729     { 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]]]] } },
22730     { 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]]]] } },
22731     { 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]]]] } },
22732     { 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]]]] } },
22733     { 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]]]] } },
22734     { 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]]]] } },
22735     { 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]]]] } },
22736     { 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]]]] } },
22737     { 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]]]] } },
22738     { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
22739     { 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]]]] } },
22740     { 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]]]] } },
22741     { 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]]]] } },
22742     { 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]]]] } },
22743     { 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]]]] } },
22744     { 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]]]] } },
22745     { 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]]]] } },
22746     { 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]]]] } },
22747     { 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]]]] } },
22748     { 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]]]] } },
22749     { 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]]]] } },
22750     { 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]]]] } },
22751     { 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]]]] } },
22752     { 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]]]] } },
22753     { 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]]]] } },
22754     { 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]]]] } },
22755     { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
22756     { 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]]]] } },
22757     { 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]]]] } },
22758     { 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]]]] } },
22759     { 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]]]] } },
22760     { 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]]]] } },
22761     { 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]]]] } },
22762     { 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]]]] } },
22763     { 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]]]] } },
22764     { 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]]]] } },
22765     { 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]]]] } },
22766     { 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]]]] } },
22767     { 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]]]] } },
22768     { type: "Feature", properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] }, 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.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]]]] } },
22769     { 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]]]] } },
22770     { 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]]]] } },
22771     { 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]]]] } },
22772     { 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]]]] } },
22773     { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
22774     { 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]]]] } },
22775     { 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]]]] } },
22776     { 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]]]] } },
22777     { 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]]]] } },
22778     { 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]]]] } },
22779     { 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]]]] } },
22780     { 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]]]] } },
22781     { 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]]]] } },
22782     { 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]]]] } },
22783     { 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]]]] } },
22784     { 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]]]] } },
22785     { 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]]]] } },
22786     { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
22787     { 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]]]] } },
22788     { 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]]]] } },
22789     { 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]]]] } },
22790     { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
22791     { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
22792     { 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]]]] } },
22793     { 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]]]] } },
22794     { 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]]]] } },
22795     { 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]]]] } },
22796     { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
22797     { 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]]]] } },
22798     { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
22799     { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
22800     { 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]]]] } },
22801     { 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]]]] } },
22802     { 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]]]] } },
22803     { 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]]]] } },
22804     { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
22805     { 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]]]] } },
22806     { 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]]]] } },
22807     { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
22808     { 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]]]] } },
22809     { 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]]]] } },
22810     { 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]]]] } },
22811     { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
22812     { 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]]]] } },
22813     { 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]]]] } },
22814     { 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]]]] } },
22815     { 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]]]] } },
22816     { 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]]]] } },
22817     { 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]]]] } },
22818     { 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]]]] } },
22819     { 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]]]] } },
22820     { 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]]]] } },
22821     { 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]]]] } },
22822     { 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]]]] } },
22823     { 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]]]] } },
22824     { 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]]]] } },
22825     { 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]]]] } },
22826     { 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]]]] } },
22827     { 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]]]] } },
22828     { 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]]]] } },
22829     { 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]]]] } },
22830     { 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]]]] } },
22831     { 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]]]] } },
22832     { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
22833     { type: "Feature", properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] }, 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], [-22.01468, 48.19557], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] } },
22834     { 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]]]] } },
22835     { 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]]]] } },
22836     { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
22837     { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
22838     { 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]]]] } },
22839     { 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]]]] } },
22840     { 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]]]] } },
22841     { 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]]]] } },
22842     { 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]]]] } },
22843     { 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]]]] } },
22844     { 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]]]] } },
22845     { 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]]]] } },
22846     { 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]]]] } },
22847     { 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]]]] } },
22848     { 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]]]] } },
22849     { 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]]]] } },
22850     { 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]]]] } },
22851     { 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]]]] } },
22852     { 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]]]] } },
22853     { 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]]]] } },
22854     { 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]]]] } },
22855     { 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]]]] } },
22856     { 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]]]] } },
22857     { 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]]]] } },
22858     { 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]]]] } },
22859     { 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]]]] } },
22860     { 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]]]] } },
22861     { 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]]]] } },
22862     { 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]]]] } },
22863     { 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]]]] } },
22864     { 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]]]] } },
22865     { 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]]]] } },
22866     { 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]]]] } },
22867     { 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]]]] } },
22868     { 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]]]] } },
22869     { 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]]]] } },
22870     { 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]]]] } },
22871     { 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]]]] } },
22872     { 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]]]] } },
22873     { 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]]]] } },
22874     { 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]]]] } },
22875     { 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]]]] } },
22876     { 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]]]] } },
22877     { 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]]]] } },
22878     { 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]]]] } },
22879     { 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]]]] } },
22880     { 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]]]] } },
22881     { 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]]]] } },
22882     { 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]]]] } },
22883     { 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]]]] } },
22884     { 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]]]] } },
22885     { 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]]]] } },
22886     { 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]]]] } },
22887     { 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]]]] } },
22888     { 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]]]] } },
22889     { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
22890     { 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]]]] } },
22891     { 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]]]] } },
22892     { 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]]]] } },
22893     { 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]]]] } },
22894     { 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]]]] } },
22895     { 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]]]] } },
22896     { 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]]]] } },
22897     { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
22898     { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
22899     { 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]]]] } },
22900     { 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]]]] } },
22901     { 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]]]] } },
22902     { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
22903     { 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]]]] } },
22904     { 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]]]] } },
22905     { 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]]]] } },
22906     { 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]]]] } },
22907     { 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]]]] } },
22908     { 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]]]] } },
22909     { 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]]]] } },
22910     { 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]]]] } },
22911     { 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]]]] } },
22912     { 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]]]] } },
22913     { 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]]]] } },
22914     { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
22915     { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
22916     { 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]]]] } },
22917     { 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]]]] } },
22918     { 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]]]] } },
22919     { 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]]]] } },
22920     { 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]]]] } },
22921     { 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]]]] } },
22922     { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
22923     { 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]]]] } },
22924     { 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]]]] } },
22925     { 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]]]] } },
22926     { 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]]]] } },
22927     { 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]]]] } },
22928     { 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]]]] } },
22929     { 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]]]] } },
22930     { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
22931     { 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]]]] } },
22932     { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
22933     { 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]]]] } },
22934     { 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]]]] } },
22935     { 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]]]] } },
22936     { 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]]]] } },
22937     { 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]]]] } },
22938     { 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]]]] } },
22939     { 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]]]] } },
22940     { 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]]]] } },
22941     { 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]]]] } },
22942     { 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]]]] } },
22943     { 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]]]] } },
22944     { 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]]]] } },
22945     { 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]]]] } },
22946     { 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]]]] } },
22947     { 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]]]] } },
22948     { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
22949     { 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]]]] } },
22950     { 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]]]] } },
22951     { 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]]]] } },
22952     { 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]]]] } },
22953     { 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]]]] } },
22954     { 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]]]] } },
22955     { 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]]]] } },
22956     { 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]]]] } },
22957     { 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]]]] } },
22958     { 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]]]] } },
22959     { 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]]]] } },
22960     { 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.49232, 25.22863], [118.56434, 24.49266], [118.42453, 24.54644], [118.35291, 24.51645], [118.28244, 24.51231], [118.11703, 24.39734], [120.69238, 21.52331], [121.8109, 21.77688]]]] } },
22961     { 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]]]] } },
22962     { 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]]]] } },
22963     { 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]]]] } },
22964     { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
22965     { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
22966     { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
22967     { 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]]]] } },
22968     { 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]]]] } },
22969     { 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]]]] } },
22970     { 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]]]] } },
22971     { 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]]]] } },
22972     { 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]]]] } },
22973     { 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]]]] } },
22974     { 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]]]] } },
22975     { 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]]]] } },
22976     { 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]]]] } },
22977     { 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]]]] } },
22978     { 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]]]] } },
22979     { 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]]]] } },
22980     { 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]]]] } },
22981     { 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]]]] } },
22982     { 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]]]] } },
22983     { 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]]]] } }
22984   ];
22985   var borders_default = { type, features };
22986   var borders = borders_default;
22987   var whichPolygonGetter = {};
22988   var featuresByCode = {};
22989   var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
22990   function canonicalID(id2) {
22991     const s = id2 || "";
22992     if (s.charAt(0) === ".") {
22993       return s.toUpperCase();
22994     } else {
22995       return s.replace(idFilterRegex, "").toUpperCase();
22996     }
22997   }
22998   var levels = [
22999     "subterritory",
23000     "territory",
23001     "subcountryGroup",
23002     "country",
23003     "sharedLandform",
23004     "intermediateRegion",
23005     "subregion",
23006     "region",
23007     "subunion",
23008     "union",
23009     "unitedNations",
23010     "world"
23011   ];
23012   loadDerivedDataAndCaches(borders);
23013   function loadDerivedDataAndCaches(borders2) {
23014     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
23015     let geometryFeatures = [];
23016     borders2.features.forEach((feature22) => {
23017       feature22.properties.id = feature22.properties.iso1A2 || feature22.properties.m49 || feature22.properties.wikidata;
23018       loadM49(feature22);
23019       loadTLD(feature22);
23020       loadIsoStatus(feature22);
23021       loadLevel(feature22);
23022       loadGroups(feature22);
23023       loadFlag(feature22);
23024       cacheFeatureByIDs(feature22);
23025       if (feature22.geometry)
23026         geometryFeatures.push(feature22);
23027     });
23028     borders2.features.forEach((feature22) => {
23029       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
23030         return featuresByCode[groupID].properties.id;
23031       });
23032       loadMembersForGroupsOf(feature22);
23033     });
23034     borders2.features.forEach((feature22) => {
23035       loadRoadSpeedUnit(feature22);
23036       loadRoadHeightUnit(feature22);
23037       loadDriveSide(feature22);
23038       loadCallingCodes(feature22);
23039       loadGroupGroups(feature22);
23040     });
23041     borders2.features.forEach((feature22) => {
23042       feature22.properties.groups.sort((groupID1, groupID2) => {
23043         return levels.indexOf(featuresByCode[groupID1].properties.level) - levels.indexOf(featuresByCode[groupID2].properties.level);
23044       });
23045       if (feature22.properties.members)
23046         feature22.properties.members.sort((id1, id2) => {
23047           const diff = levels.indexOf(featuresByCode[id1].properties.level) - levels.indexOf(featuresByCode[id2].properties.level);
23048           if (diff === 0) {
23049             return borders2.features.indexOf(featuresByCode[id1]) - borders2.features.indexOf(featuresByCode[id2]);
23050           }
23051           return diff;
23052         });
23053     });
23054     const geometryOnlyCollection = {
23055       type: "FeatureCollection",
23056       features: geometryFeatures
23057     };
23058     whichPolygonGetter = (0, import_which_polygon.default)(geometryOnlyCollection);
23059     function loadGroups(feature22) {
23060       const props = feature22.properties;
23061       if (!props.groups) {
23062         props.groups = [];
23063       }
23064       if (feature22.geometry && props.country) {
23065         props.groups.push(props.country);
23066       }
23067       if (props.m49 !== "001") {
23068         props.groups.push("001");
23069       }
23070     }
23071     function loadM49(feature22) {
23072       const props = feature22.properties;
23073       if (!props.m49 && props.iso1N3) {
23074         props.m49 = props.iso1N3;
23075       }
23076     }
23077     function loadTLD(feature22) {
23078       const props = feature22.properties;
23079       if (props.level === "unitedNations")
23080         return;
23081       if (!props.ccTLD && props.iso1A2) {
23082         props.ccTLD = "." + props.iso1A2.toLowerCase();
23083       }
23084     }
23085     function loadIsoStatus(feature22) {
23086       const props = feature22.properties;
23087       if (!props.isoStatus && props.iso1A2) {
23088         props.isoStatus = "official";
23089       }
23090     }
23091     function loadLevel(feature22) {
23092       const props = feature22.properties;
23093       if (props.level)
23094         return;
23095       if (!props.country) {
23096         props.level = "country";
23097       } else if (!props.iso1A2 || props.isoStatus === "official") {
23098         props.level = "territory";
23099       } else {
23100         props.level = "subterritory";
23101       }
23102     }
23103     function loadGroupGroups(feature22) {
23104       const props = feature22.properties;
23105       if (feature22.geometry || !props.members)
23106         return;
23107       const featureLevelIndex = levels.indexOf(props.level);
23108       let sharedGroups = [];
23109       props.members.forEach((memberID, index) => {
23110         const member = featuresByCode[memberID];
23111         const memberGroups = member.properties.groups.filter((groupID) => {
23112           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(featuresByCode[groupID].properties.level);
23113         });
23114         if (index === 0) {
23115           sharedGroups = memberGroups;
23116         } else {
23117           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23118         }
23119       });
23120       props.groups = props.groups.concat(sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1));
23121       sharedGroups.forEach((groupID) => {
23122         const groupFeature = featuresByCode[groupID];
23123         if (groupFeature.properties.members.indexOf(props.id) === -1) {
23124           groupFeature.properties.members.push(props.id);
23125         }
23126       });
23127     }
23128     function loadRoadSpeedUnit(feature22) {
23129       const props = feature22.properties;
23130       if (feature22.geometry) {
23131         if (!props.roadSpeedUnit)
23132           props.roadSpeedUnit = "km/h";
23133       } else if (props.members) {
23134         const vals = Array.from(new Set(props.members.map((id2) => {
23135           const member = featuresByCode[id2];
23136           if (member.geometry)
23137             return member.properties.roadSpeedUnit || "km/h";
23138         }).filter(Boolean)));
23139         if (vals.length === 1)
23140           props.roadSpeedUnit = vals[0];
23141       }
23142     }
23143     function loadRoadHeightUnit(feature22) {
23144       const props = feature22.properties;
23145       if (feature22.geometry) {
23146         if (!props.roadHeightUnit)
23147           props.roadHeightUnit = "m";
23148       } else if (props.members) {
23149         const vals = Array.from(new Set(props.members.map((id2) => {
23150           const member = featuresByCode[id2];
23151           if (member.geometry)
23152             return member.properties.roadHeightUnit || "m";
23153         }).filter(Boolean)));
23154         if (vals.length === 1)
23155           props.roadHeightUnit = vals[0];
23156       }
23157     }
23158     function loadDriveSide(feature22) {
23159       const props = feature22.properties;
23160       if (feature22.geometry) {
23161         if (!props.driveSide)
23162           props.driveSide = "right";
23163       } else if (props.members) {
23164         const vals = Array.from(new Set(props.members.map((id2) => {
23165           const member = featuresByCode[id2];
23166           if (member.geometry)
23167             return member.properties.driveSide || "right";
23168         }).filter(Boolean)));
23169         if (vals.length === 1)
23170           props.driveSide = vals[0];
23171       }
23172     }
23173     function loadCallingCodes(feature22) {
23174       const props = feature22.properties;
23175       if (!feature22.geometry && props.members) {
23176         props.callingCodes = Array.from(new Set(props.members.reduce((array2, id2) => {
23177           const member = featuresByCode[id2];
23178           if (member.geometry && member.properties.callingCodes) {
23179             return array2.concat(member.properties.callingCodes);
23180           }
23181           return array2;
23182         }, [])));
23183       }
23184     }
23185     function loadFlag(feature22) {
23186       if (!feature22.properties.iso1A2)
23187         return;
23188       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23189         return String.fromCodePoint(char.charCodeAt(0) + 127397);
23190       });
23191       feature22.properties.emojiFlag = flag;
23192     }
23193     function loadMembersForGroupsOf(feature22) {
23194       feature22.properties.groups.forEach((groupID) => {
23195         const groupFeature = featuresByCode[groupID];
23196         if (!groupFeature.properties.members) {
23197           groupFeature.properties.members = [];
23198         }
23199         groupFeature.properties.members.push(feature22.properties.id);
23200       });
23201     }
23202     function cacheFeatureByIDs(feature22) {
23203       let ids = [];
23204       identifierProps.forEach((prop) => {
23205         const id2 = feature22.properties[prop];
23206         if (id2)
23207           ids.push(id2);
23208       });
23209       (feature22.properties.aliases || []).forEach((alias) => {
23210         ids.push(alias);
23211       });
23212       ids.forEach((id2) => {
23213         let cid = canonicalID(id2);
23214         featuresByCode[cid] = feature22;
23215       });
23216     }
23217   }
23218   function locArray(loc) {
23219     if (Array.isArray(loc)) {
23220       return loc;
23221     } else if (loc.coordinates) {
23222       return loc.coordinates;
23223     }
23224     return loc.geometry.coordinates;
23225   }
23226   function smallestFeature(loc) {
23227     const query = locArray(loc);
23228     const featureProperties = whichPolygonGetter(query);
23229     if (!featureProperties)
23230       return null;
23231     return featuresByCode[featureProperties.id];
23232   }
23233   function countryFeature(loc) {
23234     const feature22 = smallestFeature(loc);
23235     if (!feature22)
23236       return null;
23237     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23238     return featuresByCode[countryCode] || null;
23239   }
23240   var defaultOpts = {
23241     level: void 0,
23242     maxLevel: void 0,
23243     withProp: void 0
23244   };
23245   function featureForLoc(loc, opts) {
23246     const targetLevel = opts.level || "country";
23247     const maxLevel = opts.maxLevel || "world";
23248     const withProp = opts.withProp;
23249     const targetLevelIndex = levels.indexOf(targetLevel);
23250     if (targetLevelIndex === -1)
23251       return null;
23252     const maxLevelIndex = levels.indexOf(maxLevel);
23253     if (maxLevelIndex === -1)
23254       return null;
23255     if (maxLevelIndex < targetLevelIndex)
23256       return null;
23257     if (targetLevel === "country") {
23258       const fastFeature = countryFeature(loc);
23259       if (fastFeature) {
23260         if (!withProp || fastFeature.properties[withProp]) {
23261           return fastFeature;
23262         }
23263       }
23264     }
23265     const features2 = featuresContaining(loc);
23266     const match = features2.find((feature22) => {
23267       let levelIndex = levels.indexOf(feature22.properties.level);
23268       if (feature22.properties.level === targetLevel || levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23269         if (!withProp || feature22.properties[withProp]) {
23270           return feature22;
23271         }
23272       }
23273       return false;
23274     });
23275     return match || null;
23276   }
23277   function featureForID(id2) {
23278     let stringID;
23279     if (typeof id2 === "number") {
23280       stringID = id2.toString();
23281       if (stringID.length === 1) {
23282         stringID = "00" + stringID;
23283       } else if (stringID.length === 2) {
23284         stringID = "0" + stringID;
23285       }
23286     } else {
23287       stringID = canonicalID(id2);
23288     }
23289     return featuresByCode[stringID] || null;
23290   }
23291   function smallestFeaturesForBbox(bbox) {
23292     return whichPolygonGetter.bbox(bbox).map((props) => featuresByCode[props.id]);
23293   }
23294   function smallestOrMatchingFeature(query) {
23295     if (typeof query === "object") {
23296       return smallestFeature(query);
23297     }
23298     return featureForID(query);
23299   }
23300   function feature(query, opts = defaultOpts) {
23301     if (typeof query === "object") {
23302       return featureForLoc(query, opts);
23303     }
23304     return featureForID(query);
23305   }
23306   function iso1A2Code(query, opts = defaultOpts) {
23307     opts.withProp = "iso1A2";
23308     const match = feature(query, opts);
23309     if (!match)
23310       return null;
23311     return match.properties.iso1A2 || null;
23312   }
23313   function featuresContaining(query, strict) {
23314     let matchingFeatures;
23315     if (Array.isArray(query) && query.length === 4) {
23316       matchingFeatures = smallestFeaturesForBbox(query);
23317     } else {
23318       const smallestOrMatching = smallestOrMatchingFeature(query);
23319       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23320     }
23321     if (!matchingFeatures.length)
23322       return [];
23323     let returnFeatures;
23324     if (!strict || typeof query === "object") {
23325       returnFeatures = matchingFeatures.slice();
23326     } else {
23327       returnFeatures = [];
23328     }
23329     matchingFeatures.forEach((feature22) => {
23330       const properties = feature22.properties;
23331       properties.groups.forEach((groupID) => {
23332         const groupFeature = featuresByCode[groupID];
23333         if (returnFeatures.indexOf(groupFeature) === -1) {
23334           returnFeatures.push(groupFeature);
23335         }
23336       });
23337     });
23338     return returnFeatures;
23339   }
23340   function featuresIn(id2, strict) {
23341     const feature22 = featureForID(id2);
23342     if (!feature22)
23343       return [];
23344     let features2 = [];
23345     if (!strict) {
23346       features2.push(feature22);
23347     }
23348     const properties = feature22.properties;
23349     (properties.members || []).forEach((memberID) => {
23350       features2.push(featuresByCode[memberID]);
23351     });
23352     return features2;
23353   }
23354   function aggregateFeature(id2) {
23355     const features2 = featuresIn(id2, false);
23356     if (features2.length === 0)
23357       return null;
23358     let aggregateCoordinates = [];
23359     features2.forEach((feature22) => {
23360       if (feature22.geometry && feature22.geometry.type === "MultiPolygon" && feature22.geometry.coordinates) {
23361         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23362       }
23363     });
23364     return {
23365       type: "Feature",
23366       properties: features2[0].properties,
23367       geometry: {
23368         type: "MultiPolygon",
23369         coordinates: aggregateCoordinates
23370       }
23371     };
23372   }
23373   function roadSpeedUnit(query) {
23374     const feature22 = smallestOrMatchingFeature(query);
23375     return feature22 && feature22.properties.roadSpeedUnit || null;
23376   }
23377   function roadHeightUnit(query) {
23378     const feature22 = smallestOrMatchingFeature(query);
23379     return feature22 && feature22.properties.roadHeightUnit || null;
23380   }
23381
23382   // node_modules/@ideditor/location-conflation/index.mjs
23383   var import_geojson_area = __toESM(require_geojson_area(), 1);
23384   var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
23385   var import_polygon_clipping = __toESM(require_polygon_clipping_umd(), 1);
23386   var import_geojson_precision = __toESM(require_geojson_precision(), 1);
23387   var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
23388   var location_conflation_default = class {
23389     constructor(fc) {
23390       this._cache = {};
23391       this._strict = true;
23392       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
23393         fc.features.forEach((feature3) => {
23394           feature3.properties = feature3.properties || {};
23395           let props = feature3.properties;
23396           let id2 = feature3.id || props.id;
23397           if (!id2 || !/^\S+\.geojson$/i.test(id2))
23398             return;
23399           id2 = id2.toLowerCase();
23400           feature3.id = id2;
23401           props.id = id2;
23402           if (!props.area) {
23403             const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23404             props.area = Number(area.toFixed(2));
23405           }
23406           this._cache[id2] = feature3;
23407         });
23408       }
23409       let world = _cloneDeep(feature("Q2"));
23410       world.geometry = {
23411         type: "Polygon",
23412         coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
23413       };
23414       world.id = "Q2";
23415       world.properties.id = "Q2";
23416       world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
23417       this._cache.Q2 = world;
23418     }
23419     validateLocation(location) {
23420       if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
23421         const lon = location[0];
23422         const lat = location[1];
23423         const radius = location[2];
23424         if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
23425           const id2 = "[" + location.toString() + "]";
23426           return { type: "point", location, id: id2 };
23427         }
23428       } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
23429         const id2 = location.toLowerCase();
23430         if (this._cache[id2]) {
23431           return { type: "geojson", location, id: id2 };
23432         }
23433       } else if (typeof location === "string" || typeof location === "number") {
23434         const feature3 = feature(location);
23435         if (feature3) {
23436           const id2 = feature3.properties.wikidata;
23437           return { type: "countrycoder", location, id: id2 };
23438         }
23439       }
23440       if (this._strict) {
23441         throw new Error(`validateLocation:  Invalid location: "${location}".`);
23442       } else {
23443         return null;
23444       }
23445     }
23446     resolveLocation(location) {
23447       const valid = this.validateLocation(location);
23448       if (!valid)
23449         return null;
23450       const id2 = valid.id;
23451       if (this._cache[id2]) {
23452         return Object.assign(valid, { feature: this._cache[id2] });
23453       }
23454       if (valid.type === "point") {
23455         const lon = location[0];
23456         const lat = location[1];
23457         const radius = location[2] || 25;
23458         const EDGES = 10;
23459         const PRECISION = 3;
23460         const area = Math.PI * radius * radius;
23461         const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
23462           type: "Feature",
23463           id: id2,
23464           properties: { id: id2, area: Number(area.toFixed(2)) },
23465           geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
23466         }, PRECISION);
23467         return Object.assign(valid, { feature: feature3 });
23468       } else if (valid.type === "geojson") {
23469       } else if (valid.type === "countrycoder") {
23470         let feature3 = _cloneDeep(feature(id2));
23471         let props = feature3.properties;
23472         if (Array.isArray(props.members)) {
23473           let aggregate = aggregateFeature(id2);
23474           aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
23475           feature3.geometry = aggregate.geometry;
23476         }
23477         if (!props.area) {
23478           const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23479           props.area = Number(area.toFixed(2));
23480         }
23481         feature3.id = id2;
23482         props.id = id2;
23483         this._cache[id2] = feature3;
23484         return Object.assign(valid, { feature: feature3 });
23485       }
23486       if (this._strict) {
23487         throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
23488       } else {
23489         return null;
23490       }
23491     }
23492     validateLocationSet(locationSet) {
23493       locationSet = locationSet || {};
23494       const validator = this.validateLocation.bind(this);
23495       let include = (locationSet.include || []).map(validator).filter(Boolean);
23496       let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
23497       if (!include.length) {
23498         if (this._strict) {
23499           throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
23500         } else {
23501           locationSet.include = ["Q2"];
23502           include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
23503         }
23504       }
23505       include.sort(_sortLocations);
23506       let id2 = "+[" + include.map((d) => d.id).join(",") + "]";
23507       if (exclude.length) {
23508         exclude.sort(_sortLocations);
23509         id2 += "-[" + exclude.map((d) => d.id).join(",") + "]";
23510       }
23511       return { type: "locationset", locationSet, id: id2 };
23512     }
23513     resolveLocationSet(locationSet) {
23514       locationSet = locationSet || {};
23515       const valid = this.validateLocationSet(locationSet);
23516       if (!valid)
23517         return null;
23518       const id2 = valid.id;
23519       if (this._cache[id2]) {
23520         return Object.assign(valid, { feature: this._cache[id2] });
23521       }
23522       const resolver = this.resolveLocation.bind(this);
23523       const includes = (locationSet.include || []).map(resolver).filter(Boolean);
23524       const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
23525       if (includes.length === 1 && excludes.length === 0) {
23526         return Object.assign(valid, { feature: includes[0].feature });
23527       }
23528       const includeGeoJSON = _clip(includes.map((d) => d.feature), "UNION");
23529       const excludeGeoJSON = _clip(excludes.map((d) => d.feature), "UNION");
23530       let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
23531       const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
23532       resultGeoJSON.id = id2;
23533       resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
23534       this._cache[id2] = resultGeoJSON;
23535       return Object.assign(valid, { feature: resultGeoJSON });
23536     }
23537     strict(val) {
23538       if (val === void 0) {
23539         return this._strict;
23540       } else {
23541         this._strict = val;
23542         return this;
23543       }
23544     }
23545     cache() {
23546       return this._cache;
23547     }
23548     stringify(obj, options2) {
23549       return (0, import_json_stringify_pretty_compact.default)(obj, options2);
23550     }
23551   };
23552   function _clip(features2, which) {
23553     if (!Array.isArray(features2) || !features2.length)
23554       return null;
23555     const fn = { UNION: import_polygon_clipping.default.union, DIFFERENCE: import_polygon_clipping.default.difference }[which];
23556     const args = features2.map((feature3) => feature3.geometry.coordinates);
23557     const coords = fn.apply(null, args);
23558     return {
23559       type: "Feature",
23560       properties: {},
23561       geometry: {
23562         type: whichType(coords),
23563         coordinates: coords
23564       }
23565     };
23566     function whichType(coords2) {
23567       const a = Array.isArray(coords2);
23568       const b = a && Array.isArray(coords2[0]);
23569       const c = b && Array.isArray(coords2[0][0]);
23570       const d = c && Array.isArray(coords2[0][0][0]);
23571       return d ? "MultiPolygon" : "Polygon";
23572     }
23573   }
23574   function _cloneDeep(obj) {
23575     return JSON.parse(JSON.stringify(obj));
23576   }
23577   function _sortLocations(a, b) {
23578     const rank = { countrycoder: 1, geojson: 2, point: 3 };
23579     const aRank = rank[a.type];
23580     const bRank = rank[b.type];
23581     return aRank > bRank ? 1 : aRank < bRank ? -1 : a.id.localeCompare(b.id);
23582   }
23583
23584   // modules/core/locations.js
23585   var import_which_polygon2 = __toESM(require_which_polygon());
23586   var import_geojson_area2 = __toESM(require_geojson_area());
23587
23588   // modules/util/aes.js
23589   var import_aes_js = __toESM(require_aes_js());
23590   var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
23591   function utilAesEncrypt(text2, key) {
23592     key = key || DEFAULT_128;
23593     const textBytes = import_aes_js.default.utils.utf8.toBytes(text2);
23594     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
23595     const encryptedBytes = aesCtr.encrypt(textBytes);
23596     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
23597     return encryptedHex;
23598   }
23599   function utilAesDecrypt(encryptedHex, key) {
23600     key = key || DEFAULT_128;
23601     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
23602     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
23603     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
23604     const text2 = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
23605     return text2;
23606   }
23607
23608   // modules/util/clean_tags.js
23609   function utilCleanTags(tags) {
23610     var out = {};
23611     for (var k in tags) {
23612       if (!k)
23613         continue;
23614       var v = tags[k];
23615       if (v !== void 0) {
23616         out[k] = cleanValue(k, v);
23617       }
23618     }
23619     return out;
23620     function cleanValue(k2, v2) {
23621       function keepSpaces(k3) {
23622         return /_hours|_times|:conditional$/.test(k3);
23623       }
23624       function skip(k3) {
23625         return /^(description|note|fixme)$/.test(k3);
23626       }
23627       if (skip(k2))
23628         return v2;
23629       var cleaned = v2.split(";").map(function(s) {
23630         return s.trim();
23631       }).join(keepSpaces(k2) ? "; " : ";");
23632       if (k2.indexOf("website") !== -1 || k2.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
23633         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
23634       }
23635       return cleaned;
23636     }
23637   }
23638
23639   // modules/util/detect.js
23640   var _detected;
23641   function utilDetect(refresh2) {
23642     if (_detected && !refresh2)
23643       return _detected;
23644     _detected = {};
23645     const ua = navigator.userAgent;
23646     let m = null;
23647     m = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
23648     if (m !== null) {
23649       _detected.browser = m[1];
23650       _detected.version = m[2];
23651     }
23652     if (!_detected.browser) {
23653       m = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
23654       if (m !== null) {
23655         _detected.browser = "msie";
23656         _detected.version = m[1];
23657       }
23658     }
23659     if (!_detected.browser) {
23660       m = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
23661       if (m !== null) {
23662         _detected.browser = "Opera";
23663         _detected.version = m[2];
23664       }
23665     }
23666     if (!_detected.browser) {
23667       m = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
23668       if (m !== null) {
23669         _detected.browser = m[1];
23670         _detected.version = m[2];
23671         m = ua.match(/version\/([\.\d]+)/i);
23672         if (m !== null)
23673           _detected.version = m[1];
23674       }
23675     }
23676     if (!_detected.browser) {
23677       _detected.browser = navigator.appName;
23678       _detected.version = navigator.appVersion;
23679     }
23680     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
23681     _detected.opera = _detected.browser.toLowerCase() === "opera" && parseFloat(_detected.version) < 15;
23682     if (_detected.browser.toLowerCase() === "msie") {
23683       _detected.ie = true;
23684       _detected.browser = "Internet Explorer";
23685       _detected.support = false;
23686     } else {
23687       _detected.ie = false;
23688       _detected.support = true;
23689     }
23690     _detected.filedrop = window.FileReader && "ondrop" in window;
23691     if (/Win/.test(ua)) {
23692       _detected.os = "win";
23693       _detected.platform = "Windows";
23694     } else if (/Mac/.test(ua)) {
23695       _detected.os = "mac";
23696       _detected.platform = "Macintosh";
23697     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
23698       _detected.os = "linux";
23699       _detected.platform = "Linux";
23700     } else {
23701       _detected.os = "win";
23702       _detected.platform = "Unknown";
23703     }
23704     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
23705     _detected.browserLocales = Array.from(new Set(
23706       [navigator.language].concat(navigator.languages || []).concat([
23707         navigator.userLanguage
23708       ]).filter(Boolean)
23709     ));
23710     const loc = window.top.location;
23711     let origin = loc.origin;
23712     if (!origin) {
23713       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
23714     }
23715     _detected.host = origin + loc.pathname;
23716     return _detected;
23717   }
23718
23719   // modules/util/get_set_value.js
23720   function utilGetSetValue(selection2, value) {
23721     function d3_selection_value(value2) {
23722       function valueNull() {
23723         delete this.value;
23724       }
23725       function valueConstant() {
23726         if (this.value !== value2) {
23727           this.value = value2;
23728         }
23729       }
23730       function valueFunction() {
23731         var x = value2.apply(this, arguments);
23732         if (x === null || x === void 0) {
23733           delete this.value;
23734         } else if (this.value !== x) {
23735           this.value = x;
23736         }
23737       }
23738       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
23739     }
23740     if (arguments.length === 1) {
23741       return selection2.property("value");
23742     }
23743     return selection2.each(d3_selection_value(value));
23744   }
23745
23746   // modules/util/keybinding.js
23747   function utilKeybinding(namespace) {
23748     var _keybindings = {};
23749     function testBindings(d3_event, isCapturing) {
23750       var didMatch = false;
23751       var bindings = Object.keys(_keybindings).map(function(id2) {
23752         return _keybindings[id2];
23753       });
23754       var i2, binding;
23755       for (i2 = 0; i2 < bindings.length; i2++) {
23756         binding = bindings[i2];
23757         if (!binding.event.modifiers.shiftKey)
23758           continue;
23759         if (!!binding.capture !== isCapturing)
23760           continue;
23761         if (matches(d3_event, binding, true)) {
23762           binding.callback(d3_event);
23763           didMatch = true;
23764           break;
23765         }
23766       }
23767       if (didMatch)
23768         return;
23769       for (i2 = 0; i2 < bindings.length; i2++) {
23770         binding = bindings[i2];
23771         if (binding.event.modifiers.shiftKey)
23772           continue;
23773         if (!!binding.capture !== isCapturing)
23774           continue;
23775         if (matches(d3_event, binding, false)) {
23776           binding.callback(d3_event);
23777           break;
23778         }
23779       }
23780       function matches(d3_event2, binding2, testShift) {
23781         var event = d3_event2;
23782         var isMatch = false;
23783         var tryKeyCode = true;
23784         if (event.key !== void 0) {
23785           tryKeyCode = event.key.charCodeAt(0) > 127;
23786           isMatch = true;
23787           if (binding2.event.key === void 0) {
23788             isMatch = false;
23789           } else if (Array.isArray(binding2.event.key)) {
23790             if (binding2.event.key.map(function(s) {
23791               return s.toLowerCase();
23792             }).indexOf(event.key.toLowerCase()) === -1) {
23793               isMatch = false;
23794             }
23795           } else {
23796             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
23797               isMatch = false;
23798             }
23799           }
23800         }
23801         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
23802           isMatch = event.keyCode === binding2.event.keyCode;
23803         }
23804         if (!isMatch)
23805           return false;
23806         if (!(event.ctrlKey && event.altKey)) {
23807           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
23808             return false;
23809           if (event.altKey !== binding2.event.modifiers.altKey)
23810             return false;
23811         }
23812         if (event.metaKey !== binding2.event.modifiers.metaKey)
23813           return false;
23814         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
23815           return false;
23816         return true;
23817       }
23818     }
23819     function capture(d3_event) {
23820       testBindings(d3_event, true);
23821     }
23822     function bubble(d3_event) {
23823       var tagName = select_default2(d3_event.target).node().tagName;
23824       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
23825         return;
23826       }
23827       testBindings(d3_event, false);
23828     }
23829     function keybinding(selection2) {
23830       selection2 = selection2 || select_default2(document);
23831       selection2.on("keydown.capture." + namespace, capture, true);
23832       selection2.on("keydown.bubble." + namespace, bubble, false);
23833       return keybinding;
23834     }
23835     keybinding.unbind = function(selection2) {
23836       _keybindings = [];
23837       selection2 = selection2 || select_default2(document);
23838       selection2.on("keydown.capture." + namespace, null);
23839       selection2.on("keydown.bubble." + namespace, null);
23840       return keybinding;
23841     };
23842     keybinding.clear = function() {
23843       _keybindings = {};
23844       return keybinding;
23845     };
23846     keybinding.off = function(codes, capture2) {
23847       var arr = utilArrayUniq([].concat(codes));
23848       for (var i2 = 0; i2 < arr.length; i2++) {
23849         var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
23850         delete _keybindings[id2];
23851       }
23852       return keybinding;
23853     };
23854     keybinding.on = function(codes, callback, capture2) {
23855       if (typeof callback !== "function") {
23856         return keybinding.off(codes, capture2);
23857       }
23858       var arr = utilArrayUniq([].concat(codes));
23859       for (var i2 = 0; i2 < arr.length; i2++) {
23860         var id2 = arr[i2] + (capture2 ? "-capture" : "-bubble");
23861         var binding = {
23862           id: id2,
23863           capture: capture2,
23864           callback,
23865           event: {
23866             key: void 0,
23867             keyCode: 0,
23868             modifiers: {
23869               shiftKey: false,
23870               ctrlKey: false,
23871               altKey: false,
23872               metaKey: false
23873             }
23874           }
23875         };
23876         if (_keybindings[id2]) {
23877           console.warn('warning: duplicate keybinding for "' + id2 + '"');
23878         }
23879         _keybindings[id2] = binding;
23880         var matches = arr[i2].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
23881         for (var j2 = 0; j2 < matches.length; j2++) {
23882           if (matches[j2] === "++")
23883             matches[j2] = "+";
23884           if (matches[j2] in utilKeybinding.modifierCodes) {
23885             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
23886             binding.event.modifiers[prop] = true;
23887           } else {
23888             binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
23889             if (matches[j2] in utilKeybinding.keyCodes) {
23890               binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
23891             }
23892           }
23893         }
23894       }
23895       return keybinding;
23896     };
23897     return keybinding;
23898   }
23899   utilKeybinding.modifierCodes = {
23900     "\u21E7": 16,
23901     shift: 16,
23902     "\u2303": 17,
23903     ctrl: 17,
23904     "\u2325": 18,
23905     alt: 18,
23906     option: 18,
23907     "\u2318": 91,
23908     meta: 91,
23909     cmd: 91,
23910     "super": 91,
23911     win: 91
23912   };
23913   utilKeybinding.modifierProperties = {
23914     16: "shiftKey",
23915     17: "ctrlKey",
23916     18: "altKey",
23917     91: "metaKey"
23918   };
23919   utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
23920   utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
23921   utilKeybinding.keys = {
23922     "\u232B": "Backspace",
23923     backspace: "Backspace",
23924     "\u21E5": "Tab",
23925     "\u21C6": "Tab",
23926     tab: "Tab",
23927     "\u21A9": "Enter",
23928     "\u21B5": "Enter",
23929     "\u23CE": "Enter",
23930     "return": "Enter",
23931     enter: "Enter",
23932     "\u2305": "Enter",
23933     "pause": "Pause",
23934     "pause-break": "Pause",
23935     "\u21EA": "CapsLock",
23936     caps: "CapsLock",
23937     "caps-lock": "CapsLock",
23938     "\u238B": ["Escape", "Esc"],
23939     escape: ["Escape", "Esc"],
23940     esc: ["Escape", "Esc"],
23941     space: [" ", "Spacebar"],
23942     "\u2196": "PageUp",
23943     pgup: "PageUp",
23944     "page-up": "PageUp",
23945     "\u2198": "PageDown",
23946     pgdown: "PageDown",
23947     "page-down": "PageDown",
23948     "\u21DF": "End",
23949     end: "End",
23950     "\u21DE": "Home",
23951     home: "Home",
23952     ins: "Insert",
23953     insert: "Insert",
23954     "\u2326": ["Delete", "Del"],
23955     del: ["Delete", "Del"],
23956     "delete": ["Delete", "Del"],
23957     "\u2190": ["ArrowLeft", "Left"],
23958     left: ["ArrowLeft", "Left"],
23959     "arrow-left": ["ArrowLeft", "Left"],
23960     "\u2191": ["ArrowUp", "Up"],
23961     up: ["ArrowUp", "Up"],
23962     "arrow-up": ["ArrowUp", "Up"],
23963     "\u2192": ["ArrowRight", "Right"],
23964     right: ["ArrowRight", "Right"],
23965     "arrow-right": ["ArrowRight", "Right"],
23966     "\u2193": ["ArrowDown", "Down"],
23967     down: ["ArrowDown", "Down"],
23968     "arrow-down": ["ArrowDown", "Down"],
23969     "*": ["*", "Multiply"],
23970     star: ["*", "Multiply"],
23971     asterisk: ["*", "Multiply"],
23972     multiply: ["*", "Multiply"],
23973     "+": ["+", "Add"],
23974     "plus": ["+", "Add"],
23975     "-": ["-", "Subtract"],
23976     subtract: ["-", "Subtract"],
23977     "dash": ["-", "Subtract"],
23978     semicolon: ";",
23979     equals: "=",
23980     comma: ",",
23981     period: ".",
23982     "full-stop": ".",
23983     slash: "/",
23984     "forward-slash": "/",
23985     tick: "`",
23986     "back-quote": "`",
23987     "open-bracket": "[",
23988     "back-slash": "\\",
23989     "close-bracket": "]",
23990     quote: "'",
23991     apostrophe: "'",
23992     "num-0": "0",
23993     "num-1": "1",
23994     "num-2": "2",
23995     "num-3": "3",
23996     "num-4": "4",
23997     "num-5": "5",
23998     "num-6": "6",
23999     "num-7": "7",
24000     "num-8": "8",
24001     "num-9": "9",
24002     f1: "F1",
24003     f2: "F2",
24004     f3: "F3",
24005     f4: "F4",
24006     f5: "F5",
24007     f6: "F6",
24008     f7: "F7",
24009     f8: "F8",
24010     f9: "F9",
24011     f10: "F10",
24012     f11: "F11",
24013     f12: "F12",
24014     f13: "F13",
24015     f14: "F14",
24016     f15: "F15",
24017     f16: "F16",
24018     f17: "F17",
24019     f18: "F18",
24020     f19: "F19",
24021     f20: "F20",
24022     f21: "F21",
24023     f22: "F22",
24024     f23: "F23",
24025     f24: "F24",
24026     f25: "F25"
24027   };
24028   utilKeybinding.keyCodes = {
24029     "\u232B": 8,
24030     backspace: 8,
24031     "\u21E5": 9,
24032     "\u21C6": 9,
24033     tab: 9,
24034     "\u21A9": 13,
24035     "\u21B5": 13,
24036     "\u23CE": 13,
24037     "return": 13,
24038     enter: 13,
24039     "\u2305": 13,
24040     "pause": 19,
24041     "pause-break": 19,
24042     "\u21EA": 20,
24043     caps: 20,
24044     "caps-lock": 20,
24045     "\u238B": 27,
24046     escape: 27,
24047     esc: 27,
24048     space: 32,
24049     "\u2196": 33,
24050     pgup: 33,
24051     "page-up": 33,
24052     "\u2198": 34,
24053     pgdown: 34,
24054     "page-down": 34,
24055     "\u21DF": 35,
24056     end: 35,
24057     "\u21DE": 36,
24058     home: 36,
24059     ins: 45,
24060     insert: 45,
24061     "\u2326": 46,
24062     del: 46,
24063     "delete": 46,
24064     "\u2190": 37,
24065     left: 37,
24066     "arrow-left": 37,
24067     "\u2191": 38,
24068     up: 38,
24069     "arrow-up": 38,
24070     "\u2192": 39,
24071     right: 39,
24072     "arrow-right": 39,
24073     "\u2193": 40,
24074     down: 40,
24075     "arrow-down": 40,
24076     "ffequals": 61,
24077     "*": 106,
24078     star: 106,
24079     asterisk: 106,
24080     multiply: 106,
24081     "+": 107,
24082     "plus": 107,
24083     "-": 109,
24084     subtract: 109,
24085     "|": 124,
24086     "ffplus": 171,
24087     "ffminus": 173,
24088     ";": 186,
24089     semicolon: 186,
24090     "=": 187,
24091     "equals": 187,
24092     ",": 188,
24093     comma: 188,
24094     "dash": 189,
24095     ".": 190,
24096     period: 190,
24097     "full-stop": 190,
24098     "/": 191,
24099     slash: 191,
24100     "forward-slash": 191,
24101     "`": 192,
24102     tick: 192,
24103     "back-quote": 192,
24104     "[": 219,
24105     "open-bracket": 219,
24106     "\\": 220,
24107     "back-slash": 220,
24108     "]": 221,
24109     "close-bracket": 221,
24110     "'": 222,
24111     quote: 222,
24112     apostrophe: 222
24113   };
24114   var i = 95;
24115   var n = 0;
24116   while (++i < 106) {
24117     utilKeybinding.keyCodes["num-" + n] = i;
24118     ++n;
24119   }
24120   i = 47;
24121   n = 0;
24122   while (++i < 58) {
24123     utilKeybinding.keyCodes[n] = i;
24124     ++n;
24125   }
24126   i = 111;
24127   n = 1;
24128   while (++i < 136) {
24129     utilKeybinding.keyCodes["f" + n] = i;
24130     ++n;
24131   }
24132   i = 64;
24133   while (++i < 91) {
24134     utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
24135   }
24136
24137   // modules/util/object.js
24138   function utilObjectOmit(obj, omitKeys) {
24139     return Object.keys(obj).reduce(function(result, key) {
24140       if (omitKeys.indexOf(key) === -1) {
24141         result[key] = obj[key];
24142       }
24143       return result;
24144     }, {});
24145   }
24146
24147   // modules/util/rebind.js
24148   function utilRebind(target, source) {
24149     var i2 = 1, n2 = arguments.length, method;
24150     while (++i2 < n2) {
24151       target[method = arguments[i2]] = d3_rebind(target, source, source[method]);
24152     }
24153     return target;
24154   }
24155   function d3_rebind(target, source, method) {
24156     return function() {
24157       var value = method.apply(source, arguments);
24158       return value === source ? target : value;
24159     };
24160   }
24161
24162   // modules/util/session_mutex.js
24163   function utilSessionMutex(name) {
24164     var mutex = {};
24165     var intervalID;
24166     function renew() {
24167       var expires = new Date();
24168       expires.setSeconds(expires.getSeconds() + 5);
24169       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
24170     }
24171     mutex.lock = function() {
24172       if (intervalID)
24173         return true;
24174       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
24175       if (cookie)
24176         return false;
24177       renew();
24178       intervalID = window.setInterval(renew, 4e3);
24179       return true;
24180     };
24181     mutex.unlock = function() {
24182       if (!intervalID)
24183         return;
24184       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
24185       clearInterval(intervalID);
24186       intervalID = null;
24187     };
24188     mutex.locked = function() {
24189       return !!intervalID;
24190     };
24191     return mutex;
24192   }
24193
24194   // modules/util/tiler.js
24195   function utilTiler() {
24196     var _size = [256, 256];
24197     var _scale = 256;
24198     var _tileSize = 256;
24199     var _zoomExtent = [0, 20];
24200     var _translate = [_size[0] / 2, _size[1] / 2];
24201     var _margin = 0;
24202     var _skipNullIsland = false;
24203     function clamp3(num, min3, max3) {
24204       return Math.max(min3, Math.min(num, max3));
24205     }
24206     function nearNullIsland(tile) {
24207       var x = tile[0];
24208       var y = tile[1];
24209       var z = tile[2];
24210       if (z >= 7) {
24211         var center = Math.pow(2, z - 1);
24212         var width = Math.pow(2, z - 6);
24213         var min3 = center - width / 2;
24214         var max3 = center + width / 2 - 1;
24215         return x >= min3 && x <= max3 && y >= min3 && y <= max3;
24216       }
24217       return false;
24218     }
24219     function tiler8() {
24220       var z = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
24221       var z0 = clamp3(Math.round(z), _zoomExtent[0], _zoomExtent[1]);
24222       var tileMin = 0;
24223       var tileMax = Math.pow(2, z0) - 1;
24224       var log2ts = Math.log(_tileSize) * Math.LOG2E;
24225       var k = Math.pow(2, z - z0 + log2ts);
24226       var origin = [
24227         (_translate[0] - _scale / 2) / k,
24228         (_translate[1] - _scale / 2) / k
24229       ];
24230       var cols = range(
24231         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
24232         clamp3(Math.ceil(_size[0] / k - origin[0]) + _margin, tileMin, tileMax + 1)
24233       );
24234       var rows = range(
24235         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
24236         clamp3(Math.ceil(_size[1] / k - origin[1]) + _margin, tileMin, tileMax + 1)
24237       );
24238       var tiles = [];
24239       for (var i2 = 0; i2 < rows.length; i2++) {
24240         var y = rows[i2];
24241         for (var j2 = 0; j2 < cols.length; j2++) {
24242           var x = cols[j2];
24243           if (i2 >= _margin && i2 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
24244             tiles.unshift([x, y, z0]);
24245           } else {
24246             tiles.push([x, y, z0]);
24247           }
24248         }
24249       }
24250       tiles.translate = origin;
24251       tiles.scale = k;
24252       return tiles;
24253     }
24254     tiler8.getTiles = function(projection2) {
24255       var origin = [
24256         projection2.scale() * Math.PI - projection2.translate()[0],
24257         projection2.scale() * Math.PI - projection2.translate()[1]
24258       ];
24259       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
24260       var tiles = tiler8();
24261       var ts = tiles.scale;
24262       return tiles.map(function(tile) {
24263         if (_skipNullIsland && nearNullIsland(tile)) {
24264           return false;
24265         }
24266         var x = tile[0] * ts - origin[0];
24267         var y = tile[1] * ts - origin[1];
24268         return {
24269           id: tile.toString(),
24270           xyz: tile,
24271           extent: geoExtent(
24272             projection2.invert([x, y + ts]),
24273             projection2.invert([x + ts, y])
24274           )
24275         };
24276       }).filter(Boolean);
24277     };
24278     tiler8.getGeoJSON = function(projection2) {
24279       var features2 = tiler8.getTiles(projection2).map(function(tile) {
24280         return {
24281           type: "Feature",
24282           properties: {
24283             id: tile.id,
24284             name: tile.id
24285           },
24286           geometry: {
24287             type: "Polygon",
24288             coordinates: [tile.extent.polygon()]
24289           }
24290         };
24291       });
24292       return {
24293         type: "FeatureCollection",
24294         features: features2
24295       };
24296     };
24297     tiler8.tileSize = function(val) {
24298       if (!arguments.length)
24299         return _tileSize;
24300       _tileSize = val;
24301       return tiler8;
24302     };
24303     tiler8.zoomExtent = function(val) {
24304       if (!arguments.length)
24305         return _zoomExtent;
24306       _zoomExtent = val;
24307       return tiler8;
24308     };
24309     tiler8.size = function(val) {
24310       if (!arguments.length)
24311         return _size;
24312       _size = val;
24313       return tiler8;
24314     };
24315     tiler8.scale = function(val) {
24316       if (!arguments.length)
24317         return _scale;
24318       _scale = val;
24319       return tiler8;
24320     };
24321     tiler8.translate = function(val) {
24322       if (!arguments.length)
24323         return _translate;
24324       _translate = val;
24325       return tiler8;
24326     };
24327     tiler8.margin = function(val) {
24328       if (!arguments.length)
24329         return _margin;
24330       _margin = +val;
24331       return tiler8;
24332     };
24333     tiler8.skipNullIsland = function(val) {
24334       if (!arguments.length)
24335         return _skipNullIsland;
24336       _skipNullIsland = val;
24337       return tiler8;
24338     };
24339     return tiler8;
24340   }
24341
24342   // modules/util/trigger_event.js
24343   function utilTriggerEvent(target, type3) {
24344     target.each(function() {
24345       var evt = document.createEvent("HTMLEvents");
24346       evt.initEvent(type3, true, true);
24347       this.dispatchEvent(evt);
24348     });
24349   }
24350
24351   // modules/core/locations.js
24352   var _mainLocations = coreLocations();
24353   function coreLocations() {
24354     let _this = {};
24355     let _resolvedFeatures = {};
24356     let _loco = new location_conflation_default();
24357     let _wp;
24358     const world = { locationSet: { include: ["Q2"] } };
24359     resolveLocationSet(world);
24360     rebuildIndex();
24361     let _queue = [];
24362     let _deferred2 = /* @__PURE__ */ new Set();
24363     let _inProcess;
24364     function processQueue() {
24365       if (!_queue.length)
24366         return Promise.resolve();
24367       const chunk = _queue.pop();
24368       return new Promise((resolvePromise) => {
24369         const handle = window.requestIdleCallback(() => {
24370           _deferred2.delete(handle);
24371           chunk.forEach(resolveLocationSet);
24372           resolvePromise();
24373         });
24374         _deferred2.add(handle);
24375       }).then(() => processQueue());
24376     }
24377     function resolveLocationSet(obj) {
24378       if (obj.locationSetID)
24379         return;
24380       try {
24381         let locationSet = obj.locationSet;
24382         if (!locationSet) {
24383           throw new Error("object missing locationSet property");
24384         }
24385         if (!locationSet.include) {
24386           locationSet.include = ["Q2"];
24387         }
24388         const resolved = _loco.resolveLocationSet(locationSet);
24389         const locationSetID = resolved.id;
24390         obj.locationSetID = locationSetID;
24391         if (!resolved.feature.geometry.coordinates.length || !resolved.feature.properties.area) {
24392           throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
24393         }
24394         if (!_resolvedFeatures[locationSetID]) {
24395           let feature3 = JSON.parse(JSON.stringify(resolved.feature));
24396           feature3.id = locationSetID;
24397           feature3.properties.id = locationSetID;
24398           _resolvedFeatures[locationSetID] = feature3;
24399         }
24400       } catch (err) {
24401         obj.locationSet = { include: ["Q2"] };
24402         obj.locationSetID = "+[Q2]";
24403       }
24404     }
24405     function rebuildIndex() {
24406       _wp = (0, import_which_polygon2.default)({ features: Object.values(_resolvedFeatures) });
24407     }
24408     _this.mergeCustomGeoJSON = (fc) => {
24409       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
24410         fc.features.forEach((feature3) => {
24411           feature3.properties = feature3.properties || {};
24412           let props = feature3.properties;
24413           let id2 = feature3.id || props.id;
24414           if (!id2 || !/^\S+\.geojson$/i.test(id2))
24415             return;
24416           id2 = id2.toLowerCase();
24417           feature3.id = id2;
24418           props.id = id2;
24419           if (!props.area) {
24420             const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
24421             props.area = Number(area.toFixed(2));
24422           }
24423           _loco._cache[id2] = feature3;
24424         });
24425       }
24426     };
24427     _this.mergeLocationSets = (objects) => {
24428       if (!Array.isArray(objects))
24429         return Promise.reject("nothing to do");
24430       _queue = _queue.concat(utilArrayChunk(objects, 200));
24431       if (!_inProcess) {
24432         _inProcess = processQueue().then(() => {
24433           rebuildIndex();
24434           _inProcess = null;
24435           return objects;
24436         });
24437       }
24438       return _inProcess;
24439     };
24440     _this.locationSetID = (locationSet) => {
24441       let locationSetID;
24442       try {
24443         locationSetID = _loco.validateLocationSet(locationSet).id;
24444       } catch (err) {
24445         locationSetID = "+[Q2]";
24446       }
24447       return locationSetID;
24448     };
24449     _this.feature = (locationSetID) => _resolvedFeatures[locationSetID] || _resolvedFeatures["+[Q2]"];
24450     _this.locationsAt = (loc) => {
24451       let result = {};
24452       (_wp(loc, true) || []).forEach((prop) => result[prop.id] = prop.area);
24453       return result;
24454     };
24455     _this.query = (loc, multi) => _wp(loc, multi);
24456     _this.loco = () => _loco;
24457     _this.wp = () => _wp;
24458     return _this;
24459   }
24460
24461   // node_modules/lodash-es/_freeGlobal.js
24462   var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
24463   var freeGlobal_default = freeGlobal;
24464
24465   // node_modules/lodash-es/_root.js
24466   var freeSelf = typeof self == "object" && self && self.Object === Object && self;
24467   var root2 = freeGlobal_default || freeSelf || Function("return this")();
24468   var root_default = root2;
24469
24470   // node_modules/lodash-es/_Symbol.js
24471   var Symbol2 = root_default.Symbol;
24472   var Symbol_default = Symbol2;
24473
24474   // node_modules/lodash-es/_getRawTag.js
24475   var objectProto = Object.prototype;
24476   var hasOwnProperty = objectProto.hasOwnProperty;
24477   var nativeObjectToString = objectProto.toString;
24478   var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
24479   function getRawTag(value) {
24480     var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
24481     try {
24482       value[symToStringTag] = void 0;
24483       var unmasked = true;
24484     } catch (e) {
24485     }
24486     var result = nativeObjectToString.call(value);
24487     if (unmasked) {
24488       if (isOwn) {
24489         value[symToStringTag] = tag;
24490       } else {
24491         delete value[symToStringTag];
24492       }
24493     }
24494     return result;
24495   }
24496   var getRawTag_default = getRawTag;
24497
24498   // node_modules/lodash-es/_objectToString.js
24499   var objectProto2 = Object.prototype;
24500   var nativeObjectToString2 = objectProto2.toString;
24501   function objectToString(value) {
24502     return nativeObjectToString2.call(value);
24503   }
24504   var objectToString_default = objectToString;
24505
24506   // node_modules/lodash-es/_baseGetTag.js
24507   var nullTag = "[object Null]";
24508   var undefinedTag = "[object Undefined]";
24509   var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
24510   function baseGetTag(value) {
24511     if (value == null) {
24512       return value === void 0 ? undefinedTag : nullTag;
24513     }
24514     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
24515   }
24516   var baseGetTag_default = baseGetTag;
24517
24518   // node_modules/lodash-es/isObjectLike.js
24519   function isObjectLike(value) {
24520     return value != null && typeof value == "object";
24521   }
24522   var isObjectLike_default = isObjectLike;
24523
24524   // node_modules/lodash-es/isSymbol.js
24525   var symbolTag = "[object Symbol]";
24526   function isSymbol(value) {
24527     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
24528   }
24529   var isSymbol_default = isSymbol;
24530
24531   // node_modules/lodash-es/_arrayMap.js
24532   function arrayMap(array2, iteratee) {
24533     var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
24534     while (++index < length) {
24535       result[index] = iteratee(array2[index], index, array2);
24536     }
24537     return result;
24538   }
24539   var arrayMap_default = arrayMap;
24540
24541   // node_modules/lodash-es/isArray.js
24542   var isArray = Array.isArray;
24543   var isArray_default = isArray;
24544
24545   // node_modules/lodash-es/_baseToString.js
24546   var INFINITY = 1 / 0;
24547   var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
24548   var symbolToString = symbolProto ? symbolProto.toString : void 0;
24549   function baseToString(value) {
24550     if (typeof value == "string") {
24551       return value;
24552     }
24553     if (isArray_default(value)) {
24554       return arrayMap_default(value, baseToString) + "";
24555     }
24556     if (isSymbol_default(value)) {
24557       return symbolToString ? symbolToString.call(value) : "";
24558     }
24559     var result = value + "";
24560     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
24561   }
24562   var baseToString_default = baseToString;
24563
24564   // node_modules/lodash-es/_trimmedEndIndex.js
24565   var reWhitespace = /\s/;
24566   function trimmedEndIndex(string) {
24567     var index = string.length;
24568     while (index-- && reWhitespace.test(string.charAt(index))) {
24569     }
24570     return index;
24571   }
24572   var trimmedEndIndex_default = trimmedEndIndex;
24573
24574   // node_modules/lodash-es/_baseTrim.js
24575   var reTrimStart = /^\s+/;
24576   function baseTrim(string) {
24577     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
24578   }
24579   var baseTrim_default = baseTrim;
24580
24581   // node_modules/lodash-es/isObject.js
24582   function isObject(value) {
24583     var type3 = typeof value;
24584     return value != null && (type3 == "object" || type3 == "function");
24585   }
24586   var isObject_default = isObject;
24587
24588   // node_modules/lodash-es/toNumber.js
24589   var NAN = 0 / 0;
24590   var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
24591   var reIsBinary = /^0b[01]+$/i;
24592   var reIsOctal = /^0o[0-7]+$/i;
24593   var freeParseInt = parseInt;
24594   function toNumber(value) {
24595     if (typeof value == "number") {
24596       return value;
24597     }
24598     if (isSymbol_default(value)) {
24599       return NAN;
24600     }
24601     if (isObject_default(value)) {
24602       var other = typeof value.valueOf == "function" ? value.valueOf() : value;
24603       value = isObject_default(other) ? other + "" : other;
24604     }
24605     if (typeof value != "string") {
24606       return value === 0 ? value : +value;
24607     }
24608     value = baseTrim_default(value);
24609     var isBinary = reIsBinary.test(value);
24610     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
24611   }
24612   var toNumber_default = toNumber;
24613
24614   // node_modules/lodash-es/toString.js
24615   function toString(value) {
24616     return value == null ? "" : baseToString_default(value);
24617   }
24618   var toString_default = toString;
24619
24620   // node_modules/lodash-es/_basePropertyOf.js
24621   function basePropertyOf(object) {
24622     return function(key) {
24623       return object == null ? void 0 : object[key];
24624     };
24625   }
24626   var basePropertyOf_default = basePropertyOf;
24627
24628   // node_modules/lodash-es/now.js
24629   var now2 = function() {
24630     return root_default.Date.now();
24631   };
24632   var now_default = now2;
24633
24634   // node_modules/lodash-es/debounce.js
24635   var FUNC_ERROR_TEXT = "Expected a function";
24636   var nativeMax = Math.max;
24637   var nativeMin = Math.min;
24638   function debounce(func, wait, options2) {
24639     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
24640     if (typeof func != "function") {
24641       throw new TypeError(FUNC_ERROR_TEXT);
24642     }
24643     wait = toNumber_default(wait) || 0;
24644     if (isObject_default(options2)) {
24645       leading = !!options2.leading;
24646       maxing = "maxWait" in options2;
24647       maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
24648       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24649     }
24650     function invokeFunc(time) {
24651       var args = lastArgs, thisArg = lastThis;
24652       lastArgs = lastThis = void 0;
24653       lastInvokeTime = time;
24654       result = func.apply(thisArg, args);
24655       return result;
24656     }
24657     function leadingEdge(time) {
24658       lastInvokeTime = time;
24659       timerId = setTimeout(timerExpired, wait);
24660       return leading ? invokeFunc(time) : result;
24661     }
24662     function remainingWait(time) {
24663       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
24664       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
24665     }
24666     function shouldInvoke(time) {
24667       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
24668       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
24669     }
24670     function timerExpired() {
24671       var time = now_default();
24672       if (shouldInvoke(time)) {
24673         return trailingEdge(time);
24674       }
24675       timerId = setTimeout(timerExpired, remainingWait(time));
24676     }
24677     function trailingEdge(time) {
24678       timerId = void 0;
24679       if (trailing && lastArgs) {
24680         return invokeFunc(time);
24681       }
24682       lastArgs = lastThis = void 0;
24683       return result;
24684     }
24685     function cancel() {
24686       if (timerId !== void 0) {
24687         clearTimeout(timerId);
24688       }
24689       lastInvokeTime = 0;
24690       lastArgs = lastCallTime = lastThis = timerId = void 0;
24691     }
24692     function flush() {
24693       return timerId === void 0 ? result : trailingEdge(now_default());
24694     }
24695     function debounced() {
24696       var time = now_default(), isInvoking = shouldInvoke(time);
24697       lastArgs = arguments;
24698       lastThis = this;
24699       lastCallTime = time;
24700       if (isInvoking) {
24701         if (timerId === void 0) {
24702           return leadingEdge(lastCallTime);
24703         }
24704         if (maxing) {
24705           clearTimeout(timerId);
24706           timerId = setTimeout(timerExpired, wait);
24707           return invokeFunc(lastCallTime);
24708         }
24709       }
24710       if (timerId === void 0) {
24711         timerId = setTimeout(timerExpired, wait);
24712       }
24713       return result;
24714     }
24715     debounced.cancel = cancel;
24716     debounced.flush = flush;
24717     return debounced;
24718   }
24719   var debounce_default = debounce;
24720
24721   // node_modules/lodash-es/_escapeHtmlChar.js
24722   var htmlEscapes = {
24723     "&": "&amp;",
24724     "<": "&lt;",
24725     ">": "&gt;",
24726     '"': "&quot;",
24727     "'": "&#39;"
24728   };
24729   var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
24730   var escapeHtmlChar_default = escapeHtmlChar;
24731
24732   // node_modules/lodash-es/escape.js
24733   var reUnescapedHtml = /[&<>"']/g;
24734   var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
24735   function escape2(string) {
24736     string = toString_default(string);
24737     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
24738   }
24739   var escape_default = escape2;
24740
24741   // node_modules/lodash-es/throttle.js
24742   var FUNC_ERROR_TEXT2 = "Expected a function";
24743   function throttle(func, wait, options2) {
24744     var leading = true, trailing = true;
24745     if (typeof func != "function") {
24746       throw new TypeError(FUNC_ERROR_TEXT2);
24747     }
24748     if (isObject_default(options2)) {
24749       leading = "leading" in options2 ? !!options2.leading : leading;
24750       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24751     }
24752     return debounce_default(func, wait, {
24753       "leading": leading,
24754       "maxWait": wait,
24755       "trailing": trailing
24756     });
24757   }
24758   var throttle_default = throttle;
24759
24760   // node_modules/lodash-es/_unescapeHtmlChar.js
24761   var htmlUnescapes = {
24762     "&amp;": "&",
24763     "&lt;": "<",
24764     "&gt;": ">",
24765     "&quot;": '"',
24766     "&#39;": "'"
24767   };
24768   var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
24769   var unescapeHtmlChar_default = unescapeHtmlChar;
24770
24771   // node_modules/lodash-es/unescape.js
24772   var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
24773   var reHasEscapedHtml = RegExp(reEscapedHtml.source);
24774   function unescape2(string) {
24775     string = toString_default(string);
24776     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
24777   }
24778   var unescape_default = unescape2;
24779
24780   // modules/core/localizer.js
24781   var _mainLocalizer = coreLocalizer();
24782   var _t = _mainLocalizer.t;
24783   function coreLocalizer() {
24784     let localizer = {};
24785     let _dataLanguages = {};
24786     let _dataLocales = {};
24787     let _localeStrings = {};
24788     let _localeCode = "en-US";
24789     let _localeCodes = ["en-US", "en"];
24790     let _languageCode = "en";
24791     let _textDirection = "ltr";
24792     let _usesMetric = false;
24793     let _languageNames = {};
24794     let _scriptNames = {};
24795     localizer.localeCode = () => _localeCode;
24796     localizer.localeCodes = () => _localeCodes;
24797     localizer.languageCode = () => _languageCode;
24798     localizer.textDirection = () => _textDirection;
24799     localizer.usesMetric = () => _usesMetric;
24800     localizer.languageNames = () => _languageNames;
24801     localizer.scriptNames = () => _scriptNames;
24802     let _preferredLocaleCodes = [];
24803     localizer.preferredLocaleCodes = function(codes) {
24804       if (!arguments.length)
24805         return _preferredLocaleCodes;
24806       if (typeof codes === "string") {
24807         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
24808       } else {
24809         _preferredLocaleCodes = codes;
24810       }
24811       return localizer;
24812     };
24813     var _loadPromise;
24814     localizer.ensureLoaded = () => {
24815       if (_loadPromise)
24816         return _loadPromise;
24817       let filesToFetch = [
24818         "languages",
24819         "locales"
24820       ];
24821       const localeDirs = {
24822         general: "locales",
24823         tagging: "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@3/dist/translations"
24824       };
24825       let fileMap = _mainFileFetcher.fileMap();
24826       for (let scopeId in localeDirs) {
24827         const key = `locales_index_${scopeId}`;
24828         if (!fileMap[key]) {
24829           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
24830         }
24831         filesToFetch.push(key);
24832       }
24833       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
24834         _dataLanguages = results[0];
24835         _dataLocales = results[1];
24836         let indexes = results.slice(2);
24837         let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
24838         _localeCodes = localesToUseFrom(requestedLocales);
24839         _localeCode = _localeCodes[0];
24840         let loadStringsPromises = [];
24841         indexes.forEach((index, i2) => {
24842           const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
24843             return index[locale2] && index[locale2].pct === 1;
24844           });
24845           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
24846             let scopeId = Object.keys(localeDirs)[i2];
24847             let directory = Object.values(localeDirs)[i2];
24848             if (index[code])
24849               loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
24850           });
24851         });
24852         return Promise.all(loadStringsPromises);
24853       }).then(() => {
24854         updateForCurrentLocale();
24855       }).catch((err) => console.error(err));
24856     };
24857     function localesToUseFrom(requestedLocales) {
24858       let supportedLocales = _dataLocales;
24859       let toUse = [];
24860       for (let i2 in requestedLocales) {
24861         let locale2 = requestedLocales[i2];
24862         if (supportedLocales[locale2])
24863           toUse.push(locale2);
24864         if (locale2.includes("-")) {
24865           let langPart = locale2.split("-")[0];
24866           if (supportedLocales[langPart])
24867             toUse.push(langPart);
24868         }
24869       }
24870       return utilArrayUniq(toUse);
24871     }
24872     function updateForCurrentLocale() {
24873       if (!_localeCode)
24874         return;
24875       _languageCode = _localeCode.split("-")[0];
24876       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
24877       const hash = utilStringQs(window.location.hash);
24878       if (hash.rtl === "true") {
24879         _textDirection = "rtl";
24880       } else if (hash.rtl === "false") {
24881         _textDirection = "ltr";
24882       } else {
24883         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
24884       }
24885       let locale2 = _localeCode;
24886       if (locale2.toLowerCase() === "en-us")
24887         locale2 = "en";
24888       _languageNames = _localeStrings.general[locale2].languageNames;
24889       _scriptNames = _localeStrings.general[locale2].scriptNames;
24890       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
24891     }
24892     localizer.loadLocale = (locale2, scopeId, directory) => {
24893       if (locale2.toLowerCase() === "en-us")
24894         locale2 = "en";
24895       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
24896         return Promise.resolve(locale2);
24897       }
24898       let fileMap = _mainFileFetcher.fileMap();
24899       const key = `locale_${scopeId}_${locale2}`;
24900       if (!fileMap[key]) {
24901         fileMap[key] = `${directory}/${locale2}.min.json`;
24902       }
24903       return _mainFileFetcher.get(key).then((d) => {
24904         if (!_localeStrings[scopeId])
24905           _localeStrings[scopeId] = {};
24906         _localeStrings[scopeId][locale2] = d[locale2];
24907         return locale2;
24908       });
24909     };
24910     localizer.pluralRule = function(number3) {
24911       return pluralRule(number3, _localeCode);
24912     };
24913     function pluralRule(number3, localeCode) {
24914       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
24915       if (rules) {
24916         return rules.select(number3);
24917       }
24918       if (number3 === 1)
24919         return "one";
24920       return "other";
24921     }
24922     localizer.tInfo = function(origStringId, replacements, locale2) {
24923       let stringId = origStringId.trim();
24924       let scopeId = "general";
24925       if (stringId[0] === "_") {
24926         let split = stringId.split(".");
24927         scopeId = split[0].slice(1);
24928         stringId = split.slice(1).join(".");
24929       }
24930       locale2 = locale2 || _localeCode;
24931       let path = stringId.split(".").map((s) => s.replace(/<TX_DOT>/g, ".")).reverse();
24932       let stringsKey = locale2;
24933       if (stringsKey.toLowerCase() === "en-us")
24934         stringsKey = "en";
24935       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
24936       while (result !== void 0 && path.length) {
24937         result = result[path.pop()];
24938       }
24939       if (result !== void 0) {
24940         if (replacements) {
24941           if (typeof result === "object" && Object.keys(result).length) {
24942             const number3 = Object.values(replacements).find(function(value) {
24943               return typeof value === "number";
24944             });
24945             if (number3 !== void 0) {
24946               const rule = pluralRule(number3, locale2);
24947               if (result[rule]) {
24948                 result = result[rule];
24949               } else {
24950                 result = Object.values(result)[0];
24951               }
24952             }
24953           }
24954           if (typeof result === "string") {
24955             for (let key in replacements) {
24956               let value = replacements[key];
24957               if (typeof value === "number") {
24958                 if (value.toLocaleString) {
24959                   value = value.toLocaleString(locale2, {
24960                     style: "decimal",
24961                     useGrouping: true,
24962                     minimumFractionDigits: 0
24963                   });
24964                 } else {
24965                   value = value.toString();
24966                 }
24967               }
24968               const token = `{${key}}`;
24969               const regex = new RegExp(token, "g");
24970               result = result.replace(regex, value);
24971             }
24972           }
24973         }
24974         if (typeof result === "string") {
24975           return {
24976             text: result,
24977             locale: locale2
24978           };
24979         }
24980       }
24981       let index = _localeCodes.indexOf(locale2);
24982       if (index >= 0 && index < _localeCodes.length - 1) {
24983         let fallback = _localeCodes[index + 1];
24984         return localizer.tInfo(origStringId, replacements, fallback);
24985       }
24986       if (replacements && "default" in replacements) {
24987         return {
24988           text: replacements.default,
24989           locale: null
24990         };
24991       }
24992       const missing = `Missing ${locale2} translation: ${origStringId}`;
24993       if (typeof console !== "undefined")
24994         console.error(missing);
24995       return {
24996         text: missing,
24997         locale: "en"
24998       };
24999     };
25000     localizer.hasTextForStringId = function(stringId) {
25001       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
25002     };
25003     localizer.t = function(stringId, replacements, locale2) {
25004       return localizer.tInfo(stringId, replacements, locale2).text;
25005     };
25006     localizer.t.html = function(stringId, replacements, locale2) {
25007       replacements = Object.assign({}, replacements);
25008       for (var k in replacements) {
25009         if (typeof replacements[k] === "string") {
25010           replacements[k] = escape_default(replacements[k]);
25011         }
25012         if (typeof replacements[k] === "object" && typeof replacements[k].html === "string") {
25013           replacements[k] = replacements[k].html;
25014         }
25015       }
25016       const info = localizer.tInfo(stringId, replacements, locale2);
25017       if (info.text) {
25018         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
25019       } else {
25020         return "";
25021       }
25022     };
25023     localizer.t.append = function(stringId, replacements, locale2) {
25024       const ret = function(selection2) {
25025         const info = localizer.tInfo(stringId, replacements, locale2);
25026         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
25027       };
25028       ret.stringId = stringId;
25029       return ret;
25030     };
25031     localizer.languageName = (code, options2) => {
25032       if (_languageNames[code]) {
25033         return _languageNames[code];
25034       }
25035       if (options2 && options2.localOnly)
25036         return null;
25037       const langInfo = _dataLanguages[code];
25038       if (langInfo) {
25039         if (langInfo.nativeName) {
25040           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
25041         } else if (langInfo.base && langInfo.script) {
25042           const base = langInfo.base;
25043           if (_languageNames[base]) {
25044             const scriptCode = langInfo.script;
25045             const script = _scriptNames[scriptCode] || scriptCode;
25046             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
25047           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
25048             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
25049           }
25050         }
25051       }
25052       return code;
25053     };
25054     return localizer;
25055   }
25056
25057   // modules/presets/collection.js
25058   function presetCollection(collection) {
25059     const MAXRESULTS = 50;
25060     let _this = {};
25061     let _memo = {};
25062     _this.collection = collection;
25063     _this.item = (id2) => {
25064       if (_memo[id2])
25065         return _memo[id2];
25066       const found = _this.collection.find((d) => d.id === id2);
25067       if (found)
25068         _memo[id2] = found;
25069       return found;
25070     };
25071     _this.index = (id2) => _this.collection.findIndex((d) => d.id === id2);
25072     _this.matchGeometry = (geometry) => {
25073       return presetCollection(
25074         _this.collection.filter((d) => d.matchGeometry(geometry))
25075       );
25076     };
25077     _this.matchAllGeometry = (geometries) => {
25078       return presetCollection(
25079         _this.collection.filter((d) => d && d.matchAllGeometry(geometries))
25080       );
25081     };
25082     _this.matchAnyGeometry = (geometries) => {
25083       return presetCollection(
25084         _this.collection.filter((d) => geometries.some((geom) => d.matchGeometry(geom)))
25085       );
25086     };
25087     _this.fallback = (geometry) => {
25088       let id2 = geometry;
25089       if (id2 === "vertex")
25090         id2 = "point";
25091       return _this.item(id2);
25092     };
25093     _this.search = (value, geometry, loc) => {
25094       if (!value)
25095         return _this;
25096       value = value.toLowerCase().trim();
25097       function leading(a) {
25098         const index = a.indexOf(value);
25099         return index === 0 || a[index - 1] === " ";
25100       }
25101       function leadingStrict(a) {
25102         const index = a.indexOf(value);
25103         return index === 0;
25104       }
25105       function sortPresets(nameProp, aliasesProp) {
25106         return function sortNames(a, b) {
25107           let aCompare = a[nameProp]();
25108           let bCompare = b[nameProp]();
25109           if (aliasesProp) {
25110             const findMatchingAlias = (strings) => {
25111               if (strings.some((s) => s === value)) {
25112                 return strings.find((s) => s === value);
25113               } else {
25114                 return strings.find((s) => s.includes(value));
25115               }
25116             };
25117             aCompare = findMatchingAlias([aCompare].concat(a[aliasesProp]()));
25118             bCompare = findMatchingAlias([bCompare].concat(b[aliasesProp]()));
25119           }
25120           if (value === aCompare)
25121             return -1;
25122           if (value === bCompare)
25123             return 1;
25124           let i2 = b.originalScore - a.originalScore;
25125           if (i2 !== 0)
25126             return i2;
25127           i2 = aCompare.indexOf(value) - bCompare.indexOf(value);
25128           if (i2 !== 0)
25129             return i2;
25130           return aCompare.length - bCompare.length;
25131         };
25132       }
25133       let pool = _this.collection;
25134       if (Array.isArray(loc)) {
25135         const validLocations = _mainLocations.locationsAt(loc);
25136         pool = pool.filter((a) => !a.locationSetID || validLocations[a.locationSetID]);
25137       }
25138       const searchable = pool.filter((a) => a.searchable !== false && a.suggestion !== true);
25139       const suggestions = pool.filter((a) => a.suggestion === true);
25140       const leadingNames = searchable.filter((a) => leading(a.searchName()) || a.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
25141       const leadingSuggestions = suggestions.filter((a) => leadingStrict(a.searchName())).sort(sortPresets("searchName"));
25142       const leadingNamesStripped = searchable.filter((a) => leading(a.searchNameStripped()) || a.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
25143       const leadingSuggestionsStripped = suggestions.filter((a) => leadingStrict(a.searchNameStripped())).sort(sortPresets("searchNameStripped"));
25144       const leadingTerms = searchable.filter((a) => (a.terms() || []).some(leading));
25145       const leadingSuggestionTerms = suggestions.filter((a) => (a.terms() || []).some(leading));
25146       const leadingTagValues = searchable.filter((a) => Object.values(a.tags || {}).filter((val) => val !== "*").some(leading));
25147       const similarName = searchable.map((a) => ({ preset: a, dist: utilEditDistance(value, a.searchName()) })).filter((a) => a.dist + Math.min(value.length - a.preset.searchName().length, 0) < 3).sort((a, b) => a.dist - b.dist).map((a) => a.preset);
25148       const similarSuggestions = suggestions.map((a) => ({ preset: a, dist: utilEditDistance(value, a.searchName()) })).filter((a) => a.dist + Math.min(value.length - a.preset.searchName().length, 0) < 1).sort((a, b) => a.dist - b.dist).map((a) => a.preset);
25149       const similarTerms = searchable.filter((a) => {
25150         return (a.terms() || []).some((b) => {
25151           return utilEditDistance(value, b) + Math.min(value.length - b.length, 0) < 3;
25152         });
25153       });
25154       let leadingTagKeyValues = [];
25155       if (value.includes("=")) {
25156         leadingTagKeyValues = searchable.filter((a) => a.tags && Object.keys(a.tags).some((key) => key + "=" + a.tags[key] === value)).concat(searchable.filter((a) => a.tags && Object.keys(a.tags).some((key) => leading(key + "=" + a.tags[key]))));
25157       }
25158       let results = leadingNames.concat(
25159         leadingSuggestions,
25160         leadingNamesStripped,
25161         leadingSuggestionsStripped,
25162         leadingTerms,
25163         leadingSuggestionTerms,
25164         leadingTagValues,
25165         similarName,
25166         similarSuggestions,
25167         similarTerms,
25168         leadingTagKeyValues
25169       ).slice(0, MAXRESULTS - 1);
25170       if (geometry) {
25171         if (typeof geometry === "string") {
25172           results.push(_this.fallback(geometry));
25173         } else {
25174           geometry.forEach((geom) => results.push(_this.fallback(geom)));
25175         }
25176       }
25177       return presetCollection(utilArrayUniq(results));
25178     };
25179     return _this;
25180   }
25181
25182   // modules/presets/category.js
25183   function presetCategory(categoryID, category, allPresets) {
25184     let _this = Object.assign({}, category);
25185     let _searchName;
25186     let _searchNameStripped;
25187     _this.id = categoryID;
25188     _this.members = presetCollection(
25189       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
25190     );
25191     _this.geometry = _this.members.collection.reduce((acc, preset) => {
25192       for (let i2 in preset.geometry) {
25193         const geometry = preset.geometry[i2];
25194         if (acc.indexOf(geometry) === -1) {
25195           acc.push(geometry);
25196         }
25197       }
25198       return acc;
25199     }, []);
25200     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
25201     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
25202     _this.matchScore = () => -1;
25203     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
25204     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
25205     _this.terms = () => [];
25206     _this.searchName = () => {
25207       if (!_searchName) {
25208         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
25209       }
25210       return _searchName;
25211     };
25212     _this.searchNameStripped = () => {
25213       if (!_searchNameStripped) {
25214         _searchNameStripped = _this.searchName();
25215         if (_searchNameStripped.normalize)
25216           _searchNameStripped = _searchNameStripped.normalize("NFD");
25217         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
25218       }
25219       return _searchNameStripped;
25220     };
25221     _this.searchAliases = () => [];
25222     _this.searchAliasesStripped = () => [];
25223     return _this;
25224   }
25225
25226   // modules/presets/field.js
25227   function presetField(fieldID, field) {
25228     let _this = Object.assign({}, field);
25229     _this.id = fieldID;
25230     _this.safeid = utilSafeClassName(fieldID);
25231     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
25232     _this.matchAllGeometry = (geometries) => {
25233       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
25234     };
25235     _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25236     _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25237     _this.t.append = (scope, options2) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
25238     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
25239     _this.title = () => _this.overrideLabel || _this.t("label", { "default": fieldID });
25240     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.t.append("label", { "default": fieldID });
25241     const _placeholder = _this.placeholder;
25242     _this.placeholder = () => _this.t("placeholder", { "default": _placeholder });
25243     _this.originalTerms = (_this.terms || []).join();
25244     _this.terms = () => _this.t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
25245     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
25246     return _this;
25247   }
25248
25249   // modules/presets/preset.js
25250   function presetPreset(presetID, preset, addable, allFields, allPresets) {
25251     allFields = allFields || {};
25252     allPresets = allPresets || {};
25253     let _this = Object.assign({}, preset);
25254     let _addable = addable || false;
25255     let _resolvedFields;
25256     let _resolvedMoreFields;
25257     let _searchName;
25258     let _searchNameStripped;
25259     let _searchAliases;
25260     let _searchAliasesStripped;
25261     _this.id = presetID;
25262     _this.safeid = utilSafeClassName(presetID);
25263     _this.originalTerms = (_this.terms || []).join();
25264     _this.originalName = _this.name || "";
25265     _this.originalAliases = (_this.aliases || []).join("\n");
25266     _this.originalScore = _this.matchScore || 1;
25267     _this.originalReference = _this.reference || {};
25268     _this.originalFields = _this.fields || [];
25269     _this.originalMoreFields = _this.moreFields || [];
25270     _this.fields = () => _resolvedFields || (_resolvedFields = resolve("fields"));
25271     _this.moreFields = () => _resolvedMoreFields || (_resolvedMoreFields = resolve("moreFields"));
25272     _this.resetFields = () => _resolvedFields = _resolvedMoreFields = null;
25273     _this.tags = _this.tags || {};
25274     _this.addTags = _this.addTags || _this.tags;
25275     _this.removeTags = _this.removeTags || _this.addTags;
25276     _this.geometry = _this.geometry || [];
25277     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
25278     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
25279     _this.matchScore = (entityTags) => {
25280       const tags = _this.tags;
25281       let seen = {};
25282       let score = 0;
25283       for (let k in tags) {
25284         seen[k] = true;
25285         if (entityTags[k] === tags[k]) {
25286           score += _this.originalScore;
25287         } else if (tags[k] === "*" && k in entityTags) {
25288           score += _this.originalScore / 2;
25289         } else {
25290           return -1;
25291         }
25292       }
25293       const addTags = _this.addTags;
25294       for (let k in addTags) {
25295         if (!seen[k] && entityTags[k] === addTags[k]) {
25296           score += _this.originalScore;
25297         }
25298       }
25299       if (_this.searchable === false) {
25300         score *= 0.999;
25301       }
25302       return score;
25303     };
25304     _this.t = (scope, options2) => {
25305       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
25306       return _t(textID, options2);
25307     };
25308     _this.t.append = (scope, options2) => {
25309       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
25310       return _t.append(textID, options2);
25311     };
25312     _this.name = () => {
25313       return _this.t("name", { "default": _this.originalName });
25314     };
25315     _this.nameLabel = () => _this.t.append("name", { "default": _this.originalName });
25316     _this.subtitle = () => {
25317       if (_this.suggestion) {
25318         let path = presetID.split("/");
25319         path.pop();
25320         return _t("_tagging.presets.presets." + path.join("/") + ".name");
25321       }
25322       return null;
25323     };
25324     _this.subtitleLabel = () => {
25325       if (_this.suggestion) {
25326         let path = presetID.split("/");
25327         path.pop();
25328         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
25329       }
25330       return null;
25331     };
25332     _this.aliases = () => {
25333       return _this.t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
25334     };
25335     _this.terms = () => _this.t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
25336     _this.searchName = () => {
25337       if (!_searchName) {
25338         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
25339       }
25340       return _searchName;
25341     };
25342     _this.searchNameStripped = () => {
25343       if (!_searchNameStripped) {
25344         _searchNameStripped = stripDiacritics(_this.searchName());
25345       }
25346       return _searchNameStripped;
25347     };
25348     _this.searchAliases = () => {
25349       if (!_searchAliases) {
25350         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
25351       }
25352       return _searchAliases;
25353     };
25354     _this.searchAliasesStripped = () => {
25355       if (!_searchAliasesStripped) {
25356         _searchAliasesStripped = _this.searchAliases();
25357         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
25358       }
25359       return _searchAliasesStripped;
25360     };
25361     _this.isFallback = () => {
25362       const tagCount = Object.keys(_this.tags).length;
25363       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
25364     };
25365     _this.addable = function(val) {
25366       if (!arguments.length)
25367         return _addable;
25368       _addable = val;
25369       return _this;
25370     };
25371     _this.reference = () => {
25372       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
25373       if (qid) {
25374         return { qid };
25375       }
25376       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
25377       let value = _this.originalReference.value || _this.tags[key];
25378       if (value === "*") {
25379         return { key };
25380       } else {
25381         return { key, value };
25382       }
25383     };
25384     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults) => {
25385       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
25386       tags = utilObjectOmit(tags, Object.keys(removeTags));
25387       if (geometry && !skipFieldDefaults) {
25388         _this.fields().forEach((field) => {
25389           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key]) {
25390             delete tags[field.key];
25391           }
25392         });
25393       }
25394       delete tags.area;
25395       return tags;
25396     };
25397     _this.setTags = (tags, geometry, skipFieldDefaults) => {
25398       const addTags = _this.addTags;
25399       tags = Object.assign({}, tags);
25400       for (let k in addTags) {
25401         if (addTags[k] === "*") {
25402           if (_this.tags[k] || !tags[k]) {
25403             tags[k] = "yes";
25404           }
25405         } else {
25406           tags[k] = addTags[k];
25407         }
25408       }
25409       if (!addTags.hasOwnProperty("area")) {
25410         delete tags.area;
25411         if (geometry === "area") {
25412           let needsAreaTag = true;
25413           for (let k in addTags) {
25414             if (_this.geometry.indexOf("line") === -1 && k in osmAreaKeys || k in osmAreaKeysExceptions && addTags[k] in osmAreaKeysExceptions[k]) {
25415               needsAreaTag = false;
25416               break;
25417             }
25418           }
25419           if (needsAreaTag) {
25420             tags.area = "yes";
25421           }
25422         }
25423       }
25424       if (geometry && !skipFieldDefaults) {
25425         _this.fields().forEach((field) => {
25426           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
25427             tags[field.key] = field.default;
25428           }
25429         });
25430       }
25431       return tags;
25432     };
25433     function resolve(which) {
25434       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
25435       let resolved = [];
25436       fieldIDs.forEach((fieldID) => {
25437         const match = fieldID.match(/\{(.*)\}/);
25438         if (match !== null) {
25439           resolved = resolved.concat(inheritFields(match[1], which));
25440         } else if (allFields[fieldID]) {
25441           resolved.push(allFields[fieldID]);
25442         } else {
25443           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
25444         }
25445       });
25446       if (!resolved.length) {
25447         const endIndex = _this.id.lastIndexOf("/");
25448         const parentID = endIndex && _this.id.substring(0, endIndex);
25449         if (parentID) {
25450           resolved = inheritFields(parentID, which);
25451         }
25452       }
25453       return utilArrayUniq(resolved);
25454       function inheritFields(presetID2, which2) {
25455         const parent = allPresets[presetID2];
25456         if (!parent)
25457           return [];
25458         if (which2 === "fields") {
25459           return parent.fields().filter(shouldInherit);
25460         } else if (which2 === "moreFields") {
25461           return parent.moreFields();
25462         } else {
25463           return [];
25464         }
25465       }
25466       function shouldInherit(f2) {
25467         if (f2.key && _this.tags[f2.key] !== void 0 && f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check")
25468           return false;
25469         return true;
25470       }
25471     }
25472     function stripDiacritics(s) {
25473       if (s.normalize)
25474         s = s.normalize("NFD");
25475       s = s.replace(/[\u0300-\u036f]/g, "");
25476       return s;
25477     }
25478     return _this;
25479   }
25480
25481   // modules/presets/index.js
25482   var _mainPresetIndex = presetIndex();
25483   function presetIndex() {
25484     const dispatch10 = dispatch_default("favoritePreset", "recentsChange");
25485     const MAXRECENTS = 30;
25486     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
25487     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
25488     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
25489     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
25490     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
25491     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
25492     let _defaults = {
25493       point: presetCollection([POINT]),
25494       vertex: presetCollection([POINT]),
25495       line: presetCollection([LINE]),
25496       area: presetCollection([AREA]),
25497       relation: presetCollection([RELATION])
25498     };
25499     let _fields = {};
25500     let _categories = {};
25501     let _universal = [];
25502     let _addablePresetIDs = null;
25503     let _recents;
25504     let _favorites;
25505     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
25506     let _loadPromise;
25507     _this.ensureLoaded = () => {
25508       if (_loadPromise)
25509         return _loadPromise;
25510       return _loadPromise = Promise.all([
25511         _mainFileFetcher.get("preset_categories"),
25512         _mainFileFetcher.get("preset_defaults"),
25513         _mainFileFetcher.get("preset_presets"),
25514         _mainFileFetcher.get("preset_fields")
25515       ]).then((vals) => {
25516         _this.merge({
25517           categories: vals[0],
25518           defaults: vals[1],
25519           presets: vals[2],
25520           fields: vals[3]
25521         });
25522         osmSetAreaKeys(_this.areaKeys());
25523         osmSetPointTags(_this.pointTags());
25524         osmSetVertexTags(_this.vertexTags());
25525       });
25526     };
25527     _this.merge = (d) => {
25528       let newLocationSets = [];
25529       if (d.fields) {
25530         Object.keys(d.fields).forEach((fieldID) => {
25531           let f2 = d.fields[fieldID];
25532           if (f2) {
25533             f2 = presetField(fieldID, f2);
25534             if (f2.locationSet)
25535               newLocationSets.push(f2);
25536             _fields[fieldID] = f2;
25537           } else {
25538             delete _fields[fieldID];
25539           }
25540         });
25541       }
25542       if (d.presets) {
25543         Object.keys(d.presets).forEach((presetID) => {
25544           let p = d.presets[presetID];
25545           if (p) {
25546             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
25547             p = presetPreset(presetID, p, isAddable, _fields, _presets);
25548             if (p.locationSet)
25549               newLocationSets.push(p);
25550             _presets[presetID] = p;
25551           } else {
25552             const existing = _presets[presetID];
25553             if (existing && !existing.isFallback()) {
25554               delete _presets[presetID];
25555             }
25556           }
25557         });
25558       }
25559       if (d.categories) {
25560         Object.keys(d.categories).forEach((categoryID) => {
25561           let c = d.categories[categoryID];
25562           if (c) {
25563             c = presetCategory(categoryID, c, _presets);
25564             if (c.locationSet)
25565               newLocationSets.push(c);
25566             _categories[categoryID] = c;
25567           } else {
25568             delete _categories[categoryID];
25569           }
25570         });
25571       }
25572       _this.collection = Object.values(_presets).concat(Object.values(_categories));
25573       if (d.defaults) {
25574         Object.keys(d.defaults).forEach((geometry) => {
25575           const def = d.defaults[geometry];
25576           if (Array.isArray(def)) {
25577             _defaults[geometry] = presetCollection(
25578               def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
25579             );
25580           } else {
25581             delete _defaults[geometry];
25582           }
25583         });
25584       }
25585       _universal = Object.values(_fields).filter((field) => field.universal);
25586       Object.values(_presets).forEach((preset) => preset.resetFields());
25587       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
25588       _this.collection.forEach((preset) => {
25589         (preset.geometry || []).forEach((geometry) => {
25590           let g = _geometryIndex[geometry];
25591           for (let key in preset.tags) {
25592             g[key] = g[key] || {};
25593             let value = preset.tags[key];
25594             (g[key][value] = g[key][value] || []).push(preset);
25595           }
25596         });
25597       });
25598       if (d.featureCollection && Array.isArray(d.featureCollection.features)) {
25599         _mainLocations.mergeCustomGeoJSON(d.featureCollection);
25600       }
25601       if (newLocationSets.length) {
25602         _mainLocations.mergeLocationSets(newLocationSets);
25603       }
25604       return _this;
25605     };
25606     _this.match = (entity, resolver) => {
25607       return resolver.transient(entity, "presetMatch", () => {
25608         let geometry = entity.geometry(resolver);
25609         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
25610           geometry = "point";
25611         }
25612         const entityExtent = entity.extent(resolver);
25613         return _this.matchTags(entity.tags, geometry, entityExtent.center());
25614       });
25615     };
25616     _this.matchTags = (tags, geometry, loc) => {
25617       const keyIndex = _geometryIndex[geometry];
25618       let bestScore = -1;
25619       let bestMatch;
25620       let matchCandidates = [];
25621       for (let k in tags) {
25622         let indexMatches = [];
25623         let valueIndex = keyIndex[k];
25624         if (!valueIndex)
25625           continue;
25626         let keyValueMatches = valueIndex[tags[k]];
25627         if (keyValueMatches)
25628           indexMatches.push(...keyValueMatches);
25629         let keyStarMatches = valueIndex["*"];
25630         if (keyStarMatches)
25631           indexMatches.push(...keyStarMatches);
25632         if (indexMatches.length === 0)
25633           continue;
25634         for (let i2 = 0; i2 < indexMatches.length; i2++) {
25635           const candidate = indexMatches[i2];
25636           const score = candidate.matchScore(tags);
25637           if (score === -1) {
25638             continue;
25639           }
25640           matchCandidates.push({ score, candidate });
25641           if (score > bestScore) {
25642             bestScore = score;
25643             bestMatch = candidate;
25644           }
25645         }
25646       }
25647       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
25648         let validLocations = _mainLocations.locationsAt(loc);
25649         if (!validLocations[bestMatch.locationSetID]) {
25650           matchCandidates.sort((a, b) => a.score < b.score ? 1 : -1);
25651           for (let i2 = 0; i2 < matchCandidates.length; i2++) {
25652             const candidateScore = matchCandidates[i2];
25653             if (!candidateScore.candidate.locationSetID || validLocations[candidateScore.candidate.locationSetID]) {
25654               bestMatch = candidateScore.candidate;
25655               bestScore = candidateScore.score;
25656               break;
25657             }
25658           }
25659         }
25660       }
25661       if (!bestMatch || bestMatch.isFallback()) {
25662         for (let k in tags) {
25663           if (/^addr:/.test(k) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
25664             bestMatch = keyIndex["addr:*"]["*"][0];
25665             break;
25666           }
25667         }
25668       }
25669       return bestMatch || _this.fallback(geometry);
25670     };
25671     _this.allowsVertex = (entity, resolver) => {
25672       if (entity.type !== "node")
25673         return false;
25674       if (Object.keys(entity.tags).length === 0)
25675         return true;
25676       return resolver.transient(entity, "vertexMatch", () => {
25677         if (entity.isOnAddressLine(resolver))
25678           return true;
25679         const geometries = osmNodeGeometriesForTags(entity.tags);
25680         if (geometries.vertex)
25681           return true;
25682         if (geometries.point)
25683           return false;
25684         return true;
25685       });
25686     };
25687     _this.areaKeys = () => {
25688       const ignore = {
25689         barrier: true,
25690         highway: true,
25691         footway: true,
25692         railway: true,
25693         junction: true,
25694         type: true
25695       };
25696       let areaKeys = {};
25697       const presets = _this.collection.filter((p) => !p.suggestion && !p.replacement);
25698       presets.forEach((p) => {
25699         const keys = p.tags && Object.keys(p.tags);
25700         const key = keys && keys.length && keys[0];
25701         if (!key)
25702           return;
25703         if (ignore[key])
25704           return;
25705         if (p.geometry.indexOf("area") !== -1) {
25706           areaKeys[key] = areaKeys[key] || {};
25707         }
25708       });
25709       presets.forEach((p) => {
25710         let key;
25711         for (key in p.addTags) {
25712           const value = p.addTags[key];
25713           if (key in areaKeys && p.geometry.indexOf("line") !== -1 && value !== "*") {
25714             areaKeys[key][value] = true;
25715           }
25716         }
25717       });
25718       return areaKeys;
25719     };
25720     _this.pointTags = () => {
25721       return _this.collection.reduce((pointTags, d) => {
25722         if (d.suggestion || d.replacement || d.searchable === false)
25723           return pointTags;
25724         const keys = d.tags && Object.keys(d.tags);
25725         const key = keys && keys.length && keys[0];
25726         if (!key)
25727           return pointTags;
25728         if (d.geometry.indexOf("point") !== -1) {
25729           pointTags[key] = pointTags[key] || {};
25730           pointTags[key][d.tags[key]] = true;
25731         }
25732         return pointTags;
25733       }, {});
25734     };
25735     _this.vertexTags = () => {
25736       return _this.collection.reduce((vertexTags, d) => {
25737         if (d.suggestion || d.replacement || d.searchable === false)
25738           return vertexTags;
25739         const keys = d.tags && Object.keys(d.tags);
25740         const key = keys && keys.length && keys[0];
25741         if (!key)
25742           return vertexTags;
25743         if (d.geometry.indexOf("vertex") !== -1) {
25744           vertexTags[key] = vertexTags[key] || {};
25745           vertexTags[key][d.tags[key]] = true;
25746         }
25747         return vertexTags;
25748       }, {});
25749     };
25750     _this.field = (id2) => _fields[id2];
25751     _this.universal = () => _universal;
25752     _this.defaults = (geometry, n2, startWithRecents, loc, extraPresets) => {
25753       let recents = [];
25754       if (startWithRecents) {
25755         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
25756       }
25757       let defaults2;
25758       if (_addablePresetIDs) {
25759         defaults2 = Array.from(_addablePresetIDs).map(function(id2) {
25760           var preset = _this.item(id2);
25761           if (preset && preset.matchGeometry(geometry))
25762             return preset;
25763           return null;
25764         }).filter(Boolean);
25765       } else {
25766         defaults2 = _defaults[geometry].collection.concat(_this.fallback(geometry));
25767       }
25768       let result = presetCollection(
25769         utilArrayUniq(recents.concat(defaults2).concat(extraPresets || [])).slice(0, n2 - 1)
25770       );
25771       if (Array.isArray(loc)) {
25772         const validLocations = _mainLocations.locationsAt(loc);
25773         result.collection = result.collection.filter((a) => !a.locationSetID || validLocations[a.locationSetID]);
25774       }
25775       return result;
25776     };
25777     _this.addablePresetIDs = function(val) {
25778       if (!arguments.length)
25779         return _addablePresetIDs;
25780       if (Array.isArray(val))
25781         val = new Set(val);
25782       _addablePresetIDs = val;
25783       if (_addablePresetIDs) {
25784         _this.collection.forEach((p) => {
25785           if (p.addable)
25786             p.addable(_addablePresetIDs.has(p.id));
25787         });
25788       } else {
25789         _this.collection.forEach((p) => {
25790           if (p.addable)
25791             p.addable(true);
25792         });
25793       }
25794       return _this;
25795     };
25796     _this.recent = () => {
25797       return presetCollection(
25798         utilArrayUniq(_this.getRecents().map((d) => d.preset).filter((d) => d.searchable !== false))
25799       );
25800     };
25801     function RibbonItem(preset, source) {
25802       let item = {};
25803       item.preset = preset;
25804       item.source = source;
25805       item.isFavorite = () => item.source === "favorite";
25806       item.isRecent = () => item.source === "recent";
25807       item.matches = (preset2) => item.preset.id === preset2.id;
25808       item.minified = () => ({ pID: item.preset.id });
25809       return item;
25810     }
25811     function ribbonItemForMinified(d, source) {
25812       if (d && d.pID) {
25813         const preset = _this.item(d.pID);
25814         if (!preset)
25815           return null;
25816         return RibbonItem(preset, source);
25817       }
25818       return null;
25819     }
25820     _this.getGenericRibbonItems = () => {
25821       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
25822     };
25823     _this.getAddable = () => {
25824       if (!_addablePresetIDs)
25825         return [];
25826       return _addablePresetIDs.map((id2) => {
25827         const preset = _this.item(id2);
25828         if (preset)
25829           return RibbonItem(preset, "addable");
25830         return null;
25831       }).filter(Boolean);
25832     };
25833     function setRecents(items) {
25834       _recents = items;
25835       const minifiedItems = items.map((d) => d.minified());
25836       corePreferences("preset_recents", JSON.stringify(minifiedItems));
25837       dispatch10.call("recentsChange");
25838     }
25839     _this.getRecents = () => {
25840       if (!_recents) {
25841         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d) => {
25842           let item = ribbonItemForMinified(d, "recent");
25843           if (item && item.preset.addable())
25844             acc.push(item);
25845           return acc;
25846         }, []);
25847       }
25848       return _recents;
25849     };
25850     _this.addRecent = (preset, besidePreset, after) => {
25851       const recents = _this.getRecents();
25852       const beforeItem = _this.recentMatching(besidePreset);
25853       let toIndex = recents.indexOf(beforeItem);
25854       if (after)
25855         toIndex += 1;
25856       const newItem = RibbonItem(preset, "recent");
25857       recents.splice(toIndex, 0, newItem);
25858       setRecents(recents);
25859     };
25860     _this.removeRecent = (preset) => {
25861       const item = _this.recentMatching(preset);
25862       if (item) {
25863         let items = _this.getRecents();
25864         items.splice(items.indexOf(item), 1);
25865         setRecents(items);
25866       }
25867     };
25868     _this.recentMatching = (preset) => {
25869       const items = _this.getRecents();
25870       for (let i2 in items) {
25871         if (items[i2].matches(preset)) {
25872           return items[i2];
25873         }
25874       }
25875       return null;
25876     };
25877     _this.moveItem = (items, fromIndex, toIndex) => {
25878       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
25879         return null;
25880       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
25881       return items;
25882     };
25883     _this.moveRecent = (item, beforeItem) => {
25884       const recents = _this.getRecents();
25885       const fromIndex = recents.indexOf(item);
25886       const toIndex = recents.indexOf(beforeItem);
25887       const items = _this.moveItem(recents, fromIndex, toIndex);
25888       if (items)
25889         setRecents(items);
25890     };
25891     _this.setMostRecent = (preset) => {
25892       if (preset.searchable === false)
25893         return;
25894       let items = _this.getRecents();
25895       let item = _this.recentMatching(preset);
25896       if (item) {
25897         items.splice(items.indexOf(item), 1);
25898       } else {
25899         item = RibbonItem(preset, "recent");
25900       }
25901       while (items.length >= MAXRECENTS) {
25902         items.pop();
25903       }
25904       items.unshift(item);
25905       setRecents(items);
25906     };
25907     function setFavorites(items) {
25908       _favorites = items;
25909       const minifiedItems = items.map((d) => d.minified());
25910       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
25911       dispatch10.call("favoritePreset");
25912     }
25913     _this.addFavorite = (preset, besidePreset, after) => {
25914       const favorites = _this.getFavorites();
25915       const beforeItem = _this.favoriteMatching(besidePreset);
25916       let toIndex = favorites.indexOf(beforeItem);
25917       if (after)
25918         toIndex += 1;
25919       const newItem = RibbonItem(preset, "favorite");
25920       favorites.splice(toIndex, 0, newItem);
25921       setFavorites(favorites);
25922     };
25923     _this.toggleFavorite = (preset) => {
25924       const favs = _this.getFavorites();
25925       const favorite = _this.favoriteMatching(preset);
25926       if (favorite) {
25927         favs.splice(favs.indexOf(favorite), 1);
25928       } else {
25929         if (favs.length === 10) {
25930           favs.pop();
25931         }
25932         favs.push(RibbonItem(preset, "favorite"));
25933       }
25934       setFavorites(favs);
25935     };
25936     _this.removeFavorite = (preset) => {
25937       const item = _this.favoriteMatching(preset);
25938       if (item) {
25939         const items = _this.getFavorites();
25940         items.splice(items.indexOf(item), 1);
25941         setFavorites(items);
25942       }
25943     };
25944     _this.getFavorites = () => {
25945       if (!_favorites) {
25946         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
25947         if (!rawFavorites) {
25948           rawFavorites = [];
25949           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
25950         }
25951         _favorites = rawFavorites.reduce((output, d) => {
25952           const item = ribbonItemForMinified(d, "favorite");
25953           if (item && item.preset.addable())
25954             output.push(item);
25955           return output;
25956         }, []);
25957       }
25958       return _favorites;
25959     };
25960     _this.favoriteMatching = (preset) => {
25961       const favs = _this.getFavorites();
25962       for (let index in favs) {
25963         if (favs[index].matches(preset)) {
25964           return favs[index];
25965         }
25966       }
25967       return null;
25968     };
25969     return utilRebind(_this, dispatch10, "on");
25970   }
25971
25972   // modules/util/util.js
25973   function utilTagText(entity) {
25974     var obj = entity && entity.tags || {};
25975     return Object.keys(obj).map(function(k) {
25976       return k + "=" + obj[k];
25977     }).join(", ");
25978   }
25979   function utilTotalExtent(array2, graph) {
25980     var extent = geoExtent();
25981     var val, entity;
25982     for (var i2 = 0; i2 < array2.length; i2++) {
25983       val = array2[i2];
25984       entity = typeof val === "string" ? graph.hasEntity(val) : val;
25985       if (entity) {
25986         extent._extend(entity.extent(graph));
25987       }
25988     }
25989     return extent;
25990   }
25991   function utilTagDiff(oldTags, newTags) {
25992     var tagDiff = [];
25993     var keys = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
25994     keys.forEach(function(k) {
25995       var oldVal = oldTags[k];
25996       var newVal = newTags[k];
25997       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
25998         tagDiff.push({
25999           type: "-",
26000           key: k,
26001           oldVal,
26002           newVal,
26003           display: "- " + k + "=" + oldVal
26004         });
26005       }
26006       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
26007         tagDiff.push({
26008           type: "+",
26009           key: k,
26010           oldVal,
26011           newVal,
26012           display: "+ " + k + "=" + newVal
26013         });
26014       }
26015     });
26016     return tagDiff;
26017   }
26018   function utilEntitySelector(ids) {
26019     return ids.length ? "." + ids.join(",.") : "nothing";
26020   }
26021   function utilEntityOrMemberSelector(ids, graph) {
26022     var seen = new Set(ids);
26023     ids.forEach(collectShallowDescendants);
26024     return utilEntitySelector(Array.from(seen));
26025     function collectShallowDescendants(id2) {
26026       var entity = graph.hasEntity(id2);
26027       if (!entity || entity.type !== "relation")
26028         return;
26029       entity.members.map(function(member) {
26030         return member.id;
26031       }).forEach(function(id3) {
26032         seen.add(id3);
26033       });
26034     }
26035   }
26036   function utilEntityOrDeepMemberSelector(ids, graph) {
26037     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
26038   }
26039   function utilEntityAndDeepMemberIDs(ids, graph) {
26040     var seen = /* @__PURE__ */ new Set();
26041     ids.forEach(collectDeepDescendants);
26042     return Array.from(seen);
26043     function collectDeepDescendants(id2) {
26044       if (seen.has(id2))
26045         return;
26046       seen.add(id2);
26047       var entity = graph.hasEntity(id2);
26048       if (!entity || entity.type !== "relation")
26049         return;
26050       entity.members.map(function(member) {
26051         return member.id;
26052       }).forEach(collectDeepDescendants);
26053     }
26054   }
26055   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
26056     var idsSet = new Set(ids);
26057     var seen = /* @__PURE__ */ new Set();
26058     var returners = /* @__PURE__ */ new Set();
26059     ids.forEach(collectDeepDescendants);
26060     return utilEntitySelector(Array.from(returners));
26061     function collectDeepDescendants(id2) {
26062       if (seen.has(id2))
26063         return;
26064       seen.add(id2);
26065       if (!idsSet.has(id2)) {
26066         returners.add(id2);
26067       }
26068       var entity = graph.hasEntity(id2);
26069       if (!entity || entity.type !== "relation")
26070         return;
26071       if (skipMultipolgonMembers && entity.isMultipolygon())
26072         return;
26073       entity.members.map(function(member) {
26074         return member.id;
26075       }).forEach(collectDeepDescendants);
26076     }
26077   }
26078   function utilHighlightEntities(ids, highlighted, context) {
26079     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
26080   }
26081   function utilGetAllNodes(ids, graph) {
26082     var seen = /* @__PURE__ */ new Set();
26083     var nodes = /* @__PURE__ */ new Set();
26084     ids.forEach(collectNodes);
26085     return Array.from(nodes);
26086     function collectNodes(id2) {
26087       if (seen.has(id2))
26088         return;
26089       seen.add(id2);
26090       var entity = graph.hasEntity(id2);
26091       if (!entity)
26092         return;
26093       if (entity.type === "node") {
26094         nodes.add(entity);
26095       } else if (entity.type === "way") {
26096         entity.nodes.forEach(collectNodes);
26097       } else {
26098         entity.members.map(function(member) {
26099           return member.id;
26100         }).forEach(collectNodes);
26101       }
26102     }
26103   }
26104   function utilDisplayName(entity) {
26105     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
26106     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
26107     if (name)
26108       return name;
26109     var tags = {
26110       direction: entity.tags.direction,
26111       from: entity.tags.from,
26112       network: entity.tags.cycle_network || entity.tags.network,
26113       ref: entity.tags.ref,
26114       to: entity.tags.to,
26115       via: entity.tags.via
26116     };
26117     var keyComponents = [];
26118     if (tags.network) {
26119       keyComponents.push("network");
26120     }
26121     if (tags.ref) {
26122       keyComponents.push("ref");
26123     }
26124     if (entity.tags.route) {
26125       if (tags.direction) {
26126         keyComponents.push("direction");
26127       } else if (tags.from && tags.to) {
26128         keyComponents.push("from");
26129         keyComponents.push("to");
26130         if (tags.via) {
26131           keyComponents.push("via");
26132         }
26133       }
26134     }
26135     if (keyComponents.length) {
26136       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
26137     }
26138     return name;
26139   }
26140   function utilDisplayNameForPath(entity) {
26141     var name = utilDisplayName(entity);
26142     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
26143     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
26144     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
26145       name = fixRTLTextForSvg(name);
26146     }
26147     return name;
26148   }
26149   function utilDisplayType(id2) {
26150     return {
26151       n: _t("inspector.node"),
26152       w: _t("inspector.way"),
26153       r: _t("inspector.relation")
26154     }[id2.charAt(0)];
26155   }
26156   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
26157     var result;
26158     var displayName = utilDisplayName(entity);
26159     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
26160     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
26161     if (verbose) {
26162       result = [presetName, displayName].filter(Boolean).join(" ");
26163     } else {
26164       result = displayName || presetName;
26165     }
26166     return result || utilDisplayType(entity.id);
26167   }
26168   function utilEntityRoot(entityType) {
26169     return {
26170       node: "n",
26171       way: "w",
26172       relation: "r"
26173     }[entityType];
26174   }
26175   function utilCombinedTags(entityIDs, graph) {
26176     var tags = {};
26177     var tagCounts = {};
26178     var allKeys = /* @__PURE__ */ new Set();
26179     var entities = entityIDs.map(function(entityID) {
26180       return graph.hasEntity(entityID);
26181     }).filter(Boolean);
26182     entities.forEach(function(entity) {
26183       var keys = Object.keys(entity.tags).filter(Boolean);
26184       keys.forEach(function(key2) {
26185         allKeys.add(key2);
26186       });
26187     });
26188     entities.forEach(function(entity) {
26189       allKeys.forEach(function(key2) {
26190         var value = entity.tags[key2];
26191         if (!tags.hasOwnProperty(key2)) {
26192           tags[key2] = value;
26193         } else {
26194           if (!Array.isArray(tags[key2])) {
26195             if (tags[key2] !== value) {
26196               tags[key2] = [tags[key2], value];
26197             }
26198           } else {
26199             if (tags[key2].indexOf(value) === -1) {
26200               tags[key2].push(value);
26201             }
26202           }
26203         }
26204         var tagHash = key2 + "=" + value;
26205         if (!tagCounts[tagHash])
26206           tagCounts[tagHash] = 0;
26207         tagCounts[tagHash] += 1;
26208       });
26209     });
26210     for (var key in tags) {
26211       if (!Array.isArray(tags[key]))
26212         continue;
26213       tags[key] = tags[key].sort(function(val12, val2) {
26214         var key2 = key2;
26215         var count2 = tagCounts[key2 + "=" + val2];
26216         var count1 = tagCounts[key2 + "=" + val12];
26217         if (count2 !== count1) {
26218           return count2 - count1;
26219         }
26220         if (val2 && val12) {
26221           return val12.localeCompare(val2);
26222         }
26223         return val12 ? 1 : -1;
26224       });
26225     }
26226     return tags;
26227   }
26228   function utilStringQs(str2) {
26229     var i2 = 0;
26230     while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
26231       i2++;
26232     str2 = str2.slice(i2);
26233     return str2.split("&").reduce(function(obj, pair2) {
26234       var parts = pair2.split("=");
26235       if (parts.length === 2) {
26236         obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
26237       }
26238       return obj;
26239     }, {});
26240   }
26241   function utilQsString(obj, noencode) {
26242     function softEncode(s) {
26243       return encodeURIComponent(s).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
26244     }
26245     return Object.keys(obj).sort().map(function(key) {
26246       return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
26247     }).join("&");
26248   }
26249   function utilPrefixDOMProperty(property) {
26250     var prefixes2 = ["webkit", "ms", "moz", "o"];
26251     var i2 = -1;
26252     var n2 = prefixes2.length;
26253     var s = document.body;
26254     if (property in s)
26255       return property;
26256     property = property.slice(0, 1).toUpperCase() + property.slice(1);
26257     while (++i2 < n2) {
26258       if (prefixes2[i2] + property in s) {
26259         return prefixes2[i2] + property;
26260       }
26261     }
26262     return false;
26263   }
26264   function utilPrefixCSSProperty(property) {
26265     var prefixes2 = ["webkit", "ms", "Moz", "O"];
26266     var i2 = -1;
26267     var n2 = prefixes2.length;
26268     var s = document.body.style;
26269     if (property.toLowerCase() in s) {
26270       return property.toLowerCase();
26271     }
26272     while (++i2 < n2) {
26273       if (prefixes2[i2] + property in s) {
26274         return "-" + prefixes2[i2].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
26275       }
26276     }
26277     return false;
26278   }
26279   var transformProperty;
26280   function utilSetTransform(el, x, y, scale) {
26281     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
26282     var translate = utilDetect().opera ? "translate(" + x + "px," + y + "px)" : "translate3d(" + x + "px," + y + "px,0)";
26283     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
26284   }
26285   function utilEditDistance(a, b) {
26286     a = (0, import_diacritics.remove)(a.toLowerCase());
26287     b = (0, import_diacritics.remove)(b.toLowerCase());
26288     if (a.length === 0)
26289       return b.length;
26290     if (b.length === 0)
26291       return a.length;
26292     var matrix = [];
26293     var i2, j2;
26294     for (i2 = 0; i2 <= b.length; i2++) {
26295       matrix[i2] = [i2];
26296     }
26297     for (j2 = 0; j2 <= a.length; j2++) {
26298       matrix[0][j2] = j2;
26299     }
26300     for (i2 = 1; i2 <= b.length; i2++) {
26301       for (j2 = 1; j2 <= a.length; j2++) {
26302         if (b.charAt(i2 - 1) === a.charAt(j2 - 1)) {
26303           matrix[i2][j2] = matrix[i2 - 1][j2 - 1];
26304         } else {
26305           matrix[i2][j2] = Math.min(
26306             matrix[i2 - 1][j2 - 1] + 1,
26307             Math.min(
26308               matrix[i2][j2 - 1] + 1,
26309               matrix[i2 - 1][j2] + 1
26310             )
26311           );
26312         }
26313       }
26314     }
26315     return matrix[b.length][a.length];
26316   }
26317   function utilFastMouse(container) {
26318     var rect = container.getBoundingClientRect();
26319     var rectLeft = rect.left;
26320     var rectTop = rect.top;
26321     var clientLeft = +container.clientLeft;
26322     var clientTop = +container.clientTop;
26323     return function(e) {
26324       return [
26325         e.clientX - rectLeft - clientLeft,
26326         e.clientY - rectTop - clientTop
26327       ];
26328     };
26329   }
26330   function utilAsyncMap(inputs, func, callback) {
26331     var remaining = inputs.length;
26332     var results = [];
26333     var errors = [];
26334     inputs.forEach(function(d, i2) {
26335       func(d, function done(err, data) {
26336         errors[i2] = err;
26337         results[i2] = data;
26338         remaining--;
26339         if (!remaining)
26340           callback(errors, results);
26341       });
26342     });
26343   }
26344   function utilWrap(index, length) {
26345     if (index < 0) {
26346       index += Math.ceil(-index / length) * length;
26347     }
26348     return index % length;
26349   }
26350   function utilFunctor(value) {
26351     if (typeof value === "function")
26352       return value;
26353     return function() {
26354       return value;
26355     };
26356   }
26357   function utilNoAuto(selection2) {
26358     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
26359     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
26360   }
26361   function utilHashcode(str2) {
26362     var hash = 0;
26363     if (str2.length === 0) {
26364       return hash;
26365     }
26366     for (var i2 = 0; i2 < str2.length; i2++) {
26367       var char = str2.charCodeAt(i2);
26368       hash = (hash << 5) - hash + char;
26369       hash = hash & hash;
26370     }
26371     return hash;
26372   }
26373   function utilSafeClassName(str2) {
26374     return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_");
26375   }
26376   function utilUniqueDomId(val) {
26377     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + new Date().getTime().toString();
26378   }
26379   function utilUnicodeCharsCount(str2) {
26380     return Array.from(str2).length;
26381   }
26382   function utilUnicodeCharsTruncated(str2, limit) {
26383     return Array.from(str2).slice(0, limit).join("");
26384   }
26385   function toNumericID(id2) {
26386     var match = id2.match(/^[cnwr](-?\d+)$/);
26387     if (match) {
26388       return parseInt(match[1], 10);
26389     }
26390     return NaN;
26391   }
26392   function compareNumericIDs(left, right) {
26393     if (isNaN(left) && isNaN(right))
26394       return -1;
26395     if (isNaN(left))
26396       return 1;
26397     if (isNaN(right))
26398       return -1;
26399     if (Math.sign(left) !== Math.sign(right))
26400       return -Math.sign(left);
26401     if (Math.sign(left) < 0)
26402       return Math.sign(right - left);
26403     return Math.sign(left - right);
26404   }
26405   function utilCompareIDs(left, right) {
26406     return compareNumericIDs(toNumericID(left), toNumericID(right));
26407   }
26408   function utilOldestID(ids) {
26409     if (ids.length === 0) {
26410       return void 0;
26411     }
26412     var oldestIDIndex = 0;
26413     var oldestID = toNumericID(ids[0]);
26414     for (var i2 = 1; i2 < ids.length; i2++) {
26415       var num = toNumericID(ids[i2]);
26416       if (compareNumericIDs(oldestID, num) === 1) {
26417         oldestIDIndex = i2;
26418         oldestID = num;
26419       }
26420     }
26421     return ids[oldestIDIndex];
26422   }
26423
26424   // modules/osm/entity.js
26425   function osmEntity(attrs) {
26426     if (this instanceof osmEntity)
26427       return;
26428     if (attrs && attrs.type) {
26429       return osmEntity[attrs.type].apply(this, arguments);
26430     } else if (attrs && attrs.id) {
26431       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
26432     }
26433     return new osmEntity().initialize(arguments);
26434   }
26435   osmEntity.id = function(type3) {
26436     return osmEntity.id.fromOSM(type3, osmEntity.id.next[type3]--);
26437   };
26438   osmEntity.id.next = {
26439     changeset: -1,
26440     node: -1,
26441     way: -1,
26442     relation: -1
26443   };
26444   osmEntity.id.fromOSM = function(type3, id2) {
26445     return type3[0] + id2;
26446   };
26447   osmEntity.id.toOSM = function(id2) {
26448     var match = id2.match(/^[cnwr](-?\d+)$/);
26449     if (match) {
26450       return match[1];
26451     }
26452     return "";
26453   };
26454   osmEntity.id.type = function(id2) {
26455     return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
26456   };
26457   osmEntity.key = function(entity) {
26458     return entity.id + "v" + (entity.v || 0);
26459   };
26460   var _deprecatedTagValuesByKey;
26461   osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
26462     if (!_deprecatedTagValuesByKey) {
26463       _deprecatedTagValuesByKey = {};
26464       dataDeprecated.forEach(function(d) {
26465         var oldKeys = Object.keys(d.old);
26466         if (oldKeys.length === 1) {
26467           var oldKey = oldKeys[0];
26468           var oldValue = d.old[oldKey];
26469           if (oldValue !== "*") {
26470             if (!_deprecatedTagValuesByKey[oldKey]) {
26471               _deprecatedTagValuesByKey[oldKey] = [oldValue];
26472             } else {
26473               _deprecatedTagValuesByKey[oldKey].push(oldValue);
26474             }
26475           }
26476         }
26477       });
26478     }
26479     return _deprecatedTagValuesByKey;
26480   };
26481   osmEntity.prototype = {
26482     tags: {},
26483     initialize: function(sources) {
26484       for (var i2 = 0; i2 < sources.length; ++i2) {
26485         var source = sources[i2];
26486         for (var prop in source) {
26487           if (Object.prototype.hasOwnProperty.call(source, prop)) {
26488             if (source[prop] === void 0) {
26489               delete this[prop];
26490             } else {
26491               this[prop] = source[prop];
26492             }
26493           }
26494         }
26495       }
26496       if (!this.id && this.type) {
26497         this.id = osmEntity.id(this.type);
26498       }
26499       if (!this.hasOwnProperty("visible")) {
26500         this.visible = true;
26501       }
26502       if (debug) {
26503         Object.freeze(this);
26504         Object.freeze(this.tags);
26505         if (this.loc)
26506           Object.freeze(this.loc);
26507         if (this.nodes)
26508           Object.freeze(this.nodes);
26509         if (this.members)
26510           Object.freeze(this.members);
26511       }
26512       return this;
26513     },
26514     copy: function(resolver, copies) {
26515       if (copies[this.id])
26516         return copies[this.id];
26517       var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
26518       copies[this.id] = copy2;
26519       return copy2;
26520     },
26521     osmId: function() {
26522       return osmEntity.id.toOSM(this.id);
26523     },
26524     isNew: function() {
26525       var osmId = osmEntity.id.toOSM(this.id);
26526       return osmId.length === 0 || osmId[0] === "-";
26527     },
26528     update: function(attrs) {
26529       return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
26530     },
26531     mergeTags: function(tags) {
26532       var merged = Object.assign({}, this.tags);
26533       var changed = false;
26534       for (var k in tags) {
26535         var t1 = merged[k];
26536         var t2 = tags[k];
26537         if (!t1) {
26538           changed = true;
26539           merged[k] = t2;
26540         } else if (t1 !== t2) {
26541           changed = true;
26542           merged[k] = utilUnicodeCharsTruncated(
26543             utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
26544             255
26545           );
26546         }
26547       }
26548       return changed ? this.update({ tags: merged }) : this;
26549     },
26550     intersects: function(extent, resolver) {
26551       return this.extent(resolver).intersects(extent);
26552     },
26553     hasNonGeometryTags: function() {
26554       return Object.keys(this.tags).some(function(k) {
26555         return k !== "area";
26556       });
26557     },
26558     hasParentRelations: function(resolver) {
26559       return resolver.parentRelations(this).length > 0;
26560     },
26561     hasInterestingTags: function() {
26562       return Object.keys(this.tags).some(osmIsInterestingTag);
26563     },
26564     isHighwayIntersection: function() {
26565       return false;
26566     },
26567     isDegenerate: function() {
26568       return true;
26569     },
26570     deprecatedTags: function(dataDeprecated) {
26571       var tags = this.tags;
26572       if (Object.keys(tags).length === 0)
26573         return [];
26574       var deprecated = [];
26575       dataDeprecated.forEach(function(d) {
26576         var oldKeys = Object.keys(d.old);
26577         if (d.replace) {
26578           var hasExistingValues = Object.keys(d.replace).some(function(replaceKey) {
26579             if (!tags[replaceKey] || d.old[replaceKey])
26580               return false;
26581             var replaceValue = d.replace[replaceKey];
26582             if (replaceValue === "*")
26583               return false;
26584             if (replaceValue === tags[replaceKey])
26585               return false;
26586             return true;
26587           });
26588           if (hasExistingValues)
26589             return;
26590         }
26591         var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
26592           if (!tags[oldKey])
26593             return false;
26594           if (d.old[oldKey] === "*")
26595             return true;
26596           if (d.old[oldKey] === tags[oldKey])
26597             return true;
26598           var vals = tags[oldKey].split(";").filter(Boolean);
26599           if (vals.length === 0) {
26600             return false;
26601           } else if (vals.length > 1) {
26602             return vals.indexOf(d.old[oldKey]) !== -1;
26603           } else {
26604             if (tags[oldKey] === d.old[oldKey]) {
26605               if (d.replace && d.old[oldKey] === d.replace[oldKey]) {
26606                 var replaceKeys = Object.keys(d.replace);
26607                 return !replaceKeys.every(function(replaceKey) {
26608                   return tags[replaceKey] === d.replace[replaceKey];
26609                 });
26610               } else {
26611                 return true;
26612               }
26613             }
26614           }
26615           return false;
26616         });
26617         if (matchesDeprecatedTags) {
26618           deprecated.push(d);
26619         }
26620       });
26621       return deprecated;
26622     }
26623   };
26624
26625   // modules/osm/lanes.js
26626   function osmLanes(entity) {
26627     if (entity.type !== "way")
26628       return null;
26629     if (!entity.tags.highway)
26630       return null;
26631     var tags = entity.tags;
26632     var isOneWay = entity.isOneWay();
26633     var laneCount = getLaneCount(tags, isOneWay);
26634     var maxspeed = parseMaxspeed(tags);
26635     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
26636     var forward = laneDirections.forward;
26637     var backward = laneDirections.backward;
26638     var bothways = laneDirections.bothways;
26639     var turnLanes = {};
26640     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
26641     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
26642     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
26643     var maxspeedLanes = {};
26644     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
26645     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
26646     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
26647     var psvLanes = {};
26648     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
26649     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
26650     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
26651     var busLanes = {};
26652     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
26653     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
26654     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
26655     var taxiLanes = {};
26656     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
26657     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
26658     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
26659     var hovLanes = {};
26660     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
26661     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
26662     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
26663     var hgvLanes = {};
26664     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
26665     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
26666     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
26667     var bicyclewayLanes = {};
26668     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
26669     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
26670     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
26671     var lanesObj = {
26672       forward: [],
26673       backward: [],
26674       unspecified: []
26675     };
26676     mapToLanesObj(lanesObj, turnLanes, "turnLane");
26677     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
26678     mapToLanesObj(lanesObj, psvLanes, "psv");
26679     mapToLanesObj(lanesObj, busLanes, "bus");
26680     mapToLanesObj(lanesObj, taxiLanes, "taxi");
26681     mapToLanesObj(lanesObj, hovLanes, "hov");
26682     mapToLanesObj(lanesObj, hgvLanes, "hgv");
26683     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
26684     return {
26685       metadata: {
26686         count: laneCount,
26687         oneway: isOneWay,
26688         forward,
26689         backward,
26690         bothways,
26691         turnLanes,
26692         maxspeed,
26693         maxspeedLanes,
26694         psvLanes,
26695         busLanes,
26696         taxiLanes,
26697         hovLanes,
26698         hgvLanes,
26699         bicyclewayLanes
26700       },
26701       lanes: lanesObj
26702     };
26703   }
26704   function getLaneCount(tags, isOneWay) {
26705     var count;
26706     if (tags.lanes) {
26707       count = parseInt(tags.lanes, 10);
26708       if (count > 0) {
26709         return count;
26710       }
26711     }
26712     switch (tags.highway) {
26713       case "trunk":
26714       case "motorway":
26715         count = isOneWay ? 2 : 4;
26716         break;
26717       default:
26718         count = isOneWay ? 1 : 2;
26719         break;
26720     }
26721     return count;
26722   }
26723   function parseMaxspeed(tags) {
26724     var maxspeed = tags.maxspeed;
26725     if (!maxspeed)
26726       return;
26727     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
26728     if (!maxspeedRegex.test(maxspeed))
26729       return;
26730     return parseInt(maxspeed, 10);
26731   }
26732   function parseLaneDirections(tags, isOneWay, laneCount) {
26733     var forward = parseInt(tags["lanes:forward"], 10);
26734     var backward = parseInt(tags["lanes:backward"], 10);
26735     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
26736     if (parseInt(tags.oneway, 10) === -1) {
26737       forward = 0;
26738       bothways = 0;
26739       backward = laneCount;
26740     } else if (isOneWay) {
26741       forward = laneCount;
26742       bothways = 0;
26743       backward = 0;
26744     } else if (isNaN(forward) && isNaN(backward)) {
26745       backward = Math.floor((laneCount - bothways) / 2);
26746       forward = laneCount - bothways - backward;
26747     } else if (isNaN(forward)) {
26748       if (backward > laneCount - bothways) {
26749         backward = laneCount - bothways;
26750       }
26751       forward = laneCount - bothways - backward;
26752     } else if (isNaN(backward)) {
26753       if (forward > laneCount - bothways) {
26754         forward = laneCount - bothways;
26755       }
26756       backward = laneCount - bothways - forward;
26757     }
26758     return {
26759       forward,
26760       backward,
26761       bothways
26762     };
26763   }
26764   function parseTurnLanes(tag) {
26765     if (!tag)
26766       return;
26767     var validValues = [
26768       "left",
26769       "slight_left",
26770       "sharp_left",
26771       "through",
26772       "right",
26773       "slight_right",
26774       "sharp_right",
26775       "reverse",
26776       "merge_to_left",
26777       "merge_to_right",
26778       "none"
26779     ];
26780     return tag.split("|").map(function(s) {
26781       if (s === "")
26782         s = "none";
26783       return s.split(";").map(function(d) {
26784         return validValues.indexOf(d) === -1 ? "unknown" : d;
26785       });
26786     });
26787   }
26788   function parseMaxspeedLanes(tag, maxspeed) {
26789     if (!tag)
26790       return;
26791     return tag.split("|").map(function(s) {
26792       if (s === "none")
26793         return s;
26794       var m = parseInt(s, 10);
26795       if (s === "" || m === maxspeed)
26796         return null;
26797       return isNaN(m) ? "unknown" : m;
26798     });
26799   }
26800   function parseMiscLanes(tag) {
26801     if (!tag)
26802       return;
26803     var validValues = [
26804       "yes",
26805       "no",
26806       "designated"
26807     ];
26808     return tag.split("|").map(function(s) {
26809       if (s === "")
26810         s = "no";
26811       return validValues.indexOf(s) === -1 ? "unknown" : s;
26812     });
26813   }
26814   function parseBicycleWay(tag) {
26815     if (!tag)
26816       return;
26817     var validValues = [
26818       "yes",
26819       "no",
26820       "designated",
26821       "lane"
26822     ];
26823     return tag.split("|").map(function(s) {
26824       if (s === "")
26825         s = "no";
26826       return validValues.indexOf(s) === -1 ? "unknown" : s;
26827     });
26828   }
26829   function mapToLanesObj(lanesObj, data, key) {
26830     if (data.forward) {
26831       data.forward.forEach(function(l, i2) {
26832         if (!lanesObj.forward[i2])
26833           lanesObj.forward[i2] = {};
26834         lanesObj.forward[i2][key] = l;
26835       });
26836     }
26837     if (data.backward) {
26838       data.backward.forEach(function(l, i2) {
26839         if (!lanesObj.backward[i2])
26840           lanesObj.backward[i2] = {};
26841         lanesObj.backward[i2][key] = l;
26842       });
26843     }
26844     if (data.unspecified) {
26845       data.unspecified.forEach(function(l, i2) {
26846         if (!lanesObj.unspecified[i2])
26847           lanesObj.unspecified[i2] = {};
26848         lanesObj.unspecified[i2][key] = l;
26849       });
26850     }
26851   }
26852
26853   // modules/osm/way.js
26854   function osmWay() {
26855     if (!(this instanceof osmWay)) {
26856       return new osmWay().initialize(arguments);
26857     } else if (arguments.length) {
26858       this.initialize(arguments);
26859     }
26860   }
26861   osmEntity.way = osmWay;
26862   osmWay.prototype = Object.create(osmEntity.prototype);
26863   Object.assign(osmWay.prototype, {
26864     type: "way",
26865     nodes: [],
26866     copy: function(resolver, copies) {
26867       if (copies[this.id])
26868         return copies[this.id];
26869       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
26870       var nodes = this.nodes.map(function(id2) {
26871         return resolver.entity(id2).copy(resolver, copies).id;
26872       });
26873       copy2 = copy2.update({ nodes });
26874       copies[this.id] = copy2;
26875       return copy2;
26876     },
26877     extent: function(resolver) {
26878       return resolver.transient(this, "extent", function() {
26879         var extent = geoExtent();
26880         for (var i2 = 0; i2 < this.nodes.length; i2++) {
26881           var node = resolver.hasEntity(this.nodes[i2]);
26882           if (node) {
26883             extent._extend(node.extent());
26884           }
26885         }
26886         return extent;
26887       });
26888     },
26889     first: function() {
26890       return this.nodes[0];
26891     },
26892     last: function() {
26893       return this.nodes[this.nodes.length - 1];
26894     },
26895     contains: function(node) {
26896       return this.nodes.indexOf(node) >= 0;
26897     },
26898     affix: function(node) {
26899       if (this.nodes[0] === node)
26900         return "prefix";
26901       if (this.nodes[this.nodes.length - 1] === node)
26902         return "suffix";
26903     },
26904     layer: function() {
26905       if (isFinite(this.tags.layer)) {
26906         return Math.max(-10, Math.min(+this.tags.layer, 10));
26907       }
26908       if (this.tags.covered === "yes")
26909         return -1;
26910       if (this.tags.location === "overground")
26911         return 1;
26912       if (this.tags.location === "underground")
26913         return -1;
26914       if (this.tags.location === "underwater")
26915         return -10;
26916       if (this.tags.power === "line")
26917         return 10;
26918       if (this.tags.power === "minor_line")
26919         return 10;
26920       if (this.tags.aerialway)
26921         return 10;
26922       if (this.tags.bridge)
26923         return 1;
26924       if (this.tags.cutting)
26925         return -1;
26926       if (this.tags.tunnel)
26927         return -1;
26928       if (this.tags.waterway)
26929         return -1;
26930       if (this.tags.man_made === "pipeline")
26931         return -10;
26932       if (this.tags.boundary)
26933         return -10;
26934       return 0;
26935     },
26936     impliedLineWidthMeters: function() {
26937       var averageWidths = {
26938         highway: {
26939           motorway: 5,
26940           motorway_link: 5,
26941           trunk: 4.5,
26942           trunk_link: 4.5,
26943           primary: 4,
26944           secondary: 4,
26945           tertiary: 4,
26946           primary_link: 4,
26947           secondary_link: 4,
26948           tertiary_link: 4,
26949           unclassified: 4,
26950           road: 4,
26951           living_street: 4,
26952           bus_guideway: 4,
26953           pedestrian: 4,
26954           residential: 3.5,
26955           service: 3.5,
26956           track: 3,
26957           cycleway: 2.5,
26958           bridleway: 2,
26959           corridor: 2,
26960           steps: 2,
26961           path: 1.5,
26962           footway: 1.5
26963         },
26964         railway: {
26965           rail: 2.5,
26966           light_rail: 2.5,
26967           tram: 2.5,
26968           subway: 2.5,
26969           monorail: 2.5,
26970           funicular: 2.5,
26971           disused: 2.5,
26972           preserved: 2.5,
26973           miniature: 1.5,
26974           narrow_gauge: 1.5
26975         },
26976         waterway: {
26977           river: 50,
26978           canal: 25,
26979           stream: 5,
26980           tidal_channel: 5,
26981           fish_pass: 2.5,
26982           drain: 2.5,
26983           ditch: 1.5
26984         }
26985       };
26986       for (var key in averageWidths) {
26987         if (this.tags[key] && averageWidths[key][this.tags[key]]) {
26988           var width = averageWidths[key][this.tags[key]];
26989           if (key === "highway") {
26990             var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
26991             if (!laneCount)
26992               laneCount = this.isOneWay() ? 1 : 2;
26993             return width * laneCount;
26994           }
26995           return width;
26996         }
26997       }
26998       return null;
26999     },
27000     isOneWay: function() {
27001       var values = {
27002         "yes": true,
27003         "1": true,
27004         "-1": true,
27005         "reversible": true,
27006         "alternating": true,
27007         "no": false,
27008         "0": false
27009       };
27010       if (values[this.tags.oneway] !== void 0) {
27011         return values[this.tags.oneway];
27012       }
27013       for (var key in this.tags) {
27014         if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
27015           return true;
27016         }
27017       }
27018       return false;
27019     },
27020     sidednessIdentifier: function() {
27021       for (var key in this.tags) {
27022         var value = this.tags[key];
27023         if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
27024           if (osmRightSideIsInsideTags[key][value] === true) {
27025             return key;
27026           } else {
27027             return osmRightSideIsInsideTags[key][value];
27028           }
27029         }
27030       }
27031       return null;
27032     },
27033     isSided: function() {
27034       if (this.tags.two_sided === "yes") {
27035         return false;
27036       }
27037       return this.sidednessIdentifier() !== null;
27038     },
27039     lanes: function() {
27040       return osmLanes(this);
27041     },
27042     isClosed: function() {
27043       return this.nodes.length > 1 && this.first() === this.last();
27044     },
27045     isConvex: function(resolver) {
27046       if (!this.isClosed() || this.isDegenerate())
27047         return null;
27048       var nodes = utilArrayUniq(resolver.childNodes(this));
27049       var coords = nodes.map(function(n2) {
27050         return n2.loc;
27051       });
27052       var curr = 0;
27053       var prev = 0;
27054       for (var i2 = 0; i2 < coords.length; i2++) {
27055         var o = coords[(i2 + 1) % coords.length];
27056         var a = coords[i2];
27057         var b = coords[(i2 + 2) % coords.length];
27058         var res = geoVecCross(a, b, o);
27059         curr = res > 0 ? 1 : res < 0 ? -1 : 0;
27060         if (curr === 0) {
27061           continue;
27062         } else if (prev && curr !== prev) {
27063           return false;
27064         }
27065         prev = curr;
27066       }
27067       return true;
27068     },
27069     tagSuggestingArea: function() {
27070       return osmTagSuggestingArea(this.tags);
27071     },
27072     isArea: function() {
27073       if (this.tags.area === "yes")
27074         return true;
27075       if (!this.isClosed() || this.tags.area === "no")
27076         return false;
27077       return this.tagSuggestingArea() !== null;
27078     },
27079     isDegenerate: function() {
27080       return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
27081     },
27082     areAdjacent: function(n1, n2) {
27083       for (var i2 = 0; i2 < this.nodes.length; i2++) {
27084         if (this.nodes[i2] === n1) {
27085           if (this.nodes[i2 - 1] === n2)
27086             return true;
27087           if (this.nodes[i2 + 1] === n2)
27088             return true;
27089         }
27090       }
27091       return false;
27092     },
27093     geometry: function(graph) {
27094       return graph.transient(this, "geometry", function() {
27095         return this.isArea() ? "area" : "line";
27096       });
27097     },
27098     segments: function(graph) {
27099       function segmentExtent(graph2) {
27100         var n1 = graph2.hasEntity(this.nodes[0]);
27101         var n2 = graph2.hasEntity(this.nodes[1]);
27102         return n1 && n2 && geoExtent([
27103           [
27104             Math.min(n1.loc[0], n2.loc[0]),
27105             Math.min(n1.loc[1], n2.loc[1])
27106           ],
27107           [
27108             Math.max(n1.loc[0], n2.loc[0]),
27109             Math.max(n1.loc[1], n2.loc[1])
27110           ]
27111         ]);
27112       }
27113       return graph.transient(this, "segments", function() {
27114         var segments = [];
27115         for (var i2 = 0; i2 < this.nodes.length - 1; i2++) {
27116           segments.push({
27117             id: this.id + "-" + i2,
27118             wayId: this.id,
27119             index: i2,
27120             nodes: [this.nodes[i2], this.nodes[i2 + 1]],
27121             extent: segmentExtent
27122           });
27123         }
27124         return segments;
27125       });
27126     },
27127     close: function() {
27128       if (this.isClosed() || !this.nodes.length)
27129         return this;
27130       var nodes = this.nodes.slice();
27131       nodes = nodes.filter(noRepeatNodes);
27132       nodes.push(nodes[0]);
27133       return this.update({ nodes });
27134     },
27135     unclose: function() {
27136       if (!this.isClosed())
27137         return this;
27138       var nodes = this.nodes.slice();
27139       var connector = this.first();
27140       var i2 = nodes.length - 1;
27141       while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27142         nodes.splice(i2, 1);
27143         i2 = nodes.length - 1;
27144       }
27145       nodes = nodes.filter(noRepeatNodes);
27146       return this.update({ nodes });
27147     },
27148     addNode: function(id2, index) {
27149       var nodes = this.nodes.slice();
27150       var isClosed = this.isClosed();
27151       var max3 = isClosed ? nodes.length - 1 : nodes.length;
27152       if (index === void 0) {
27153         index = max3;
27154       }
27155       if (index < 0 || index > max3) {
27156         throw new RangeError("index " + index + " out of range 0.." + max3);
27157       }
27158       if (isClosed) {
27159         var connector = this.first();
27160         var i2 = 1;
27161         while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
27162           nodes.splice(i2, 1);
27163           if (index > i2)
27164             index--;
27165         }
27166         i2 = nodes.length - 1;
27167         while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27168           nodes.splice(i2, 1);
27169           if (index > i2)
27170             index--;
27171           i2 = nodes.length - 1;
27172         }
27173       }
27174       nodes.splice(index, 0, id2);
27175       nodes = nodes.filter(noRepeatNodes);
27176       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27177         nodes.push(nodes[0]);
27178       }
27179       return this.update({ nodes });
27180     },
27181     updateNode: function(id2, index) {
27182       var nodes = this.nodes.slice();
27183       var isClosed = this.isClosed();
27184       var max3 = nodes.length - 1;
27185       if (index === void 0 || index < 0 || index > max3) {
27186         throw new RangeError("index " + index + " out of range 0.." + max3);
27187       }
27188       if (isClosed) {
27189         var connector = this.first();
27190         var i2 = 1;
27191         while (i2 < nodes.length && nodes.length > 2 && nodes[i2] === connector) {
27192           nodes.splice(i2, 1);
27193           if (index > i2)
27194             index--;
27195         }
27196         i2 = nodes.length - 1;
27197         while (i2 > 0 && nodes.length > 1 && nodes[i2] === connector) {
27198           nodes.splice(i2, 1);
27199           if (index === i2)
27200             index = 0;
27201           i2 = nodes.length - 1;
27202         }
27203       }
27204       nodes.splice(index, 1, id2);
27205       nodes = nodes.filter(noRepeatNodes);
27206       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27207         nodes.push(nodes[0]);
27208       }
27209       return this.update({ nodes });
27210     },
27211     replaceNode: function(needleID, replacementID) {
27212       var nodes = this.nodes.slice();
27213       var isClosed = this.isClosed();
27214       for (var i2 = 0; i2 < nodes.length; i2++) {
27215         if (nodes[i2] === needleID) {
27216           nodes[i2] = replacementID;
27217         }
27218       }
27219       nodes = nodes.filter(noRepeatNodes);
27220       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27221         nodes.push(nodes[0]);
27222       }
27223       return this.update({ nodes });
27224     },
27225     removeNode: function(id2) {
27226       var nodes = this.nodes.slice();
27227       var isClosed = this.isClosed();
27228       nodes = nodes.filter(function(node) {
27229         return node !== id2;
27230       }).filter(noRepeatNodes);
27231       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
27232         nodes.push(nodes[0]);
27233       }
27234       return this.update({ nodes });
27235     },
27236     asJXON: function(changeset_id) {
27237       var r = {
27238         way: {
27239           "@id": this.osmId(),
27240           "@version": this.version || 0,
27241           nd: this.nodes.map(function(id2) {
27242             return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
27243           }, this),
27244           tag: Object.keys(this.tags).map(function(k) {
27245             return { keyAttributes: { k, v: this.tags[k] } };
27246           }, this)
27247         }
27248       };
27249       if (changeset_id) {
27250         r.way["@changeset"] = changeset_id;
27251       }
27252       return r;
27253     },
27254     asGeoJSON: function(resolver) {
27255       return resolver.transient(this, "GeoJSON", function() {
27256         var coordinates = resolver.childNodes(this).map(function(n2) {
27257           return n2.loc;
27258         });
27259         if (this.isArea() && this.isClosed()) {
27260           return {
27261             type: "Polygon",
27262             coordinates: [coordinates]
27263           };
27264         } else {
27265           return {
27266             type: "LineString",
27267             coordinates
27268           };
27269         }
27270       });
27271     },
27272     area: function(resolver) {
27273       return resolver.transient(this, "area", function() {
27274         var nodes = resolver.childNodes(this);
27275         var json = {
27276           type: "Polygon",
27277           coordinates: [nodes.map(function(n2) {
27278             return n2.loc;
27279           })]
27280         };
27281         if (!this.isClosed() && nodes.length) {
27282           json.coordinates[0].push(nodes[0].loc);
27283         }
27284         var area = area_default(json);
27285         if (area > 2 * Math.PI) {
27286           json.coordinates[0] = json.coordinates[0].reverse();
27287           area = area_default(json);
27288         }
27289         return isNaN(area) ? 0 : area;
27290       });
27291     }
27292   });
27293   function noRepeatNodes(node, i2, arr) {
27294     return i2 === 0 || node !== arr[i2 - 1];
27295   }
27296
27297   // modules/osm/multipolygon.js
27298   function osmOldMultipolygonOuterMemberOfRelation(entity, graph) {
27299     if (entity.type !== "relation" || !entity.isMultipolygon() || Object.keys(entity.tags).filter(osmIsInterestingTag).length > 1) {
27300       return false;
27301     }
27302     var outerMember;
27303     for (var memberIndex in entity.members) {
27304       var member = entity.members[memberIndex];
27305       if (!member.role || member.role === "outer") {
27306         if (outerMember)
27307           return false;
27308         if (member.type !== "way")
27309           return false;
27310         if (!graph.hasEntity(member.id))
27311           return false;
27312         outerMember = graph.entity(member.id);
27313         if (Object.keys(outerMember.tags).filter(osmIsInterestingTag).length === 0) {
27314           return false;
27315         }
27316       }
27317     }
27318     return outerMember;
27319   }
27320   function osmIsOldMultipolygonOuterMember(entity, graph) {
27321     if (entity.type !== "way" || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) {
27322       return false;
27323     }
27324     var parents = graph.parentRelations(entity);
27325     if (parents.length !== 1)
27326       return false;
27327     var parent = parents[0];
27328     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
27329       return false;
27330     }
27331     var members = parent.members, member;
27332     for (var i2 = 0; i2 < members.length; i2++) {
27333       member = members[i2];
27334       if (member.id === entity.id && member.role && member.role !== "outer") {
27335         return false;
27336       }
27337       if (member.id !== entity.id && (!member.role || member.role === "outer")) {
27338         return false;
27339       }
27340     }
27341     return parent;
27342   }
27343   function osmOldMultipolygonOuterMember(entity, graph) {
27344     if (entity.type !== "way")
27345       return false;
27346     var parents = graph.parentRelations(entity);
27347     if (parents.length !== 1)
27348       return false;
27349     var parent = parents[0];
27350     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
27351       return false;
27352     }
27353     var members = parent.members, member, outerMember;
27354     for (var i2 = 0; i2 < members.length; i2++) {
27355       member = members[i2];
27356       if (!member.role || member.role === "outer") {
27357         if (outerMember)
27358           return false;
27359         outerMember = member;
27360       }
27361     }
27362     if (!outerMember)
27363       return false;
27364     var outerEntity = graph.hasEntity(outerMember.id);
27365     if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) {
27366       return false;
27367     }
27368     return outerEntity;
27369   }
27370   function osmJoinWays(toJoin, graph) {
27371     function resolve(member) {
27372       return graph.childNodes(graph.entity(member.id));
27373     }
27374     function reverse(item2) {
27375       var action = actionReverse(item2.id, { reverseOneway: true });
27376       sequences.actions.push(action);
27377       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
27378     }
27379     toJoin = toJoin.filter(function(member) {
27380       return member.type === "way" && graph.hasEntity(member.id);
27381     });
27382     var i2;
27383     var joinAsMembers = true;
27384     for (i2 = 0; i2 < toJoin.length; i2++) {
27385       if (toJoin[i2] instanceof osmWay) {
27386         joinAsMembers = false;
27387         break;
27388       }
27389     }
27390     var sequences = [];
27391     sequences.actions = [];
27392     while (toJoin.length) {
27393       var item = toJoin.shift();
27394       var currWays = [item];
27395       var currNodes = resolve(item).slice();
27396       while (toJoin.length) {
27397         var start2 = currNodes[0];
27398         var end = currNodes[currNodes.length - 1];
27399         var fn = null;
27400         var nodes = null;
27401         for (i2 = 0; i2 < toJoin.length; i2++) {
27402           item = toJoin[i2];
27403           nodes = resolve(item);
27404           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
27405             currWays[0] = reverse(currWays[0]);
27406             currNodes.reverse();
27407             start2 = currNodes[0];
27408             end = currNodes[currNodes.length - 1];
27409           }
27410           if (nodes[0] === end) {
27411             fn = currNodes.push;
27412             nodes = nodes.slice(1);
27413             break;
27414           } else if (nodes[nodes.length - 1] === end) {
27415             fn = currNodes.push;
27416             nodes = nodes.slice(0, -1).reverse();
27417             item = reverse(item);
27418             break;
27419           } else if (nodes[nodes.length - 1] === start2) {
27420             fn = currNodes.unshift;
27421             nodes = nodes.slice(0, -1);
27422             break;
27423           } else if (nodes[0] === start2) {
27424             fn = currNodes.unshift;
27425             nodes = nodes.slice(1).reverse();
27426             item = reverse(item);
27427             break;
27428           } else {
27429             fn = nodes = null;
27430           }
27431         }
27432         if (!nodes) {
27433           break;
27434         }
27435         fn.apply(currWays, [item]);
27436         fn.apply(currNodes, nodes);
27437         toJoin.splice(i2, 1);
27438       }
27439       currWays.nodes = currNodes;
27440       sequences.push(currWays);
27441     }
27442     return sequences;
27443   }
27444
27445   // modules/actions/add_member.js
27446   function actionAddMember(relationId, member, memberIndex, insertPair) {
27447     return function action(graph) {
27448       var relation = graph.entity(relationId);
27449       var isPTv2 = /stop|platform/.test(member.role);
27450       if ((isNaN(memberIndex) || insertPair) && member.type === "way" && !isPTv2) {
27451         graph = addWayMember(relation, graph);
27452       } else {
27453         if (isPTv2 && isNaN(memberIndex)) {
27454           memberIndex = 0;
27455         }
27456         graph = graph.replace(relation.addMember(member, memberIndex));
27457       }
27458       return graph;
27459     };
27460     function addWayMember(relation, graph) {
27461       var groups, tempWay, insertPairIsReversed, item, i2, j2, k;
27462       var PTv2members = [];
27463       var members = [];
27464       for (i2 = 0; i2 < relation.members.length; i2++) {
27465         var m = relation.members[i2];
27466         if (/stop|platform/.test(m.role)) {
27467           PTv2members.push(m);
27468         } else {
27469           members.push(m);
27470         }
27471       }
27472       relation = relation.update({ members });
27473       if (insertPair) {
27474         tempWay = osmWay({ id: "wTemp", nodes: insertPair.nodes });
27475         graph = graph.replace(tempWay);
27476         var tempMember = { id: tempWay.id, type: "way", role: member.role };
27477         var tempRelation = relation.replaceMember({ id: insertPair.originalID }, tempMember, true);
27478         groups = utilArrayGroupBy(tempRelation.members, "type");
27479         groups.way = groups.way || [];
27480         var originalWay = graph.entity(insertPair.originalID);
27481         var insertedWay = graph.entity(insertPair.insertedID);
27482         insertPairIsReversed = originalWay.nodes.length > 0 && insertedWay.nodes.length > 0 && insertedWay.nodes[insertedWay.nodes.length - 1] === originalWay.nodes[0] && originalWay.nodes[originalWay.nodes.length - 1] !== insertedWay.nodes[0];
27483       } else {
27484         groups = utilArrayGroupBy(relation.members, "type");
27485         groups.way = groups.way || [];
27486         groups.way.push(member);
27487       }
27488       members = withIndex(groups.way);
27489       var joined = osmJoinWays(members, graph);
27490       for (i2 = 0; i2 < joined.length; i2++) {
27491         var segment = joined[i2];
27492         var nodes = segment.nodes.slice();
27493         var startIndex = segment[0].index;
27494         for (j2 = 0; j2 < members.length; j2++) {
27495           if (members[j2].index === startIndex) {
27496             break;
27497           }
27498         }
27499         for (k = 0; k < segment.length; k++) {
27500           item = segment[k];
27501           var way = graph.entity(item.id);
27502           if (tempWay && item.id === tempWay.id) {
27503             var reverse = nodes[0].id !== insertPair.nodes[0] ^ insertPairIsReversed;
27504             if (reverse) {
27505               item.pair = [
27506                 { id: insertPair.insertedID, type: "way", role: item.role },
27507                 { id: insertPair.originalID, type: "way", role: item.role }
27508               ];
27509             } else {
27510               item.pair = [
27511                 { id: insertPair.originalID, type: "way", role: item.role },
27512                 { id: insertPair.insertedID, type: "way", role: item.role }
27513               ];
27514             }
27515           }
27516           if (k > 0) {
27517             if (j2 + k >= members.length || item.index !== members[j2 + k].index) {
27518               moveMember(members, item.index, j2 + k);
27519             }
27520           }
27521           nodes.splice(0, way.nodes.length - 1);
27522         }
27523       }
27524       if (tempWay) {
27525         graph = graph.remove(tempWay);
27526       }
27527       var wayMembers = [];
27528       for (i2 = 0; i2 < members.length; i2++) {
27529         item = members[i2];
27530         if (item.index === -1)
27531           continue;
27532         if (item.pair) {
27533           wayMembers.push(item.pair[0]);
27534           wayMembers.push(item.pair[1]);
27535         } else {
27536           wayMembers.push(utilObjectOmit(item, ["index"]));
27537         }
27538       }
27539       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
27540       return graph.replace(relation.update({ members: newMembers }));
27541       function moveMember(arr, findIndex, toIndex) {
27542         var i3;
27543         for (i3 = 0; i3 < arr.length; i3++) {
27544           if (arr[i3].index === findIndex) {
27545             break;
27546           }
27547         }
27548         var item2 = Object.assign({}, arr[i3]);
27549         arr[i3].index = -1;
27550         item2.index = toIndex;
27551         arr.splice(toIndex, 0, item2);
27552       }
27553       function withIndex(arr) {
27554         var result = new Array(arr.length);
27555         for (var i3 = 0; i3 < arr.length; i3++) {
27556           result[i3] = Object.assign({}, arr[i3]);
27557           result[i3].index = i3;
27558         }
27559         return result;
27560       }
27561     }
27562   }
27563
27564   // modules/actions/add_midpoint.js
27565   function actionAddMidpoint(midpoint, node) {
27566     return function(graph) {
27567       graph = graph.replace(node.move(midpoint.loc));
27568       var parents = utilArrayIntersection(
27569         graph.parentWays(graph.entity(midpoint.edge[0])),
27570         graph.parentWays(graph.entity(midpoint.edge[1]))
27571       );
27572       parents.forEach(function(way) {
27573         for (var i2 = 0; i2 < way.nodes.length - 1; i2++) {
27574           if (geoEdgeEqual([way.nodes[i2], way.nodes[i2 + 1]], midpoint.edge)) {
27575             graph = graph.replace(graph.entity(way.id).addNode(node.id, i2 + 1));
27576             return;
27577           }
27578         }
27579       });
27580       return graph;
27581     };
27582   }
27583
27584   // modules/actions/add_vertex.js
27585   function actionAddVertex(wayId, nodeId, index) {
27586     return function(graph) {
27587       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
27588     };
27589   }
27590
27591   // modules/actions/change_member.js
27592   function actionChangeMember(relationId, member, memberIndex) {
27593     return function(graph) {
27594       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
27595     };
27596   }
27597
27598   // modules/actions/change_preset.js
27599   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
27600     return function action(graph) {
27601       var entity = graph.entity(entityID);
27602       var geometry = entity.geometry(graph);
27603       var tags = entity.tags;
27604       if (oldPreset)
27605         tags = oldPreset.unsetTags(tags, geometry, newPreset && newPreset.addTags ? Object.keys(newPreset.addTags) : null);
27606       if (newPreset)
27607         tags = newPreset.setTags(tags, geometry, skipFieldDefaults);
27608       return graph.replace(entity.update({ tags }));
27609     };
27610   }
27611
27612   // modules/actions/change_tags.js
27613   function actionChangeTags(entityId, tags) {
27614     return function(graph) {
27615       var entity = graph.entity(entityId);
27616       return graph.replace(entity.update({ tags }));
27617     };
27618   }
27619
27620   // modules/osm/node.js
27621   var cardinal = {
27622     north: 0,
27623     n: 0,
27624     northnortheast: 22,
27625     nne: 22,
27626     northeast: 45,
27627     ne: 45,
27628     eastnortheast: 67,
27629     ene: 67,
27630     east: 90,
27631     e: 90,
27632     eastsoutheast: 112,
27633     ese: 112,
27634     southeast: 135,
27635     se: 135,
27636     southsoutheast: 157,
27637     sse: 157,
27638     south: 180,
27639     s: 180,
27640     southsouthwest: 202,
27641     ssw: 202,
27642     southwest: 225,
27643     sw: 225,
27644     westsouthwest: 247,
27645     wsw: 247,
27646     west: 270,
27647     w: 270,
27648     westnorthwest: 292,
27649     wnw: 292,
27650     northwest: 315,
27651     nw: 315,
27652     northnorthwest: 337,
27653     nnw: 337
27654   };
27655   function osmNode() {
27656     if (!(this instanceof osmNode)) {
27657       return new osmNode().initialize(arguments);
27658     } else if (arguments.length) {
27659       this.initialize(arguments);
27660     }
27661   }
27662   osmEntity.node = osmNode;
27663   osmNode.prototype = Object.create(osmEntity.prototype);
27664   Object.assign(osmNode.prototype, {
27665     type: "node",
27666     loc: [9999, 9999],
27667     extent: function() {
27668       return new geoExtent(this.loc);
27669     },
27670     geometry: function(graph) {
27671       return graph.transient(this, "geometry", function() {
27672         return graph.isPoi(this) ? "point" : "vertex";
27673       });
27674     },
27675     move: function(loc) {
27676       return this.update({ loc });
27677     },
27678     isDegenerate: function() {
27679       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);
27680     },
27681     directions: function(resolver, projection2) {
27682       var val;
27683       var i2;
27684       if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
27685         val = "all";
27686       } else {
27687         val = (this.tags.direction || "").toLowerCase();
27688         var re2 = /:direction$/i;
27689         var keys = Object.keys(this.tags);
27690         for (i2 = 0; i2 < keys.length; i2++) {
27691           if (re2.test(keys[i2])) {
27692             val = this.tags[keys[i2]].toLowerCase();
27693             break;
27694           }
27695         }
27696       }
27697       if (val === "")
27698         return [];
27699       var values = val.split(";");
27700       var results = [];
27701       values.forEach(function(v) {
27702         if (cardinal[v] !== void 0) {
27703           v = cardinal[v];
27704         }
27705         if (v !== "" && !isNaN(+v)) {
27706           results.push(+v);
27707           return;
27708         }
27709         var lookBackward = this.tags["traffic_sign:backward"] || v === "backward" || v === "both" || v === "all";
27710         var lookForward = this.tags["traffic_sign:forward"] || v === "forward" || v === "both" || v === "all";
27711         if (!lookForward && !lookBackward)
27712           return;
27713         var nodeIds = {};
27714         resolver.parentWays(this).forEach(function(parent) {
27715           var nodes = parent.nodes;
27716           for (i2 = 0; i2 < nodes.length; i2++) {
27717             if (nodes[i2] === this.id) {
27718               if (lookForward && i2 > 0) {
27719                 nodeIds[nodes[i2 - 1]] = true;
27720               }
27721               if (lookBackward && i2 < nodes.length - 1) {
27722                 nodeIds[nodes[i2 + 1]] = true;
27723               }
27724             }
27725           }
27726         }, this);
27727         Object.keys(nodeIds).forEach(function(nodeId) {
27728           results.push(
27729             geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
27730           );
27731         }, this);
27732       }, this);
27733       return utilArrayUniq(results);
27734     },
27735     isCrossing: function() {
27736       return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
27737     },
27738     isEndpoint: function(resolver) {
27739       return resolver.transient(this, "isEndpoint", function() {
27740         var id2 = this.id;
27741         return resolver.parentWays(this).filter(function(parent) {
27742           return !parent.isClosed() && !!parent.affix(id2);
27743         }).length > 0;
27744       });
27745     },
27746     isConnected: function(resolver) {
27747       return resolver.transient(this, "isConnected", function() {
27748         var parents = resolver.parentWays(this);
27749         if (parents.length > 1) {
27750           for (var i2 in parents) {
27751             if (parents[i2].geometry(resolver) === "line" && parents[i2].hasInterestingTags())
27752               return true;
27753           }
27754         } else if (parents.length === 1) {
27755           var way = parents[0];
27756           var nodes = way.nodes.slice();
27757           if (way.isClosed()) {
27758             nodes.pop();
27759           }
27760           return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
27761         }
27762         return false;
27763       });
27764     },
27765     parentIntersectionWays: function(resolver) {
27766       return resolver.transient(this, "parentIntersectionWays", function() {
27767         return resolver.parentWays(this).filter(function(parent) {
27768           return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
27769         });
27770       });
27771     },
27772     isIntersection: function(resolver) {
27773       return this.parentIntersectionWays(resolver).length > 1;
27774     },
27775     isHighwayIntersection: function(resolver) {
27776       return resolver.transient(this, "isHighwayIntersection", function() {
27777         return resolver.parentWays(this).filter(function(parent) {
27778           return parent.tags.highway && parent.geometry(resolver) === "line";
27779         }).length > 1;
27780       });
27781     },
27782     isOnAddressLine: function(resolver) {
27783       return resolver.transient(this, "isOnAddressLine", function() {
27784         return resolver.parentWays(this).filter(function(parent) {
27785           return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
27786         }).length > 0;
27787       });
27788     },
27789     asJXON: function(changeset_id) {
27790       var r = {
27791         node: {
27792           "@id": this.osmId(),
27793           "@lon": this.loc[0],
27794           "@lat": this.loc[1],
27795           "@version": this.version || 0,
27796           tag: Object.keys(this.tags).map(function(k) {
27797             return { keyAttributes: { k, v: this.tags[k] } };
27798           }, this)
27799         }
27800       };
27801       if (changeset_id)
27802         r.node["@changeset"] = changeset_id;
27803       return r;
27804     },
27805     asGeoJSON: function() {
27806       return {
27807         type: "Point",
27808         coordinates: this.loc
27809       };
27810     }
27811   });
27812
27813   // modules/actions/circularize.js
27814   function actionCircularize(wayId, projection2, maxAngle) {
27815     maxAngle = (maxAngle || 20) * Math.PI / 180;
27816     var action = function(graph, t) {
27817       if (t === null || !isFinite(t))
27818         t = 1;
27819       t = Math.min(Math.max(+t, 0), 1);
27820       var way = graph.entity(wayId);
27821       var origNodes = {};
27822       graph.childNodes(way).forEach(function(node2) {
27823         if (!origNodes[node2.id])
27824           origNodes[node2.id] = node2;
27825       });
27826       if (!way.isConvex(graph)) {
27827         graph = action.makeConvex(graph);
27828       }
27829       var nodes = utilArrayUniq(graph.childNodes(way));
27830       var keyNodes = nodes.filter(function(n2) {
27831         return graph.parentWays(n2).length !== 1;
27832       });
27833       var points = nodes.map(function(n2) {
27834         return projection2(n2.loc);
27835       });
27836       var keyPoints = keyNodes.map(function(n2) {
27837         return projection2(n2.loc);
27838       });
27839       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
27840       var radius = median(points, function(p) {
27841         return geoVecLength(centroid, p);
27842       });
27843       var sign2 = area_default3(points) > 0 ? 1 : -1;
27844       var ids, i2, j2, k;
27845       if (!keyNodes.length) {
27846         keyNodes = [nodes[0]];
27847         keyPoints = [points[0]];
27848       }
27849       if (keyNodes.length === 1) {
27850         var index = nodes.indexOf(keyNodes[0]);
27851         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
27852         keyNodes.push(nodes[oppositeIndex]);
27853         keyPoints.push(points[oppositeIndex]);
27854       }
27855       for (i2 = 0; i2 < keyPoints.length; i2++) {
27856         var nextKeyNodeIndex = (i2 + 1) % keyNodes.length;
27857         var startNode = keyNodes[i2];
27858         var endNode = keyNodes[nextKeyNodeIndex];
27859         var startNodeIndex = nodes.indexOf(startNode);
27860         var endNodeIndex = nodes.indexOf(endNode);
27861         var numberNewPoints = -1;
27862         var indexRange = endNodeIndex - startNodeIndex;
27863         var nearNodes = {};
27864         var inBetweenNodes = [];
27865         var startAngle, endAngle, totalAngle, eachAngle;
27866         var angle2, loc, node, origNode;
27867         if (indexRange < 0) {
27868           indexRange += nodes.length;
27869         }
27870         var distance = geoVecLength(centroid, keyPoints[i2]) || 1e-4;
27871         keyPoints[i2] = [
27872           centroid[0] + (keyPoints[i2][0] - centroid[0]) / distance * radius,
27873           centroid[1] + (keyPoints[i2][1] - centroid[1]) / distance * radius
27874         ];
27875         loc = projection2.invert(keyPoints[i2]);
27876         node = keyNodes[i2];
27877         origNode = origNodes[node.id];
27878         node = node.move(geoVecInterp(origNode.loc, loc, t));
27879         graph = graph.replace(node);
27880         startAngle = Math.atan2(keyPoints[i2][1] - centroid[1], keyPoints[i2][0] - centroid[0]);
27881         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
27882         totalAngle = endAngle - startAngle;
27883         if (totalAngle * sign2 > 0) {
27884           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
27885         }
27886         do {
27887           numberNewPoints++;
27888           eachAngle = totalAngle / (indexRange + numberNewPoints);
27889         } while (Math.abs(eachAngle) > maxAngle);
27890         for (j2 = 1; j2 < indexRange; j2++) {
27891           angle2 = startAngle + j2 * eachAngle;
27892           loc = projection2.invert([
27893             centroid[0] + Math.cos(angle2) * radius,
27894             centroid[1] + Math.sin(angle2) * radius
27895           ]);
27896           node = nodes[(j2 + startNodeIndex) % nodes.length];
27897           origNode = origNodes[node.id];
27898           nearNodes[node.id] = angle2;
27899           node = node.move(geoVecInterp(origNode.loc, loc, t));
27900           graph = graph.replace(node);
27901         }
27902         for (j2 = 0; j2 < numberNewPoints; j2++) {
27903           angle2 = startAngle + (indexRange + j2) * eachAngle;
27904           loc = projection2.invert([
27905             centroid[0] + Math.cos(angle2) * radius,
27906             centroid[1] + Math.sin(angle2) * radius
27907           ]);
27908           var min3 = Infinity;
27909           for (var nodeId in nearNodes) {
27910             var nearAngle = nearNodes[nodeId];
27911             var dist = Math.abs(nearAngle - angle2);
27912             if (dist < min3) {
27913               min3 = dist;
27914               origNode = origNodes[nodeId];
27915             }
27916           }
27917           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t) });
27918           graph = graph.replace(node);
27919           nodes.splice(endNodeIndex + j2, 0, node);
27920           inBetweenNodes.push(node.id);
27921         }
27922         if (indexRange === 1 && inBetweenNodes.length) {
27923           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
27924           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
27925           var wayDirection1 = endIndex1 - startIndex1;
27926           if (wayDirection1 < -1) {
27927             wayDirection1 = 1;
27928           }
27929           var parentWays = graph.parentWays(keyNodes[i2]);
27930           for (j2 = 0; j2 < parentWays.length; j2++) {
27931             var sharedWay = parentWays[j2];
27932             if (sharedWay === way)
27933               continue;
27934             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
27935               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
27936               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
27937               var wayDirection2 = endIndex2 - startIndex2;
27938               var insertAt = endIndex2;
27939               if (wayDirection2 < -1) {
27940                 wayDirection2 = 1;
27941               }
27942               if (wayDirection1 !== wayDirection2) {
27943                 inBetweenNodes.reverse();
27944                 insertAt = startIndex2;
27945               }
27946               for (k = 0; k < inBetweenNodes.length; k++) {
27947                 sharedWay = sharedWay.addNode(inBetweenNodes[k], insertAt + k);
27948               }
27949               graph = graph.replace(sharedWay);
27950             }
27951           }
27952         }
27953       }
27954       ids = nodes.map(function(n2) {
27955         return n2.id;
27956       });
27957       ids.push(ids[0]);
27958       way = way.update({ nodes: ids });
27959       graph = graph.replace(way);
27960       return graph;
27961     };
27962     action.makeConvex = function(graph) {
27963       var way = graph.entity(wayId);
27964       var nodes = utilArrayUniq(graph.childNodes(way));
27965       var points = nodes.map(function(n2) {
27966         return projection2(n2.loc);
27967       });
27968       var sign2 = area_default3(points) > 0 ? 1 : -1;
27969       var hull = hull_default(points);
27970       var i2, j2;
27971       if (sign2 === -1) {
27972         nodes.reverse();
27973         points.reverse();
27974       }
27975       for (i2 = 0; i2 < hull.length - 1; i2++) {
27976         var startIndex = points.indexOf(hull[i2]);
27977         var endIndex = points.indexOf(hull[i2 + 1]);
27978         var indexRange = endIndex - startIndex;
27979         if (indexRange < 0) {
27980           indexRange += nodes.length;
27981         }
27982         for (j2 = 1; j2 < indexRange; j2++) {
27983           var point = geoVecInterp(hull[i2], hull[i2 + 1], j2 / indexRange);
27984           var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point));
27985           graph = graph.replace(node);
27986         }
27987       }
27988       return graph;
27989     };
27990     action.disabled = function(graph) {
27991       if (!graph.entity(wayId).isClosed()) {
27992         return "not_closed";
27993       }
27994       var way = graph.entity(wayId);
27995       var nodes = utilArrayUniq(graph.childNodes(way));
27996       var points = nodes.map(function(n2) {
27997         return projection2(n2.loc);
27998       });
27999       var hull = hull_default(points);
28000       var epsilonAngle = Math.PI / 180;
28001       if (hull.length !== points.length || hull.length < 3) {
28002         return false;
28003       }
28004       var centroid = centroid_default2(points);
28005       var radius = geoVecLengthSquare(centroid, points[0]);
28006       var i2, actualPoint;
28007       for (i2 = 0; i2 < hull.length; i2++) {
28008         actualPoint = hull[i2];
28009         var actualDist = geoVecLengthSquare(actualPoint, centroid);
28010         var diff = Math.abs(actualDist - radius);
28011         if (diff > 0.05 * radius) {
28012           return false;
28013         }
28014       }
28015       for (i2 = 0; i2 < hull.length; i2++) {
28016         actualPoint = hull[i2];
28017         var nextPoint = hull[(i2 + 1) % hull.length];
28018         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
28019         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
28020         var angle2 = endAngle - startAngle;
28021         if (angle2 < 0) {
28022           angle2 = -angle2;
28023         }
28024         if (angle2 > Math.PI) {
28025           angle2 = 2 * Math.PI - angle2;
28026         }
28027         if (angle2 > maxAngle + epsilonAngle) {
28028           return false;
28029         }
28030       }
28031       return "already_circular";
28032     };
28033     action.transitionable = true;
28034     return action;
28035   }
28036
28037   // modules/actions/delete_way.js
28038   function actionDeleteWay(wayID) {
28039     function canDeleteNode(node, graph) {
28040       if (graph.parentWays(node).length || graph.parentRelations(node).length)
28041         return false;
28042       var geometries = osmNodeGeometriesForTags(node.tags);
28043       if (geometries.point)
28044         return false;
28045       if (geometries.vertex)
28046         return true;
28047       return !node.hasInterestingTags();
28048     }
28049     var action = function(graph) {
28050       var way = graph.entity(wayID);
28051       graph.parentRelations(way).forEach(function(parent) {
28052         parent = parent.removeMembersWithID(wayID);
28053         graph = graph.replace(parent);
28054         if (parent.isDegenerate()) {
28055           graph = actionDeleteRelation(parent.id)(graph);
28056         }
28057       });
28058       new Set(way.nodes).forEach(function(nodeID) {
28059         graph = graph.replace(way.removeNode(nodeID));
28060         var node = graph.entity(nodeID);
28061         if (canDeleteNode(node, graph)) {
28062           graph = graph.remove(node);
28063         }
28064       });
28065       return graph.remove(way);
28066     };
28067     return action;
28068   }
28069
28070   // modules/actions/delete_multiple.js
28071   function actionDeleteMultiple(ids) {
28072     var actions = {
28073       way: actionDeleteWay,
28074       node: actionDeleteNode,
28075       relation: actionDeleteRelation
28076     };
28077     var action = function(graph) {
28078       ids.forEach(function(id2) {
28079         if (graph.hasEntity(id2)) {
28080           graph = actions[graph.entity(id2).type](id2)(graph);
28081         }
28082       });
28083       return graph;
28084     };
28085     return action;
28086   }
28087
28088   // modules/actions/delete_relation.js
28089   function actionDeleteRelation(relationID, allowUntaggedMembers) {
28090     function canDeleteEntity(entity, graph) {
28091       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
28092     }
28093     var action = function(graph) {
28094       var relation = graph.entity(relationID);
28095       graph.parentRelations(relation).forEach(function(parent) {
28096         parent = parent.removeMembersWithID(relationID);
28097         graph = graph.replace(parent);
28098         if (parent.isDegenerate()) {
28099           graph = actionDeleteRelation(parent.id)(graph);
28100         }
28101       });
28102       var memberIDs = utilArrayUniq(relation.members.map(function(m) {
28103         return m.id;
28104       }));
28105       memberIDs.forEach(function(memberID) {
28106         graph = graph.replace(relation.removeMembersWithID(memberID));
28107         var entity = graph.entity(memberID);
28108         if (canDeleteEntity(entity, graph)) {
28109           graph = actionDeleteMultiple([memberID])(graph);
28110         }
28111       });
28112       return graph.remove(relation);
28113     };
28114     return action;
28115   }
28116
28117   // modules/actions/delete_node.js
28118   function actionDeleteNode(nodeId) {
28119     var action = function(graph) {
28120       var node = graph.entity(nodeId);
28121       graph.parentWays(node).forEach(function(parent) {
28122         parent = parent.removeNode(nodeId);
28123         graph = graph.replace(parent);
28124         if (parent.isDegenerate()) {
28125           graph = actionDeleteWay(parent.id)(graph);
28126         }
28127       });
28128       graph.parentRelations(node).forEach(function(parent) {
28129         parent = parent.removeMembersWithID(nodeId);
28130         graph = graph.replace(parent);
28131         if (parent.isDegenerate()) {
28132           graph = actionDeleteRelation(parent.id)(graph);
28133         }
28134       });
28135       return graph.remove(node);
28136     };
28137     return action;
28138   }
28139
28140   // modules/actions/connect.js
28141   function actionConnect(nodeIDs) {
28142     var action = function(graph) {
28143       var survivor;
28144       var node;
28145       var parents;
28146       var i2, j2;
28147       nodeIDs.reverse();
28148       var interestingIDs = [];
28149       for (i2 = 0; i2 < nodeIDs.length; i2++) {
28150         node = graph.entity(nodeIDs[i2]);
28151         if (node.hasInterestingTags()) {
28152           if (!node.isNew()) {
28153             interestingIDs.push(node.id);
28154           }
28155         }
28156       }
28157       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
28158       for (i2 = 0; i2 < nodeIDs.length; i2++) {
28159         node = graph.entity(nodeIDs[i2]);
28160         if (node.id === survivor.id)
28161           continue;
28162         parents = graph.parentWays(node);
28163         for (j2 = 0; j2 < parents.length; j2++) {
28164           graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
28165         }
28166         parents = graph.parentRelations(node);
28167         for (j2 = 0; j2 < parents.length; j2++) {
28168           graph = graph.replace(parents[j2].replaceMember(node, survivor));
28169         }
28170         survivor = survivor.mergeTags(node.tags);
28171         graph = actionDeleteNode(node.id)(graph);
28172       }
28173       graph = graph.replace(survivor);
28174       parents = graph.parentWays(survivor);
28175       for (i2 = 0; i2 < parents.length; i2++) {
28176         if (parents[i2].isDegenerate()) {
28177           graph = actionDeleteWay(parents[i2].id)(graph);
28178         }
28179       }
28180       return graph;
28181     };
28182     action.disabled = function(graph) {
28183       var seen = {};
28184       var restrictionIDs = [];
28185       var survivor;
28186       var node, way;
28187       var relations, relation, role;
28188       var i2, j2, k;
28189       survivor = graph.entity(utilOldestID(nodeIDs));
28190       for (i2 = 0; i2 < nodeIDs.length; i2++) {
28191         node = graph.entity(nodeIDs[i2]);
28192         relations = graph.parentRelations(node);
28193         for (j2 = 0; j2 < relations.length; j2++) {
28194           relation = relations[j2];
28195           role = relation.memberById(node.id).role || "";
28196           if (relation.hasFromViaTo()) {
28197             restrictionIDs.push(relation.id);
28198           }
28199           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
28200             return "relation";
28201           } else {
28202             seen[relation.id] = role;
28203           }
28204         }
28205       }
28206       for (i2 = 0; i2 < nodeIDs.length; i2++) {
28207         node = graph.entity(nodeIDs[i2]);
28208         var parents = graph.parentWays(node);
28209         for (j2 = 0; j2 < parents.length; j2++) {
28210           var parent = parents[j2];
28211           relations = graph.parentRelations(parent);
28212           for (k = 0; k < relations.length; k++) {
28213             relation = relations[k];
28214             if (relation.hasFromViaTo()) {
28215               restrictionIDs.push(relation.id);
28216             }
28217           }
28218         }
28219       }
28220       restrictionIDs = utilArrayUniq(restrictionIDs);
28221       for (i2 = 0; i2 < restrictionIDs.length; i2++) {
28222         relation = graph.entity(restrictionIDs[i2]);
28223         if (!relation.isComplete(graph))
28224           continue;
28225         var memberWays = relation.members.filter(function(m) {
28226           return m.type === "way";
28227         }).map(function(m) {
28228           return graph.entity(m.id);
28229         });
28230         memberWays = utilArrayUniq(memberWays);
28231         var f2 = relation.memberByRole("from");
28232         var t = relation.memberByRole("to");
28233         var isUturn = f2.id === t.id;
28234         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
28235         for (j2 = 0; j2 < relation.members.length; j2++) {
28236           collectNodes(relation.members[j2], nodes);
28237         }
28238         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
28239         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
28240         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
28241         nodes.from = nodes.from.filter(filter2);
28242         nodes.via = nodes.via.filter(filter2);
28243         nodes.to = nodes.to.filter(filter2);
28244         var connectFrom = false;
28245         var connectVia = false;
28246         var connectTo = false;
28247         var connectKeyFrom = false;
28248         var connectKeyTo = false;
28249         for (j2 = 0; j2 < nodeIDs.length; j2++) {
28250           var n2 = nodeIDs[j2];
28251           if (nodes.from.indexOf(n2) !== -1) {
28252             connectFrom = true;
28253           }
28254           if (nodes.via.indexOf(n2) !== -1) {
28255             connectVia = true;
28256           }
28257           if (nodes.to.indexOf(n2) !== -1) {
28258             connectTo = true;
28259           }
28260           if (nodes.keyfrom.indexOf(n2) !== -1) {
28261             connectKeyFrom = true;
28262           }
28263           if (nodes.keyto.indexOf(n2) !== -1) {
28264             connectKeyTo = true;
28265           }
28266         }
28267         if (connectFrom && connectTo && !isUturn) {
28268           return "restriction";
28269         }
28270         if (connectFrom && connectVia) {
28271           return "restriction";
28272         }
28273         if (connectTo && connectVia) {
28274           return "restriction";
28275         }
28276         if (connectKeyFrom || connectKeyTo) {
28277           if (nodeIDs.length !== 2) {
28278             return "restriction";
28279           }
28280           var n0 = null;
28281           var n1 = null;
28282           for (j2 = 0; j2 < memberWays.length; j2++) {
28283             way = memberWays[j2];
28284             if (way.contains(nodeIDs[0])) {
28285               n0 = nodeIDs[0];
28286             }
28287             if (way.contains(nodeIDs[1])) {
28288               n1 = nodeIDs[1];
28289             }
28290           }
28291           if (n0 && n1) {
28292             var ok = false;
28293             for (j2 = 0; j2 < memberWays.length; j2++) {
28294               way = memberWays[j2];
28295               if (way.areAdjacent(n0, n1)) {
28296                 ok = true;
28297                 break;
28298               }
28299             }
28300             if (!ok) {
28301               return "restriction";
28302             }
28303           }
28304         }
28305         for (j2 = 0; j2 < memberWays.length; j2++) {
28306           way = memberWays[j2].update({});
28307           for (k = 0; k < nodeIDs.length; k++) {
28308             if (nodeIDs[k] === survivor.id)
28309               continue;
28310             if (way.areAdjacent(nodeIDs[k], survivor.id)) {
28311               way = way.removeNode(nodeIDs[k]);
28312             } else {
28313               way = way.replaceNode(nodeIDs[k], survivor.id);
28314             }
28315           }
28316           if (way.isDegenerate()) {
28317             return "restriction";
28318           }
28319         }
28320       }
28321       return false;
28322       function hasDuplicates(n3, i3, arr) {
28323         return arr.indexOf(n3) !== arr.lastIndexOf(n3);
28324       }
28325       function keyNodeFilter(froms, tos) {
28326         return function(n3) {
28327           return froms.indexOf(n3) === -1 && tos.indexOf(n3) === -1;
28328         };
28329       }
28330       function collectNodes(member, collection) {
28331         var entity = graph.hasEntity(member.id);
28332         if (!entity)
28333           return;
28334         var role2 = member.role || "";
28335         if (!collection[role2]) {
28336           collection[role2] = [];
28337         }
28338         if (member.type === "node") {
28339           collection[role2].push(member.id);
28340           if (role2 === "via") {
28341             collection.keyfrom.push(member.id);
28342             collection.keyto.push(member.id);
28343           }
28344         } else if (member.type === "way") {
28345           collection[role2].push.apply(collection[role2], entity.nodes);
28346           if (role2 === "from" || role2 === "via") {
28347             collection.keyfrom.push(entity.first());
28348             collection.keyfrom.push(entity.last());
28349           }
28350           if (role2 === "to" || role2 === "via") {
28351             collection.keyto.push(entity.first());
28352             collection.keyto.push(entity.last());
28353           }
28354         }
28355       }
28356     };
28357     return action;
28358   }
28359
28360   // modules/actions/copy_entities.js
28361   function actionCopyEntities(ids, fromGraph) {
28362     var _copies = {};
28363     var action = function(graph) {
28364       ids.forEach(function(id3) {
28365         fromGraph.entity(id3).copy(fromGraph, _copies);
28366       });
28367       for (var id2 in _copies) {
28368         graph = graph.replace(_copies[id2]);
28369       }
28370       return graph;
28371     };
28372     action.copies = function() {
28373       return _copies;
28374     };
28375     return action;
28376   }
28377
28378   // modules/actions/delete_member.js
28379   function actionDeleteMember(relationId, memberIndex) {
28380     return function(graph) {
28381       var relation = graph.entity(relationId).removeMember(memberIndex);
28382       graph = graph.replace(relation);
28383       if (relation.isDegenerate()) {
28384         graph = actionDeleteRelation(relation.id)(graph);
28385       }
28386       return graph;
28387     };
28388   }
28389
28390   // modules/actions/discard_tags.js
28391   function actionDiscardTags(difference, discardTags) {
28392     discardTags = discardTags || {};
28393     return (graph) => {
28394       difference.modified().forEach(checkTags);
28395       difference.created().forEach(checkTags);
28396       return graph;
28397       function checkTags(entity) {
28398         const keys = Object.keys(entity.tags);
28399         let didDiscard = false;
28400         let tags = {};
28401         for (let i2 = 0; i2 < keys.length; i2++) {
28402           const k = keys[i2];
28403           if (discardTags[k] || !entity.tags[k]) {
28404             didDiscard = true;
28405           } else {
28406             tags[k] = entity.tags[k];
28407           }
28408         }
28409         if (didDiscard) {
28410           graph = graph.replace(entity.update({ tags }));
28411         }
28412       }
28413     };
28414   }
28415
28416   // modules/actions/disconnect.js
28417   function actionDisconnect(nodeId, newNodeId) {
28418     var wayIds;
28419     var disconnectableRelationTypes = {
28420       "associatedStreet": true,
28421       "enforcement": true,
28422       "site": true
28423     };
28424     var action = function(graph) {
28425       var node = graph.entity(nodeId);
28426       var connections = action.connections(graph);
28427       connections.forEach(function(connection) {
28428         var way = graph.entity(connection.wayID);
28429         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
28430         graph = graph.replace(newNode);
28431         if (connection.index === 0 && way.isArea()) {
28432           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
28433         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
28434           graph = graph.replace(way.unclose().addNode(newNode.id));
28435         } else {
28436           graph = graph.replace(way.updateNode(newNode.id, connection.index));
28437         }
28438       });
28439       return graph;
28440     };
28441     action.connections = function(graph) {
28442       var candidates = [];
28443       var keeping = false;
28444       var parentWays = graph.parentWays(graph.entity(nodeId));
28445       var way, waynode;
28446       for (var i2 = 0; i2 < parentWays.length; i2++) {
28447         way = parentWays[i2];
28448         if (wayIds && wayIds.indexOf(way.id) === -1) {
28449           keeping = true;
28450           continue;
28451         }
28452         if (way.isArea() && way.nodes[0] === nodeId) {
28453           candidates.push({ wayID: way.id, index: 0 });
28454         } else {
28455           for (var j2 = 0; j2 < way.nodes.length; j2++) {
28456             waynode = way.nodes[j2];
28457             if (waynode === nodeId) {
28458               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
28459                 continue;
28460               }
28461               candidates.push({ wayID: way.id, index: j2 });
28462             }
28463           }
28464         }
28465       }
28466       return keeping ? candidates : candidates.slice(1);
28467     };
28468     action.disabled = function(graph) {
28469       var connections = action.connections(graph);
28470       if (connections.length === 0)
28471         return "not_connected";
28472       var parentWays = graph.parentWays(graph.entity(nodeId));
28473       var seenRelationIds = {};
28474       var sharedRelation;
28475       parentWays.forEach(function(way) {
28476         var relations = graph.parentRelations(way);
28477         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
28478           if (relation.id in seenRelationIds) {
28479             if (wayIds) {
28480               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
28481                 sharedRelation = relation;
28482               }
28483             } else {
28484               sharedRelation = relation;
28485             }
28486           } else {
28487             seenRelationIds[relation.id] = way.id;
28488           }
28489         });
28490       });
28491       if (sharedRelation)
28492         return "relation";
28493     };
28494     action.limitWays = function(val) {
28495       if (!arguments.length)
28496         return wayIds;
28497       wayIds = val;
28498       return action;
28499     };
28500     return action;
28501   }
28502
28503   // modules/actions/extract.js
28504   function actionExtract(entityID, projection2) {
28505     var extractedNodeID;
28506     var action = function(graph) {
28507       var entity = graph.entity(entityID);
28508       if (entity.type === "node") {
28509         return extractFromNode(entity, graph);
28510       }
28511       return extractFromWayOrRelation(entity, graph);
28512     };
28513     function extractFromNode(node, graph) {
28514       extractedNodeID = node.id;
28515       var replacement = osmNode({ loc: node.loc });
28516       graph = graph.replace(replacement);
28517       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
28518         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
28519       }, graph);
28520       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
28521         return accGraph.replace(parentRel.replaceMember(node, replacement));
28522       }, graph);
28523     }
28524     function extractFromWayOrRelation(entity, graph) {
28525       var fromGeometry = entity.geometry(graph);
28526       var keysToCopyAndRetain = ["source", "wheelchair"];
28527       var keysToRetain = ["area"];
28528       var buildingKeysToRetain = ["architect", "building", "height", "layer"];
28529       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
28530       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
28531       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
28532         extractedLoc = entity.extent(graph).center();
28533       }
28534       var indoorAreaValues = {
28535         area: true,
28536         corridor: true,
28537         elevator: true,
28538         level: true,
28539         room: true
28540       };
28541       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
28542       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
28543       var entityTags = Object.assign({}, entity.tags);
28544       var pointTags = {};
28545       for (var key in entityTags) {
28546         if (entity.type === "relation" && key === "type") {
28547           continue;
28548         }
28549         if (keysToRetain.indexOf(key) !== -1) {
28550           continue;
28551         }
28552         if (isBuilding) {
28553           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
28554             continue;
28555         }
28556         if (isIndoorArea && key === "indoor") {
28557           continue;
28558         }
28559         pointTags[key] = entityTags[key];
28560         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
28561           continue;
28562         } else if (isIndoorArea && key === "level") {
28563           continue;
28564         }
28565         delete entityTags[key];
28566       }
28567       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
28568         entityTags.area = "yes";
28569       }
28570       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
28571       graph = graph.replace(replacement);
28572       extractedNodeID = replacement.id;
28573       return graph.replace(entity.update({ tags: entityTags }));
28574     }
28575     action.getExtractedNodeID = function() {
28576       return extractedNodeID;
28577     };
28578     return action;
28579   }
28580
28581   // modules/actions/join.js
28582   function actionJoin(ids) {
28583     function groupEntitiesByGeometry(graph) {
28584       var entities = ids.map(function(id2) {
28585         return graph.entity(id2);
28586       });
28587       return Object.assign(
28588         { line: [] },
28589         utilArrayGroupBy(entities, function(entity) {
28590           return entity.geometry(graph);
28591         })
28592       );
28593     }
28594     var action = function(graph) {
28595       var ways = ids.map(graph.entity, graph);
28596       var survivorID = utilOldestID(ways.map((way) => way.id));
28597       ways.sort(function(a, b) {
28598         var aSided = a.isSided();
28599         var bSided = b.isSided();
28600         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
28601       });
28602       var sequences = osmJoinWays(ways, graph);
28603       var joined = sequences[0];
28604       graph = sequences.actions.reduce(function(g, action2) {
28605         return action2(g);
28606       }, graph);
28607       var survivor = graph.entity(survivorID);
28608       survivor = survivor.update({ nodes: joined.nodes.map(function(n2) {
28609         return n2.id;
28610       }) });
28611       graph = graph.replace(survivor);
28612       joined.forEach(function(way) {
28613         if (way.id === survivorID)
28614           return;
28615         graph.parentRelations(way).forEach(function(parent) {
28616           graph = graph.replace(parent.replaceMember(way, survivor));
28617         });
28618         survivor = survivor.mergeTags(way.tags);
28619         graph = graph.replace(survivor);
28620         graph = actionDeleteWay(way.id)(graph);
28621       });
28622       function checkForSimpleMultipolygon() {
28623         if (!survivor.isClosed())
28624           return;
28625         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
28626           return multipolygon2.members.length === 1;
28627         });
28628         if (multipolygons.length !== 1)
28629           return;
28630         var multipolygon = multipolygons[0];
28631         for (var key in survivor.tags) {
28632           if (multipolygon.tags[key] && multipolygon.tags[key] !== survivor.tags[key])
28633             return;
28634         }
28635         survivor = survivor.mergeTags(multipolygon.tags);
28636         graph = graph.replace(survivor);
28637         graph = actionDeleteRelation(multipolygon.id, true)(graph);
28638         var tags = Object.assign({}, survivor.tags);
28639         if (survivor.geometry(graph) !== "area") {
28640           tags.area = "yes";
28641         }
28642         delete tags.type;
28643         survivor = survivor.update({ tags });
28644         graph = graph.replace(survivor);
28645       }
28646       checkForSimpleMultipolygon();
28647       return graph;
28648     };
28649     action.resultingWayNodesLength = function(graph) {
28650       return ids.reduce(function(count, id2) {
28651         return count + graph.entity(id2).nodes.length;
28652       }, 0) - ids.length - 1;
28653     };
28654     action.disabled = function(graph) {
28655       var geometries = groupEntitiesByGeometry(graph);
28656       if (ids.length < 2 || ids.length !== geometries.line.length) {
28657         return "not_eligible";
28658       }
28659       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
28660       if (joined.length > 1) {
28661         return "not_adjacent";
28662       }
28663       var i2;
28664       var sortedParentRelations = function(id2) {
28665         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a, b) => a.id - b.id);
28666       };
28667       var relsA = sortedParentRelations(ids[0]);
28668       for (i2 = 1; i2 < ids.length; i2++) {
28669         var relsB = sortedParentRelations(ids[i2]);
28670         if (!utilArrayIdentical(relsA, relsB)) {
28671           return "conflicting_relations";
28672         }
28673       }
28674       for (i2 = 0; i2 < ids.length - 1; i2++) {
28675         for (var j2 = i2 + 1; j2 < ids.length; j2++) {
28676           var path1 = graph.childNodes(graph.entity(ids[i2])).map(function(e) {
28677             return e.loc;
28678           });
28679           var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e) {
28680             return e.loc;
28681           });
28682           var intersections = geoPathIntersections(path1, path2);
28683           var common = utilArrayIntersection(
28684             joined[0].nodes.map(function(n2) {
28685               return n2.loc.toString();
28686             }),
28687             intersections.map(function(n2) {
28688               return n2.toString();
28689             })
28690           );
28691           if (common.length !== intersections.length) {
28692             return "paths_intersect";
28693           }
28694         }
28695       }
28696       var nodeIds = joined[0].nodes.map(function(n2) {
28697         return n2.id;
28698       }).slice(1, -1);
28699       var relation;
28700       var tags = {};
28701       var conflicting = false;
28702       joined[0].forEach(function(way) {
28703         var parents = graph.parentRelations(way);
28704         parents.forEach(function(parent) {
28705           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m) {
28706             return nodeIds.indexOf(m.id) >= 0;
28707           })) {
28708             relation = parent;
28709           }
28710         });
28711         for (var k in way.tags) {
28712           if (!(k in tags)) {
28713             tags[k] = way.tags[k];
28714           } else if (tags[k] && osmIsInterestingTag(k) && tags[k] !== way.tags[k]) {
28715             conflicting = true;
28716           }
28717         }
28718       });
28719       if (relation) {
28720         return relation.isRestriction() ? "restriction" : "connectivity";
28721       }
28722       if (conflicting) {
28723         return "conflicting_tags";
28724       }
28725     };
28726     return action;
28727   }
28728
28729   // modules/actions/merge.js
28730   function actionMerge(ids) {
28731     function groupEntitiesByGeometry(graph) {
28732       var entities = ids.map(function(id2) {
28733         return graph.entity(id2);
28734       });
28735       return Object.assign(
28736         { point: [], area: [], line: [], relation: [] },
28737         utilArrayGroupBy(entities, function(entity) {
28738           return entity.geometry(graph);
28739         })
28740       );
28741     }
28742     var action = function(graph) {
28743       var geometries = groupEntitiesByGeometry(graph);
28744       var target = geometries.area[0] || geometries.line[0];
28745       var points = geometries.point;
28746       points.forEach(function(point) {
28747         target = target.mergeTags(point.tags);
28748         graph = graph.replace(target);
28749         graph.parentRelations(point).forEach(function(parent) {
28750           graph = graph.replace(parent.replaceMember(point, target));
28751         });
28752         var nodes = utilArrayUniq(graph.childNodes(target));
28753         var removeNode = point;
28754         if (!point.isNew()) {
28755           var inserted = false;
28756           var canBeReplaced = function(node2) {
28757             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
28758           };
28759           var replaceNode = function(node2) {
28760             graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
28761             target = target.replaceNode(node2.id, point.id);
28762             graph = graph.replace(target);
28763             removeNode = node2;
28764             inserted = true;
28765           };
28766           var i2;
28767           var node;
28768           for (i2 = 0; i2 < nodes.length; i2++) {
28769             node = nodes[i2];
28770             if (canBeReplaced(node) && node.isNew()) {
28771               replaceNode(node);
28772               break;
28773             }
28774           }
28775           if (!inserted && point.hasInterestingTags()) {
28776             for (i2 = 0; i2 < nodes.length; i2++) {
28777               node = nodes[i2];
28778               if (canBeReplaced(node) && !node.hasInterestingTags()) {
28779                 replaceNode(node);
28780                 break;
28781               }
28782             }
28783             if (!inserted) {
28784               for (i2 = 0; i2 < nodes.length; i2++) {
28785                 node = nodes[i2];
28786                 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
28787                   replaceNode(node);
28788                   break;
28789                 }
28790               }
28791             }
28792           }
28793         }
28794         graph = graph.remove(removeNode);
28795       });
28796       if (target.tags.area === "yes") {
28797         var tags = Object.assign({}, target.tags);
28798         delete tags.area;
28799         if (osmTagSuggestingArea(tags)) {
28800           target = target.update({ tags });
28801           graph = graph.replace(target);
28802         }
28803       }
28804       return graph;
28805     };
28806     action.disabled = function(graph) {
28807       var geometries = groupEntitiesByGeometry(graph);
28808       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
28809         return "not_eligible";
28810       }
28811     };
28812     return action;
28813   }
28814
28815   // modules/actions/merge_nodes.js
28816   function actionMergeNodes(nodeIDs, loc) {
28817     function chooseLoc(graph) {
28818       if (!nodeIDs.length)
28819         return null;
28820       var sum = [0, 0];
28821       var interestingCount = 0;
28822       var interestingLoc;
28823       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28824         var node = graph.entity(nodeIDs[i2]);
28825         if (node.hasInterestingTags()) {
28826           interestingLoc = ++interestingCount === 1 ? node.loc : null;
28827         }
28828         sum = geoVecAdd(sum, node.loc);
28829       }
28830       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
28831     }
28832     var action = function(graph) {
28833       if (nodeIDs.length < 2)
28834         return graph;
28835       var toLoc = loc;
28836       if (!toLoc) {
28837         toLoc = chooseLoc(graph);
28838       }
28839       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28840         var node = graph.entity(nodeIDs[i2]);
28841         if (node.loc !== toLoc) {
28842           graph = graph.replace(node.move(toLoc));
28843         }
28844       }
28845       return actionConnect(nodeIDs)(graph);
28846     };
28847     action.disabled = function(graph) {
28848       if (nodeIDs.length < 2)
28849         return "not_eligible";
28850       for (var i2 = 0; i2 < nodeIDs.length; i2++) {
28851         var entity = graph.entity(nodeIDs[i2]);
28852         if (entity.type !== "node")
28853           return "not_eligible";
28854       }
28855       return actionConnect(nodeIDs).disabled(graph);
28856     };
28857     return action;
28858   }
28859
28860   // modules/osm/changeset.js
28861   function osmChangeset() {
28862     if (!(this instanceof osmChangeset)) {
28863       return new osmChangeset().initialize(arguments);
28864     } else if (arguments.length) {
28865       this.initialize(arguments);
28866     }
28867   }
28868   osmEntity.changeset = osmChangeset;
28869   osmChangeset.prototype = Object.create(osmEntity.prototype);
28870   Object.assign(osmChangeset.prototype, {
28871     type: "changeset",
28872     extent: function() {
28873       return new geoExtent();
28874     },
28875     geometry: function() {
28876       return "changeset";
28877     },
28878     asJXON: function() {
28879       return {
28880         osm: {
28881           changeset: {
28882             tag: Object.keys(this.tags).map(function(k) {
28883               return { "@k": k, "@v": this.tags[k] };
28884             }, this),
28885             "@version": 0.6,
28886             "@generator": "iD"
28887           }
28888         }
28889       };
28890     },
28891     osmChangeJXON: function(changes) {
28892       var changeset_id = this.id;
28893       function nest(x, order) {
28894         var groups = {};
28895         for (var i2 = 0; i2 < x.length; i2++) {
28896           var tagName = Object.keys(x[i2])[0];
28897           if (!groups[tagName])
28898             groups[tagName] = [];
28899           groups[tagName].push(x[i2][tagName]);
28900         }
28901         var ordered = {};
28902         order.forEach(function(o) {
28903           if (groups[o])
28904             ordered[o] = groups[o];
28905         });
28906         return ordered;
28907       }
28908       function sort(changes2) {
28909         function resolve(item) {
28910           return relations.find(function(relation2) {
28911             return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
28912           });
28913         }
28914         function isNew(item) {
28915           return !sorted[item["@id"]] && !processing.find(function(proc) {
28916             return proc["@id"] === item["@id"];
28917           });
28918         }
28919         var processing = [];
28920         var sorted = {};
28921         var relations = changes2.relation;
28922         if (!relations)
28923           return changes2;
28924         for (var i2 = 0; i2 < relations.length; i2++) {
28925           var relation = relations[i2];
28926           if (!sorted[relation["@id"]]) {
28927             processing.push(relation);
28928           }
28929           while (processing.length > 0) {
28930             var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
28931             if (deps.length === 0) {
28932               sorted[next["@id"]] = next;
28933               processing.shift();
28934             } else {
28935               processing = deps.concat(processing);
28936             }
28937           }
28938         }
28939         changes2.relation = Object.values(sorted);
28940         return changes2;
28941       }
28942       function rep2(entity) {
28943         return entity.asJXON(changeset_id);
28944       }
28945       return {
28946         osmChange: {
28947           "@version": 0.6,
28948           "@generator": "iD",
28949           "create": sort(nest(changes.created.map(rep2), ["node", "way", "relation"])),
28950           "modify": nest(changes.modified.map(rep2), ["node", "way", "relation"]),
28951           "delete": Object.assign(nest(changes.deleted.map(rep2), ["relation", "way", "node"]), { "@if-unused": true })
28952         }
28953       };
28954     },
28955     asGeoJSON: function() {
28956       return {};
28957     }
28958   });
28959
28960   // modules/osm/note.js
28961   function osmNote() {
28962     if (!(this instanceof osmNote)) {
28963       return new osmNote().initialize(arguments);
28964     } else if (arguments.length) {
28965       this.initialize(arguments);
28966     }
28967   }
28968   osmNote.id = function() {
28969     return osmNote.id.next--;
28970   };
28971   osmNote.id.next = -1;
28972   Object.assign(osmNote.prototype, {
28973     type: "note",
28974     initialize: function(sources) {
28975       for (var i2 = 0; i2 < sources.length; ++i2) {
28976         var source = sources[i2];
28977         for (var prop in source) {
28978           if (Object.prototype.hasOwnProperty.call(source, prop)) {
28979             if (source[prop] === void 0) {
28980               delete this[prop];
28981             } else {
28982               this[prop] = source[prop];
28983             }
28984           }
28985         }
28986       }
28987       if (!this.id) {
28988         this.id = osmNote.id().toString();
28989       }
28990       return this;
28991     },
28992     extent: function() {
28993       return new geoExtent(this.loc);
28994     },
28995     update: function(attrs) {
28996       return osmNote(this, attrs);
28997     },
28998     isNew: function() {
28999       return this.id < 0;
29000     },
29001     move: function(loc) {
29002       return this.update({ loc });
29003     }
29004   });
29005
29006   // modules/osm/relation.js
29007   function osmRelation() {
29008     if (!(this instanceof osmRelation)) {
29009       return new osmRelation().initialize(arguments);
29010     } else if (arguments.length) {
29011       this.initialize(arguments);
29012     }
29013   }
29014   osmEntity.relation = osmRelation;
29015   osmRelation.prototype = Object.create(osmEntity.prototype);
29016   osmRelation.creationOrder = function(a, b) {
29017     var aId = parseInt(osmEntity.id.toOSM(a.id), 10);
29018     var bId = parseInt(osmEntity.id.toOSM(b.id), 10);
29019     if (aId < 0 || bId < 0)
29020       return aId - bId;
29021     return bId - aId;
29022   };
29023   Object.assign(osmRelation.prototype, {
29024     type: "relation",
29025     members: [],
29026     copy: function(resolver, copies) {
29027       if (copies[this.id])
29028         return copies[this.id];
29029       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
29030       var members = this.members.map(function(member) {
29031         return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
29032       });
29033       copy2 = copy2.update({ members });
29034       copies[this.id] = copy2;
29035       return copy2;
29036     },
29037     extent: function(resolver, memo) {
29038       return resolver.transient(this, "extent", function() {
29039         if (memo && memo[this.id])
29040           return geoExtent();
29041         memo = memo || {};
29042         memo[this.id] = true;
29043         var extent = geoExtent();
29044         for (var i2 = 0; i2 < this.members.length; i2++) {
29045           var member = resolver.hasEntity(this.members[i2].id);
29046           if (member) {
29047             extent._extend(member.extent(resolver, memo));
29048           }
29049         }
29050         return extent;
29051       });
29052     },
29053     geometry: function(graph) {
29054       return graph.transient(this, "geometry", function() {
29055         return this.isMultipolygon() ? "area" : "relation";
29056       });
29057     },
29058     isDegenerate: function() {
29059       return this.members.length === 0;
29060     },
29061     indexedMembers: function() {
29062       var result = new Array(this.members.length);
29063       for (var i2 = 0; i2 < this.members.length; i2++) {
29064         result[i2] = Object.assign({}, this.members[i2], { index: i2 });
29065       }
29066       return result;
29067     },
29068     memberByRole: function(role) {
29069       for (var i2 = 0; i2 < this.members.length; i2++) {
29070         if (this.members[i2].role === role) {
29071           return Object.assign({}, this.members[i2], { index: i2 });
29072         }
29073       }
29074     },
29075     membersByRole: function(role) {
29076       var result = [];
29077       for (var i2 = 0; i2 < this.members.length; i2++) {
29078         if (this.members[i2].role === role) {
29079           result.push(Object.assign({}, this.members[i2], { index: i2 }));
29080         }
29081       }
29082       return result;
29083     },
29084     memberById: function(id2) {
29085       for (var i2 = 0; i2 < this.members.length; i2++) {
29086         if (this.members[i2].id === id2) {
29087           return Object.assign({}, this.members[i2], { index: i2 });
29088         }
29089       }
29090     },
29091     memberByIdAndRole: function(id2, role) {
29092       for (var i2 = 0; i2 < this.members.length; i2++) {
29093         if (this.members[i2].id === id2 && this.members[i2].role === role) {
29094           return Object.assign({}, this.members[i2], { index: i2 });
29095         }
29096       }
29097     },
29098     addMember: function(member, index) {
29099       var members = this.members.slice();
29100       members.splice(index === void 0 ? members.length : index, 0, member);
29101       return this.update({ members });
29102     },
29103     updateMember: function(member, index) {
29104       var members = this.members.slice();
29105       members.splice(index, 1, Object.assign({}, members[index], member));
29106       return this.update({ members });
29107     },
29108     removeMember: function(index) {
29109       var members = this.members.slice();
29110       members.splice(index, 1);
29111       return this.update({ members });
29112     },
29113     removeMembersWithID: function(id2) {
29114       var members = this.members.filter(function(m) {
29115         return m.id !== id2;
29116       });
29117       return this.update({ members });
29118     },
29119     moveMember: function(fromIndex, toIndex) {
29120       var members = this.members.slice();
29121       members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
29122       return this.update({ members });
29123     },
29124     replaceMember: function(needle, replacement, keepDuplicates) {
29125       if (!this.memberById(needle.id))
29126         return this;
29127       var members = [];
29128       for (var i2 = 0; i2 < this.members.length; i2++) {
29129         var member = this.members[i2];
29130         if (member.id !== needle.id) {
29131           members.push(member);
29132         } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
29133           members.push({ id: replacement.id, type: replacement.type, role: member.role });
29134         }
29135       }
29136       return this.update({ members });
29137     },
29138     asJXON: function(changeset_id) {
29139       var r = {
29140         relation: {
29141           "@id": this.osmId(),
29142           "@version": this.version || 0,
29143           member: this.members.map(function(member) {
29144             return {
29145               keyAttributes: {
29146                 type: member.type,
29147                 role: member.role,
29148                 ref: osmEntity.id.toOSM(member.id)
29149               }
29150             };
29151           }, this),
29152           tag: Object.keys(this.tags).map(function(k) {
29153             return { keyAttributes: { k, v: this.tags[k] } };
29154           }, this)
29155         }
29156       };
29157       if (changeset_id) {
29158         r.relation["@changeset"] = changeset_id;
29159       }
29160       return r;
29161     },
29162     asGeoJSON: function(resolver) {
29163       return resolver.transient(this, "GeoJSON", function() {
29164         if (this.isMultipolygon()) {
29165           return {
29166             type: "MultiPolygon",
29167             coordinates: this.multipolygon(resolver)
29168           };
29169         } else {
29170           return {
29171             type: "FeatureCollection",
29172             properties: this.tags,
29173             features: this.members.map(function(member) {
29174               return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
29175             })
29176           };
29177         }
29178       });
29179     },
29180     area: function(resolver) {
29181       return resolver.transient(this, "area", function() {
29182         return area_default(this.asGeoJSON(resolver));
29183       });
29184     },
29185     isMultipolygon: function() {
29186       return this.tags.type === "multipolygon";
29187     },
29188     isComplete: function(resolver) {
29189       for (var i2 = 0; i2 < this.members.length; i2++) {
29190         if (!resolver.hasEntity(this.members[i2].id)) {
29191           return false;
29192         }
29193       }
29194       return true;
29195     },
29196     hasFromViaTo: function() {
29197       return this.members.some(function(m) {
29198         return m.role === "from";
29199       }) && this.members.some(function(m) {
29200         return m.role === "via";
29201       }) && this.members.some(function(m) {
29202         return m.role === "to";
29203       });
29204     },
29205     isRestriction: function() {
29206       return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
29207     },
29208     isValidRestriction: function() {
29209       if (!this.isRestriction())
29210         return false;
29211       var froms = this.members.filter(function(m) {
29212         return m.role === "from";
29213       });
29214       var vias = this.members.filter(function(m) {
29215         return m.role === "via";
29216       });
29217       var tos = this.members.filter(function(m) {
29218         return m.role === "to";
29219       });
29220       if (froms.length !== 1 && this.tags.restriction !== "no_entry")
29221         return false;
29222       if (froms.some(function(m) {
29223         return m.type !== "way";
29224       }))
29225         return false;
29226       if (tos.length !== 1 && this.tags.restriction !== "no_exit")
29227         return false;
29228       if (tos.some(function(m) {
29229         return m.type !== "way";
29230       }))
29231         return false;
29232       if (vias.length === 0)
29233         return false;
29234       if (vias.length > 1 && vias.some(function(m) {
29235         return m.type !== "way";
29236       }))
29237         return false;
29238       return true;
29239     },
29240     isConnectivity: function() {
29241       return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
29242     },
29243     multipolygon: function(resolver) {
29244       var outers = this.members.filter(function(m) {
29245         return "outer" === (m.role || "outer");
29246       });
29247       var inners = this.members.filter(function(m) {
29248         return "inner" === m.role;
29249       });
29250       outers = osmJoinWays(outers, resolver);
29251       inners = osmJoinWays(inners, resolver);
29252       var sequenceToLineString = function(sequence) {
29253         if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
29254           sequence.nodes.push(sequence.nodes[0]);
29255         }
29256         return sequence.nodes.map(function(node) {
29257           return node.loc;
29258         });
29259       };
29260       outers = outers.map(sequenceToLineString);
29261       inners = inners.map(sequenceToLineString);
29262       var result = outers.map(function(o2) {
29263         return [area_default({ type: "Polygon", coordinates: [o2] }) > 2 * Math.PI ? o2.reverse() : o2];
29264       });
29265       function findOuter(inner2) {
29266         var o2, outer;
29267         for (o2 = 0; o2 < outers.length; o2++) {
29268           outer = outers[o2];
29269           if (geoPolygonContainsPolygon(outer, inner2)) {
29270             return o2;
29271           }
29272         }
29273         for (o2 = 0; o2 < outers.length; o2++) {
29274           outer = outers[o2];
29275           if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
29276             return o2;
29277           }
29278         }
29279       }
29280       for (var i2 = 0; i2 < inners.length; i2++) {
29281         var inner = inners[i2];
29282         if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
29283           inner = inner.reverse();
29284         }
29285         var o = findOuter(inners[i2]);
29286         if (o !== void 0) {
29287           result[o].push(inners[i2]);
29288         } else {
29289           result.push([inners[i2]]);
29290         }
29291       }
29292       return result;
29293     }
29294   });
29295
29296   // modules/osm/qa_item.js
29297   var QAItem = class {
29298     constructor(loc, service, itemType, id2, props) {
29299       this.loc = loc;
29300       this.service = service.title;
29301       this.itemType = itemType;
29302       this.id = id2 ? id2 : `${QAItem.id()}`;
29303       this.update(props);
29304       if (service && typeof service.getIcon === "function") {
29305         this.icon = service.getIcon(itemType);
29306       }
29307     }
29308     update(props) {
29309       const { loc, service, itemType, id: id2 } = this;
29310       Object.keys(props).forEach((prop) => this[prop] = props[prop]);
29311       this.loc = loc;
29312       this.service = service;
29313       this.itemType = itemType;
29314       this.id = id2;
29315       return this;
29316     }
29317     static id() {
29318       return this.nextId--;
29319     }
29320   };
29321   QAItem.nextId = -1;
29322
29323   // modules/actions/split.js
29324   function actionSplit(nodeIds, newWayIds) {
29325     if (typeof nodeIds === "string")
29326       nodeIds = [nodeIds];
29327     var _wayIDs;
29328     var _keepHistoryOn = "longest";
29329     var _createdWayIDs = [];
29330     function dist(graph, nA, nB) {
29331       var locA = graph.entity(nA).loc;
29332       var locB = graph.entity(nB).loc;
29333       var epsilon3 = 1e-6;
29334       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
29335     }
29336     function splitArea(nodes, idxA, graph) {
29337       var lengths = new Array(nodes.length);
29338       var length;
29339       var i2;
29340       var best = 0;
29341       var idxB;
29342       function wrap2(index) {
29343         return utilWrap(index, nodes.length);
29344       }
29345       length = 0;
29346       for (i2 = wrap2(idxA + 1); i2 !== idxA; i2 = wrap2(i2 + 1)) {
29347         length += dist(graph, nodes[i2], nodes[wrap2(i2 - 1)]);
29348         lengths[i2] = length;
29349       }
29350       length = 0;
29351       for (i2 = wrap2(idxA - 1); i2 !== idxA; i2 = wrap2(i2 - 1)) {
29352         length += dist(graph, nodes[i2], nodes[wrap2(i2 + 1)]);
29353         if (length < lengths[i2]) {
29354           lengths[i2] = length;
29355         }
29356       }
29357       for (i2 = 0; i2 < nodes.length; i2++) {
29358         var cost = lengths[i2] / dist(graph, nodes[idxA], nodes[i2]);
29359         if (cost > best) {
29360           idxB = i2;
29361           best = cost;
29362         }
29363       }
29364       return idxB;
29365     }
29366     function totalLengthBetweenNodes(graph, nodes) {
29367       var totalLength = 0;
29368       for (var i2 = 0; i2 < nodes.length - 1; i2++) {
29369         totalLength += dist(graph, nodes[i2], nodes[i2 + 1]);
29370       }
29371       return totalLength;
29372     }
29373     function split(graph, nodeId, wayA, newWayId) {
29374       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
29375       var origNodes = wayA.nodes.slice();
29376       var nodesA;
29377       var nodesB;
29378       var isArea = wayA.isArea();
29379       var isOuter = osmIsOldMultipolygonOuterMember(wayA, graph);
29380       if (wayA.isClosed()) {
29381         var nodes = wayA.nodes.slice(0, -1);
29382         var idxA = nodes.indexOf(nodeId);
29383         var idxB = splitArea(nodes, idxA, graph);
29384         if (idxB < idxA) {
29385           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
29386           nodesB = nodes.slice(idxB, idxA + 1);
29387         } else {
29388           nodesA = nodes.slice(idxA, idxB + 1);
29389           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
29390         }
29391       } else {
29392         var idx = wayA.nodes.indexOf(nodeId, 1);
29393         nodesA = wayA.nodes.slice(0, idx + 1);
29394         nodesB = wayA.nodes.slice(idx);
29395       }
29396       var lengthA = totalLengthBetweenNodes(graph, nodesA);
29397       var lengthB = totalLengthBetweenNodes(graph, nodesB);
29398       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
29399         wayA = wayA.update({ nodes: nodesB });
29400         wayB = wayB.update({ nodes: nodesA });
29401         var temp = lengthA;
29402         lengthA = lengthB;
29403         lengthB = temp;
29404       } else {
29405         wayA = wayA.update({ nodes: nodesA });
29406         wayB = wayB.update({ nodes: nodesB });
29407       }
29408       if (wayA.tags.step_count) {
29409         var stepCount = parseFloat(wayA.tags.step_count);
29410         if (stepCount && isFinite(stepCount) && stepCount > 0 && Math.round(stepCount) === stepCount) {
29411           var tagsA = Object.assign({}, wayA.tags);
29412           var tagsB = Object.assign({}, wayB.tags);
29413           var ratioA = lengthA / (lengthA + lengthB);
29414           var countA = Math.round(stepCount * ratioA);
29415           tagsA.step_count = countA.toString();
29416           tagsB.step_count = (stepCount - countA).toString();
29417           wayA = wayA.update({ tags: tagsA });
29418           wayB = wayB.update({ tags: tagsB });
29419         }
29420       }
29421       graph = graph.replace(wayA);
29422       graph = graph.replace(wayB);
29423       graph.parentRelations(wayA).forEach(function(relation) {
29424         var member;
29425         if (relation.hasFromViaTo()) {
29426           var f2 = relation.memberByRole("from");
29427           var v = relation.membersByRole("via");
29428           var t = relation.memberByRole("to");
29429           var i2;
29430           if (f2.id === wayA.id || t.id === wayA.id) {
29431             var keepB = false;
29432             if (v.length === 1 && v[0].type === "node") {
29433               keepB = wayB.contains(v[0].id);
29434             } else {
29435               for (i2 = 0; i2 < v.length; i2++) {
29436                 if (v[i2].type === "way") {
29437                   var wayVia = graph.hasEntity(v[i2].id);
29438                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
29439                     keepB = true;
29440                     break;
29441                   }
29442                 }
29443               }
29444             }
29445             if (keepB) {
29446               relation = relation.replaceMember(wayA, wayB);
29447               graph = graph.replace(relation);
29448             }
29449           } else {
29450             for (i2 = 0; i2 < v.length; i2++) {
29451               if (v[i2].type === "way" && v[i2].id === wayA.id) {
29452                 member = {
29453                   id: wayB.id,
29454                   type: "way",
29455                   role: "via"
29456                 };
29457                 graph = actionAddMember(relation.id, member, v[i2].index + 1)(graph);
29458                 break;
29459               }
29460             }
29461           }
29462         } else {
29463           if (relation === isOuter) {
29464             graph = graph.replace(relation.mergeTags(wayA.tags));
29465             graph = graph.replace(wayA.update({ tags: {} }));
29466             graph = graph.replace(wayB.update({ tags: {} }));
29467           }
29468           member = {
29469             id: wayB.id,
29470             type: "way",
29471             role: relation.memberById(wayA.id).role
29472           };
29473           var insertPair = {
29474             originalID: wayA.id,
29475             insertedID: wayB.id,
29476             nodes: origNodes
29477           };
29478           graph = actionAddMember(relation.id, member, void 0, insertPair)(graph);
29479         }
29480       });
29481       if (!isOuter && isArea) {
29482         var multipolygon = osmRelation({
29483           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
29484           members: [
29485             { id: wayA.id, role: "outer", type: "way" },
29486             { id: wayB.id, role: "outer", type: "way" }
29487           ]
29488         });
29489         graph = graph.replace(multipolygon);
29490         graph = graph.replace(wayA.update({ tags: {} }));
29491         graph = graph.replace(wayB.update({ tags: {} }));
29492       }
29493       _createdWayIDs.push(wayB.id);
29494       return graph;
29495     }
29496     var action = function(graph) {
29497       _createdWayIDs = [];
29498       var newWayIndex = 0;
29499       for (var i2 = 0; i2 < nodeIds.length; i2++) {
29500         var nodeId = nodeIds[i2];
29501         var candidates = action.waysForNode(nodeId, graph);
29502         for (var j2 = 0; j2 < candidates.length; j2++) {
29503           graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex]);
29504           newWayIndex += 1;
29505         }
29506       }
29507       return graph;
29508     };
29509     action.getCreatedWayIDs = function() {
29510       return _createdWayIDs;
29511     };
29512     action.waysForNode = function(nodeId, graph) {
29513       var node = graph.entity(nodeId);
29514       var splittableParents = graph.parentWays(node).filter(isSplittable);
29515       if (!_wayIDs) {
29516         var hasLine = splittableParents.some(function(parent) {
29517           return parent.geometry(graph) === "line";
29518         });
29519         if (hasLine) {
29520           return splittableParents.filter(function(parent) {
29521             return parent.geometry(graph) === "line";
29522           });
29523         }
29524       }
29525       return splittableParents;
29526       function isSplittable(parent) {
29527         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
29528           return false;
29529         if (parent.isClosed())
29530           return true;
29531         for (var i2 = 1; i2 < parent.nodes.length - 1; i2++) {
29532           if (parent.nodes[i2] === nodeId)
29533             return true;
29534         }
29535         return false;
29536       }
29537     };
29538     action.ways = function(graph) {
29539       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
29540         return action.waysForNode(nodeId, graph);
29541       })));
29542     };
29543     action.disabled = function(graph) {
29544       for (var i2 = 0; i2 < nodeIds.length; i2++) {
29545         var nodeId = nodeIds[i2];
29546         var candidates = action.waysForNode(nodeId, graph);
29547         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
29548           return "not_eligible";
29549         }
29550       }
29551     };
29552     action.limitWays = function(val) {
29553       if (!arguments.length)
29554         return _wayIDs;
29555       _wayIDs = val;
29556       return action;
29557     };
29558     action.keepHistoryOn = function(val) {
29559       if (!arguments.length)
29560         return _keepHistoryOn;
29561       _keepHistoryOn = val;
29562       return action;
29563     };
29564     return action;
29565   }
29566
29567   // modules/core/graph.js
29568   function coreGraph(other, mutable) {
29569     if (!(this instanceof coreGraph))
29570       return new coreGraph(other, mutable);
29571     if (other instanceof coreGraph) {
29572       var base = other.base();
29573       this.entities = Object.assign(Object.create(base.entities), other.entities);
29574       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
29575       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
29576     } else {
29577       this.entities = /* @__PURE__ */ Object.create({});
29578       this._parentWays = /* @__PURE__ */ Object.create({});
29579       this._parentRels = /* @__PURE__ */ Object.create({});
29580       this.rebase(other || [], [this]);
29581     }
29582     this.transients = {};
29583     this._childNodes = {};
29584     this.frozen = !mutable;
29585   }
29586   coreGraph.prototype = {
29587     hasEntity: function(id2) {
29588       return this.entities[id2];
29589     },
29590     entity: function(id2) {
29591       var entity = this.entities[id2];
29592       if (!entity) {
29593         entity = this.entities.__proto__[id2];
29594       }
29595       if (!entity) {
29596         throw new Error("entity " + id2 + " not found");
29597       }
29598       return entity;
29599     },
29600     geometry: function(id2) {
29601       return this.entity(id2).geometry(this);
29602     },
29603     transient: function(entity, key, fn) {
29604       var id2 = entity.id;
29605       var transients = this.transients[id2] || (this.transients[id2] = {});
29606       if (transients[key] !== void 0) {
29607         return transients[key];
29608       }
29609       transients[key] = fn.call(entity);
29610       return transients[key];
29611     },
29612     parentWays: function(entity) {
29613       var parents = this._parentWays[entity.id];
29614       var result = [];
29615       if (parents) {
29616         parents.forEach(function(id2) {
29617           result.push(this.entity(id2));
29618         }, this);
29619       }
29620       return result;
29621     },
29622     isPoi: function(entity) {
29623       var parents = this._parentWays[entity.id];
29624       return !parents || parents.size === 0;
29625     },
29626     isShared: function(entity) {
29627       var parents = this._parentWays[entity.id];
29628       return parents && parents.size > 1;
29629     },
29630     parentRelations: function(entity) {
29631       var parents = this._parentRels[entity.id];
29632       var result = [];
29633       if (parents) {
29634         parents.forEach(function(id2) {
29635           result.push(this.entity(id2));
29636         }, this);
29637       }
29638       return result;
29639     },
29640     parentMultipolygons: function(entity) {
29641       return this.parentRelations(entity).filter(function(relation) {
29642         return relation.isMultipolygon();
29643       });
29644     },
29645     childNodes: function(entity) {
29646       if (this._childNodes[entity.id])
29647         return this._childNodes[entity.id];
29648       if (!entity.nodes)
29649         return [];
29650       var nodes = [];
29651       for (var i2 = 0; i2 < entity.nodes.length; i2++) {
29652         nodes[i2] = this.entity(entity.nodes[i2]);
29653       }
29654       if (debug)
29655         Object.freeze(nodes);
29656       this._childNodes[entity.id] = nodes;
29657       return this._childNodes[entity.id];
29658     },
29659     base: function() {
29660       return {
29661         "entities": Object.getPrototypeOf(this.entities),
29662         "parentWays": Object.getPrototypeOf(this._parentWays),
29663         "parentRels": Object.getPrototypeOf(this._parentRels)
29664       };
29665     },
29666     rebase: function(entities, stack, force) {
29667       var base = this.base();
29668       var i2, j2, k, id2;
29669       for (i2 = 0; i2 < entities.length; i2++) {
29670         var entity = entities[i2];
29671         if (!entity.visible || !force && base.entities[entity.id])
29672           continue;
29673         base.entities[entity.id] = entity;
29674         this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
29675         if (entity.type === "way") {
29676           for (j2 = 0; j2 < entity.nodes.length; j2++) {
29677             id2 = entity.nodes[j2];
29678             for (k = 1; k < stack.length; k++) {
29679               var ents = stack[k].entities;
29680               if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
29681                 delete ents[id2];
29682               }
29683             }
29684           }
29685         }
29686       }
29687       for (i2 = 0; i2 < stack.length; i2++) {
29688         stack[i2]._updateRebased();
29689       }
29690     },
29691     _updateRebased: function() {
29692       var base = this.base();
29693       Object.keys(this._parentWays).forEach(function(child) {
29694         if (base.parentWays[child]) {
29695           base.parentWays[child].forEach(function(id2) {
29696             if (!this.entities.hasOwnProperty(id2)) {
29697               this._parentWays[child].add(id2);
29698             }
29699           }, this);
29700         }
29701       }, this);
29702       Object.keys(this._parentRels).forEach(function(child) {
29703         if (base.parentRels[child]) {
29704           base.parentRels[child].forEach(function(id2) {
29705             if (!this.entities.hasOwnProperty(id2)) {
29706               this._parentRels[child].add(id2);
29707             }
29708           }, this);
29709         }
29710       }, this);
29711       this.transients = {};
29712     },
29713     _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
29714       parentWays = parentWays || this._parentWays;
29715       parentRels = parentRels || this._parentRels;
29716       var type3 = entity && entity.type || oldentity && oldentity.type;
29717       var removed, added, i2;
29718       if (type3 === "way") {
29719         if (oldentity && entity) {
29720           removed = utilArrayDifference(oldentity.nodes, entity.nodes);
29721           added = utilArrayDifference(entity.nodes, oldentity.nodes);
29722         } else if (oldentity) {
29723           removed = oldentity.nodes;
29724           added = [];
29725         } else if (entity) {
29726           removed = [];
29727           added = entity.nodes;
29728         }
29729         for (i2 = 0; i2 < removed.length; i2++) {
29730           parentWays[removed[i2]] = new Set(parentWays[removed[i2]]);
29731           parentWays[removed[i2]].delete(oldentity.id);
29732         }
29733         for (i2 = 0; i2 < added.length; i2++) {
29734           parentWays[added[i2]] = new Set(parentWays[added[i2]]);
29735           parentWays[added[i2]].add(entity.id);
29736         }
29737       } else if (type3 === "relation") {
29738         var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m) {
29739           return m.id;
29740         }) : [];
29741         var entityMemberIDs = entity ? entity.members.map(function(m) {
29742           return m.id;
29743         }) : [];
29744         if (oldentity && entity) {
29745           removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
29746           added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
29747         } else if (oldentity) {
29748           removed = oldentityMemberIDs;
29749           added = [];
29750         } else if (entity) {
29751           removed = [];
29752           added = entityMemberIDs;
29753         }
29754         for (i2 = 0; i2 < removed.length; i2++) {
29755           parentRels[removed[i2]] = new Set(parentRels[removed[i2]]);
29756           parentRels[removed[i2]].delete(oldentity.id);
29757         }
29758         for (i2 = 0; i2 < added.length; i2++) {
29759           parentRels[added[i2]] = new Set(parentRels[added[i2]]);
29760           parentRels[added[i2]].add(entity.id);
29761         }
29762       }
29763     },
29764     replace: function(entity) {
29765       if (this.entities[entity.id] === entity)
29766         return this;
29767       return this.update(function() {
29768         this._updateCalculated(this.entities[entity.id], entity);
29769         this.entities[entity.id] = entity;
29770       });
29771     },
29772     remove: function(entity) {
29773       return this.update(function() {
29774         this._updateCalculated(entity, void 0);
29775         this.entities[entity.id] = void 0;
29776       });
29777     },
29778     revert: function(id2) {
29779       var baseEntity = this.base().entities[id2];
29780       var headEntity = this.entities[id2];
29781       if (headEntity === baseEntity)
29782         return this;
29783       return this.update(function() {
29784         this._updateCalculated(headEntity, baseEntity);
29785         delete this.entities[id2];
29786       });
29787     },
29788     update: function() {
29789       var graph = this.frozen ? coreGraph(this, true) : this;
29790       for (var i2 = 0; i2 < arguments.length; i2++) {
29791         arguments[i2].call(graph, graph);
29792       }
29793       if (this.frozen)
29794         graph.frozen = true;
29795       return graph;
29796     },
29797     load: function(entities) {
29798       var base = this.base();
29799       this.entities = Object.create(base.entities);
29800       for (var i2 in entities) {
29801         this.entities[i2] = entities[i2];
29802         this._updateCalculated(base.entities[i2], this.entities[i2]);
29803       }
29804       return this;
29805     }
29806   };
29807
29808   // modules/osm/intersection.js
29809   function osmTurn(turn) {
29810     if (!(this instanceof osmTurn)) {
29811       return new osmTurn(turn);
29812     }
29813     Object.assign(this, turn);
29814   }
29815   function osmIntersection(graph, startVertexId, maxDistance) {
29816     maxDistance = maxDistance || 30;
29817     var vgraph = coreGraph();
29818     var i2, j2, k;
29819     function memberOfRestriction(entity) {
29820       return graph.parentRelations(entity).some(function(r) {
29821         return r.isRestriction();
29822       });
29823     }
29824     function isRoad(way2) {
29825       if (way2.isArea() || way2.isDegenerate())
29826         return false;
29827       var roads = {
29828         "motorway": true,
29829         "motorway_link": true,
29830         "trunk": true,
29831         "trunk_link": true,
29832         "primary": true,
29833         "primary_link": true,
29834         "secondary": true,
29835         "secondary_link": true,
29836         "tertiary": true,
29837         "tertiary_link": true,
29838         "residential": true,
29839         "unclassified": true,
29840         "living_street": true,
29841         "service": true,
29842         "road": true,
29843         "track": true
29844       };
29845       return roads[way2.tags.highway];
29846     }
29847     var startNode = graph.entity(startVertexId);
29848     var checkVertices = [startNode];
29849     var checkWays;
29850     var vertices = [];
29851     var vertexIds = [];
29852     var vertex;
29853     var ways = [];
29854     var wayIds = [];
29855     var way;
29856     var nodes = [];
29857     var node;
29858     var parents = [];
29859     var parent;
29860     var actions = [];
29861     while (checkVertices.length) {
29862       vertex = checkVertices.pop();
29863       checkWays = graph.parentWays(vertex);
29864       var hasWays = false;
29865       for (i2 = 0; i2 < checkWays.length; i2++) {
29866         way = checkWays[i2];
29867         if (!isRoad(way) && !memberOfRestriction(way))
29868           continue;
29869         ways.push(way);
29870         hasWays = true;
29871         nodes = utilArrayUniq(graph.childNodes(way));
29872         for (j2 = 0; j2 < nodes.length; j2++) {
29873           node = nodes[j2];
29874           if (node === vertex)
29875             continue;
29876           if (vertices.indexOf(node) !== -1)
29877             continue;
29878           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
29879             continue;
29880           var hasParents = false;
29881           parents = graph.parentWays(node);
29882           for (k = 0; k < parents.length; k++) {
29883             parent = parents[k];
29884             if (parent === way)
29885               continue;
29886             if (ways.indexOf(parent) !== -1)
29887               continue;
29888             if (!isRoad(parent))
29889               continue;
29890             hasParents = true;
29891             break;
29892           }
29893           if (hasParents) {
29894             checkVertices.push(node);
29895           }
29896         }
29897       }
29898       if (hasWays) {
29899         vertices.push(vertex);
29900       }
29901     }
29902     vertices = utilArrayUniq(vertices);
29903     ways = utilArrayUniq(ways);
29904     ways.forEach(function(way2) {
29905       graph.childNodes(way2).forEach(function(node2) {
29906         vgraph = vgraph.replace(node2);
29907       });
29908       vgraph = vgraph.replace(way2);
29909       graph.parentRelations(way2).forEach(function(relation) {
29910         if (relation.isRestriction()) {
29911           if (relation.isValidRestriction(graph)) {
29912             vgraph = vgraph.replace(relation);
29913           } else if (relation.isComplete(graph)) {
29914             actions.push(actionDeleteRelation(relation.id));
29915           }
29916         }
29917       });
29918     });
29919     ways.forEach(function(w) {
29920       var way2 = vgraph.entity(w.id);
29921       if (way2.tags.oneway === "-1") {
29922         var action = actionReverse(way2.id, { reverseOneway: true });
29923         actions.push(action);
29924         vgraph = action(vgraph);
29925       }
29926     });
29927     var origCount = osmEntity.id.next.way;
29928     vertices.forEach(function(v) {
29929       var splitAll = actionSplit([v.id]).keepHistoryOn("first");
29930       if (!splitAll.disabled(vgraph)) {
29931         splitAll.ways(vgraph).forEach(function(way2) {
29932           var splitOne = actionSplit([v.id]).limitWays([way2.id]).keepHistoryOn("first");
29933           actions.push(splitOne);
29934           vgraph = splitOne(vgraph);
29935         });
29936       }
29937     });
29938     osmEntity.id.next.way = origCount;
29939     vertexIds = vertices.map(function(v) {
29940       return v.id;
29941     });
29942     vertices = [];
29943     ways = [];
29944     vertexIds.forEach(function(id2) {
29945       var vertex2 = vgraph.entity(id2);
29946       var parents2 = vgraph.parentWays(vertex2);
29947       vertices.push(vertex2);
29948       ways = ways.concat(parents2);
29949     });
29950     vertices = utilArrayUniq(vertices);
29951     ways = utilArrayUniq(ways);
29952     vertexIds = vertices.map(function(v) {
29953       return v.id;
29954     });
29955     wayIds = ways.map(function(w) {
29956       return w.id;
29957     });
29958     function withMetadata(way2, vertexIds2) {
29959       var __oneWay = way2.isOneWay();
29960       var __first = vertexIds2.indexOf(way2.first()) !== -1;
29961       var __last = vertexIds2.indexOf(way2.last()) !== -1;
29962       var __via = __first && __last;
29963       var __from = __first && !__oneWay || __last;
29964       var __to = __first || __last && !__oneWay;
29965       return way2.update({
29966         __first,
29967         __last,
29968         __from,
29969         __via,
29970         __to,
29971         __oneWay
29972       });
29973     }
29974     ways = [];
29975     wayIds.forEach(function(id2) {
29976       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
29977       vgraph = vgraph.replace(way2);
29978       ways.push(way2);
29979     });
29980     var keepGoing;
29981     var removeWayIds = [];
29982     var removeVertexIds = [];
29983     do {
29984       keepGoing = false;
29985       checkVertices = vertexIds.slice();
29986       for (i2 = 0; i2 < checkVertices.length; i2++) {
29987         var vertexId = checkVertices[i2];
29988         vertex = vgraph.hasEntity(vertexId);
29989         if (!vertex) {
29990           if (vertexIds.indexOf(vertexId) !== -1) {
29991             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
29992           }
29993           removeVertexIds.push(vertexId);
29994           continue;
29995         }
29996         parents = vgraph.parentWays(vertex);
29997         if (parents.length < 3) {
29998           if (vertexIds.indexOf(vertexId) !== -1) {
29999             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
30000           }
30001         }
30002         if (parents.length === 2) {
30003           var a = parents[0];
30004           var b = parents[1];
30005           var aIsLeaf = a && !a.__via;
30006           var bIsLeaf = b && !b.__via;
30007           var leaf, survivor;
30008           if (aIsLeaf && !bIsLeaf) {
30009             leaf = a;
30010             survivor = b;
30011           } else if (!aIsLeaf && bIsLeaf) {
30012             leaf = b;
30013             survivor = a;
30014           }
30015           if (leaf && survivor) {
30016             survivor = withMetadata(survivor, vertexIds);
30017             vgraph = vgraph.replace(survivor).remove(leaf);
30018             removeWayIds.push(leaf.id);
30019             keepGoing = true;
30020           }
30021         }
30022         parents = vgraph.parentWays(vertex);
30023         if (parents.length < 2) {
30024           if (vertexIds.indexOf(vertexId) !== -1) {
30025             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
30026           }
30027           removeVertexIds.push(vertexId);
30028           keepGoing = true;
30029         }
30030         if (parents.length < 1) {
30031           vgraph = vgraph.remove(vertex);
30032         }
30033       }
30034     } while (keepGoing);
30035     vertices = vertices.filter(function(vertex2) {
30036       return removeVertexIds.indexOf(vertex2.id) === -1;
30037     }).map(function(vertex2) {
30038       return vgraph.entity(vertex2.id);
30039     });
30040     ways = ways.filter(function(way2) {
30041       return removeWayIds.indexOf(way2.id) === -1;
30042     }).map(function(way2) {
30043       return vgraph.entity(way2.id);
30044     });
30045     var intersection = {
30046       graph: vgraph,
30047       actions,
30048       vertices,
30049       ways
30050     };
30051     intersection.turns = function(fromWayId, maxViaWay) {
30052       if (!fromWayId)
30053         return [];
30054       if (!maxViaWay)
30055         maxViaWay = 0;
30056       var vgraph2 = intersection.graph;
30057       var keyVertexIds = intersection.vertices.map(function(v) {
30058         return v.id;
30059       });
30060       var start2 = vgraph2.entity(fromWayId);
30061       if (!start2 || !(start2.__from || start2.__via))
30062         return [];
30063       var maxPathLength = maxViaWay * 2 + 3;
30064       var turns = [];
30065       step(start2);
30066       return turns;
30067       function step(entity, currPath, currRestrictions, matchedRestriction) {
30068         currPath = (currPath || []).slice();
30069         if (currPath.length >= maxPathLength)
30070           return;
30071         currPath.push(entity.id);
30072         currRestrictions = (currRestrictions || []).slice();
30073         var i3, j3;
30074         if (entity.type === "node") {
30075           var parents2 = vgraph2.parentWays(entity);
30076           var nextWays = [];
30077           for (i3 = 0; i3 < parents2.length; i3++) {
30078             var way2 = parents2[i3];
30079             if (way2.__oneWay && way2.nodes[0] !== entity.id)
30080               continue;
30081             if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
30082               continue;
30083             var restrict = null;
30084             for (j3 = 0; j3 < currRestrictions.length; j3++) {
30085               var restriction = currRestrictions[j3];
30086               var f2 = restriction.memberByRole("from");
30087               var v = restriction.membersByRole("via");
30088               var t = restriction.memberByRole("to");
30089               var isOnly = /^only_/.test(restriction.tags.restriction);
30090               var matchesFrom = f2.id === fromWayId;
30091               var matchesViaTo = false;
30092               var isAlongOnlyPath = false;
30093               if (t.id === way2.id) {
30094                 if (v.length === 1 && v[0].type === "node") {
30095                   matchesViaTo = v[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
30096                 } else {
30097                   var pathVias = [];
30098                   for (k = 2; k < currPath.length; k += 2) {
30099                     pathVias.push(currPath[k]);
30100                   }
30101                   var restrictionVias = [];
30102                   for (k = 0; k < v.length; k++) {
30103                     if (v[k].type === "way") {
30104                       restrictionVias.push(v[k].id);
30105                     }
30106                   }
30107                   var diff = utilArrayDifference(pathVias, restrictionVias);
30108                   matchesViaTo = !diff.length;
30109                 }
30110               } else if (isOnly) {
30111                 for (k = 0; k < v.length; k++) {
30112                   if (v[k].type === "way" && v[k].id === way2.id) {
30113                     isAlongOnlyPath = true;
30114                     break;
30115                   }
30116                 }
30117               }
30118               if (matchesViaTo) {
30119                 if (isOnly) {
30120                   restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
30121                 } else {
30122                   restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
30123                 }
30124               } else {
30125                 if (isAlongOnlyPath) {
30126                   restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
30127                 } else if (isOnly) {
30128                   restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
30129                 }
30130               }
30131               if (restrict && restrict.direct)
30132                 break;
30133             }
30134             nextWays.push({ way: way2, restrict });
30135           }
30136           nextWays.forEach(function(nextWay) {
30137             step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
30138           });
30139         } else {
30140           if (currPath.length >= 3) {
30141             var turnPath = currPath.slice();
30142             if (matchedRestriction && matchedRestriction.direct === false) {
30143               for (i3 = 0; i3 < turnPath.length; i3++) {
30144                 if (turnPath[i3] === matchedRestriction.from) {
30145                   turnPath = turnPath.slice(i3);
30146                   break;
30147                 }
30148               }
30149             }
30150             var turn = pathToTurn(turnPath);
30151             if (turn) {
30152               if (matchedRestriction) {
30153                 turn.restrictionID = matchedRestriction.id;
30154                 turn.no = matchedRestriction.no;
30155                 turn.only = matchedRestriction.only;
30156                 turn.direct = matchedRestriction.direct;
30157               }
30158               turns.push(osmTurn(turn));
30159             }
30160             if (currPath[0] === currPath[2])
30161               return;
30162           }
30163           if (matchedRestriction && matchedRestriction.end)
30164             return;
30165           var n1 = vgraph2.entity(entity.first());
30166           var n2 = vgraph2.entity(entity.last());
30167           var dist = geoSphericalDistance(n1.loc, n2.loc);
30168           var nextNodes = [];
30169           if (currPath.length > 1) {
30170             if (dist > maxDistance)
30171               return;
30172             if (!entity.__via)
30173               return;
30174           }
30175           if (!entity.__oneWay && keyVertexIds.indexOf(n1.id) !== -1 && currPath.indexOf(n1.id) === -1) {
30176             nextNodes.push(n1);
30177           }
30178           if (keyVertexIds.indexOf(n2.id) !== -1 && currPath.indexOf(n2.id) === -1) {
30179             nextNodes.push(n2);
30180           }
30181           nextNodes.forEach(function(nextNode) {
30182             var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r) {
30183               if (!r.isRestriction())
30184                 return false;
30185               var f3 = r.memberByRole("from");
30186               if (!f3 || f3.id !== entity.id)
30187                 return false;
30188               var isOnly2 = /^only_/.test(r.tags.restriction);
30189               if (!isOnly2)
30190                 return true;
30191               var isOnlyVia = false;
30192               var v2 = r.membersByRole("via");
30193               if (v2.length === 1 && v2[0].type === "node") {
30194                 isOnlyVia = v2[0].id === nextNode.id;
30195               } else {
30196                 for (var i4 = 0; i4 < v2.length; i4++) {
30197                   if (v2[i4].type !== "way")
30198                     continue;
30199                   var viaWay = vgraph2.entity(v2[i4].id);
30200                   if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
30201                     isOnlyVia = true;
30202                     break;
30203                   }
30204                 }
30205               }
30206               return isOnlyVia;
30207             });
30208             step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
30209           });
30210         }
30211       }
30212       function pathToTurn(path) {
30213         if (path.length < 3)
30214           return;
30215         var fromWayId2, fromNodeId, fromVertexId;
30216         var toWayId, toNodeId, toVertexId;
30217         var viaWayIds, viaNodeId, isUturn;
30218         fromWayId2 = path[0];
30219         toWayId = path[path.length - 1];
30220         if (path.length === 3 && fromWayId2 === toWayId) {
30221           var way2 = vgraph2.entity(fromWayId2);
30222           if (way2.__oneWay)
30223             return null;
30224           isUturn = true;
30225           viaNodeId = fromVertexId = toVertexId = path[1];
30226           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
30227         } else {
30228           isUturn = false;
30229           fromVertexId = path[1];
30230           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
30231           toVertexId = path[path.length - 2];
30232           toNodeId = adjacentNode(toWayId, toVertexId);
30233           if (path.length === 3) {
30234             viaNodeId = path[1];
30235           } else {
30236             viaWayIds = path.filter(function(entityId) {
30237               return entityId[0] === "w";
30238             });
30239             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
30240           }
30241         }
30242         return {
30243           key: path.join("_"),
30244           path,
30245           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
30246           via: { node: viaNodeId, ways: viaWayIds },
30247           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
30248           u: isUturn
30249         };
30250         function adjacentNode(wayId, affixId) {
30251           var nodes2 = vgraph2.entity(wayId).nodes;
30252           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
30253         }
30254       }
30255     };
30256     return intersection;
30257   }
30258   function osmInferRestriction(graph, turn, projection2) {
30259     var fromWay = graph.entity(turn.from.way);
30260     var fromNode = graph.entity(turn.from.node);
30261     var fromVertex = graph.entity(turn.from.vertex);
30262     var toWay = graph.entity(turn.to.way);
30263     var toNode = graph.entity(turn.to.node);
30264     var toVertex = graph.entity(turn.to.vertex);
30265     var fromOneWay = fromWay.tags.oneway === "yes";
30266     var toOneWay = toWay.tags.oneway === "yes";
30267     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
30268     while (angle2 < 0) {
30269       angle2 += 360;
30270     }
30271     if (fromNode === toNode) {
30272       return "no_u_turn";
30273     }
30274     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
30275       return "no_u_turn";
30276     }
30277     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
30278       return "no_u_turn";
30279     }
30280     if (angle2 < 158) {
30281       return "no_right_turn";
30282     }
30283     if (angle2 > 202) {
30284       return "no_left_turn";
30285     }
30286     return "no_straight_on";
30287   }
30288
30289   // modules/actions/merge_polygon.js
30290   function actionMergePolygon(ids, newRelationId) {
30291     function groupEntities(graph) {
30292       var entities = ids.map(function(id2) {
30293         return graph.entity(id2);
30294       });
30295       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
30296         if (entity.type === "way" && entity.isClosed()) {
30297           return "closedWay";
30298         } else if (entity.type === "relation" && entity.isMultipolygon()) {
30299           return "multipolygon";
30300         } else {
30301           return "other";
30302         }
30303       });
30304       return Object.assign(
30305         { closedWay: [], multipolygon: [], other: [] },
30306         geometryGroups
30307       );
30308     }
30309     var action = function(graph) {
30310       var entities = groupEntities(graph);
30311       var polygons = entities.multipolygon.reduce(function(polygons2, m) {
30312         return polygons2.concat(osmJoinWays(m.members, graph));
30313       }, []).concat(entities.closedWay.map(function(d) {
30314         var member = [{ id: d.id }];
30315         member.nodes = graph.childNodes(d);
30316         return member;
30317       }));
30318       var contained = polygons.map(function(w, i2) {
30319         return polygons.map(function(d, n2) {
30320           if (i2 === n2)
30321             return null;
30322           return geoPolygonContainsPolygon(
30323             d.nodes.map(function(n3) {
30324               return n3.loc;
30325             }),
30326             w.nodes.map(function(n3) {
30327               return n3.loc;
30328             })
30329           );
30330         });
30331       });
30332       var members = [];
30333       var outer = true;
30334       while (polygons.length) {
30335         extractUncontained(polygons);
30336         polygons = polygons.filter(isContained);
30337         contained = contained.filter(isContained).map(filterContained);
30338       }
30339       function isContained(d, i2) {
30340         return contained[i2].some(function(val) {
30341           return val;
30342         });
30343       }
30344       function filterContained(d) {
30345         return d.filter(isContained);
30346       }
30347       function extractUncontained(polygons2) {
30348         polygons2.forEach(function(d, i2) {
30349           if (!isContained(d, i2)) {
30350             d.forEach(function(member) {
30351               members.push({
30352                 type: "way",
30353                 id: member.id,
30354                 role: outer ? "outer" : "inner"
30355               });
30356             });
30357           }
30358         });
30359         outer = !outer;
30360       }
30361       var relation;
30362       if (entities.multipolygon.length > 0) {
30363         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
30364         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
30365       } else {
30366         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
30367       }
30368       entities.multipolygon.forEach(function(m) {
30369         if (m.id !== relation.id) {
30370           relation = relation.mergeTags(m.tags);
30371           graph = graph.remove(m);
30372         }
30373       });
30374       entities.closedWay.forEach(function(way) {
30375         function isThisOuter(m) {
30376           return m.id === way.id && m.role !== "inner";
30377         }
30378         if (members.some(isThisOuter)) {
30379           relation = relation.mergeTags(way.tags);
30380           graph = graph.replace(way.update({ tags: {} }));
30381         }
30382       });
30383       return graph.replace(relation.update({
30384         members,
30385         tags: utilObjectOmit(relation.tags, ["area"])
30386       }));
30387     };
30388     action.disabled = function(graph) {
30389       var entities = groupEntities(graph);
30390       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
30391         return "not_eligible";
30392       }
30393       if (!entities.multipolygon.every(function(r) {
30394         return r.isComplete(graph);
30395       })) {
30396         return "incomplete_relation";
30397       }
30398       if (!entities.multipolygon.length) {
30399         var sharedMultipolygons = [];
30400         entities.closedWay.forEach(function(way, i2) {
30401           if (i2 === 0) {
30402             sharedMultipolygons = graph.parentMultipolygons(way);
30403           } else {
30404             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
30405           }
30406         });
30407         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
30408           return relation.members.length === entities.closedWay.length;
30409         });
30410         if (sharedMultipolygons.length) {
30411           return "not_eligible";
30412         }
30413       } else if (entities.closedWay.some(function(way) {
30414         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
30415       })) {
30416         return "not_eligible";
30417       }
30418     };
30419     return action;
30420   }
30421
30422   // modules/actions/merge_remote_changes.js
30423   var import_fast_deep_equal = __toESM(require_fast_deep_equal());
30424
30425   // node_modules/node-diff3/index.mjs
30426   function LCS(buffer1, buffer2) {
30427     let equivalenceClasses = {};
30428     for (let j2 = 0; j2 < buffer2.length; j2++) {
30429       const item = buffer2[j2];
30430       if (equivalenceClasses[item]) {
30431         equivalenceClasses[item].push(j2);
30432       } else {
30433         equivalenceClasses[item] = [j2];
30434       }
30435     }
30436     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
30437     let candidates = [NULLRESULT];
30438     for (let i2 = 0; i2 < buffer1.length; i2++) {
30439       const item = buffer1[i2];
30440       const buffer2indices = equivalenceClasses[item] || [];
30441       let r = 0;
30442       let c = candidates[0];
30443       for (let jx = 0; jx < buffer2indices.length; jx++) {
30444         const j2 = buffer2indices[jx];
30445         let s;
30446         for (s = r; s < candidates.length; s++) {
30447           if (candidates[s].buffer2index < j2 && (s === candidates.length - 1 || candidates[s + 1].buffer2index > j2)) {
30448             break;
30449           }
30450         }
30451         if (s < candidates.length) {
30452           const newCandidate = { buffer1index: i2, buffer2index: j2, chain: candidates[s] };
30453           if (r === candidates.length) {
30454             candidates.push(c);
30455           } else {
30456             candidates[r] = c;
30457           }
30458           r = s + 1;
30459           c = newCandidate;
30460           if (r === candidates.length) {
30461             break;
30462           }
30463         }
30464       }
30465       candidates[r] = c;
30466     }
30467     return candidates[candidates.length - 1];
30468   }
30469   function diffIndices(buffer1, buffer2) {
30470     const lcs = LCS(buffer1, buffer2);
30471     let result = [];
30472     let tail1 = buffer1.length;
30473     let tail2 = buffer2.length;
30474     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
30475       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
30476       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
30477       tail1 = candidate.buffer1index;
30478       tail2 = candidate.buffer2index;
30479       if (mismatchLength1 || mismatchLength2) {
30480         result.push({
30481           buffer1: [tail1 + 1, mismatchLength1],
30482           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
30483           buffer2: [tail2 + 1, mismatchLength2],
30484           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
30485         });
30486       }
30487     }
30488     result.reverse();
30489     return result;
30490   }
30491   function diff3MergeRegions(a, o, b) {
30492     let hunks = [];
30493     function addHunk(h, ab) {
30494       hunks.push({
30495         ab,
30496         oStart: h.buffer1[0],
30497         oLength: h.buffer1[1],
30498         abStart: h.buffer2[0],
30499         abLength: h.buffer2[1]
30500       });
30501     }
30502     diffIndices(o, a).forEach((item) => addHunk(item, "a"));
30503     diffIndices(o, b).forEach((item) => addHunk(item, "b"));
30504     hunks.sort((x, y) => x.oStart - y.oStart);
30505     let results = [];
30506     let currOffset = 0;
30507     function advanceTo(endOffset) {
30508       if (endOffset > currOffset) {
30509         results.push({
30510           stable: true,
30511           buffer: "o",
30512           bufferStart: currOffset,
30513           bufferLength: endOffset - currOffset,
30514           bufferContent: o.slice(currOffset, endOffset)
30515         });
30516         currOffset = endOffset;
30517       }
30518     }
30519     while (hunks.length) {
30520       let hunk = hunks.shift();
30521       let regionStart = hunk.oStart;
30522       let regionEnd = hunk.oStart + hunk.oLength;
30523       let regionHunks = [hunk];
30524       advanceTo(regionStart);
30525       while (hunks.length) {
30526         const nextHunk = hunks[0];
30527         const nextHunkStart = nextHunk.oStart;
30528         if (nextHunkStart > regionEnd)
30529           break;
30530         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
30531         regionHunks.push(hunks.shift());
30532       }
30533       if (regionHunks.length === 1) {
30534         if (hunk.abLength > 0) {
30535           const buffer = hunk.ab === "a" ? a : b;
30536           results.push({
30537             stable: true,
30538             buffer: hunk.ab,
30539             bufferStart: hunk.abStart,
30540             bufferLength: hunk.abLength,
30541             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
30542           });
30543         }
30544       } else {
30545         let bounds = {
30546           a: [a.length, -1, o.length, -1],
30547           b: [b.length, -1, o.length, -1]
30548         };
30549         while (regionHunks.length) {
30550           hunk = regionHunks.shift();
30551           const oStart = hunk.oStart;
30552           const oEnd = oStart + hunk.oLength;
30553           const abStart = hunk.abStart;
30554           const abEnd = abStart + hunk.abLength;
30555           let b2 = bounds[hunk.ab];
30556           b2[0] = Math.min(abStart, b2[0]);
30557           b2[1] = Math.max(abEnd, b2[1]);
30558           b2[2] = Math.min(oStart, b2[2]);
30559           b2[3] = Math.max(oEnd, b2[3]);
30560         }
30561         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
30562         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
30563         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
30564         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
30565         let result = {
30566           stable: false,
30567           aStart,
30568           aLength: aEnd - aStart,
30569           aContent: a.slice(aStart, aEnd),
30570           oStart: regionStart,
30571           oLength: regionEnd - regionStart,
30572           oContent: o.slice(regionStart, regionEnd),
30573           bStart,
30574           bLength: bEnd - bStart,
30575           bContent: b.slice(bStart, bEnd)
30576         };
30577         results.push(result);
30578       }
30579       currOffset = regionEnd;
30580     }
30581     advanceTo(o.length);
30582     return results;
30583   }
30584   function diff3Merge(a, o, b, options2) {
30585     let defaults2 = {
30586       excludeFalseConflicts: true,
30587       stringSeparator: /\s+/
30588     };
30589     options2 = Object.assign(defaults2, options2);
30590     if (typeof a === "string")
30591       a = a.split(options2.stringSeparator);
30592     if (typeof o === "string")
30593       o = o.split(options2.stringSeparator);
30594     if (typeof b === "string")
30595       b = b.split(options2.stringSeparator);
30596     let results = [];
30597     const regions = diff3MergeRegions(a, o, b);
30598     let okBuffer = [];
30599     function flushOk() {
30600       if (okBuffer.length) {
30601         results.push({ ok: okBuffer });
30602       }
30603       okBuffer = [];
30604     }
30605     function isFalseConflict(a2, b2) {
30606       if (a2.length !== b2.length)
30607         return false;
30608       for (let i2 = 0; i2 < a2.length; i2++) {
30609         if (a2[i2] !== b2[i2])
30610           return false;
30611       }
30612       return true;
30613     }
30614     regions.forEach((region) => {
30615       if (region.stable) {
30616         okBuffer.push(...region.bufferContent);
30617       } else {
30618         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
30619           okBuffer.push(...region.aContent);
30620         } else {
30621           flushOk();
30622           results.push({
30623             conflict: {
30624               a: region.aContent,
30625               aIndex: region.aStart,
30626               o: region.oContent,
30627               oIndex: region.oStart,
30628               b: region.bContent,
30629               bIndex: region.bStart
30630             }
30631           });
30632         }
30633       }
30634     });
30635     flushOk();
30636     return results;
30637   }
30638
30639   // modules/actions/merge_remote_changes.js
30640   var import_lodash = __toESM(require_lodash());
30641   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
30642     discardTags = discardTags || {};
30643     var _option = "safe";
30644     var _conflicts = [];
30645     function user(d) {
30646       return typeof formatUser === "function" ? formatUser(d) : (0, import_lodash.escape)(d);
30647     }
30648     function mergeLocation(remote, target) {
30649       function pointEqual(a, b) {
30650         var epsilon3 = 1e-6;
30651         return Math.abs(a[0] - b[0]) < epsilon3 && Math.abs(a[1] - b[1]) < epsilon3;
30652       }
30653       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
30654         return target;
30655       }
30656       if (_option === "force_remote") {
30657         return target.update({ loc: remote.loc });
30658       }
30659       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
30660       return target;
30661     }
30662     function mergeNodes(base, remote, target) {
30663       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
30664         return target;
30665       }
30666       if (_option === "force_remote") {
30667         return target.update({ nodes: remote.nodes });
30668       }
30669       var ccount = _conflicts.length;
30670       var o = base.nodes || [];
30671       var a = target.nodes || [];
30672       var b = remote.nodes || [];
30673       var nodes = [];
30674       var hunks = diff3Merge(a, o, b, { excludeFalseConflicts: true });
30675       for (var i2 = 0; i2 < hunks.length; i2++) {
30676         var hunk = hunks[i2];
30677         if (hunk.ok) {
30678           nodes.push.apply(nodes, hunk.ok);
30679         } else {
30680           var c = hunk.conflict;
30681           if ((0, import_fast_deep_equal.default)(c.o, c.a)) {
30682             nodes.push.apply(nodes, c.b);
30683           } else if ((0, import_fast_deep_equal.default)(c.o, c.b)) {
30684             nodes.push.apply(nodes, c.a);
30685           } else {
30686             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
30687             break;
30688           }
30689         }
30690       }
30691       return _conflicts.length === ccount ? target.update({ nodes }) : target;
30692     }
30693     function mergeChildren(targetWay, children2, updates, graph) {
30694       function isUsed(node2, targetWay2) {
30695         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
30696           return way.id !== targetWay2.id;
30697         });
30698         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
30699       }
30700       var ccount = _conflicts.length;
30701       for (var i2 = 0; i2 < children2.length; i2++) {
30702         var id3 = children2[i2];
30703         var node = graph.hasEntity(id3);
30704         if (targetWay.nodes.indexOf(id3) === -1) {
30705           if (node && !isUsed(node, targetWay)) {
30706             updates.removeIds.push(id3);
30707           }
30708           continue;
30709         }
30710         var local = localGraph.hasEntity(id3);
30711         var remote = remoteGraph.hasEntity(id3);
30712         var target;
30713         if (_option === "force_remote" && remote && remote.visible) {
30714           updates.replacements.push(remote);
30715         } else if (_option === "force_local" && local) {
30716           target = osmEntity(local);
30717           if (remote) {
30718             target = target.update({ version: remote.version });
30719           }
30720           updates.replacements.push(target);
30721         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
30722           target = osmEntity(local, { version: remote.version });
30723           if (remote.visible) {
30724             target = mergeLocation(remote, target);
30725           } else {
30726             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
30727           }
30728           if (_conflicts.length !== ccount)
30729             break;
30730           updates.replacements.push(target);
30731         }
30732       }
30733       return targetWay;
30734     }
30735     function updateChildren(updates, graph) {
30736       for (var i2 = 0; i2 < updates.replacements.length; i2++) {
30737         graph = graph.replace(updates.replacements[i2]);
30738       }
30739       if (updates.removeIds.length) {
30740         graph = actionDeleteMultiple(updates.removeIds)(graph);
30741       }
30742       return graph;
30743     }
30744     function mergeMembers(remote, target) {
30745       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
30746         return target;
30747       }
30748       if (_option === "force_remote") {
30749         return target.update({ members: remote.members });
30750       }
30751       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
30752       return target;
30753     }
30754     function mergeTags(base, remote, target) {
30755       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
30756         return target;
30757       }
30758       if (_option === "force_remote") {
30759         return target.update({ tags: remote.tags });
30760       }
30761       var ccount = _conflicts.length;
30762       var o = base.tags || {};
30763       var a = target.tags || {};
30764       var b = remote.tags || {};
30765       var keys = utilArrayUnion(utilArrayUnion(Object.keys(o), Object.keys(a)), Object.keys(b)).filter(function(k2) {
30766         return !discardTags[k2];
30767       });
30768       var tags = Object.assign({}, a);
30769       var changed = false;
30770       for (var i2 = 0; i2 < keys.length; i2++) {
30771         var k = keys[i2];
30772         if (o[k] !== b[k] && a[k] !== b[k]) {
30773           if (o[k] !== a[k]) {
30774             _conflicts.push(_t.html(
30775               "merge_remote_changes.conflict.tags",
30776               { tag: k, local: a[k], remote: b[k], user: { html: user(remote.user) } }
30777             ));
30778           } else {
30779             if (b.hasOwnProperty(k)) {
30780               tags[k] = b[k];
30781             } else {
30782               delete tags[k];
30783             }
30784             changed = true;
30785           }
30786         }
30787       }
30788       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
30789     }
30790     var action = function(graph) {
30791       var updates = { replacements: [], removeIds: [] };
30792       var base = graph.base().entities[id2];
30793       var local = localGraph.entity(id2);
30794       var remote = remoteGraph.entity(id2);
30795       var target = osmEntity(local, { version: remote.version });
30796       if (!remote.visible) {
30797         if (_option === "force_remote") {
30798           return actionDeleteMultiple([id2])(graph);
30799         } else if (_option === "force_local") {
30800           if (target.type === "way") {
30801             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
30802             graph = updateChildren(updates, graph);
30803           }
30804           return graph.replace(target);
30805         } else {
30806           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
30807           return graph;
30808         }
30809       }
30810       if (target.type === "node") {
30811         target = mergeLocation(remote, target);
30812       } else if (target.type === "way") {
30813         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
30814         target = mergeNodes(base, remote, target);
30815         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
30816       } else if (target.type === "relation") {
30817         target = mergeMembers(remote, target);
30818       }
30819       target = mergeTags(base, remote, target);
30820       if (!_conflicts.length) {
30821         graph = updateChildren(updates, graph).replace(target);
30822       }
30823       return graph;
30824     };
30825     action.withOption = function(opt) {
30826       _option = opt;
30827       return action;
30828     };
30829     action.conflicts = function() {
30830       return _conflicts;
30831     };
30832     return action;
30833   }
30834
30835   // modules/actions/move.js
30836   function actionMove(moveIDs, tryDelta, projection2, cache) {
30837     var _delta = tryDelta;
30838     function setupCache(graph) {
30839       function canMove(nodeID) {
30840         if (moveIDs.indexOf(nodeID) !== -1)
30841           return true;
30842         var parents = graph.parentWays(graph.entity(nodeID));
30843         if (parents.length < 3)
30844           return true;
30845         var parentsMoving = parents.every(function(way) {
30846           return cache.moving[way.id];
30847         });
30848         if (!parentsMoving)
30849           delete cache.moving[nodeID];
30850         return parentsMoving;
30851       }
30852       function cacheEntities(ids) {
30853         for (var i2 = 0; i2 < ids.length; i2++) {
30854           var id2 = ids[i2];
30855           if (cache.moving[id2])
30856             continue;
30857           cache.moving[id2] = true;
30858           var entity = graph.hasEntity(id2);
30859           if (!entity)
30860             continue;
30861           if (entity.type === "node") {
30862             cache.nodes.push(id2);
30863             cache.startLoc[id2] = entity.loc;
30864           } else if (entity.type === "way") {
30865             cache.ways.push(id2);
30866             cacheEntities(entity.nodes);
30867           } else {
30868             cacheEntities(entity.members.map(function(member) {
30869               return member.id;
30870             }));
30871           }
30872         }
30873       }
30874       function cacheIntersections(ids) {
30875         function isEndpoint(way2, id3) {
30876           return !way2.isClosed() && !!way2.affix(id3);
30877         }
30878         for (var i2 = 0; i2 < ids.length; i2++) {
30879           var id2 = ids[i2];
30880           var childNodes = graph.childNodes(graph.entity(id2));
30881           for (var j2 = 0; j2 < childNodes.length; j2++) {
30882             var node = childNodes[j2];
30883             var parents = graph.parentWays(node);
30884             if (parents.length !== 2)
30885               continue;
30886             var moved = graph.entity(id2);
30887             var unmoved = null;
30888             for (var k = 0; k < parents.length; k++) {
30889               var way = parents[k];
30890               if (!cache.moving[way.id]) {
30891                 unmoved = way;
30892                 break;
30893               }
30894             }
30895             if (!unmoved)
30896               continue;
30897             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
30898               continue;
30899             if (moved.isArea() || unmoved.isArea())
30900               continue;
30901             cache.intersections.push({
30902               nodeId: node.id,
30903               movedId: moved.id,
30904               unmovedId: unmoved.id,
30905               movedIsEP: isEndpoint(moved, node.id),
30906               unmovedIsEP: isEndpoint(unmoved, node.id)
30907             });
30908           }
30909         }
30910       }
30911       if (!cache) {
30912         cache = {};
30913       }
30914       if (!cache.ok) {
30915         cache.moving = {};
30916         cache.intersections = [];
30917         cache.replacedVertex = {};
30918         cache.startLoc = {};
30919         cache.nodes = [];
30920         cache.ways = [];
30921         cacheEntities(moveIDs);
30922         cacheIntersections(cache.ways);
30923         cache.nodes = cache.nodes.filter(canMove);
30924         cache.ok = true;
30925       }
30926     }
30927     function replaceMovedVertex(nodeId, wayId, graph, delta) {
30928       var way = graph.entity(wayId);
30929       var moved = graph.entity(nodeId);
30930       var movedIndex = way.nodes.indexOf(nodeId);
30931       var len, prevIndex, nextIndex;
30932       if (way.isClosed()) {
30933         len = way.nodes.length - 1;
30934         prevIndex = (movedIndex + len - 1) % len;
30935         nextIndex = (movedIndex + len + 1) % len;
30936       } else {
30937         len = way.nodes.length;
30938         prevIndex = movedIndex - 1;
30939         nextIndex = movedIndex + 1;
30940       }
30941       var prev = graph.hasEntity(way.nodes[prevIndex]);
30942       var next = graph.hasEntity(way.nodes[nextIndex]);
30943       if (!prev || !next)
30944         return graph;
30945       var key = wayId + "_" + nodeId;
30946       var orig = cache.replacedVertex[key];
30947       if (!orig) {
30948         orig = osmNode();
30949         cache.replacedVertex[key] = orig;
30950         cache.startLoc[orig.id] = cache.startLoc[nodeId];
30951       }
30952       var start2, end;
30953       if (delta) {
30954         start2 = projection2(cache.startLoc[nodeId]);
30955         end = projection2.invert(geoVecAdd(start2, delta));
30956       } else {
30957         end = cache.startLoc[nodeId];
30958       }
30959       orig = orig.move(end);
30960       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
30961       if (angle2 > 175 && angle2 < 185)
30962         return graph;
30963       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
30964       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
30965       var d1 = geoPathLength(p1);
30966       var d2 = geoPathLength(p2);
30967       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
30968       if (way.isClosed() && insertAt === 0)
30969         insertAt = len;
30970       way = way.addNode(orig.id, insertAt);
30971       return graph.replace(orig).replace(way);
30972     }
30973     function removeDuplicateVertices(wayId, graph) {
30974       var way = graph.entity(wayId);
30975       var epsilon3 = 1e-6;
30976       var prev, curr;
30977       function isInteresting(node, graph2) {
30978         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
30979       }
30980       for (var i2 = 0; i2 < way.nodes.length; i2++) {
30981         curr = graph.entity(way.nodes[i2]);
30982         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
30983           if (!isInteresting(prev, graph)) {
30984             way = way.removeNode(prev.id);
30985             graph = graph.replace(way).remove(prev);
30986           } else if (!isInteresting(curr, graph)) {
30987             way = way.removeNode(curr.id);
30988             graph = graph.replace(way).remove(curr);
30989           }
30990         }
30991         prev = curr;
30992       }
30993       return graph;
30994     }
30995     function unZorroIntersection(intersection, graph) {
30996       var vertex = graph.entity(intersection.nodeId);
30997       var way1 = graph.entity(intersection.movedId);
30998       var way2 = graph.entity(intersection.unmovedId);
30999       var isEP1 = intersection.movedIsEP;
31000       var isEP2 = intersection.unmovedIsEP;
31001       if (isEP1 && isEP2)
31002         return graph;
31003       var nodes1 = graph.childNodes(way1).filter(function(n2) {
31004         return n2 !== vertex;
31005       });
31006       var nodes2 = graph.childNodes(way2).filter(function(n2) {
31007         return n2 !== vertex;
31008       });
31009       if (way1.isClosed() && way1.first() === vertex.id)
31010         nodes1.push(nodes1[0]);
31011       if (way2.isClosed() && way2.first() === vertex.id)
31012         nodes2.push(nodes2[0]);
31013       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
31014       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
31015       var loc;
31016       if (!isEP1 && !isEP2) {
31017         var epsilon3 = 1e-6, maxIter = 10;
31018         for (var i2 = 0; i2 < maxIter; i2++) {
31019           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
31020           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
31021           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
31022           if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
31023             break;
31024         }
31025       } else if (!isEP1) {
31026         loc = edge1.loc;
31027       } else {
31028         loc = edge2.loc;
31029       }
31030       graph = graph.replace(vertex.move(loc));
31031       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
31032         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
31033         graph = graph.replace(way1);
31034       }
31035       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
31036         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
31037         graph = graph.replace(way2);
31038       }
31039       return graph;
31040     }
31041     function cleanupIntersections(graph) {
31042       for (var i2 = 0; i2 < cache.intersections.length; i2++) {
31043         var obj = cache.intersections[i2];
31044         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
31045         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
31046         graph = unZorroIntersection(obj, graph);
31047         graph = removeDuplicateVertices(obj.movedId, graph);
31048         graph = removeDuplicateVertices(obj.unmovedId, graph);
31049       }
31050       return graph;
31051     }
31052     function limitDelta(graph) {
31053       function moveNode(loc) {
31054         return geoVecAdd(projection2(loc), _delta);
31055       }
31056       for (var i2 = 0; i2 < cache.intersections.length; i2++) {
31057         var obj = cache.intersections[i2];
31058         if (obj.movedIsEP && obj.unmovedIsEP)
31059           continue;
31060         if (!obj.movedIsEP)
31061           continue;
31062         var node = graph.entity(obj.nodeId);
31063         var start2 = projection2(node.loc);
31064         var end = geoVecAdd(start2, _delta);
31065         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
31066         var movedPath = movedNodes.map(function(n2) {
31067           return moveNode(n2.loc);
31068         });
31069         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
31070         var unmovedPath = unmovedNodes.map(function(n2) {
31071           return projection2(n2.loc);
31072         });
31073         var hits = geoPathIntersections(movedPath, unmovedPath);
31074         for (var j2 = 0; i2 < hits.length; i2++) {
31075           if (geoVecEqual(hits[j2], end))
31076             continue;
31077           var edge = geoChooseEdge(unmovedNodes, end, projection2);
31078           _delta = geoVecSubtract(projection2(edge.loc), start2);
31079         }
31080       }
31081     }
31082     var action = function(graph) {
31083       if (_delta[0] === 0 && _delta[1] === 0)
31084         return graph;
31085       setupCache(graph);
31086       if (cache.intersections.length) {
31087         limitDelta(graph);
31088       }
31089       for (var i2 = 0; i2 < cache.nodes.length; i2++) {
31090         var node = graph.entity(cache.nodes[i2]);
31091         var start2 = projection2(node.loc);
31092         var end = geoVecAdd(start2, _delta);
31093         graph = graph.replace(node.move(projection2.invert(end)));
31094       }
31095       if (cache.intersections.length) {
31096         graph = cleanupIntersections(graph);
31097       }
31098       return graph;
31099     };
31100     action.delta = function() {
31101       return _delta;
31102     };
31103     return action;
31104   }
31105
31106   // modules/actions/move_member.js
31107   function actionMoveMember(relationId, fromIndex, toIndex) {
31108     return function(graph) {
31109       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
31110     };
31111   }
31112
31113   // modules/actions/move_node.js
31114   function actionMoveNode(nodeID, toLoc) {
31115     var action = function(graph, t) {
31116       if (t === null || !isFinite(t))
31117         t = 1;
31118       t = Math.min(Math.max(+t, 0), 1);
31119       var node = graph.entity(nodeID);
31120       return graph.replace(
31121         node.move(geoVecInterp(node.loc, toLoc, t))
31122       );
31123     };
31124     action.transitionable = true;
31125     return action;
31126   }
31127
31128   // modules/actions/noop.js
31129   function actionNoop() {
31130     return function(graph) {
31131       return graph;
31132     };
31133   }
31134
31135   // modules/actions/orthogonalize.js
31136   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
31137     var epsilon3 = ep || 1e-4;
31138     var threshold = degThresh || 13;
31139     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
31140     var upperThreshold = Math.cos(threshold * Math.PI / 180);
31141     var action = function(graph, t) {
31142       if (t === null || !isFinite(t))
31143         t = 1;
31144       t = Math.min(Math.max(+t, 0), 1);
31145       var way = graph.entity(wayID);
31146       way = way.removeNode("");
31147       if (way.tags.nonsquare) {
31148         var tags = Object.assign({}, way.tags);
31149         delete tags.nonsquare;
31150         way = way.update({ tags });
31151       }
31152       graph = graph.replace(way);
31153       var isClosed = way.isClosed();
31154       var nodes = graph.childNodes(way).slice();
31155       if (isClosed)
31156         nodes.pop();
31157       if (vertexID !== void 0) {
31158         nodes = nodeSubset(nodes, vertexID, isClosed);
31159         if (nodes.length !== 3)
31160           return graph;
31161       }
31162       var nodeCount = {};
31163       var points = [];
31164       var corner = { i: 0, dotp: 1 };
31165       var node, point, loc, score, motions, i2, j2;
31166       for (i2 = 0; i2 < nodes.length; i2++) {
31167         node = nodes[i2];
31168         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
31169         points.push({ id: node.id, coord: projection2(node.loc) });
31170       }
31171       if (points.length === 3) {
31172         for (i2 = 0; i2 < 1e3; i2++) {
31173           motions = points.map(calcMotion);
31174           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
31175           score = corner.dotp;
31176           if (score < epsilon3) {
31177             break;
31178           }
31179         }
31180         node = graph.entity(nodes[corner.i].id);
31181         loc = projection2.invert(points[corner.i].coord);
31182         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31183       } else {
31184         var straights = [];
31185         var simplified = [];
31186         for (i2 = 0; i2 < points.length; i2++) {
31187           point = points[i2];
31188           var dotp = 0;
31189           if (isClosed || i2 > 0 && i2 < points.length - 1) {
31190             var a = points[(i2 - 1 + points.length) % points.length];
31191             var b = points[(i2 + 1) % points.length];
31192             dotp = Math.abs(geoOrthoNormalizedDotProduct(a.coord, b.coord, point.coord));
31193           }
31194           if (dotp > upperThreshold) {
31195             straights.push(point);
31196           } else {
31197             simplified.push(point);
31198           }
31199         }
31200         var bestPoints = clonePoints(simplified);
31201         var originalPoints = clonePoints(simplified);
31202         score = Infinity;
31203         for (i2 = 0; i2 < 1e3; i2++) {
31204           motions = simplified.map(calcMotion);
31205           for (j2 = 0; j2 < motions.length; j2++) {
31206             simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
31207           }
31208           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
31209           if (newScore < score) {
31210             bestPoints = clonePoints(simplified);
31211             score = newScore;
31212           }
31213           if (score < epsilon3) {
31214             break;
31215           }
31216         }
31217         var bestCoords = bestPoints.map(function(p) {
31218           return p.coord;
31219         });
31220         if (isClosed)
31221           bestCoords.push(bestCoords[0]);
31222         for (i2 = 0; i2 < bestPoints.length; i2++) {
31223           point = bestPoints[i2];
31224           if (!geoVecEqual(originalPoints[i2].coord, point.coord)) {
31225             node = graph.entity(point.id);
31226             loc = projection2.invert(point.coord);
31227             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31228           }
31229         }
31230         for (i2 = 0; i2 < straights.length; i2++) {
31231           point = straights[i2];
31232           if (nodeCount[point.id] > 1)
31233             continue;
31234           node = graph.entity(point.id);
31235           if (t === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
31236             graph = actionDeleteNode(node.id)(graph);
31237           } else {
31238             var choice = geoVecProject(point.coord, bestCoords);
31239             if (choice) {
31240               loc = projection2.invert(choice.target);
31241               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
31242             }
31243           }
31244         }
31245       }
31246       return graph;
31247       function clonePoints(array2) {
31248         return array2.map(function(p) {
31249           return { id: p.id, coord: [p.coord[0], p.coord[1]] };
31250         });
31251       }
31252       function calcMotion(point2, i3, array2) {
31253         if (!isClosed && (i3 === 0 || i3 === array2.length - 1))
31254           return [0, 0];
31255         if (nodeCount[array2[i3].id] > 1)
31256           return [0, 0];
31257         var a2 = array2[(i3 - 1 + array2.length) % array2.length].coord;
31258         var origin = point2.coord;
31259         var b2 = array2[(i3 + 1) % array2.length].coord;
31260         var p = geoVecSubtract(a2, origin);
31261         var q = geoVecSubtract(b2, origin);
31262         var scale = 2 * Math.min(geoVecLength(p), geoVecLength(q));
31263         p = geoVecNormalize(p);
31264         q = geoVecNormalize(q);
31265         var dotp2 = p[0] * q[0] + p[1] * q[1];
31266         var val = Math.abs(dotp2);
31267         if (val < lowerThreshold) {
31268           corner.i = i3;
31269           corner.dotp = val;
31270           var vec = geoVecNormalize(geoVecAdd(p, q));
31271           return geoVecScale(vec, 0.1 * dotp2 * scale);
31272         }
31273         return [0, 0];
31274       }
31275     };
31276     function nodeSubset(nodes, vertexID2, isClosed) {
31277       var first = isClosed ? 0 : 1;
31278       var last = isClosed ? nodes.length : nodes.length - 1;
31279       for (var i2 = first; i2 < last; i2++) {
31280         if (nodes[i2].id === vertexID2) {
31281           return [
31282             nodes[(i2 - 1 + nodes.length) % nodes.length],
31283             nodes[i2],
31284             nodes[(i2 + 1) % nodes.length]
31285           ];
31286         }
31287       }
31288       return [];
31289     }
31290     action.disabled = function(graph) {
31291       var way = graph.entity(wayID);
31292       way = way.removeNode("");
31293       graph = graph.replace(way);
31294       var isClosed = way.isClosed();
31295       var nodes = graph.childNodes(way).slice();
31296       if (isClosed)
31297         nodes.pop();
31298       var allowStraightAngles = false;
31299       if (vertexID !== void 0) {
31300         allowStraightAngles = true;
31301         nodes = nodeSubset(nodes, vertexID, isClosed);
31302         if (nodes.length !== 3)
31303           return "end_vertex";
31304       }
31305       var coords = nodes.map(function(n2) {
31306         return projection2(n2.loc);
31307       });
31308       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
31309       if (score === null) {
31310         return "not_squarish";
31311       } else if (score === 0) {
31312         return "square_enough";
31313       } else {
31314         return false;
31315       }
31316     };
31317     action.transitionable = true;
31318     return action;
31319   }
31320
31321   // modules/actions/restrict_turn.js
31322   function actionRestrictTurn(turn, restrictionType, restrictionID) {
31323     return function(graph) {
31324       var fromWay = graph.entity(turn.from.way);
31325       var toWay = graph.entity(turn.to.way);
31326       var viaNode = turn.via.node && graph.entity(turn.via.node);
31327       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
31328         return graph.entity(id2);
31329       });
31330       var members = [];
31331       members.push({ id: fromWay.id, type: "way", role: "from" });
31332       if (viaNode) {
31333         members.push({ id: viaNode.id, type: "node", role: "via" });
31334       } else if (viaWays) {
31335         viaWays.forEach(function(viaWay) {
31336           members.push({ id: viaWay.id, type: "way", role: "via" });
31337         });
31338       }
31339       members.push({ id: toWay.id, type: "way", role: "to" });
31340       return graph.replace(osmRelation({
31341         id: restrictionID,
31342         tags: {
31343           type: "restriction",
31344           restriction: restrictionType
31345         },
31346         members
31347       }));
31348     };
31349   }
31350
31351   // modules/actions/revert.js
31352   function actionRevert(id2) {
31353     var action = function(graph) {
31354       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
31355       if (entity && !base) {
31356         if (entity.type === "node") {
31357           graph.parentWays(entity).forEach(function(parent) {
31358             parent = parent.removeNode(id2);
31359             graph = graph.replace(parent);
31360             if (parent.isDegenerate()) {
31361               graph = actionDeleteWay(parent.id)(graph);
31362             }
31363           });
31364         }
31365         graph.parentRelations(entity).forEach(function(parent) {
31366           parent = parent.removeMembersWithID(id2);
31367           graph = graph.replace(parent);
31368           if (parent.isDegenerate()) {
31369             graph = actionDeleteRelation(parent.id)(graph);
31370           }
31371         });
31372       }
31373       return graph.revert(id2);
31374     };
31375     return action;
31376   }
31377
31378   // modules/actions/rotate.js
31379   function actionRotate(rotateIds, pivot, angle2, projection2) {
31380     var action = function(graph) {
31381       return graph.update(function(graph2) {
31382         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
31383           var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
31384           graph2 = graph2.replace(node.move(projection2.invert(point)));
31385         });
31386       });
31387     };
31388     return action;
31389   }
31390
31391   // modules/actions/scale.js
31392   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
31393     return function(graph) {
31394       return graph.update(function(graph2) {
31395         let point, radial;
31396         utilGetAllNodes(ids, graph2).forEach(function(node) {
31397           point = projection2(node.loc);
31398           radial = [
31399             point[0] - pivotLoc[0],
31400             point[1] - pivotLoc[1]
31401           ];
31402           point = [
31403             pivotLoc[0] + scaleFactor * radial[0],
31404             pivotLoc[1] + scaleFactor * radial[1]
31405           ];
31406           graph2 = graph2.replace(node.move(projection2.invert(point)));
31407         });
31408       });
31409     };
31410   }
31411
31412   // modules/actions/straighten_nodes.js
31413   function actionStraightenNodes(nodeIDs, projection2) {
31414     function positionAlongWay(a, o, b) {
31415       return geoVecDot(a, b, o) / geoVecDot(b, b, o);
31416     }
31417     function getEndpoints(points) {
31418       var ssr = geoGetSmallestSurroundingRectangle(points);
31419       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
31420       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
31421       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
31422       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
31423       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
31424       if (isLong) {
31425         return [p1, q1];
31426       }
31427       return [p2, q2];
31428     }
31429     var action = function(graph, t) {
31430       if (t === null || !isFinite(t))
31431         t = 1;
31432       t = Math.min(Math.max(+t, 0), 1);
31433       var nodes = nodeIDs.map(function(id2) {
31434         return graph.entity(id2);
31435       });
31436       var points = nodes.map(function(n2) {
31437         return projection2(n2.loc);
31438       });
31439       var endpoints = getEndpoints(points);
31440       var startPoint = endpoints[0];
31441       var endPoint = endpoints[1];
31442       for (var i2 = 0; i2 < points.length; i2++) {
31443         var node = nodes[i2];
31444         var point = points[i2];
31445         var u = positionAlongWay(point, startPoint, endPoint);
31446         var point2 = geoVecInterp(startPoint, endPoint, u);
31447         var loc2 = projection2.invert(point2);
31448         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
31449       }
31450       return graph;
31451     };
31452     action.disabled = function(graph) {
31453       var nodes = nodeIDs.map(function(id2) {
31454         return graph.entity(id2);
31455       });
31456       var points = nodes.map(function(n2) {
31457         return projection2(n2.loc);
31458       });
31459       var endpoints = getEndpoints(points);
31460       var startPoint = endpoints[0];
31461       var endPoint = endpoints[1];
31462       var maxDistance = 0;
31463       for (var i2 = 0; i2 < points.length; i2++) {
31464         var point = points[i2];
31465         var u = positionAlongWay(point, startPoint, endPoint);
31466         var p = geoVecInterp(startPoint, endPoint, u);
31467         var dist = geoVecLength(p, point);
31468         if (!isNaN(dist) && dist > maxDistance) {
31469           maxDistance = dist;
31470         }
31471       }
31472       if (maxDistance < 1e-4) {
31473         return "straight_enough";
31474       }
31475     };
31476     action.transitionable = true;
31477     return action;
31478   }
31479
31480   // modules/actions/straighten_way.js
31481   function actionStraightenWay(selectedIDs, projection2) {
31482     function positionAlongWay(a, o, b) {
31483       return geoVecDot(a, b, o) / geoVecDot(b, b, o);
31484     }
31485     function allNodes(graph) {
31486       var nodes = [];
31487       var startNodes = [];
31488       var endNodes = [];
31489       var remainingWays = [];
31490       var selectedWays = selectedIDs.filter(function(w) {
31491         return graph.entity(w).type === "way";
31492       });
31493       var selectedNodes = selectedIDs.filter(function(n2) {
31494         return graph.entity(n2).type === "node";
31495       });
31496       for (var i2 = 0; i2 < selectedWays.length; i2++) {
31497         var way = graph.entity(selectedWays[i2]);
31498         nodes = way.nodes.slice(0);
31499         remainingWays.push(nodes);
31500         startNodes.push(nodes[0]);
31501         endNodes.push(nodes[nodes.length - 1]);
31502       }
31503       startNodes = startNodes.filter(function(n2) {
31504         return startNodes.indexOf(n2) === startNodes.lastIndexOf(n2);
31505       });
31506       endNodes = endNodes.filter(function(n2) {
31507         return endNodes.indexOf(n2) === endNodes.lastIndexOf(n2);
31508       });
31509       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
31510       var nextWay = [];
31511       nodes = [];
31512       var getNextWay = function(currNode2, remainingWays2) {
31513         return remainingWays2.filter(function(way2) {
31514           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
31515         })[0];
31516       };
31517       while (remainingWays.length) {
31518         nextWay = getNextWay(currNode, remainingWays);
31519         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
31520         if (nextWay[0] !== currNode) {
31521           nextWay.reverse();
31522         }
31523         nodes = nodes.concat(nextWay);
31524         currNode = nodes[nodes.length - 1];
31525       }
31526       if (selectedNodes.length === 2) {
31527         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
31528         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
31529         var sortedStartEnd = [startNodeIdx, endNodeIdx];
31530         sortedStartEnd.sort(function(a, b) {
31531           return a - b;
31532         });
31533         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
31534       }
31535       return nodes.map(function(n2) {
31536         return graph.entity(n2);
31537       });
31538     }
31539     function shouldKeepNode(node, graph) {
31540       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
31541     }
31542     var action = function(graph, t) {
31543       if (t === null || !isFinite(t))
31544         t = 1;
31545       t = Math.min(Math.max(+t, 0), 1);
31546       var nodes = allNodes(graph);
31547       var points = nodes.map(function(n2) {
31548         return projection2(n2.loc);
31549       });
31550       var startPoint = points[0];
31551       var endPoint = points[points.length - 1];
31552       var toDelete = [];
31553       var i2;
31554       for (i2 = 1; i2 < points.length - 1; i2++) {
31555         var node = nodes[i2];
31556         var point = points[i2];
31557         if (t < 1 || shouldKeepNode(node, graph)) {
31558           var u = positionAlongWay(point, startPoint, endPoint);
31559           var p = geoVecInterp(startPoint, endPoint, u);
31560           var loc2 = projection2.invert(p);
31561           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
31562         } else {
31563           if (toDelete.indexOf(node) === -1) {
31564             toDelete.push(node);
31565           }
31566         }
31567       }
31568       for (i2 = 0; i2 < toDelete.length; i2++) {
31569         graph = actionDeleteNode(toDelete[i2].id)(graph);
31570       }
31571       return graph;
31572     };
31573     action.disabled = function(graph) {
31574       var nodes = allNodes(graph);
31575       var points = nodes.map(function(n2) {
31576         return projection2(n2.loc);
31577       });
31578       var startPoint = points[0];
31579       var endPoint = points[points.length - 1];
31580       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
31581       var i2;
31582       if (threshold === 0) {
31583         return "too_bendy";
31584       }
31585       var maxDistance = 0;
31586       for (i2 = 1; i2 < points.length - 1; i2++) {
31587         var point = points[i2];
31588         var u = positionAlongWay(point, startPoint, endPoint);
31589         var p = geoVecInterp(startPoint, endPoint, u);
31590         var dist = geoVecLength(p, point);
31591         if (isNaN(dist) || dist > threshold) {
31592           return "too_bendy";
31593         } else if (dist > maxDistance) {
31594           maxDistance = dist;
31595         }
31596       }
31597       var keepingAllNodes = nodes.every(function(node, i3) {
31598         return i3 === 0 || i3 === nodes.length - 1 || shouldKeepNode(node, graph);
31599       });
31600       if (maxDistance < 1e-4 && keepingAllNodes) {
31601         return "straight_enough";
31602       }
31603     };
31604     action.transitionable = true;
31605     return action;
31606   }
31607
31608   // modules/actions/unrestrict_turn.js
31609   function actionUnrestrictTurn(turn) {
31610     return function(graph) {
31611       return actionDeleteRelation(turn.restrictionID)(graph);
31612     };
31613   }
31614
31615   // modules/actions/reflect.js
31616   function actionReflect(reflectIds, projection2) {
31617     var _useLongAxis = true;
31618     var action = function(graph, t) {
31619       if (t === null || !isFinite(t))
31620         t = 1;
31621       t = Math.min(Math.max(+t, 0), 1);
31622       var nodes = utilGetAllNodes(reflectIds, graph);
31623       var points = nodes.map(function(n2) {
31624         return projection2(n2.loc);
31625       });
31626       var ssr = geoGetSmallestSurroundingRectangle(points);
31627       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
31628       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
31629       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
31630       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
31631       var p, q;
31632       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
31633       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
31634         p = p1;
31635         q = q1;
31636       } else {
31637         p = p2;
31638         q = q2;
31639       }
31640       var dx = q[0] - p[0];
31641       var dy = q[1] - p[1];
31642       var a = (dx * dx - dy * dy) / (dx * dx + dy * dy);
31643       var b = 2 * dx * dy / (dx * dx + dy * dy);
31644       for (var i2 = 0; i2 < nodes.length; i2++) {
31645         var node = nodes[i2];
31646         var c = projection2(node.loc);
31647         var c2 = [
31648           a * (c[0] - p[0]) + b * (c[1] - p[1]) + p[0],
31649           b * (c[0] - p[0]) - a * (c[1] - p[1]) + p[1]
31650         ];
31651         var loc2 = projection2.invert(c2);
31652         node = node.move(geoVecInterp(node.loc, loc2, t));
31653         graph = graph.replace(node);
31654       }
31655       return graph;
31656     };
31657     action.useLongAxis = function(val) {
31658       if (!arguments.length)
31659         return _useLongAxis;
31660       _useLongAxis = val;
31661       return action;
31662     };
31663     action.transitionable = true;
31664     return action;
31665   }
31666
31667   // modules/actions/upgrade_tags.js
31668   function actionUpgradeTags(entityId, oldTags, replaceTags) {
31669     return function(graph) {
31670       var entity = graph.entity(entityId);
31671       var tags = Object.assign({}, entity.tags);
31672       var transferValue;
31673       var semiIndex;
31674       for (var oldTagKey in oldTags) {
31675         if (!(oldTagKey in tags))
31676           continue;
31677         if (oldTags[oldTagKey] === "*") {
31678           transferValue = tags[oldTagKey];
31679           delete tags[oldTagKey];
31680         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
31681           delete tags[oldTagKey];
31682         } else {
31683           var vals = tags[oldTagKey].split(";").filter(Boolean);
31684           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
31685           if (vals.length === 1 || oldIndex === -1) {
31686             delete tags[oldTagKey];
31687           } else {
31688             if (replaceTags && replaceTags[oldTagKey]) {
31689               semiIndex = oldIndex;
31690             }
31691             vals.splice(oldIndex, 1);
31692             tags[oldTagKey] = vals.join(";");
31693           }
31694         }
31695       }
31696       if (replaceTags) {
31697         for (var replaceKey in replaceTags) {
31698           var replaceValue = replaceTags[replaceKey];
31699           if (replaceValue === "*") {
31700             if (tags[replaceKey] && tags[replaceKey] !== "no") {
31701               continue;
31702             } else {
31703               tags[replaceKey] = "yes";
31704             }
31705           } else if (replaceValue === "$1") {
31706             tags[replaceKey] = transferValue;
31707           } else {
31708             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
31709               var existingVals = tags[replaceKey].split(";").filter(Boolean);
31710               if (existingVals.indexOf(replaceValue) === -1) {
31711                 existingVals.splice(semiIndex, 0, replaceValue);
31712                 tags[replaceKey] = existingVals.join(";");
31713               }
31714             } else {
31715               tags[replaceKey] = replaceValue;
31716             }
31717           }
31718         }
31719       }
31720       return graph.replace(entity.update({ tags }));
31721     };
31722   }
31723
31724   // modules/behavior/edit.js
31725   function behaviorEdit(context) {
31726     function behavior() {
31727       context.map().minzoom(context.minEditableZoom());
31728     }
31729     behavior.off = function() {
31730       context.map().minzoom(0);
31731     };
31732     return behavior;
31733   }
31734
31735   // modules/behavior/hover.js
31736   function behaviorHover(context) {
31737     var dispatch10 = dispatch_default("hover");
31738     var _selection = select_default2(null);
31739     var _newNodeId = null;
31740     var _initialNodeID = null;
31741     var _altDisables;
31742     var _ignoreVertex;
31743     var _targets = [];
31744     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
31745     function keydown(d3_event) {
31746       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
31747         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
31748         _selection.classed("hover-disabled", true);
31749         dispatch10.call("hover", this, null);
31750       }
31751     }
31752     function keyup(d3_event) {
31753       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
31754         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
31755         _selection.classed("hover-disabled", false);
31756         dispatch10.call("hover", this, _targets);
31757       }
31758     }
31759     function behavior(selection2) {
31760       _selection = selection2;
31761       _targets = [];
31762       if (_initialNodeID) {
31763         _newNodeId = _initialNodeID;
31764         _initialNodeID = null;
31765       } else {
31766         _newNodeId = null;
31767       }
31768       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
31769       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
31770       function eventTarget(d3_event) {
31771         var datum2 = d3_event.target && d3_event.target.__data__;
31772         if (typeof datum2 !== "object")
31773           return null;
31774         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
31775           return datum2.properties.entity;
31776         }
31777         return datum2;
31778       }
31779       function pointerover(d3_event) {
31780         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
31781           return;
31782         var target = eventTarget(d3_event);
31783         if (target && _targets.indexOf(target) === -1) {
31784           _targets.push(target);
31785           updateHover(d3_event, _targets);
31786         }
31787       }
31788       function pointerout(d3_event) {
31789         var target = eventTarget(d3_event);
31790         var index = _targets.indexOf(target);
31791         if (index !== -1) {
31792           _targets.splice(index);
31793           updateHover(d3_event, _targets);
31794         }
31795       }
31796       function allowsVertex(d) {
31797         return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
31798       }
31799       function modeAllowsHover(target) {
31800         var mode = context.mode();
31801         if (mode.id === "add-point") {
31802           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
31803         }
31804         return true;
31805       }
31806       function updateHover(d3_event, targets) {
31807         _selection.selectAll(".hover").classed("hover", false);
31808         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
31809         var mode = context.mode();
31810         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
31811           var node = targets.find(function(target) {
31812             return target instanceof osmEntity && target.type === "node";
31813           });
31814           _newNodeId = node && node.id;
31815         }
31816         targets = targets.filter(function(datum3) {
31817           if (datum3 instanceof osmEntity) {
31818             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
31819           }
31820           return true;
31821         });
31822         var selector = "";
31823         for (var i2 in targets) {
31824           var datum2 = targets[i2];
31825           if (datum2.__featurehash__) {
31826             selector += ", .data" + datum2.__featurehash__;
31827           } else if (datum2 instanceof QAItem) {
31828             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
31829           } else if (datum2 instanceof osmNote) {
31830             selector += ", .note-" + datum2.id;
31831           } else if (datum2 instanceof osmEntity) {
31832             selector += ", ." + datum2.id;
31833             if (datum2.type === "relation") {
31834               for (var j2 in datum2.members) {
31835                 selector += ", ." + datum2.members[j2].id;
31836               }
31837             }
31838           }
31839         }
31840         var suppressed = _altDisables && d3_event && d3_event.altKey;
31841         if (selector.trim().length) {
31842           selector = selector.slice(1);
31843           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
31844         }
31845         dispatch10.call("hover", this, !suppressed && targets);
31846       }
31847     }
31848     behavior.off = function(selection2) {
31849       selection2.selectAll(".hover").classed("hover", false);
31850       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
31851       selection2.classed("hover-disabled", false);
31852       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
31853       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
31854     };
31855     behavior.altDisables = function(val) {
31856       if (!arguments.length)
31857         return _altDisables;
31858       _altDisables = val;
31859       return behavior;
31860     };
31861     behavior.ignoreVertex = function(val) {
31862       if (!arguments.length)
31863         return _ignoreVertex;
31864       _ignoreVertex = val;
31865       return behavior;
31866     };
31867     behavior.initialNodeID = function(nodeId) {
31868       _initialNodeID = nodeId;
31869       return behavior;
31870     };
31871     return utilRebind(behavior, dispatch10, "on");
31872   }
31873
31874   // modules/behavior/draw.js
31875   var _disableSpace = false;
31876   var _lastSpace = null;
31877   function behaviorDraw(context) {
31878     var dispatch10 = dispatch_default(
31879       "move",
31880       "down",
31881       "downcancel",
31882       "click",
31883       "clickWay",
31884       "clickNode",
31885       "undo",
31886       "cancel",
31887       "finish"
31888     );
31889     var keybinding = utilKeybinding("draw");
31890     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
31891     var _edit = behaviorEdit(context);
31892     var _closeTolerance = 4;
31893     var _tolerance = 12;
31894     var _mouseLeave = false;
31895     var _lastMouse = null;
31896     var _lastPointerUpEvent;
31897     var _downPointer;
31898     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
31899     function datum2(d3_event) {
31900       var mode = context.mode();
31901       var isNote = mode && mode.id.indexOf("note") !== -1;
31902       if (d3_event.altKey || isNote)
31903         return {};
31904       var element;
31905       if (d3_event.type === "keydown") {
31906         element = _lastMouse && _lastMouse.target;
31907       } else {
31908         element = d3_event.target;
31909       }
31910       var d = element.__data__;
31911       return d && d.properties && d.properties.target ? d : {};
31912     }
31913     function pointerdown(d3_event) {
31914       if (_downPointer)
31915         return;
31916       var pointerLocGetter = utilFastMouse(this);
31917       _downPointer = {
31918         id: d3_event.pointerId || "mouse",
31919         pointerLocGetter,
31920         downTime: +new Date(),
31921         downLoc: pointerLocGetter(d3_event)
31922       };
31923       dispatch10.call("down", this, d3_event, datum2(d3_event));
31924     }
31925     function pointerup(d3_event) {
31926       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
31927         return;
31928       var downPointer = _downPointer;
31929       _downPointer = null;
31930       _lastPointerUpEvent = d3_event;
31931       if (downPointer.isCancelled)
31932         return;
31933       var t2 = +new Date();
31934       var p2 = downPointer.pointerLocGetter(d3_event);
31935       var dist = geoVecLength(downPointer.downLoc, p2);
31936       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
31937         select_default2(window).on("click.draw-block", function() {
31938           d3_event.stopPropagation();
31939         }, true);
31940         context.map().dblclickZoomEnable(false);
31941         window.setTimeout(function() {
31942           context.map().dblclickZoomEnable(true);
31943           select_default2(window).on("click.draw-block", null);
31944         }, 500);
31945         click(d3_event, p2);
31946       }
31947     }
31948     function pointermove(d3_event) {
31949       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
31950         var p2 = _downPointer.pointerLocGetter(d3_event);
31951         var dist = geoVecLength(_downPointer.downLoc, p2);
31952         if (dist >= _closeTolerance) {
31953           _downPointer.isCancelled = true;
31954           dispatch10.call("downcancel", this);
31955         }
31956       }
31957       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
31958         return;
31959       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
31960         return;
31961       _lastMouse = d3_event;
31962       dispatch10.call("move", this, d3_event, datum2(d3_event));
31963     }
31964     function pointercancel(d3_event) {
31965       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
31966         if (!_downPointer.isCancelled) {
31967           dispatch10.call("downcancel", this);
31968         }
31969         _downPointer = null;
31970       }
31971     }
31972     function mouseenter() {
31973       _mouseLeave = false;
31974     }
31975     function mouseleave() {
31976       _mouseLeave = true;
31977     }
31978     function allowsVertex(d) {
31979       return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
31980     }
31981     function click(d3_event, loc) {
31982       var d = datum2(d3_event);
31983       var target = d && d.properties && d.properties.entity;
31984       var mode = context.mode();
31985       if (target && target.type === "node" && allowsVertex(target)) {
31986         dispatch10.call("clickNode", this, target, d);
31987         return;
31988       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
31989         var choice = geoChooseEdge(
31990           context.graph().childNodes(target),
31991           loc,
31992           context.projection,
31993           context.activeID()
31994         );
31995         if (choice) {
31996           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
31997           dispatch10.call("clickWay", this, choice.loc, edge, d);
31998           return;
31999         }
32000       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
32001         var locLatLng = context.projection.invert(loc);
32002         dispatch10.call("click", this, locLatLng, d);
32003       }
32004     }
32005     function space(d3_event) {
32006       d3_event.preventDefault();
32007       d3_event.stopPropagation();
32008       var currSpace = context.map().mouse();
32009       if (_disableSpace && _lastSpace) {
32010         var dist = geoVecLength(_lastSpace, currSpace);
32011         if (dist > _tolerance) {
32012           _disableSpace = false;
32013         }
32014       }
32015       if (_disableSpace || _mouseLeave || !_lastMouse)
32016         return;
32017       _lastSpace = currSpace;
32018       _disableSpace = true;
32019       select_default2(window).on("keyup.space-block", function() {
32020         d3_event.preventDefault();
32021         d3_event.stopPropagation();
32022         _disableSpace = false;
32023         select_default2(window).on("keyup.space-block", null);
32024       });
32025       var loc = context.map().mouse() || context.projection(context.map().center());
32026       click(d3_event, loc);
32027     }
32028     function backspace(d3_event) {
32029       d3_event.preventDefault();
32030       dispatch10.call("undo");
32031     }
32032     function del(d3_event) {
32033       d3_event.preventDefault();
32034       dispatch10.call("cancel");
32035     }
32036     function ret(d3_event) {
32037       d3_event.preventDefault();
32038       dispatch10.call("finish");
32039     }
32040     function behavior(selection2) {
32041       context.install(_hover);
32042       context.install(_edit);
32043       _downPointer = null;
32044       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
32045       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
32046       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
32047       select_default2(document).call(keybinding);
32048       return behavior;
32049     }
32050     behavior.off = function(selection2) {
32051       context.ui().sidebar.hover.cancel();
32052       context.uninstall(_hover);
32053       context.uninstall(_edit);
32054       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
32055       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
32056       select_default2(document).call(keybinding.unbind);
32057     };
32058     behavior.hover = function() {
32059       return _hover;
32060     };
32061     return utilRebind(behavior, dispatch10, "on");
32062   }
32063
32064   // modules/behavior/breathe.js
32065   var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
32066
32067   // node_modules/d3-scale/src/init.js
32068   function initRange(domain2, range3) {
32069     switch (arguments.length) {
32070       case 0:
32071         break;
32072       case 1:
32073         this.range(domain2);
32074         break;
32075       default:
32076         this.range(range3).domain(domain2);
32077         break;
32078     }
32079     return this;
32080   }
32081
32082   // node_modules/d3-scale/src/constant.js
32083   function constants(x) {
32084     return function() {
32085       return x;
32086     };
32087   }
32088
32089   // node_modules/d3-scale/src/number.js
32090   function number2(x) {
32091     return +x;
32092   }
32093
32094   // node_modules/d3-scale/src/continuous.js
32095   var unit = [0, 1];
32096   function identity3(x) {
32097     return x;
32098   }
32099   function normalize(a, b) {
32100     return (b -= a = +a) ? function(x) {
32101       return (x - a) / b;
32102     } : constants(isNaN(b) ? NaN : 0.5);
32103   }
32104   function clamper(a, b) {
32105     var t;
32106     if (a > b)
32107       t = a, a = b, b = t;
32108     return function(x) {
32109       return Math.max(a, Math.min(b, x));
32110     };
32111   }
32112   function bimap(domain2, range3, interpolate) {
32113     var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
32114     if (d1 < d0)
32115       d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
32116     else
32117       d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
32118     return function(x) {
32119       return r0(d0(x));
32120     };
32121   }
32122   function polymap(domain2, range3, interpolate) {
32123     var j2 = Math.min(domain2.length, range3.length) - 1, d = new Array(j2), r = new Array(j2), i2 = -1;
32124     if (domain2[j2] < domain2[0]) {
32125       domain2 = domain2.slice().reverse();
32126       range3 = range3.slice().reverse();
32127     }
32128     while (++i2 < j2) {
32129       d[i2] = normalize(domain2[i2], domain2[i2 + 1]);
32130       r[i2] = interpolate(range3[i2], range3[i2 + 1]);
32131     }
32132     return function(x) {
32133       var i3 = bisect_default(domain2, x, 1, j2) - 1;
32134       return r[i3](d[i3](x));
32135     };
32136   }
32137   function copy(source, target) {
32138     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
32139   }
32140   function transformer2() {
32141     var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
32142     function rescale() {
32143       var n2 = Math.min(domain2.length, range3.length);
32144       if (clamp3 !== identity3)
32145         clamp3 = clamper(domain2[0], domain2[n2 - 1]);
32146       piecewise = n2 > 2 ? polymap : bimap;
32147       output = input = null;
32148       return scale;
32149     }
32150     function scale(x) {
32151       return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x)));
32152     }
32153     scale.invert = function(y) {
32154       return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y)));
32155     };
32156     scale.domain = function(_) {
32157       return arguments.length ? (domain2 = Array.from(_, number2), rescale()) : domain2.slice();
32158     };
32159     scale.range = function(_) {
32160       return arguments.length ? (range3 = Array.from(_), rescale()) : range3.slice();
32161     };
32162     scale.rangeRound = function(_) {
32163       return range3 = Array.from(_), interpolate = round_default, rescale();
32164     };
32165     scale.clamp = function(_) {
32166       return arguments.length ? (clamp3 = _ ? true : identity3, rescale()) : clamp3 !== identity3;
32167     };
32168     scale.interpolate = function(_) {
32169       return arguments.length ? (interpolate = _, rescale()) : interpolate;
32170     };
32171     scale.unknown = function(_) {
32172       return arguments.length ? (unknown = _, scale) : unknown;
32173     };
32174     return function(t, u) {
32175       transform2 = t, untransform = u;
32176       return rescale();
32177     };
32178   }
32179   function continuous() {
32180     return transformer2()(identity3, identity3);
32181   }
32182
32183   // node_modules/d3-format/src/formatDecimal.js
32184   function formatDecimal_default(x) {
32185     return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
32186   }
32187   function formatDecimalParts(x, p) {
32188     if ((i2 = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0)
32189       return null;
32190     var i2, coefficient = x.slice(0, i2);
32191     return [
32192       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
32193       +x.slice(i2 + 1)
32194     ];
32195   }
32196
32197   // node_modules/d3-format/src/exponent.js
32198   function exponent_default(x) {
32199     return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
32200   }
32201
32202   // node_modules/d3-format/src/formatGroup.js
32203   function formatGroup_default(grouping, thousands) {
32204     return function(value, width) {
32205       var i2 = value.length, t = [], j2 = 0, g = grouping[0], length = 0;
32206       while (i2 > 0 && g > 0) {
32207         if (length + g + 1 > width)
32208           g = Math.max(1, width - length);
32209         t.push(value.substring(i2 -= g, i2 + g));
32210         if ((length += g + 1) > width)
32211           break;
32212         g = grouping[j2 = (j2 + 1) % grouping.length];
32213       }
32214       return t.reverse().join(thousands);
32215     };
32216   }
32217
32218   // node_modules/d3-format/src/formatNumerals.js
32219   function formatNumerals_default(numerals) {
32220     return function(value) {
32221       return value.replace(/[0-9]/g, function(i2) {
32222         return numerals[+i2];
32223       });
32224     };
32225   }
32226
32227   // node_modules/d3-format/src/formatSpecifier.js
32228   var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
32229   function formatSpecifier(specifier) {
32230     if (!(match = re.exec(specifier)))
32231       throw new Error("invalid format: " + specifier);
32232     var match;
32233     return new FormatSpecifier({
32234       fill: match[1],
32235       align: match[2],
32236       sign: match[3],
32237       symbol: match[4],
32238       zero: match[5],
32239       width: match[6],
32240       comma: match[7],
32241       precision: match[8] && match[8].slice(1),
32242       trim: match[9],
32243       type: match[10]
32244     });
32245   }
32246   formatSpecifier.prototype = FormatSpecifier.prototype;
32247   function FormatSpecifier(specifier) {
32248     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
32249     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
32250     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
32251     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
32252     this.zero = !!specifier.zero;
32253     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
32254     this.comma = !!specifier.comma;
32255     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
32256     this.trim = !!specifier.trim;
32257     this.type = specifier.type === void 0 ? "" : specifier.type + "";
32258   }
32259   FormatSpecifier.prototype.toString = function() {
32260     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;
32261   };
32262
32263   // node_modules/d3-format/src/formatTrim.js
32264   function formatTrim_default(s) {
32265     out:
32266       for (var n2 = s.length, i2 = 1, i0 = -1, i1; i2 < n2; ++i2) {
32267         switch (s[i2]) {
32268           case ".":
32269             i0 = i1 = i2;
32270             break;
32271           case "0":
32272             if (i0 === 0)
32273               i0 = i2;
32274             i1 = i2;
32275             break;
32276           default:
32277             if (!+s[i2])
32278               break out;
32279             if (i0 > 0)
32280               i0 = 0;
32281             break;
32282         }
32283       }
32284     return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
32285   }
32286
32287   // node_modules/d3-format/src/formatPrefixAuto.js
32288   var prefixExponent;
32289   function formatPrefixAuto_default(x, p) {
32290     var d = formatDecimalParts(x, p);
32291     if (!d)
32292       return x + "";
32293     var coefficient = d[0], exponent = d[1], i2 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n2 = coefficient.length;
32294     return i2 === n2 ? coefficient : i2 > n2 ? coefficient + new Array(i2 - n2 + 1).join("0") : i2 > 0 ? coefficient.slice(0, i2) + "." + coefficient.slice(i2) : "0." + new Array(1 - i2).join("0") + formatDecimalParts(x, Math.max(0, p + i2 - 1))[0];
32295   }
32296
32297   // node_modules/d3-format/src/formatRounded.js
32298   function formatRounded_default(x, p) {
32299     var d = formatDecimalParts(x, p);
32300     if (!d)
32301       return x + "";
32302     var coefficient = d[0], exponent = d[1];
32303     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");
32304   }
32305
32306   // node_modules/d3-format/src/formatTypes.js
32307   var formatTypes_default = {
32308     "%": (x, p) => (x * 100).toFixed(p),
32309     "b": (x) => Math.round(x).toString(2),
32310     "c": (x) => x + "",
32311     "d": formatDecimal_default,
32312     "e": (x, p) => x.toExponential(p),
32313     "f": (x, p) => x.toFixed(p),
32314     "g": (x, p) => x.toPrecision(p),
32315     "o": (x) => Math.round(x).toString(8),
32316     "p": (x, p) => formatRounded_default(x * 100, p),
32317     "r": formatRounded_default,
32318     "s": formatPrefixAuto_default,
32319     "X": (x) => Math.round(x).toString(16).toUpperCase(),
32320     "x": (x) => Math.round(x).toString(16)
32321   };
32322
32323   // node_modules/d3-format/src/identity.js
32324   function identity_default3(x) {
32325     return x;
32326   }
32327
32328   // node_modules/d3-format/src/locale.js
32329   var map = Array.prototype.map;
32330   var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
32331   function locale_default(locale2) {
32332     var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default3 : 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_default3 : 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 + "";
32333     function newFormat(specifier) {
32334       specifier = formatSpecifier(specifier);
32335       var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision2 = specifier.precision, trim = specifier.trim, type3 = specifier.type;
32336       if (type3 === "n")
32337         comma = true, type3 = "g";
32338       else if (!formatTypes_default[type3])
32339         precision2 === void 0 && (precision2 = 12), trim = true, type3 = "g";
32340       if (zero3 || fill === "0" && align === "=")
32341         zero3 = true, fill = "0", align = "=";
32342       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type3) ? "0" + type3.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type3) ? percent : "";
32343       var formatType = formatTypes_default[type3], maybeSuffix = /[defgprs%]/.test(type3);
32344       precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type3) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
32345       function format2(value) {
32346         var valuePrefix = prefix, valueSuffix = suffix, i2, n2, c;
32347         if (type3 === "c") {
32348           valueSuffix = formatType(value) + valueSuffix;
32349           value = "";
32350         } else {
32351           value = +value;
32352           var valueNegative = value < 0 || 1 / value < 0;
32353           value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
32354           if (trim)
32355             value = formatTrim_default(value);
32356           if (valueNegative && +value === 0 && sign2 !== "+")
32357             valueNegative = false;
32358           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
32359           valueSuffix = (type3 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
32360           if (maybeSuffix) {
32361             i2 = -1, n2 = value.length;
32362             while (++i2 < n2) {
32363               if (c = value.charCodeAt(i2), 48 > c || c > 57) {
32364                 valueSuffix = (c === 46 ? decimal + value.slice(i2 + 1) : value.slice(i2)) + valueSuffix;
32365                 value = value.slice(0, i2);
32366                 break;
32367               }
32368             }
32369           }
32370         }
32371         if (comma && !zero3)
32372           value = group(value, Infinity);
32373         var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
32374         if (comma && zero3)
32375           value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
32376         switch (align) {
32377           case "<":
32378             value = valuePrefix + value + valueSuffix + padding;
32379             break;
32380           case "=":
32381             value = valuePrefix + padding + value + valueSuffix;
32382             break;
32383           case "^":
32384             value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
32385             break;
32386           default:
32387             value = padding + valuePrefix + value + valueSuffix;
32388             break;
32389         }
32390         return numerals(value);
32391       }
32392       format2.toString = function() {
32393         return specifier + "";
32394       };
32395       return format2;
32396     }
32397     function formatPrefix2(specifier, value) {
32398       var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
32399       return function(value2) {
32400         return f2(k * value2) + prefix;
32401       };
32402     }
32403     return {
32404       format: newFormat,
32405       formatPrefix: formatPrefix2
32406     };
32407   }
32408
32409   // node_modules/d3-format/src/defaultLocale.js
32410   var locale;
32411   var format;
32412   var formatPrefix;
32413   defaultLocale({
32414     thousands: ",",
32415     grouping: [3],
32416     currency: ["$", ""]
32417   });
32418   function defaultLocale(definition) {
32419     locale = locale_default(definition);
32420     format = locale.format;
32421     formatPrefix = locale.formatPrefix;
32422     return locale;
32423   }
32424
32425   // node_modules/d3-format/src/precisionFixed.js
32426   function precisionFixed_default(step) {
32427     return Math.max(0, -exponent_default(Math.abs(step)));
32428   }
32429
32430   // node_modules/d3-format/src/precisionPrefix.js
32431   function precisionPrefix_default(step, value) {
32432     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
32433   }
32434
32435   // node_modules/d3-format/src/precisionRound.js
32436   function precisionRound_default(step, max3) {
32437     step = Math.abs(step), max3 = Math.abs(max3) - step;
32438     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
32439   }
32440
32441   // node_modules/d3-scale/src/tickFormat.js
32442   function tickFormat(start2, stop, count, specifier) {
32443     var step = tickStep(start2, stop, count), precision2;
32444     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
32445     switch (specifier.type) {
32446       case "s": {
32447         var value = Math.max(Math.abs(start2), Math.abs(stop));
32448         if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
32449           specifier.precision = precision2;
32450         return formatPrefix(specifier, value);
32451       }
32452       case "":
32453       case "e":
32454       case "g":
32455       case "p":
32456       case "r": {
32457         if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
32458           specifier.precision = precision2 - (specifier.type === "e");
32459         break;
32460       }
32461       case "f":
32462       case "%": {
32463         if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
32464           specifier.precision = precision2 - (specifier.type === "%") * 2;
32465         break;
32466       }
32467     }
32468     return format(specifier);
32469   }
32470
32471   // node_modules/d3-scale/src/linear.js
32472   function linearish(scale) {
32473     var domain2 = scale.domain;
32474     scale.ticks = function(count) {
32475       var d = domain2();
32476       return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
32477     };
32478     scale.tickFormat = function(count, specifier) {
32479       var d = domain2();
32480       return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
32481     };
32482     scale.nice = function(count) {
32483       if (count == null)
32484         count = 10;
32485       var d = domain2();
32486       var i0 = 0;
32487       var i1 = d.length - 1;
32488       var start2 = d[i0];
32489       var stop = d[i1];
32490       var prestep;
32491       var step;
32492       var maxIter = 10;
32493       if (stop < start2) {
32494         step = start2, start2 = stop, stop = step;
32495         step = i0, i0 = i1, i1 = step;
32496       }
32497       while (maxIter-- > 0) {
32498         step = tickIncrement(start2, stop, count);
32499         if (step === prestep) {
32500           d[i0] = start2;
32501           d[i1] = stop;
32502           return domain2(d);
32503         } else if (step > 0) {
32504           start2 = Math.floor(start2 / step) * step;
32505           stop = Math.ceil(stop / step) * step;
32506         } else if (step < 0) {
32507           start2 = Math.ceil(start2 * step) / step;
32508           stop = Math.floor(stop * step) / step;
32509         } else {
32510           break;
32511         }
32512         prestep = step;
32513       }
32514       return scale;
32515     };
32516     return scale;
32517   }
32518   function linear3() {
32519     var scale = continuous();
32520     scale.copy = function() {
32521       return copy(scale, linear3());
32522     };
32523     initRange.apply(scale, arguments);
32524     return linearish(scale);
32525   }
32526
32527   // node_modules/d3-scale/src/quantize.js
32528   function quantize() {
32529     var x05 = 0, x12 = 1, n2 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
32530     function scale(x) {
32531       return x != null && x <= x ? range3[bisect_default(domain2, x, 0, n2)] : unknown;
32532     }
32533     function rescale() {
32534       var i2 = -1;
32535       domain2 = new Array(n2);
32536       while (++i2 < n2)
32537         domain2[i2] = ((i2 + 1) * x12 - (i2 - n2) * x05) / (n2 + 1);
32538       return scale;
32539     }
32540     scale.domain = function(_) {
32541       return arguments.length ? ([x05, x12] = _, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
32542     };
32543     scale.range = function(_) {
32544       return arguments.length ? (n2 = (range3 = Array.from(_)).length - 1, rescale()) : range3.slice();
32545     };
32546     scale.invertExtent = function(y) {
32547       var i2 = range3.indexOf(y);
32548       return i2 < 0 ? [NaN, NaN] : i2 < 1 ? [x05, domain2[0]] : i2 >= n2 ? [domain2[n2 - 1], x12] : [domain2[i2 - 1], domain2[i2]];
32549     };
32550     scale.unknown = function(_) {
32551       return arguments.length ? (unknown = _, scale) : scale;
32552     };
32553     scale.thresholds = function() {
32554       return domain2.slice();
32555     };
32556     scale.copy = function() {
32557       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
32558     };
32559     return initRange.apply(linearish(scale), arguments);
32560   }
32561
32562   // modules/behavior/breathe.js
32563   function behaviorBreathe() {
32564     var duration = 800;
32565     var steps = 4;
32566     var selector = ".selected.shadow, .selected .shadow";
32567     var _selected = select_default2(null);
32568     var _classed = "";
32569     var _params = {};
32570     var _done = false;
32571     var _timer;
32572     function ratchetyInterpolator(a, b, steps2, units) {
32573       a = parseFloat(a);
32574       b = parseFloat(b);
32575       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a, b), steps2));
32576       return function(t) {
32577         return String(sample(t)) + (units || "");
32578       };
32579     }
32580     function reset(selection2) {
32581       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
32582     }
32583     function setAnimationParams(transition2, fromTo) {
32584       var toFrom = fromTo === "from" ? "to" : "from";
32585       transition2.styleTween("stroke-opacity", function(d) {
32586         return ratchetyInterpolator(
32587           _params[d.id][toFrom].opacity,
32588           _params[d.id][fromTo].opacity,
32589           steps
32590         );
32591       }).styleTween("stroke-width", function(d) {
32592         return ratchetyInterpolator(
32593           _params[d.id][toFrom].width,
32594           _params[d.id][fromTo].width,
32595           steps,
32596           "px"
32597         );
32598       }).styleTween("fill-opacity", function(d) {
32599         return ratchetyInterpolator(
32600           _params[d.id][toFrom].opacity,
32601           _params[d.id][fromTo].opacity,
32602           steps
32603         );
32604       }).styleTween("r", function(d) {
32605         return ratchetyInterpolator(
32606           _params[d.id][toFrom].width,
32607           _params[d.id][fromTo].width,
32608           steps,
32609           "px"
32610         );
32611       });
32612     }
32613     function calcAnimationParams(selection2) {
32614       selection2.call(reset).each(function(d) {
32615         var s = select_default2(this);
32616         var tag = s.node().tagName;
32617         var p = { "from": {}, "to": {} };
32618         var opacity;
32619         var width;
32620         if (tag === "circle") {
32621           opacity = parseFloat(s.style("fill-opacity") || 0.5);
32622           width = parseFloat(s.style("r") || 15.5);
32623         } else {
32624           opacity = parseFloat(s.style("stroke-opacity") || 0.7);
32625           width = parseFloat(s.style("stroke-width") || 10);
32626         }
32627         p.tag = tag;
32628         p.from.opacity = opacity * 0.6;
32629         p.to.opacity = opacity * 1.25;
32630         p.from.width = width * 0.7;
32631         p.to.width = width * (tag === "circle" ? 1.5 : 1);
32632         _params[d.id] = p;
32633       });
32634     }
32635     function run(surface, fromTo) {
32636       var toFrom = fromTo === "from" ? "to" : "from";
32637       var currSelected = surface.selectAll(selector);
32638       var currClassed = surface.attr("class");
32639       if (_done || currSelected.empty()) {
32640         _selected.call(reset);
32641         _selected = select_default2(null);
32642         return;
32643       }
32644       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
32645         _selected.call(reset);
32646         _classed = currClassed;
32647         _selected = currSelected.call(calcAnimationParams);
32648       }
32649       var didCallNextRun = false;
32650       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
32651         if (!didCallNextRun) {
32652           surface.call(run, toFrom);
32653           didCallNextRun = true;
32654         }
32655         if (!select_default2(this).classed("selected")) {
32656           reset(select_default2(this));
32657         }
32658       });
32659     }
32660     function behavior(surface) {
32661       _done = false;
32662       _timer = timer(function() {
32663         if (surface.selectAll(selector).empty()) {
32664           return false;
32665         }
32666         surface.call(run, "from");
32667         _timer.stop();
32668         return true;
32669       }, 20);
32670     }
32671     behavior.restartIfNeeded = function(surface) {
32672       if (_selected.empty()) {
32673         surface.call(run, "from");
32674         if (_timer) {
32675           _timer.stop();
32676         }
32677       }
32678     };
32679     behavior.off = function() {
32680       _done = true;
32681       if (_timer) {
32682         _timer.stop();
32683       }
32684       _selected.interrupt().call(reset);
32685     };
32686     return behavior;
32687   }
32688
32689   // modules/behavior/operation.js
32690   function behaviorOperation(context) {
32691     var _operation;
32692     function keypress(d3_event) {
32693       if (!context.map().withinEditableZoom())
32694         return;
32695       if (_operation.availableForKeypress && !_operation.availableForKeypress())
32696         return;
32697       d3_event.preventDefault();
32698       var disabled = _operation.disabled();
32699       if (disabled) {
32700         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
32701       } else {
32702         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
32703         if (_operation.point)
32704           _operation.point(null);
32705         _operation();
32706       }
32707     }
32708     function behavior() {
32709       if (_operation && _operation.available()) {
32710         context.keybinding().on(_operation.keys, keypress);
32711       }
32712       return behavior;
32713     }
32714     behavior.off = function() {
32715       context.keybinding().off(_operation.keys);
32716     };
32717     behavior.which = function(_) {
32718       if (!arguments.length)
32719         return _operation;
32720       _operation = _;
32721       return behavior;
32722     };
32723     return behavior;
32724   }
32725
32726   // modules/operations/circularize.js
32727   function operationCircularize(context, selectedIDs) {
32728     var _extent;
32729     var _actions = selectedIDs.map(getAction).filter(Boolean);
32730     var _amount = _actions.length === 1 ? "single" : "multiple";
32731     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
32732       return n2.loc;
32733     });
32734     function getAction(entityID) {
32735       var entity = context.entity(entityID);
32736       if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
32737         return null;
32738       if (!_extent) {
32739         _extent = entity.extent(context.graph());
32740       } else {
32741         _extent = _extent.extend(entity.extent(context.graph()));
32742       }
32743       return actionCircularize(entityID, context.projection);
32744     }
32745     var operation = function() {
32746       if (!_actions.length)
32747         return;
32748       var combinedAction = function(graph, t) {
32749         _actions.forEach(function(action) {
32750           if (!action.disabled(graph)) {
32751             graph = action(graph, t);
32752           }
32753         });
32754         return graph;
32755       };
32756       combinedAction.transitionable = true;
32757       context.perform(combinedAction, operation.annotation());
32758       window.setTimeout(function() {
32759         context.validator().validate();
32760       }, 300);
32761     };
32762     operation.available = function() {
32763       return _actions.length && selectedIDs.length === _actions.length;
32764     };
32765     operation.disabled = function() {
32766       if (!_actions.length)
32767         return "";
32768       var actionDisableds = _actions.map(function(action) {
32769         return action.disabled(context.graph());
32770       }).filter(Boolean);
32771       if (actionDisableds.length === _actions.length) {
32772         if (new Set(actionDisableds).size > 1) {
32773           return "multiple_blockers";
32774         }
32775         return actionDisableds[0];
32776       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
32777         return "too_large";
32778       } else if (someMissing()) {
32779         return "not_downloaded";
32780       } else if (selectedIDs.some(context.hasHiddenConnections)) {
32781         return "connected_to_hidden";
32782       }
32783       return false;
32784       function someMissing() {
32785         if (context.inIntro())
32786           return false;
32787         var osm = context.connection();
32788         if (osm) {
32789           var missing = _coords.filter(function(loc) {
32790             return !osm.isDataLoaded(loc);
32791           });
32792           if (missing.length) {
32793             missing.forEach(function(loc) {
32794               context.loadTileAtLoc(loc);
32795             });
32796             return true;
32797           }
32798         }
32799         return false;
32800       }
32801     };
32802     operation.tooltip = function() {
32803       var disable = operation.disabled();
32804       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
32805     };
32806     operation.annotation = function() {
32807       return _t("operations.circularize.annotation.feature", { n: _actions.length });
32808     };
32809     operation.id = "circularize";
32810     operation.keys = [_t("operations.circularize.key")];
32811     operation.title = _t.append("operations.circularize.title");
32812     operation.behavior = behaviorOperation(context).which(operation);
32813     return operation;
32814   }
32815
32816   // modules/ui/cmd.js
32817   var uiCmd = function(code) {
32818     var detected = utilDetect();
32819     if (detected.os === "mac") {
32820       return code;
32821     }
32822     if (detected.os === "win") {
32823       if (code === "\u2318\u21E7Z")
32824         return "Ctrl+Y";
32825     }
32826     var result = "", replacements = {
32827       "\u2318": "Ctrl",
32828       "\u21E7": "Shift",
32829       "\u2325": "Alt",
32830       "\u232B": "Backspace",
32831       "\u2326": "Delete"
32832     };
32833     for (var i2 = 0; i2 < code.length; i2++) {
32834       if (code[i2] in replacements) {
32835         result += replacements[code[i2]] + (i2 < code.length - 1 ? "+" : "");
32836       } else {
32837         result += code[i2];
32838       }
32839     }
32840     return result;
32841   };
32842   uiCmd.display = function(code) {
32843     if (code.length !== 1)
32844       return code;
32845     var detected = utilDetect();
32846     var mac = detected.os === "mac";
32847     var replacements = {
32848       "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
32849       "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
32850       "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
32851       "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
32852       "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
32853       "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
32854       "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
32855       "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
32856       "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
32857       "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
32858       "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
32859       "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
32860       "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
32861     };
32862     return replacements[code] || code;
32863   };
32864
32865   // modules/operations/delete.js
32866   function operationDelete(context, selectedIDs) {
32867     var multi = selectedIDs.length === 1 ? "single" : "multiple";
32868     var action = actionDeleteMultiple(selectedIDs);
32869     var nodes = utilGetAllNodes(selectedIDs, context.graph());
32870     var coords = nodes.map(function(n2) {
32871       return n2.loc;
32872     });
32873     var extent = utilTotalExtent(selectedIDs, context.graph());
32874     var operation = function() {
32875       var nextSelectedID;
32876       var nextSelectedLoc;
32877       if (selectedIDs.length === 1) {
32878         var id2 = selectedIDs[0];
32879         var entity = context.entity(id2);
32880         var geometry = entity.geometry(context.graph());
32881         var parents = context.graph().parentWays(entity);
32882         var parent = parents[0];
32883         if (geometry === "vertex") {
32884           var nodes2 = parent.nodes;
32885           var i2 = nodes2.indexOf(id2);
32886           if (i2 === 0) {
32887             i2++;
32888           } else if (i2 === nodes2.length - 1) {
32889             i2--;
32890           } else {
32891             var a = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 - 1]).loc);
32892             var b = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 + 1]).loc);
32893             i2 = a < b ? i2 - 1 : i2 + 1;
32894           }
32895           nextSelectedID = nodes2[i2];
32896           nextSelectedLoc = context.entity(nextSelectedID).loc;
32897         }
32898       }
32899       context.perform(action, operation.annotation());
32900       context.validator().validate();
32901       if (nextSelectedID && nextSelectedLoc) {
32902         if (context.hasEntity(nextSelectedID)) {
32903           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
32904         } else {
32905           context.map().centerEase(nextSelectedLoc);
32906           context.enter(modeBrowse(context));
32907         }
32908       } else {
32909         context.enter(modeBrowse(context));
32910       }
32911     };
32912     operation.available = function() {
32913       return true;
32914     };
32915     operation.disabled = function() {
32916       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
32917         return "too_large";
32918       } else if (someMissing()) {
32919         return "not_downloaded";
32920       } else if (selectedIDs.some(context.hasHiddenConnections)) {
32921         return "connected_to_hidden";
32922       } else if (selectedIDs.some(protectedMember)) {
32923         return "part_of_relation";
32924       } else if (selectedIDs.some(incompleteRelation)) {
32925         return "incomplete_relation";
32926       } else if (selectedIDs.some(hasWikidataTag)) {
32927         return "has_wikidata_tag";
32928       }
32929       return false;
32930       function someMissing() {
32931         if (context.inIntro())
32932           return false;
32933         var osm = context.connection();
32934         if (osm) {
32935           var missing = coords.filter(function(loc) {
32936             return !osm.isDataLoaded(loc);
32937           });
32938           if (missing.length) {
32939             missing.forEach(function(loc) {
32940               context.loadTileAtLoc(loc);
32941             });
32942             return true;
32943           }
32944         }
32945         return false;
32946       }
32947       function hasWikidataTag(id2) {
32948         var entity = context.entity(id2);
32949         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
32950       }
32951       function incompleteRelation(id2) {
32952         var entity = context.entity(id2);
32953         return entity.type === "relation" && !entity.isComplete(context.graph());
32954       }
32955       function protectedMember(id2) {
32956         var entity = context.entity(id2);
32957         if (entity.type !== "way")
32958           return false;
32959         var parents = context.graph().parentRelations(entity);
32960         for (var i2 = 0; i2 < parents.length; i2++) {
32961           var parent = parents[i2];
32962           var type3 = parent.tags.type;
32963           var role = parent.memberById(id2).role || "outer";
32964           if (type3 === "route" || type3 === "boundary" || type3 === "multipolygon" && role === "outer") {
32965             return true;
32966           }
32967         }
32968         return false;
32969       }
32970     };
32971     operation.tooltip = function() {
32972       var disable = operation.disabled();
32973       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
32974     };
32975     operation.annotation = function() {
32976       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
32977     };
32978     operation.id = "delete";
32979     operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
32980     operation.title = _t.append("operations.delete.title");
32981     operation.behavior = behaviorOperation(context).which(operation);
32982     return operation;
32983   }
32984
32985   // modules/operations/orthogonalize.js
32986   function operationOrthogonalize(context, selectedIDs) {
32987     var _extent;
32988     var _type;
32989     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
32990     var _amount = _actions.length === 1 ? "single" : "multiple";
32991     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
32992       return n2.loc;
32993     });
32994     function chooseAction(entityID) {
32995       var entity = context.entity(entityID);
32996       var geometry = entity.geometry(context.graph());
32997       if (!_extent) {
32998         _extent = entity.extent(context.graph());
32999       } else {
33000         _extent = _extent.extend(entity.extent(context.graph()));
33001       }
33002       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
33003         if (_type && _type !== "feature")
33004           return null;
33005         _type = "feature";
33006         return actionOrthogonalize(entityID, context.projection);
33007       } else if (geometry === "vertex") {
33008         if (_type && _type !== "corner")
33009           return null;
33010         _type = "corner";
33011         var graph = context.graph();
33012         var parents = graph.parentWays(entity);
33013         if (parents.length === 1) {
33014           var way = parents[0];
33015           if (way.nodes.indexOf(entityID) !== -1) {
33016             return actionOrthogonalize(way.id, context.projection, entityID);
33017           }
33018         }
33019       }
33020       return null;
33021     }
33022     var operation = function() {
33023       if (!_actions.length)
33024         return;
33025       var combinedAction = function(graph, t) {
33026         _actions.forEach(function(action) {
33027           if (!action.disabled(graph)) {
33028             graph = action(graph, t);
33029           }
33030         });
33031         return graph;
33032       };
33033       combinedAction.transitionable = true;
33034       context.perform(combinedAction, operation.annotation());
33035       window.setTimeout(function() {
33036         context.validator().validate();
33037       }, 300);
33038     };
33039     operation.available = function() {
33040       return _actions.length && selectedIDs.length === _actions.length;
33041     };
33042     operation.disabled = function() {
33043       if (!_actions.length)
33044         return "";
33045       var actionDisableds = _actions.map(function(action) {
33046         return action.disabled(context.graph());
33047       }).filter(Boolean);
33048       if (actionDisableds.length === _actions.length) {
33049         if (new Set(actionDisableds).size > 1) {
33050           return "multiple_blockers";
33051         }
33052         return actionDisableds[0];
33053       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
33054         return "too_large";
33055       } else if (someMissing()) {
33056         return "not_downloaded";
33057       } else if (selectedIDs.some(context.hasHiddenConnections)) {
33058         return "connected_to_hidden";
33059       }
33060       return false;
33061       function someMissing() {
33062         if (context.inIntro())
33063           return false;
33064         var osm = context.connection();
33065         if (osm) {
33066           var missing = _coords.filter(function(loc) {
33067             return !osm.isDataLoaded(loc);
33068           });
33069           if (missing.length) {
33070             missing.forEach(function(loc) {
33071               context.loadTileAtLoc(loc);
33072             });
33073             return true;
33074           }
33075         }
33076         return false;
33077       }
33078     };
33079     operation.tooltip = function() {
33080       var disable = operation.disabled();
33081       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
33082     };
33083     operation.annotation = function() {
33084       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
33085     };
33086     operation.id = "orthogonalize";
33087     operation.keys = [_t("operations.orthogonalize.key")];
33088     operation.title = _t.append("operations.orthogonalize.title");
33089     operation.behavior = behaviorOperation(context).which(operation);
33090     return operation;
33091   }
33092
33093   // modules/operations/reflect.js
33094   function operationReflectShort(context, selectedIDs) {
33095     return operationReflect(context, selectedIDs, "short");
33096   }
33097   function operationReflectLong(context, selectedIDs) {
33098     return operationReflect(context, selectedIDs, "long");
33099   }
33100   function operationReflect(context, selectedIDs, axis) {
33101     axis = axis || "long";
33102     var multi = selectedIDs.length === 1 ? "single" : "multiple";
33103     var nodes = utilGetAllNodes(selectedIDs, context.graph());
33104     var coords = nodes.map(function(n2) {
33105       return n2.loc;
33106     });
33107     var extent = utilTotalExtent(selectedIDs, context.graph());
33108     var operation = function() {
33109       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
33110       context.perform(action, operation.annotation());
33111       window.setTimeout(function() {
33112         context.validator().validate();
33113       }, 300);
33114     };
33115     operation.available = function() {
33116       return nodes.length >= 3;
33117     };
33118     operation.disabled = function() {
33119       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33120         return "too_large";
33121       } else if (someMissing()) {
33122         return "not_downloaded";
33123       } else if (selectedIDs.some(context.hasHiddenConnections)) {
33124         return "connected_to_hidden";
33125       } else if (selectedIDs.some(incompleteRelation)) {
33126         return "incomplete_relation";
33127       }
33128       return false;
33129       function someMissing() {
33130         if (context.inIntro())
33131           return false;
33132         var osm = context.connection();
33133         if (osm) {
33134           var missing = coords.filter(function(loc) {
33135             return !osm.isDataLoaded(loc);
33136           });
33137           if (missing.length) {
33138             missing.forEach(function(loc) {
33139               context.loadTileAtLoc(loc);
33140             });
33141             return true;
33142           }
33143         }
33144         return false;
33145       }
33146       function incompleteRelation(id2) {
33147         var entity = context.entity(id2);
33148         return entity.type === "relation" && !entity.isComplete(context.graph());
33149       }
33150     };
33151     operation.tooltip = function() {
33152       var disable = operation.disabled();
33153       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
33154     };
33155     operation.annotation = function() {
33156       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
33157     };
33158     operation.id = "reflect-" + axis;
33159     operation.keys = [_t("operations.reflect.key." + axis)];
33160     operation.title = _t.append("operations.reflect.title." + axis);
33161     operation.behavior = behaviorOperation(context).which(operation);
33162     return operation;
33163   }
33164
33165   // modules/operations/move.js
33166   function operationMove(context, selectedIDs) {
33167     var multi = selectedIDs.length === 1 ? "single" : "multiple";
33168     var nodes = utilGetAllNodes(selectedIDs, context.graph());
33169     var coords = nodes.map(function(n2) {
33170       return n2.loc;
33171     });
33172     var extent = utilTotalExtent(selectedIDs, context.graph());
33173     var operation = function() {
33174       context.enter(modeMove(context, selectedIDs));
33175     };
33176     operation.available = function() {
33177       return selectedIDs.length > 0;
33178     };
33179     operation.disabled = function() {
33180       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33181         return "too_large";
33182       } else if (someMissing()) {
33183         return "not_downloaded";
33184       } else if (selectedIDs.some(context.hasHiddenConnections)) {
33185         return "connected_to_hidden";
33186       } else if (selectedIDs.some(incompleteRelation)) {
33187         return "incomplete_relation";
33188       }
33189       return false;
33190       function someMissing() {
33191         if (context.inIntro())
33192           return false;
33193         var osm = context.connection();
33194         if (osm) {
33195           var missing = coords.filter(function(loc) {
33196             return !osm.isDataLoaded(loc);
33197           });
33198           if (missing.length) {
33199             missing.forEach(function(loc) {
33200               context.loadTileAtLoc(loc);
33201             });
33202             return true;
33203           }
33204         }
33205         return false;
33206       }
33207       function incompleteRelation(id2) {
33208         var entity = context.entity(id2);
33209         return entity.type === "relation" && !entity.isComplete(context.graph());
33210       }
33211     };
33212     operation.tooltip = function() {
33213       var disable = operation.disabled();
33214       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
33215     };
33216     operation.annotation = function() {
33217       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
33218     };
33219     operation.id = "move";
33220     operation.keys = [_t("operations.move.key")];
33221     operation.title = _t.append("operations.move.title");
33222     operation.behavior = behaviorOperation(context).which(operation);
33223     operation.mouseOnly = true;
33224     return operation;
33225   }
33226
33227   // modules/modes/rotate.js
33228   function modeRotate(context, entityIDs) {
33229     var _tolerancePx = 4;
33230     var mode = {
33231       id: "rotate",
33232       button: "browse"
33233     };
33234     var keybinding = utilKeybinding("rotate");
33235     var behaviors = [
33236       behaviorEdit(context),
33237       operationCircularize(context, entityIDs).behavior,
33238       operationDelete(context, entityIDs).behavior,
33239       operationMove(context, entityIDs).behavior,
33240       operationOrthogonalize(context, entityIDs).behavior,
33241       operationReflectLong(context, entityIDs).behavior,
33242       operationReflectShort(context, entityIDs).behavior
33243     ];
33244     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
33245     var _prevGraph;
33246     var _prevAngle;
33247     var _prevTransform;
33248     var _pivot;
33249     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33250     function doRotate(d3_event) {
33251       var fn;
33252       if (context.graph() !== _prevGraph) {
33253         fn = context.perform;
33254       } else {
33255         fn = context.replace;
33256       }
33257       var projection2 = context.projection;
33258       var currTransform = projection2.transform();
33259       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
33260         var nodes = utilGetAllNodes(entityIDs, context.graph());
33261         var points = nodes.map(function(n2) {
33262           return projection2(n2.loc);
33263         });
33264         _pivot = getPivot(points);
33265         _prevAngle = void 0;
33266       }
33267       var currMouse = context.map().mouse(d3_event);
33268       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
33269       if (typeof _prevAngle === "undefined")
33270         _prevAngle = currAngle;
33271       var delta = currAngle - _prevAngle;
33272       fn(actionRotate(entityIDs, _pivot, delta, projection2));
33273       _prevTransform = currTransform;
33274       _prevAngle = currAngle;
33275       _prevGraph = context.graph();
33276     }
33277     function getPivot(points) {
33278       var _pivot2;
33279       if (points.length === 1) {
33280         _pivot2 = points[0];
33281       } else if (points.length === 2) {
33282         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
33283       } else {
33284         var polygonHull = hull_default(points);
33285         if (polygonHull.length === 2) {
33286           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
33287         } else {
33288           _pivot2 = centroid_default2(hull_default(points));
33289         }
33290       }
33291       return _pivot2;
33292     }
33293     function finish(d3_event) {
33294       d3_event.stopPropagation();
33295       context.replace(actionNoop(), annotation);
33296       context.enter(modeSelect(context, entityIDs));
33297     }
33298     function cancel() {
33299       if (_prevGraph)
33300         context.pop();
33301       context.enter(modeSelect(context, entityIDs));
33302     }
33303     function undone() {
33304       context.enter(modeBrowse(context));
33305     }
33306     mode.enter = function() {
33307       _prevGraph = null;
33308       context.features().forceVisible(entityIDs);
33309       behaviors.forEach(context.install);
33310       var downEvent;
33311       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
33312         downEvent = d3_event;
33313       });
33314       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
33315         if (!downEvent)
33316           return;
33317         var mapNode = context.container().select(".main-map").node();
33318         var pointGetter = utilFastMouse(mapNode);
33319         var p1 = pointGetter(downEvent);
33320         var p2 = pointGetter(d3_event);
33321         var dist = geoVecLength(p1, p2);
33322         if (dist <= _tolerancePx)
33323           finish(d3_event);
33324         downEvent = null;
33325       }, true);
33326       context.history().on("undone.modeRotate", undone);
33327       keybinding.on("\u238B", cancel).on("\u21A9", finish);
33328       select_default2(document).call(keybinding);
33329     };
33330     mode.exit = function() {
33331       behaviors.forEach(context.uninstall);
33332       context.surface().on(_pointerPrefix + "down.modeRotate", null);
33333       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
33334       context.history().on("undone.modeRotate", null);
33335       select_default2(document).call(keybinding.unbind);
33336       context.features().forceVisible([]);
33337     };
33338     mode.selectedIDs = function() {
33339       if (!arguments.length)
33340         return entityIDs;
33341       return mode;
33342     };
33343     return mode;
33344   }
33345
33346   // modules/operations/rotate.js
33347   function operationRotate(context, selectedIDs) {
33348     var multi = selectedIDs.length === 1 ? "single" : "multiple";
33349     var nodes = utilGetAllNodes(selectedIDs, context.graph());
33350     var coords = nodes.map(function(n2) {
33351       return n2.loc;
33352     });
33353     var extent = utilTotalExtent(selectedIDs, context.graph());
33354     var operation = function() {
33355       context.enter(modeRotate(context, selectedIDs));
33356     };
33357     operation.available = function() {
33358       return nodes.length >= 2;
33359     };
33360     operation.disabled = function() {
33361       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
33362         return "too_large";
33363       } else if (someMissing()) {
33364         return "not_downloaded";
33365       } else if (selectedIDs.some(context.hasHiddenConnections)) {
33366         return "connected_to_hidden";
33367       } else if (selectedIDs.some(incompleteRelation)) {
33368         return "incomplete_relation";
33369       }
33370       return false;
33371       function someMissing() {
33372         if (context.inIntro())
33373           return false;
33374         var osm = context.connection();
33375         if (osm) {
33376           var missing = coords.filter(function(loc) {
33377             return !osm.isDataLoaded(loc);
33378           });
33379           if (missing.length) {
33380             missing.forEach(function(loc) {
33381               context.loadTileAtLoc(loc);
33382             });
33383             return true;
33384           }
33385         }
33386         return false;
33387       }
33388       function incompleteRelation(id2) {
33389         var entity = context.entity(id2);
33390         return entity.type === "relation" && !entity.isComplete(context.graph());
33391       }
33392     };
33393     operation.tooltip = function() {
33394       var disable = operation.disabled();
33395       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
33396     };
33397     operation.annotation = function() {
33398       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
33399     };
33400     operation.id = "rotate";
33401     operation.keys = [_t("operations.rotate.key")];
33402     operation.title = _t.append("operations.rotate.title");
33403     operation.behavior = behaviorOperation(context).which(operation);
33404     operation.mouseOnly = true;
33405     return operation;
33406   }
33407
33408   // modules/modes/move.js
33409   function modeMove(context, entityIDs, baseGraph) {
33410     var _tolerancePx = 4;
33411     var mode = {
33412       id: "move",
33413       button: "browse"
33414     };
33415     var keybinding = utilKeybinding("move");
33416     var behaviors = [
33417       behaviorEdit(context),
33418       operationCircularize(context, entityIDs).behavior,
33419       operationDelete(context, entityIDs).behavior,
33420       operationOrthogonalize(context, entityIDs).behavior,
33421       operationReflectLong(context, entityIDs).behavior,
33422       operationReflectShort(context, entityIDs).behavior,
33423       operationRotate(context, entityIDs).behavior
33424     ];
33425     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
33426     var _prevGraph;
33427     var _cache4;
33428     var _origin;
33429     var _nudgeInterval;
33430     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33431     function doMove(nudge) {
33432       nudge = nudge || [0, 0];
33433       var fn;
33434       if (_prevGraph !== context.graph()) {
33435         _cache4 = {};
33436         _origin = context.map().mouseCoordinates();
33437         fn = context.perform;
33438       } else {
33439         fn = context.overwrite;
33440       }
33441       var currMouse = context.map().mouse();
33442       var origMouse = context.projection(_origin);
33443       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
33444       fn(actionMove(entityIDs, delta, context.projection, _cache4));
33445       _prevGraph = context.graph();
33446     }
33447     function startNudge(nudge) {
33448       if (_nudgeInterval)
33449         window.clearInterval(_nudgeInterval);
33450       _nudgeInterval = window.setInterval(function() {
33451         context.map().pan(nudge);
33452         doMove(nudge);
33453       }, 50);
33454     }
33455     function stopNudge() {
33456       if (_nudgeInterval) {
33457         window.clearInterval(_nudgeInterval);
33458         _nudgeInterval = null;
33459       }
33460     }
33461     function move() {
33462       doMove();
33463       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
33464       if (nudge) {
33465         startNudge(nudge);
33466       } else {
33467         stopNudge();
33468       }
33469     }
33470     function finish(d3_event) {
33471       d3_event.stopPropagation();
33472       context.replace(actionNoop(), annotation);
33473       context.enter(modeSelect(context, entityIDs));
33474       stopNudge();
33475     }
33476     function cancel() {
33477       if (baseGraph) {
33478         while (context.graph() !== baseGraph)
33479           context.pop();
33480         context.enter(modeBrowse(context));
33481       } else {
33482         if (_prevGraph)
33483           context.pop();
33484         context.enter(modeSelect(context, entityIDs));
33485       }
33486       stopNudge();
33487     }
33488     function undone() {
33489       context.enter(modeBrowse(context));
33490     }
33491     mode.enter = function() {
33492       _origin = context.map().mouseCoordinates();
33493       _prevGraph = null;
33494       _cache4 = {};
33495       context.features().forceVisible(entityIDs);
33496       behaviors.forEach(context.install);
33497       var downEvent;
33498       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
33499         downEvent = d3_event;
33500       });
33501       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
33502         if (!downEvent)
33503           return;
33504         var mapNode = context.container().select(".main-map").node();
33505         var pointGetter = utilFastMouse(mapNode);
33506         var p1 = pointGetter(downEvent);
33507         var p2 = pointGetter(d3_event);
33508         var dist = geoVecLength(p1, p2);
33509         if (dist <= _tolerancePx)
33510           finish(d3_event);
33511         downEvent = null;
33512       }, true);
33513       context.history().on("undone.modeMove", undone);
33514       keybinding.on("\u238B", cancel).on("\u21A9", finish);
33515       select_default2(document).call(keybinding);
33516     };
33517     mode.exit = function() {
33518       stopNudge();
33519       behaviors.forEach(function(behavior) {
33520         context.uninstall(behavior);
33521       });
33522       context.surface().on(_pointerPrefix + "down.modeMove", null);
33523       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
33524       context.history().on("undone.modeMove", null);
33525       select_default2(document).call(keybinding.unbind);
33526       context.features().forceVisible([]);
33527     };
33528     mode.selectedIDs = function() {
33529       if (!arguments.length)
33530         return entityIDs;
33531       return mode;
33532     };
33533     return mode;
33534   }
33535
33536   // modules/behavior/paste.js
33537   function behaviorPaste(context) {
33538     function doPaste(d3_event) {
33539       if (!context.map().withinEditableZoom())
33540         return;
33541       d3_event.preventDefault();
33542       var baseGraph = context.graph();
33543       var mouse = context.map().mouse();
33544       var projection2 = context.projection;
33545       var viewport = geoExtent(projection2.clipExtent()).polygon();
33546       if (!geoPointInPolygon(mouse, viewport))
33547         return;
33548       var oldIDs = context.copyIDs();
33549       if (!oldIDs.length)
33550         return;
33551       var extent = geoExtent();
33552       var oldGraph = context.copyGraph();
33553       var newIDs = [];
33554       var action = actionCopyEntities(oldIDs, oldGraph);
33555       context.perform(action);
33556       var copies = action.copies();
33557       var originals = /* @__PURE__ */ new Set();
33558       Object.values(copies).forEach(function(entity) {
33559         originals.add(entity.id);
33560       });
33561       for (var id2 in copies) {
33562         var oldEntity = oldGraph.entity(id2);
33563         var newEntity = copies[id2];
33564         extent._extend(oldEntity.extent(oldGraph));
33565         var parents = context.graph().parentWays(newEntity);
33566         var parentCopied = parents.some(function(parent) {
33567           return originals.has(parent.id);
33568         });
33569         if (!parentCopied) {
33570           newIDs.push(newEntity.id);
33571         }
33572       }
33573       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
33574       var delta = geoVecSubtract(mouse, copyPoint);
33575       context.perform(actionMove(newIDs, delta, projection2));
33576       context.enter(modeMove(context, newIDs, baseGraph));
33577     }
33578     function behavior() {
33579       context.keybinding().on(uiCmd("\u2318V"), doPaste);
33580       return behavior;
33581     }
33582     behavior.off = function() {
33583       context.keybinding().off(uiCmd("\u2318V"));
33584     };
33585     return behavior;
33586   }
33587
33588   // modules/behavior/drag.js
33589   function behaviorDrag() {
33590     var dispatch10 = dispatch_default("start", "move", "end");
33591     var _tolerancePx = 1;
33592     var _penTolerancePx = 4;
33593     var _origin = null;
33594     var _selector = "";
33595     var _targetNode;
33596     var _targetEntity;
33597     var _surface;
33598     var _pointerId;
33599     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33600     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
33601     var d3_event_userSelectSuppress = function() {
33602       var selection2 = selection_default();
33603       var select = selection2.style(d3_event_userSelectProperty);
33604       selection2.style(d3_event_userSelectProperty, "none");
33605       return function() {
33606         selection2.style(d3_event_userSelectProperty, select);
33607       };
33608     };
33609     function pointerdown(d3_event) {
33610       if (_pointerId)
33611         return;
33612       _pointerId = d3_event.pointerId || "mouse";
33613       _targetNode = this;
33614       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
33615       var offset;
33616       var startOrigin = pointerLocGetter(d3_event);
33617       var started = false;
33618       var selectEnable = d3_event_userSelectSuppress();
33619       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
33620       if (_origin) {
33621         offset = _origin.call(_targetNode, _targetEntity);
33622         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
33623       } else {
33624         offset = [0, 0];
33625       }
33626       d3_event.stopPropagation();
33627       function pointermove(d3_event2) {
33628         if (_pointerId !== (d3_event2.pointerId || "mouse"))
33629           return;
33630         var p = pointerLocGetter(d3_event2);
33631         if (!started) {
33632           var dist = geoVecLength(startOrigin, p);
33633           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
33634           if (dist < tolerance)
33635             return;
33636           started = true;
33637           dispatch10.call("start", this, d3_event2, _targetEntity);
33638         } else {
33639           startOrigin = p;
33640           d3_event2.stopPropagation();
33641           d3_event2.preventDefault();
33642           var dx = p[0] - startOrigin[0];
33643           var dy = p[1] - startOrigin[1];
33644           dispatch10.call("move", this, d3_event2, _targetEntity, [p[0] + offset[0], p[1] + offset[1]], [dx, dy]);
33645         }
33646       }
33647       function pointerup(d3_event2) {
33648         if (_pointerId !== (d3_event2.pointerId || "mouse"))
33649           return;
33650         _pointerId = null;
33651         if (started) {
33652           dispatch10.call("end", this, d3_event2, _targetEntity);
33653           d3_event2.preventDefault();
33654         }
33655         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
33656         selectEnable();
33657       }
33658     }
33659     function behavior(selection2) {
33660       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
33661       var delegate = pointerdown;
33662       if (_selector) {
33663         delegate = function(d3_event) {
33664           var root3 = this;
33665           var target = d3_event.target;
33666           for (; target && target !== root3; target = target.parentNode) {
33667             var datum2 = target.__data__;
33668             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
33669             if (_targetEntity && target[matchesSelector](_selector)) {
33670               return pointerdown.call(target, d3_event);
33671             }
33672           }
33673         };
33674       }
33675       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
33676     }
33677     behavior.off = function(selection2) {
33678       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
33679     };
33680     behavior.selector = function(_) {
33681       if (!arguments.length)
33682         return _selector;
33683       _selector = _;
33684       return behavior;
33685     };
33686     behavior.origin = function(_) {
33687       if (!arguments.length)
33688         return _origin;
33689       _origin = _;
33690       return behavior;
33691     };
33692     behavior.cancel = function() {
33693       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
33694       return behavior;
33695     };
33696     behavior.targetNode = function(_) {
33697       if (!arguments.length)
33698         return _targetNode;
33699       _targetNode = _;
33700       return behavior;
33701     };
33702     behavior.targetEntity = function(_) {
33703       if (!arguments.length)
33704         return _targetEntity;
33705       _targetEntity = _;
33706       return behavior;
33707     };
33708     behavior.surface = function(_) {
33709       if (!arguments.length)
33710         return _surface;
33711       _surface = _;
33712       return behavior;
33713     };
33714     return utilRebind(behavior, dispatch10, "on");
33715   }
33716
33717   // modules/modes/drag_node.js
33718   function modeDragNode(context) {
33719     var mode = {
33720       id: "drag-node",
33721       button: "browse"
33722     };
33723     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
33724     var edit2 = behaviorEdit(context);
33725     var _nudgeInterval;
33726     var _restoreSelectedIDs = [];
33727     var _wasMidpoint = false;
33728     var _isCancelled = false;
33729     var _activeEntity;
33730     var _startLoc;
33731     var _lastLoc;
33732     function startNudge(d3_event, entity, nudge) {
33733       if (_nudgeInterval)
33734         window.clearInterval(_nudgeInterval);
33735       _nudgeInterval = window.setInterval(function() {
33736         context.map().pan(nudge);
33737         doMove(d3_event, entity, nudge);
33738       }, 50);
33739     }
33740     function stopNudge() {
33741       if (_nudgeInterval) {
33742         window.clearInterval(_nudgeInterval);
33743         _nudgeInterval = null;
33744       }
33745     }
33746     function moveAnnotation(entity) {
33747       return _t("operations.move.annotation." + entity.geometry(context.graph()));
33748     }
33749     function connectAnnotation(nodeEntity, targetEntity) {
33750       var nodeGeometry = nodeEntity.geometry(context.graph());
33751       var targetGeometry = targetEntity.geometry(context.graph());
33752       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
33753         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
33754         var targetParentWayIDs = context.graph().parentWays(targetEntity);
33755         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
33756         if (sharedParentWays.length !== 0) {
33757           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
33758             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
33759           }
33760           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
33761         }
33762       }
33763       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
33764     }
33765     function shouldSnapToNode(target) {
33766       if (!_activeEntity)
33767         return false;
33768       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
33769     }
33770     function origin(entity) {
33771       return context.projection(entity.loc);
33772     }
33773     function keydown(d3_event) {
33774       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33775         if (context.surface().classed("nope")) {
33776           context.surface().classed("nope-suppressed", true);
33777         }
33778         context.surface().classed("nope", false).classed("nope-disabled", true);
33779       }
33780     }
33781     function keyup(d3_event) {
33782       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33783         if (context.surface().classed("nope-suppressed")) {
33784           context.surface().classed("nope", true);
33785         }
33786         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
33787       }
33788     }
33789     function start2(d3_event, entity) {
33790       _wasMidpoint = entity.type === "midpoint";
33791       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
33792       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
33793       if (_isCancelled) {
33794         if (hasHidden) {
33795           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
33796         }
33797         return drag.cancel();
33798       }
33799       if (_wasMidpoint) {
33800         var midpoint = entity;
33801         entity = osmNode();
33802         context.perform(actionAddMidpoint(midpoint, entity));
33803         entity = context.entity(entity.id);
33804         var vertex = context.surface().selectAll("." + entity.id);
33805         drag.targetNode(vertex.node()).targetEntity(entity);
33806       } else {
33807         context.perform(actionNoop());
33808       }
33809       _activeEntity = entity;
33810       _startLoc = entity.loc;
33811       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
33812       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
33813       context.enter(mode);
33814     }
33815     function datum2(d3_event) {
33816       if (!d3_event || d3_event.altKey) {
33817         return {};
33818       } else {
33819         var d = d3_event.target.__data__;
33820         return d && d.properties && d.properties.target ? d : {};
33821       }
33822     }
33823     function doMove(d3_event, entity, nudge) {
33824       nudge = nudge || [0, 0];
33825       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
33826       var currMouse = geoVecSubtract(currPoint, nudge);
33827       var loc = context.projection.invert(currMouse);
33828       var target, edge;
33829       if (!_nudgeInterval) {
33830         var d = datum2(d3_event);
33831         target = d && d.properties && d.properties.entity;
33832         var targetLoc = target && target.loc;
33833         var targetNodes = d && d.properties && d.properties.nodes;
33834         if (targetLoc) {
33835           if (shouldSnapToNode(target)) {
33836             loc = targetLoc;
33837           }
33838         } else if (targetNodes) {
33839           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
33840           if (edge) {
33841             loc = edge.loc;
33842           }
33843         }
33844       }
33845       context.replace(
33846         actionMoveNode(entity.id, loc)
33847       );
33848       var isInvalid = false;
33849       if (target) {
33850         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
33851       }
33852       if (!isInvalid) {
33853         isInvalid = hasInvalidGeometry(entity, context.graph());
33854       }
33855       var nope = context.surface().classed("nope");
33856       if (isInvalid === "relation" || isInvalid === "restriction") {
33857         if (!nope) {
33858           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
33859             "operations.connect." + isInvalid,
33860             { relation: _mainPresetIndex.item("type/restriction").name() }
33861           ))();
33862         }
33863       } else if (isInvalid) {
33864         var errorID = isInvalid === "line" ? "lines" : "areas";
33865         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
33866       } else {
33867         if (nope) {
33868           context.ui().flash.duration(1).label("")();
33869         }
33870       }
33871       var nopeDisabled = context.surface().classed("nope-disabled");
33872       if (nopeDisabled) {
33873         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
33874       } else {
33875         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
33876       }
33877       _lastLoc = loc;
33878     }
33879     function hasRelationConflict(entity, target, edge, graph) {
33880       var testGraph = graph.update();
33881       if (edge) {
33882         var midpoint = osmNode();
33883         var action = actionAddMidpoint({
33884           loc: edge.loc,
33885           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
33886         }, midpoint);
33887         testGraph = action(testGraph);
33888         target = midpoint;
33889       }
33890       var ids = [entity.id, target.id];
33891       return actionConnect(ids).disabled(testGraph);
33892     }
33893     function hasInvalidGeometry(entity, graph) {
33894       var parents = graph.parentWays(entity);
33895       var i2, j2, k;
33896       for (i2 = 0; i2 < parents.length; i2++) {
33897         var parent = parents[i2];
33898         var nodes = [];
33899         var activeIndex = null;
33900         var relations = graph.parentRelations(parent);
33901         for (j2 = 0; j2 < relations.length; j2++) {
33902           if (!relations[j2].isMultipolygon())
33903             continue;
33904           var rings = osmJoinWays(relations[j2].members, graph);
33905           for (k = 0; k < rings.length; k++) {
33906             nodes = rings[k].nodes;
33907             if (nodes.find(function(n2) {
33908               return n2.id === entity.id;
33909             })) {
33910               activeIndex = k;
33911               if (geoHasSelfIntersections(nodes, entity.id)) {
33912                 return "multipolygonMember";
33913               }
33914             }
33915             rings[k].coords = nodes.map(function(n2) {
33916               return n2.loc;
33917             });
33918           }
33919           for (k = 0; k < rings.length; k++) {
33920             if (k === activeIndex)
33921               continue;
33922             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k].nodes, entity.id)) {
33923               return "multipolygonRing";
33924             }
33925           }
33926         }
33927         if (activeIndex === null) {
33928           nodes = parent.nodes.map(function(nodeID) {
33929             return graph.entity(nodeID);
33930           });
33931           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
33932             return parent.geometry(graph);
33933           }
33934         }
33935       }
33936       return false;
33937     }
33938     function move(d3_event, entity, point) {
33939       if (_isCancelled)
33940         return;
33941       d3_event.stopPropagation();
33942       context.surface().classed("nope-disabled", d3_event.altKey);
33943       _lastLoc = context.projection.invert(point);
33944       doMove(d3_event, entity);
33945       var nudge = geoViewportEdge(point, context.map().dimensions());
33946       if (nudge) {
33947         startNudge(d3_event, entity, nudge);
33948       } else {
33949         stopNudge();
33950       }
33951     }
33952     function end(d3_event, entity) {
33953       if (_isCancelled)
33954         return;
33955       var wasPoint = entity.geometry(context.graph()) === "point";
33956       var d = datum2(d3_event);
33957       var nope = d && d.properties && d.properties.nope || context.surface().classed("nope");
33958       var target = d && d.properties && d.properties.entity;
33959       if (nope) {
33960         context.perform(
33961           _actionBounceBack(entity.id, _startLoc)
33962         );
33963       } else if (target && target.type === "way") {
33964         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
33965         context.replace(
33966           actionAddMidpoint({
33967             loc: choice.loc,
33968             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
33969           }, entity),
33970           connectAnnotation(entity, target)
33971         );
33972       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
33973         context.replace(
33974           actionConnect([target.id, entity.id]),
33975           connectAnnotation(entity, target)
33976         );
33977       } else if (_wasMidpoint) {
33978         context.replace(
33979           actionNoop(),
33980           _t("operations.add.annotation.vertex")
33981         );
33982       } else {
33983         context.replace(
33984           actionNoop(),
33985           moveAnnotation(entity)
33986         );
33987       }
33988       if (wasPoint) {
33989         context.enter(modeSelect(context, [entity.id]));
33990       } else {
33991         var reselection = _restoreSelectedIDs.filter(function(id2) {
33992           return context.graph().hasEntity(id2);
33993         });
33994         if (reselection.length) {
33995           context.enter(modeSelect(context, reselection));
33996         } else {
33997           context.enter(modeBrowse(context));
33998         }
33999       }
34000     }
34001     function _actionBounceBack(nodeID, toLoc) {
34002       var moveNode = actionMoveNode(nodeID, toLoc);
34003       var action = function(graph, t) {
34004         if (t === 1)
34005           context.pop();
34006         return moveNode(graph, t);
34007       };
34008       action.transitionable = true;
34009       return action;
34010     }
34011     function cancel() {
34012       drag.cancel();
34013       context.enter(modeBrowse(context));
34014     }
34015     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);
34016     mode.enter = function() {
34017       context.install(hover);
34018       context.install(edit2);
34019       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
34020       context.history().on("undone.drag-node", cancel);
34021     };
34022     mode.exit = function() {
34023       context.ui().sidebar.hover.cancel();
34024       context.uninstall(hover);
34025       context.uninstall(edit2);
34026       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
34027       context.history().on("undone.drag-node", null);
34028       _activeEntity = null;
34029       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
34030       stopNudge();
34031     };
34032     mode.selectedIDs = function() {
34033       if (!arguments.length)
34034         return _activeEntity ? [_activeEntity.id] : [];
34035       return mode;
34036     };
34037     mode.activeID = function() {
34038       if (!arguments.length)
34039         return _activeEntity && _activeEntity.id;
34040       return mode;
34041     };
34042     mode.restoreSelectedIDs = function(_) {
34043       if (!arguments.length)
34044         return _restoreSelectedIDs;
34045       _restoreSelectedIDs = _;
34046       return mode;
34047     };
34048     mode.behavior = drag;
34049     return mode;
34050   }
34051
34052   // modules/services/keepRight.js
34053   var import_rbush = __toESM(require_rbush_min());
34054
34055   // node_modules/d3-fetch/src/text.js
34056   function responseText(response) {
34057     if (!response.ok)
34058       throw new Error(response.status + " " + response.statusText);
34059     return response.text();
34060   }
34061   function text_default3(input, init2) {
34062     return fetch(input, init2).then(responseText);
34063   }
34064
34065   // node_modules/d3-fetch/src/json.js
34066   function responseJson(response) {
34067     if (!response.ok)
34068       throw new Error(response.status + " " + response.statusText);
34069     if (response.status === 204 || response.status === 205)
34070       return;
34071     return response.json();
34072   }
34073   function json_default(input, init2) {
34074     return fetch(input, init2).then(responseJson);
34075   }
34076
34077   // node_modules/d3-fetch/src/xml.js
34078   function parser(type3) {
34079     return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type3));
34080   }
34081   var xml_default = parser("application/xml");
34082   var html = parser("text/html");
34083   var svg = parser("image/svg+xml");
34084
34085   // modules/services/keepRight.js
34086   var tiler = utilTiler();
34087   var dispatch2 = dispatch_default("loaded");
34088   var _tileZoom = 14;
34089   var _krUrlRoot = "https://www.keepright.at";
34090   var _krData = { errorTypes: {}, localizeStrings: {} };
34091   var _cache;
34092   var _krRuleset = [
34093     30,
34094     40,
34095     50,
34096     60,
34097     70,
34098     90,
34099     100,
34100     110,
34101     120,
34102     130,
34103     150,
34104     160,
34105     170,
34106     180,
34107     190,
34108     191,
34109     192,
34110     193,
34111     194,
34112     195,
34113     196,
34114     197,
34115     198,
34116     200,
34117     201,
34118     202,
34119     203,
34120     204,
34121     205,
34122     206,
34123     207,
34124     208,
34125     210,
34126     220,
34127     230,
34128     231,
34129     232,
34130     270,
34131     280,
34132     281,
34133     282,
34134     283,
34135     284,
34136     285,
34137     290,
34138     291,
34139     292,
34140     293,
34141     294,
34142     295,
34143     296,
34144     297,
34145     298,
34146     300,
34147     310,
34148     311,
34149     312,
34150     313,
34151     320,
34152     350,
34153     360,
34154     370,
34155     380,
34156     390,
34157     400,
34158     401,
34159     402,
34160     410,
34161     411,
34162     412,
34163     413
34164   ];
34165   function abortRequest(controller) {
34166     if (controller) {
34167       controller.abort();
34168     }
34169   }
34170   function abortUnwantedRequests(cache, tiles) {
34171     Object.keys(cache.inflightTile).forEach((k) => {
34172       const wanted = tiles.find((tile) => k === tile.id);
34173       if (!wanted) {
34174         abortRequest(cache.inflightTile[k]);
34175         delete cache.inflightTile[k];
34176       }
34177     });
34178   }
34179   function encodeIssueRtree(d) {
34180     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
34181   }
34182   function updateRtree(item, replace) {
34183     _cache.rtree.remove(item, (a, b) => a.data.id === b.data.id);
34184     if (replace) {
34185       _cache.rtree.insert(item);
34186     }
34187   }
34188   function tokenReplacements(d) {
34189     if (!(d instanceof QAItem))
34190       return;
34191     const replacements = {};
34192     const issueTemplate = _krData.errorTypes[d.whichType];
34193     if (!issueTemplate) {
34194       console.log("No Template: ", d.whichType);
34195       console.log("  ", d.description);
34196       return;
34197     }
34198     if (!issueTemplate.regex)
34199       return;
34200     const errorRegex = new RegExp(issueTemplate.regex, "i");
34201     const errorMatch = errorRegex.exec(d.description);
34202     if (!errorMatch) {
34203       console.log("Unmatched: ", d.whichType);
34204       console.log("  ", d.description);
34205       console.log("  ", errorRegex);
34206       return;
34207     }
34208     for (let i2 = 1; i2 < errorMatch.length; i2++) {
34209       let capture = errorMatch[i2];
34210       let idType;
34211       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i2 - 1] : "";
34212       if (idType && capture) {
34213         capture = parseError(capture, idType);
34214       } else {
34215         const compare = capture.toLowerCase();
34216         if (_krData.localizeStrings[compare]) {
34217           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
34218         } else {
34219           capture = unescape_default(capture);
34220         }
34221       }
34222       replacements["var" + i2] = capture;
34223     }
34224     return replacements;
34225   }
34226   function parseError(capture, idType) {
34227     const compare = capture.toLowerCase();
34228     if (_krData.localizeStrings[compare]) {
34229       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
34230     }
34231     switch (idType) {
34232       case "this":
34233         capture = linkErrorObject2(capture);
34234         break;
34235       case "url":
34236         capture = linkURL(capture);
34237         break;
34238       case "n":
34239       case "w":
34240       case "r":
34241         capture = linkEntity2(idType + capture);
34242         break;
34243       case "20":
34244         capture = parse20(capture);
34245         break;
34246       case "211":
34247         capture = parse211(capture);
34248         break;
34249       case "231":
34250         capture = parse231(capture);
34251         break;
34252       case "294":
34253         capture = parse294(capture);
34254         break;
34255       case "370":
34256         capture = parse370(capture);
34257         break;
34258     }
34259     return capture;
34260     function linkErrorObject2(d) {
34261       return { html: `<a class="error_object_link">${d}</a>` };
34262     }
34263     function linkEntity2(d) {
34264       return { html: `<a class="error_entity_link">${d}</a>` };
34265     }
34266     function linkURL(d) {
34267       return { html: `<a class="kr_external_link" target="_blank" href="${d}">${d}</a>` };
34268     }
34269     function parse211(capture2) {
34270       let newList = [];
34271       const items = capture2.split(", ");
34272       items.forEach((item) => {
34273         let id2 = linkEntity2("n" + item.slice(1));
34274         newList.push(id2);
34275       });
34276       return newList.join(", ");
34277     }
34278     function parse231(capture2) {
34279       let newList = [];
34280       const items = capture2.split("),");
34281       items.forEach((item) => {
34282         const match = item.match(/\#(\d+)\((.+)\)?/);
34283         if (match !== null && match.length > 2) {
34284           newList.push(
34285             linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
34286           );
34287         }
34288       });
34289       return newList.join(", ");
34290     }
34291     function parse294(capture2) {
34292       let newList = [];
34293       const items = capture2.split(",");
34294       items.forEach((item) => {
34295         item = item.split(" ");
34296         const role = `"${item[0]}"`;
34297         const idType2 = item[1].slice(0, 1);
34298         let id2 = item[2].slice(1);
34299         id2 = linkEntity2(idType2 + id2);
34300         newList.push(`${role} ${item[1]} ${id2}`);
34301       });
34302       return newList.join(", ");
34303     }
34304     function parse370(capture2) {
34305       if (!capture2)
34306         return "";
34307       const match = capture2.match(/\(including the name (\'.+\')\)/);
34308       if (match && match.length) {
34309         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
34310       }
34311       return "";
34312     }
34313     function parse20(capture2) {
34314       let newList = [];
34315       const items = capture2.split(",");
34316       items.forEach((item) => {
34317         const id2 = linkEntity2("n" + item.slice(1));
34318         newList.push(id2);
34319       });
34320       return newList.join(", ");
34321     }
34322   }
34323   var keepRight_default = {
34324     title: "keepRight",
34325     init() {
34326       _mainFileFetcher.get("keepRight").then((d) => _krData = d);
34327       if (!_cache) {
34328         this.reset();
34329       }
34330       this.event = utilRebind(this, dispatch2, "on");
34331     },
34332     reset() {
34333       if (_cache) {
34334         Object.values(_cache.inflightTile).forEach(abortRequest);
34335       }
34336       _cache = {
34337         data: {},
34338         loadedTile: {},
34339         inflightTile: {},
34340         inflightPost: {},
34341         closed: {},
34342         rtree: new import_rbush.default()
34343       };
34344     },
34345     loadIssues(projection2) {
34346       const options2 = {
34347         format: "geojson",
34348         ch: _krRuleset
34349       };
34350       const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
34351       abortUnwantedRequests(_cache, tiles);
34352       tiles.forEach((tile) => {
34353         if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
34354           return;
34355         const [left, top, right, bottom] = tile.extent.rectangle();
34356         const params = Object.assign({}, options2, { left, bottom, right, top });
34357         const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
34358         const controller = new AbortController();
34359         _cache.inflightTile[tile.id] = controller;
34360         json_default(url, { signal: controller.signal }).then((data) => {
34361           delete _cache.inflightTile[tile.id];
34362           _cache.loadedTile[tile.id] = true;
34363           if (!data || !data.features || !data.features.length) {
34364             throw new Error("No Data");
34365           }
34366           data.features.forEach((feature3) => {
34367             const {
34368               properties: {
34369                 error_type: itemType,
34370                 error_id: id2,
34371                 comment = null,
34372                 object_id: objectId,
34373                 object_type: objectType,
34374                 schema,
34375                 title
34376               }
34377             } = feature3;
34378             let {
34379               geometry: { coordinates: loc },
34380               properties: { description = "" }
34381             } = feature3;
34382             const issueTemplate = _krData.errorTypes[itemType];
34383             const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
34384             const whichType = issueTemplate ? itemType : parentIssueType;
34385             const whichTemplate = _krData.errorTypes[whichType];
34386             switch (whichType) {
34387               case "170":
34388                 description = `This feature has a FIXME tag: ${description}`;
34389                 break;
34390               case "292":
34391               case "293":
34392                 description = description.replace("A turn-", "This turn-");
34393                 break;
34394               case "294":
34395               case "295":
34396               case "296":
34397               case "297":
34398               case "298":
34399                 description = `This turn-restriction~${description}`;
34400                 break;
34401               case "300":
34402                 description = "This highway is missing a maxspeed tag";
34403                 break;
34404               case "411":
34405               case "412":
34406               case "413":
34407                 description = `This feature~${description}`;
34408                 break;
34409             }
34410             let coincident = false;
34411             do {
34412               let delta = coincident ? [1e-5, 0] : [0, 1e-5];
34413               loc = geoVecAdd(loc, delta);
34414               let bbox = geoExtent(loc).bbox();
34415               coincident = _cache.rtree.search(bbox).length;
34416             } while (coincident);
34417             let d = new QAItem(loc, this, itemType, id2, {
34418               comment,
34419               description,
34420               whichType,
34421               parentIssueType,
34422               severity: whichTemplate.severity || "error",
34423               objectId,
34424               objectType,
34425               schema,
34426               title
34427             });
34428             d.replacements = tokenReplacements(d);
34429             _cache.data[id2] = d;
34430             _cache.rtree.insert(encodeIssueRtree(d));
34431           });
34432           dispatch2.call("loaded");
34433         }).catch(() => {
34434           delete _cache.inflightTile[tile.id];
34435           _cache.loadedTile[tile.id] = true;
34436         });
34437       });
34438     },
34439     postUpdate(d, callback) {
34440       if (_cache.inflightPost[d.id]) {
34441         return callback({ message: "Error update already inflight", status: -2 }, d);
34442       }
34443       const params = { schema: d.schema, id: d.id };
34444       if (d.newStatus) {
34445         params.st = d.newStatus;
34446       }
34447       if (d.newComment !== void 0) {
34448         params.co = d.newComment;
34449       }
34450       const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
34451       const controller = new AbortController();
34452       _cache.inflightPost[d.id] = controller;
34453       json_default(url, { signal: controller.signal }).finally(() => {
34454         delete _cache.inflightPost[d.id];
34455         if (d.newStatus === "ignore") {
34456           this.removeItem(d);
34457         } else if (d.newStatus === "ignore_t") {
34458           this.removeItem(d);
34459           _cache.closed[`${d.schema}:${d.id}`] = true;
34460         } else {
34461           d = this.replaceItem(d.update({
34462             comment: d.newComment,
34463             newComment: void 0,
34464             newState: void 0
34465           }));
34466         }
34467         if (callback)
34468           callback(null, d);
34469       });
34470     },
34471     getItems(projection2) {
34472       const viewport = projection2.clipExtent();
34473       const min3 = [viewport[0][0], viewport[1][1]];
34474       const max3 = [viewport[1][0], viewport[0][1]];
34475       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34476       return _cache.rtree.search(bbox).map((d) => d.data);
34477     },
34478     getError(id2) {
34479       return _cache.data[id2];
34480     },
34481     replaceItem(item) {
34482       if (!(item instanceof QAItem) || !item.id)
34483         return;
34484       _cache.data[item.id] = item;
34485       updateRtree(encodeIssueRtree(item), true);
34486       return item;
34487     },
34488     removeItem(item) {
34489       if (!(item instanceof QAItem) || !item.id)
34490         return;
34491       delete _cache.data[item.id];
34492       updateRtree(encodeIssueRtree(item), false);
34493     },
34494     issueURL(item) {
34495       return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
34496     },
34497     getClosedIDs() {
34498       return Object.keys(_cache.closed).sort();
34499     }
34500   };
34501
34502   // modules/services/improveOSM.js
34503   var import_rbush2 = __toESM(require_rbush_min());
34504   var tiler2 = utilTiler();
34505   var dispatch3 = dispatch_default("loaded");
34506   var _tileZoom2 = 14;
34507   var _impOsmUrls = {
34508     ow: "https://grab.community.improve-osm.org/directionOfFlowService",
34509     mr: "https://grab.community.improve-osm.org/missingGeoService",
34510     tr: "https://grab.community.improve-osm.org/turnRestrictionService"
34511   };
34512   var _impOsmData = { icons: {} };
34513   var _cache2;
34514   function abortRequest2(i2) {
34515     Object.values(i2).forEach((controller) => {
34516       if (controller) {
34517         controller.abort();
34518       }
34519     });
34520   }
34521   function abortUnwantedRequests2(cache, tiles) {
34522     Object.keys(cache.inflightTile).forEach((k) => {
34523       const wanted = tiles.find((tile) => k === tile.id);
34524       if (!wanted) {
34525         abortRequest2(cache.inflightTile[k]);
34526         delete cache.inflightTile[k];
34527       }
34528     });
34529   }
34530   function encodeIssueRtree2(d) {
34531     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
34532   }
34533   function updateRtree2(item, replace) {
34534     _cache2.rtree.remove(item, (a, b) => a.data.id === b.data.id);
34535     if (replace) {
34536       _cache2.rtree.insert(item);
34537     }
34538   }
34539   function linkErrorObject(d) {
34540     return { html: `<a class="error_object_link">${d}</a>` };
34541   }
34542   function linkEntity(d) {
34543     return { html: `<a class="error_entity_link">${d}</a>` };
34544   }
34545   function pointAverage(points) {
34546     if (points.length) {
34547       const sum = points.reduce(
34548         (acc, point) => geoVecAdd(acc, [point.lon, point.lat]),
34549         [0, 0]
34550       );
34551       return geoVecScale(sum, 1 / points.length);
34552     } else {
34553       return [0, 0];
34554     }
34555   }
34556   function relativeBearing(p1, p2) {
34557     let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
34558     if (angle2 < 0) {
34559       angle2 += 2 * Math.PI;
34560     }
34561     return angle2 * 180 / Math.PI;
34562   }
34563   function cardinalDirection(bearing) {
34564     const dir = 45 * Math.round(bearing / 45);
34565     const compass = {
34566       0: "north",
34567       45: "northeast",
34568       90: "east",
34569       135: "southeast",
34570       180: "south",
34571       225: "southwest",
34572       270: "west",
34573       315: "northwest",
34574       360: "north"
34575     };
34576     return _t(`QA.improveOSM.directions.${compass[dir]}`);
34577   }
34578   function preventCoincident(loc, bumpUp) {
34579     let coincident = false;
34580     do {
34581       let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
34582       loc = geoVecAdd(loc, delta);
34583       let bbox = geoExtent(loc).bbox();
34584       coincident = _cache2.rtree.search(bbox).length;
34585     } while (coincident);
34586     return loc;
34587   }
34588   var improveOSM_default = {
34589     title: "improveOSM",
34590     init() {
34591       _mainFileFetcher.get("qa_data").then((d) => _impOsmData = d.improveOSM);
34592       if (!_cache2) {
34593         this.reset();
34594       }
34595       this.event = utilRebind(this, dispatch3, "on");
34596     },
34597     reset() {
34598       if (_cache2) {
34599         Object.values(_cache2.inflightTile).forEach(abortRequest2);
34600       }
34601       _cache2 = {
34602         data: {},
34603         loadedTile: {},
34604         inflightTile: {},
34605         inflightPost: {},
34606         closed: {},
34607         rtree: new import_rbush2.default()
34608       };
34609     },
34610     loadIssues(projection2) {
34611       const options2 = {
34612         client: "iD",
34613         status: "OPEN",
34614         zoom: "19"
34615       };
34616       const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
34617       abortUnwantedRequests2(_cache2, tiles);
34618       tiles.forEach((tile) => {
34619         if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
34620           return;
34621         const [east, north, west, south] = tile.extent.rectangle();
34622         const params = Object.assign({}, options2, { east, south, west, north });
34623         const requests = {};
34624         Object.keys(_impOsmUrls).forEach((k) => {
34625           const kParams = Object.assign(
34626             {},
34627             params,
34628             k === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" }
34629           );
34630           const url = `${_impOsmUrls[k]}/search?` + utilQsString(kParams);
34631           const controller = new AbortController();
34632           requests[k] = controller;
34633           json_default(url, { signal: controller.signal }).then((data) => {
34634             delete _cache2.inflightTile[tile.id][k];
34635             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
34636               delete _cache2.inflightTile[tile.id];
34637               _cache2.loadedTile[tile.id] = true;
34638             }
34639             if (data.roadSegments) {
34640               data.roadSegments.forEach((feature3) => {
34641                 const { points, wayId, fromNodeId, toNodeId } = feature3;
34642                 const itemId = `${wayId}${fromNodeId}${toNodeId}`;
34643                 let mid = points.length / 2;
34644                 let loc;
34645                 if (mid % 1 === 0) {
34646                   loc = pointAverage([points[mid - 1], points[mid]]);
34647                 } else {
34648                   mid = points[Math.floor(mid)];
34649                   loc = [mid.lon, mid.lat];
34650                 }
34651                 loc = preventCoincident(loc, false);
34652                 let d = new QAItem(loc, this, k, itemId, {
34653                   issueKey: k,
34654                   identifier: {
34655                     wayId,
34656                     fromNodeId,
34657                     toNodeId
34658                   },
34659                   objectId: wayId,
34660                   objectType: "way"
34661                 });
34662                 d.replacements = {
34663                   percentage: feature3.percentOfTrips,
34664                   num_trips: feature3.numberOfTrips,
34665                   highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
34666                   from_node: linkEntity("n" + feature3.fromNodeId),
34667                   to_node: linkEntity("n" + feature3.toNodeId)
34668                 };
34669                 _cache2.data[d.id] = d;
34670                 _cache2.rtree.insert(encodeIssueRtree2(d));
34671               });
34672             }
34673             if (data.tiles) {
34674               data.tiles.forEach((feature3) => {
34675                 const { type: type3, x, y, numberOfTrips } = feature3;
34676                 const geoType = type3.toLowerCase();
34677                 const itemId = `${geoType}${x}${y}${numberOfTrips}`;
34678                 let loc = pointAverage(feature3.points);
34679                 loc = preventCoincident(loc, false);
34680                 let d = new QAItem(loc, this, `${k}-${geoType}`, itemId, {
34681                   issueKey: k,
34682                   identifier: { x, y }
34683                 });
34684                 d.replacements = {
34685                   num_trips: numberOfTrips,
34686                   geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`)
34687                 };
34688                 if (numberOfTrips === -1) {
34689                   d.desc = _t("QA.improveOSM.error_types.mr.description_alt", d.replacements);
34690                 }
34691                 _cache2.data[d.id] = d;
34692                 _cache2.rtree.insert(encodeIssueRtree2(d));
34693               });
34694             }
34695             if (data.entities) {
34696               data.entities.forEach((feature3) => {
34697                 const { point, id: id2, segments, numberOfPasses, turnType } = feature3;
34698                 const itemId = `${id2.replace(/[,:+#]/g, "_")}`;
34699                 const loc = preventCoincident([point.lon, point.lat], true);
34700                 const ids = id2.split(",");
34701                 const from_way = ids[0];
34702                 const via_node = ids[3];
34703                 const to_way = ids[2].split(":")[1];
34704                 let d = new QAItem(loc, this, k, itemId, {
34705                   issueKey: k,
34706                   identifier: id2,
34707                   objectId: via_node,
34708                   objectType: "node"
34709                 });
34710                 const [p1, p2] = segments[0].points;
34711                 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
34712                 d.replacements = {
34713                   num_passed: numberOfPasses,
34714                   num_trips: segments[0].numberOfTrips,
34715                   turn_restriction: turnType.toLowerCase(),
34716                   from_way: linkEntity("w" + from_way),
34717                   to_way: linkEntity("w" + to_way),
34718                   travel_direction: dir_of_travel,
34719                   junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
34720                 };
34721                 _cache2.data[d.id] = d;
34722                 _cache2.rtree.insert(encodeIssueRtree2(d));
34723                 dispatch3.call("loaded");
34724               });
34725             }
34726           }).catch(() => {
34727             delete _cache2.inflightTile[tile.id][k];
34728             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
34729               delete _cache2.inflightTile[tile.id];
34730               _cache2.loadedTile[tile.id] = true;
34731             }
34732           });
34733         });
34734         _cache2.inflightTile[tile.id] = requests;
34735       });
34736     },
34737     getComments(item) {
34738       if (item.comments) {
34739         return Promise.resolve(item);
34740       }
34741       const key = item.issueKey;
34742       let qParams = {};
34743       if (key === "ow") {
34744         qParams = item.identifier;
34745       } else if (key === "mr") {
34746         qParams.tileX = item.identifier.x;
34747         qParams.tileY = item.identifier.y;
34748       } else if (key === "tr") {
34749         qParams.targetId = item.identifier;
34750       }
34751       const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams);
34752       const cacheComments = (data) => {
34753         item.comments = data.comments ? data.comments.reverse() : [];
34754         this.replaceItem(item);
34755       };
34756       return json_default(url).then(cacheComments).then(() => item);
34757     },
34758     postUpdate(d, callback) {
34759       if (!osm_default.authenticated()) {
34760         return callback({ message: "Not Authenticated", status: -3 }, d);
34761       }
34762       if (_cache2.inflightPost[d.id]) {
34763         return callback({ message: "Error update already inflight", status: -2 }, d);
34764       }
34765       osm_default.userDetails(sendPayload.bind(this));
34766       function sendPayload(err, user) {
34767         if (err) {
34768           return callback(err, d);
34769         }
34770         const key = d.issueKey;
34771         const url = `${_impOsmUrls[key]}/comment`;
34772         const payload = {
34773           username: user.display_name,
34774           targetIds: [d.identifier]
34775         };
34776         if (d.newStatus) {
34777           payload.status = d.newStatus;
34778           payload.text = "status changed";
34779         }
34780         if (d.newComment) {
34781           payload.text = d.newComment;
34782         }
34783         const controller = new AbortController();
34784         _cache2.inflightPost[d.id] = controller;
34785         const options2 = {
34786           method: "POST",
34787           signal: controller.signal,
34788           body: JSON.stringify(payload)
34789         };
34790         json_default(url, options2).then(() => {
34791           delete _cache2.inflightPost[d.id];
34792           if (!d.newStatus) {
34793             const now3 = new Date();
34794             let comments = d.comments ? d.comments : [];
34795             comments.push({
34796               username: payload.username,
34797               text: payload.text,
34798               timestamp: now3.getTime() / 1e3
34799             });
34800             this.replaceItem(d.update({
34801               comments,
34802               newComment: void 0
34803             }));
34804           } else {
34805             this.removeItem(d);
34806             if (d.newStatus === "SOLVED") {
34807               if (!(d.issueKey in _cache2.closed)) {
34808                 _cache2.closed[d.issueKey] = 0;
34809               }
34810               _cache2.closed[d.issueKey] += 1;
34811             }
34812           }
34813           if (callback)
34814             callback(null, d);
34815         }).catch((err2) => {
34816           delete _cache2.inflightPost[d.id];
34817           if (callback)
34818             callback(err2.message);
34819         });
34820       }
34821     },
34822     getItems(projection2) {
34823       const viewport = projection2.clipExtent();
34824       const min3 = [viewport[0][0], viewport[1][1]];
34825       const max3 = [viewport[1][0], viewport[0][1]];
34826       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34827       return _cache2.rtree.search(bbox).map((d) => d.data);
34828     },
34829     getError(id2) {
34830       return _cache2.data[id2];
34831     },
34832     getIcon(itemType) {
34833       return _impOsmData.icons[itemType];
34834     },
34835     replaceItem(issue) {
34836       if (!(issue instanceof QAItem) || !issue.id)
34837         return;
34838       _cache2.data[issue.id] = issue;
34839       updateRtree2(encodeIssueRtree2(issue), true);
34840       return issue;
34841     },
34842     removeItem(issue) {
34843       if (!(issue instanceof QAItem) || !issue.id)
34844         return;
34845       delete _cache2.data[issue.id];
34846       updateRtree2(encodeIssueRtree2(issue), false);
34847     },
34848     getClosedCounts() {
34849       return _cache2.closed;
34850     }
34851   };
34852
34853   // modules/services/osmose.js
34854   var import_rbush3 = __toESM(require_rbush_min());
34855
34856   // node_modules/marked/lib/marked.esm.js
34857   function getDefaults() {
34858     return {
34859       async: false,
34860       baseUrl: null,
34861       breaks: false,
34862       extensions: null,
34863       gfm: true,
34864       headerIds: true,
34865       headerPrefix: "",
34866       highlight: null,
34867       langPrefix: "language-",
34868       mangle: true,
34869       pedantic: false,
34870       renderer: null,
34871       sanitize: false,
34872       sanitizer: null,
34873       silent: false,
34874       smartLists: false,
34875       smartypants: false,
34876       tokenizer: null,
34877       walkTokens: null,
34878       xhtml: false
34879     };
34880   }
34881   var defaults = getDefaults();
34882   function changeDefaults(newDefaults) {
34883     defaults = newDefaults;
34884   }
34885   var escapeTest = /[&<>"']/;
34886   var escapeReplace = /[&<>"']/g;
34887   var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
34888   var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
34889   var escapeReplacements = {
34890     "&": "&amp;",
34891     "<": "&lt;",
34892     ">": "&gt;",
34893     '"': "&quot;",
34894     "'": "&#39;"
34895   };
34896   var getEscapeReplacement = (ch) => escapeReplacements[ch];
34897   function escape4(html2, encode) {
34898     if (encode) {
34899       if (escapeTest.test(html2)) {
34900         return html2.replace(escapeReplace, getEscapeReplacement);
34901       }
34902     } else {
34903       if (escapeTestNoEncode.test(html2)) {
34904         return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
34905       }
34906     }
34907     return html2;
34908   }
34909   var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
34910   function unescape3(html2) {
34911     return html2.replace(unescapeTest, (_, n2) => {
34912       n2 = n2.toLowerCase();
34913       if (n2 === "colon")
34914         return ":";
34915       if (n2.charAt(0) === "#") {
34916         return n2.charAt(1) === "x" ? String.fromCharCode(parseInt(n2.substring(2), 16)) : String.fromCharCode(+n2.substring(1));
34917       }
34918       return "";
34919     });
34920   }
34921   var caret = /(^|[^\[])\^/g;
34922   function edit(regex, opt) {
34923     regex = typeof regex === "string" ? regex : regex.source;
34924     opt = opt || "";
34925     const obj = {
34926       replace: (name, val) => {
34927         val = val.source || val;
34928         val = val.replace(caret, "$1");
34929         regex = regex.replace(name, val);
34930         return obj;
34931       },
34932       getRegex: () => {
34933         return new RegExp(regex, opt);
34934       }
34935     };
34936     return obj;
34937   }
34938   var nonWordAndColonTest = /[^\w:]/g;
34939   var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
34940   function cleanUrl(sanitize, base, href) {
34941     if (sanitize) {
34942       let prot;
34943       try {
34944         prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
34945       } catch (e) {
34946         return null;
34947       }
34948       if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
34949         return null;
34950       }
34951     }
34952     if (base && !originIndependentUrl.test(href)) {
34953       href = resolveUrl(base, href);
34954     }
34955     try {
34956       href = encodeURI(href).replace(/%25/g, "%");
34957     } catch (e) {
34958       return null;
34959     }
34960     return href;
34961   }
34962   var baseUrls = {};
34963   var justDomain = /^[^:]+:\/*[^/]*$/;
34964   var protocol = /^([^:]+:)[\s\S]*$/;
34965   var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
34966   function resolveUrl(base, href) {
34967     if (!baseUrls[" " + base]) {
34968       if (justDomain.test(base)) {
34969         baseUrls[" " + base] = base + "/";
34970       } else {
34971         baseUrls[" " + base] = rtrim(base, "/", true);
34972       }
34973     }
34974     base = baseUrls[" " + base];
34975     const relativeBase = base.indexOf(":") === -1;
34976     if (href.substring(0, 2) === "//") {
34977       if (relativeBase) {
34978         return href;
34979       }
34980       return base.replace(protocol, "$1") + href;
34981     } else if (href.charAt(0) === "/") {
34982       if (relativeBase) {
34983         return href;
34984       }
34985       return base.replace(domain, "$1") + href;
34986     } else {
34987       return base + href;
34988     }
34989   }
34990   var noopTest = { exec: function noopTest2() {
34991   } };
34992   function merge2(obj) {
34993     let i2 = 1, target, key;
34994     for (; i2 < arguments.length; i2++) {
34995       target = arguments[i2];
34996       for (key in target) {
34997         if (Object.prototype.hasOwnProperty.call(target, key)) {
34998           obj[key] = target[key];
34999         }
35000       }
35001     }
35002     return obj;
35003   }
35004   function splitCells(tableRow, count) {
35005     const row = tableRow.replace(/\|/g, (match, offset, str2) => {
35006       let escaped = false, curr = offset;
35007       while (--curr >= 0 && str2[curr] === "\\")
35008         escaped = !escaped;
35009       if (escaped) {
35010         return "|";
35011       } else {
35012         return " |";
35013       }
35014     }), cells = row.split(/ \|/);
35015     let i2 = 0;
35016     if (!cells[0].trim()) {
35017       cells.shift();
35018     }
35019     if (cells.length > 0 && !cells[cells.length - 1].trim()) {
35020       cells.pop();
35021     }
35022     if (cells.length > count) {
35023       cells.splice(count);
35024     } else {
35025       while (cells.length < count)
35026         cells.push("");
35027     }
35028     for (; i2 < cells.length; i2++) {
35029       cells[i2] = cells[i2].trim().replace(/\\\|/g, "|");
35030     }
35031     return cells;
35032   }
35033   function rtrim(str2, c, invert) {
35034     const l = str2.length;
35035     if (l === 0) {
35036       return "";
35037     }
35038     let suffLen = 0;
35039     while (suffLen < l) {
35040       const currChar = str2.charAt(l - suffLen - 1);
35041       if (currChar === c && !invert) {
35042         suffLen++;
35043       } else if (currChar !== c && invert) {
35044         suffLen++;
35045       } else {
35046         break;
35047       }
35048     }
35049     return str2.slice(0, l - suffLen);
35050   }
35051   function findClosingBracket(str2, b) {
35052     if (str2.indexOf(b[1]) === -1) {
35053       return -1;
35054     }
35055     const l = str2.length;
35056     let level = 0, i2 = 0;
35057     for (; i2 < l; i2++) {
35058       if (str2[i2] === "\\") {
35059         i2++;
35060       } else if (str2[i2] === b[0]) {
35061         level++;
35062       } else if (str2[i2] === b[1]) {
35063         level--;
35064         if (level < 0) {
35065           return i2;
35066         }
35067       }
35068     }
35069     return -1;
35070   }
35071   function checkSanitizeDeprecation(opt) {
35072     if (opt && opt.sanitize && !opt.silent) {
35073       console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
35074     }
35075   }
35076   function repeatString(pattern, count) {
35077     if (count < 1) {
35078       return "";
35079     }
35080     let result = "";
35081     while (count > 1) {
35082       if (count & 1) {
35083         result += pattern;
35084       }
35085       count >>= 1;
35086       pattern += pattern;
35087     }
35088     return result + pattern;
35089   }
35090   function outputLink(cap, link2, raw, lexer2) {
35091     const href = link2.href;
35092     const title = link2.title ? escape4(link2.title) : null;
35093     const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
35094     if (cap[0].charAt(0) !== "!") {
35095       lexer2.state.inLink = true;
35096       const token = {
35097         type: "link",
35098         raw,
35099         href,
35100         title,
35101         text: text2,
35102         tokens: lexer2.inlineTokens(text2)
35103       };
35104       lexer2.state.inLink = false;
35105       return token;
35106     }
35107     return {
35108       type: "image",
35109       raw,
35110       href,
35111       title,
35112       text: escape4(text2)
35113     };
35114   }
35115   function indentCodeCompensation(raw, text2) {
35116     const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
35117     if (matchIndentToCode === null) {
35118       return text2;
35119     }
35120     const indentToCode = matchIndentToCode[1];
35121     return text2.split("\n").map((node) => {
35122       const matchIndentInNode = node.match(/^\s+/);
35123       if (matchIndentInNode === null) {
35124         return node;
35125       }
35126       const [indentInNode] = matchIndentInNode;
35127       if (indentInNode.length >= indentToCode.length) {
35128         return node.slice(indentToCode.length);
35129       }
35130       return node;
35131     }).join("\n");
35132   }
35133   var Tokenizer = class {
35134     constructor(options2) {
35135       this.options = options2 || defaults;
35136     }
35137     space(src) {
35138       const cap = this.rules.block.newline.exec(src);
35139       if (cap && cap[0].length > 0) {
35140         return {
35141           type: "space",
35142           raw: cap[0]
35143         };
35144       }
35145     }
35146     code(src) {
35147       const cap = this.rules.block.code.exec(src);
35148       if (cap) {
35149         const text2 = cap[0].replace(/^ {1,4}/gm, "");
35150         return {
35151           type: "code",
35152           raw: cap[0],
35153           codeBlockStyle: "indented",
35154           text: !this.options.pedantic ? rtrim(text2, "\n") : text2
35155         };
35156       }
35157     }
35158     fences(src) {
35159       const cap = this.rules.block.fences.exec(src);
35160       if (cap) {
35161         const raw = cap[0];
35162         const text2 = indentCodeCompensation(raw, cap[3] || "");
35163         return {
35164           type: "code",
35165           raw,
35166           lang: cap[2] ? cap[2].trim() : cap[2],
35167           text: text2
35168         };
35169       }
35170     }
35171     heading(src) {
35172       const cap = this.rules.block.heading.exec(src);
35173       if (cap) {
35174         let text2 = cap[2].trim();
35175         if (/#$/.test(text2)) {
35176           const trimmed = rtrim(text2, "#");
35177           if (this.options.pedantic) {
35178             text2 = trimmed.trim();
35179           } else if (!trimmed || / $/.test(trimmed)) {
35180             text2 = trimmed.trim();
35181           }
35182         }
35183         return {
35184           type: "heading",
35185           raw: cap[0],
35186           depth: cap[1].length,
35187           text: text2,
35188           tokens: this.lexer.inline(text2)
35189         };
35190       }
35191     }
35192     hr(src) {
35193       const cap = this.rules.block.hr.exec(src);
35194       if (cap) {
35195         return {
35196           type: "hr",
35197           raw: cap[0]
35198         };
35199       }
35200     }
35201     blockquote(src) {
35202       const cap = this.rules.block.blockquote.exec(src);
35203       if (cap) {
35204         const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
35205         return {
35206           type: "blockquote",
35207           raw: cap[0],
35208           tokens: this.lexer.blockTokens(text2, []),
35209           text: text2
35210         };
35211       }
35212     }
35213     list(src) {
35214       let cap = this.rules.block.list.exec(src);
35215       if (cap) {
35216         let raw, istask, ischecked, indent2, i2, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
35217         let bull = cap[1].trim();
35218         const isordered = bull.length > 1;
35219         const list = {
35220           type: "list",
35221           raw: "",
35222           ordered: isordered,
35223           start: isordered ? +bull.slice(0, -1) : "",
35224           loose: false,
35225           items: []
35226         };
35227         bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
35228         if (this.options.pedantic) {
35229           bull = isordered ? bull : "[*+-]";
35230         }
35231         const itemRegex = new RegExp(`^( {0,3}${bull})((?:[      ][^\\n]*)?(?:\\n|$))`);
35232         while (src) {
35233           endEarly = false;
35234           if (!(cap = itemRegex.exec(src))) {
35235             break;
35236           }
35237           if (this.rules.block.hr.test(src)) {
35238             break;
35239           }
35240           raw = cap[0];
35241           src = src.substring(raw.length);
35242           line = cap[2].split("\n", 1)[0];
35243           nextLine = src.split("\n", 1)[0];
35244           if (this.options.pedantic) {
35245             indent2 = 2;
35246             itemContents = line.trimLeft();
35247           } else {
35248             indent2 = cap[2].search(/[^ ]/);
35249             indent2 = indent2 > 4 ? 1 : indent2;
35250             itemContents = line.slice(indent2);
35251             indent2 += cap[1].length;
35252           }
35253           blankLine = false;
35254           if (!line && /^ *$/.test(nextLine)) {
35255             raw += nextLine + "\n";
35256             src = src.substring(nextLine.length + 1);
35257             endEarly = true;
35258           }
35259           if (!endEarly) {
35260             const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`);
35261             const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
35262             const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:\`\`\`|~~~)`);
35263             const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}#`);
35264             while (src) {
35265               rawLine = src.split("\n", 1)[0];
35266               line = rawLine;
35267               if (this.options.pedantic) {
35268                 line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
35269               }
35270               if (fencesBeginRegex.test(line)) {
35271                 break;
35272               }
35273               if (headingBeginRegex.test(line)) {
35274                 break;
35275               }
35276               if (nextBulletRegex.test(line)) {
35277                 break;
35278               }
35279               if (hrRegex.test(src)) {
35280                 break;
35281               }
35282               if (line.search(/[^ ]/) >= indent2 || !line.trim()) {
35283                 itemContents += "\n" + line.slice(indent2);
35284               } else if (!blankLine) {
35285                 itemContents += "\n" + line;
35286               } else {
35287                 break;
35288               }
35289               if (!blankLine && !line.trim()) {
35290                 blankLine = true;
35291               }
35292               raw += rawLine + "\n";
35293               src = src.substring(rawLine.length + 1);
35294             }
35295           }
35296           if (!list.loose) {
35297             if (endsWithBlankLine) {
35298               list.loose = true;
35299             } else if (/\n *\n *$/.test(raw)) {
35300               endsWithBlankLine = true;
35301             }
35302           }
35303           if (this.options.gfm) {
35304             istask = /^\[[ xX]\] /.exec(itemContents);
35305             if (istask) {
35306               ischecked = istask[0] !== "[ ] ";
35307               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
35308             }
35309           }
35310           list.items.push({
35311             type: "list_item",
35312             raw,
35313             task: !!istask,
35314             checked: ischecked,
35315             loose: false,
35316             text: itemContents
35317           });
35318           list.raw += raw;
35319         }
35320         list.items[list.items.length - 1].raw = raw.trimRight();
35321         list.items[list.items.length - 1].text = itemContents.trimRight();
35322         list.raw = list.raw.trimRight();
35323         const l = list.items.length;
35324         for (i2 = 0; i2 < l; i2++) {
35325           this.lexer.state.top = false;
35326           list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []);
35327           const spacers = list.items[i2].tokens.filter((t) => t.type === "space");
35328           const hasMultipleLineBreaks = spacers.every((t) => {
35329             const chars = t.raw.split("");
35330             let lineBreaks = 0;
35331             for (const char of chars) {
35332               if (char === "\n") {
35333                 lineBreaks += 1;
35334               }
35335               if (lineBreaks > 1) {
35336                 return true;
35337               }
35338             }
35339             return false;
35340           });
35341           if (!list.loose && spacers.length && hasMultipleLineBreaks) {
35342             list.loose = true;
35343             list.items[i2].loose = true;
35344           }
35345         }
35346         return list;
35347       }
35348     }
35349     html(src) {
35350       const cap = this.rules.block.html.exec(src);
35351       if (cap) {
35352         const token = {
35353           type: "html",
35354           raw: cap[0],
35355           pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
35356           text: cap[0]
35357         };
35358         if (this.options.sanitize) {
35359           const text2 = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
35360           token.type = "paragraph";
35361           token.text = text2;
35362           token.tokens = this.lexer.inline(text2);
35363         }
35364         return token;
35365       }
35366     }
35367     def(src) {
35368       const cap = this.rules.block.def.exec(src);
35369       if (cap) {
35370         if (cap[3])
35371           cap[3] = cap[3].substring(1, cap[3].length - 1);
35372         const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
35373         return {
35374           type: "def",
35375           tag,
35376           raw: cap[0],
35377           href: cap[2],
35378           title: cap[3]
35379         };
35380       }
35381     }
35382     table(src) {
35383       const cap = this.rules.block.table.exec(src);
35384       if (cap) {
35385         const item = {
35386           type: "table",
35387           header: splitCells(cap[1]).map((c) => {
35388             return { text: c };
35389           }),
35390           align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
35391           rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
35392         };
35393         if (item.header.length === item.align.length) {
35394           item.raw = cap[0];
35395           let l = item.align.length;
35396           let i2, j2, k, row;
35397           for (i2 = 0; i2 < l; i2++) {
35398             if (/^ *-+: *$/.test(item.align[i2])) {
35399               item.align[i2] = "right";
35400             } else if (/^ *:-+: *$/.test(item.align[i2])) {
35401               item.align[i2] = "center";
35402             } else if (/^ *:-+ *$/.test(item.align[i2])) {
35403               item.align[i2] = "left";
35404             } else {
35405               item.align[i2] = null;
35406             }
35407           }
35408           l = item.rows.length;
35409           for (i2 = 0; i2 < l; i2++) {
35410             item.rows[i2] = splitCells(item.rows[i2], item.header.length).map((c) => {
35411               return { text: c };
35412             });
35413           }
35414           l = item.header.length;
35415           for (j2 = 0; j2 < l; j2++) {
35416             item.header[j2].tokens = this.lexer.inline(item.header[j2].text);
35417           }
35418           l = item.rows.length;
35419           for (j2 = 0; j2 < l; j2++) {
35420             row = item.rows[j2];
35421             for (k = 0; k < row.length; k++) {
35422               row[k].tokens = this.lexer.inline(row[k].text);
35423             }
35424           }
35425           return item;
35426         }
35427       }
35428     }
35429     lheading(src) {
35430       const cap = this.rules.block.lheading.exec(src);
35431       if (cap) {
35432         return {
35433           type: "heading",
35434           raw: cap[0],
35435           depth: cap[2].charAt(0) === "=" ? 1 : 2,
35436           text: cap[1],
35437           tokens: this.lexer.inline(cap[1])
35438         };
35439       }
35440     }
35441     paragraph(src) {
35442       const cap = this.rules.block.paragraph.exec(src);
35443       if (cap) {
35444         const text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
35445         return {
35446           type: "paragraph",
35447           raw: cap[0],
35448           text: text2,
35449           tokens: this.lexer.inline(text2)
35450         };
35451       }
35452     }
35453     text(src) {
35454       const cap = this.rules.block.text.exec(src);
35455       if (cap) {
35456         return {
35457           type: "text",
35458           raw: cap[0],
35459           text: cap[0],
35460           tokens: this.lexer.inline(cap[0])
35461         };
35462       }
35463     }
35464     escape(src) {
35465       const cap = this.rules.inline.escape.exec(src);
35466       if (cap) {
35467         return {
35468           type: "escape",
35469           raw: cap[0],
35470           text: escape4(cap[1])
35471         };
35472       }
35473     }
35474     tag(src) {
35475       const cap = this.rules.inline.tag.exec(src);
35476       if (cap) {
35477         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
35478           this.lexer.state.inLink = true;
35479         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
35480           this.lexer.state.inLink = false;
35481         }
35482         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35483           this.lexer.state.inRawBlock = true;
35484         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
35485           this.lexer.state.inRawBlock = false;
35486         }
35487         return {
35488           type: this.options.sanitize ? "text" : "html",
35489           raw: cap[0],
35490           inLink: this.lexer.state.inLink,
35491           inRawBlock: this.lexer.state.inRawBlock,
35492           text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
35493         };
35494       }
35495     }
35496     link(src) {
35497       const cap = this.rules.inline.link.exec(src);
35498       if (cap) {
35499         const trimmedUrl = cap[2].trim();
35500         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
35501           if (!/>$/.test(trimmedUrl)) {
35502             return;
35503           }
35504           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
35505           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
35506             return;
35507           }
35508         } else {
35509           const lastParenIndex = findClosingBracket(cap[2], "()");
35510           if (lastParenIndex > -1) {
35511             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
35512             const linkLen = start2 + cap[1].length + lastParenIndex;
35513             cap[2] = cap[2].substring(0, lastParenIndex);
35514             cap[0] = cap[0].substring(0, linkLen).trim();
35515             cap[3] = "";
35516           }
35517         }
35518         let href = cap[2];
35519         let title = "";
35520         if (this.options.pedantic) {
35521           const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
35522           if (link2) {
35523             href = link2[1];
35524             title = link2[3];
35525           }
35526         } else {
35527           title = cap[3] ? cap[3].slice(1, -1) : "";
35528         }
35529         href = href.trim();
35530         if (/^</.test(href)) {
35531           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
35532             href = href.slice(1);
35533           } else {
35534             href = href.slice(1, -1);
35535           }
35536         }
35537         return outputLink(cap, {
35538           href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
35539           title: title ? title.replace(this.rules.inline._escapes, "$1") : title
35540         }, cap[0], this.lexer);
35541       }
35542     }
35543     reflink(src, links) {
35544       let cap;
35545       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
35546         let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
35547         link2 = links[link2.toLowerCase()];
35548         if (!link2 || !link2.href) {
35549           const text2 = cap[0].charAt(0);
35550           return {
35551             type: "text",
35552             raw: text2,
35553             text: text2
35554           };
35555         }
35556         return outputLink(cap, link2, cap[0], this.lexer);
35557       }
35558     }
35559     emStrong(src, maskedSrc, prevChar = "") {
35560       let match = this.rules.inline.emStrong.lDelim.exec(src);
35561       if (!match)
35562         return;
35563       if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
35564         return;
35565       const nextChar = match[1] || match[2] || "";
35566       if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) {
35567         const lLength = match[0].length - 1;
35568         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
35569         const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
35570         endReg.lastIndex = 0;
35571         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
35572         while ((match = endReg.exec(maskedSrc)) != null) {
35573           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
35574           if (!rDelim)
35575             continue;
35576           rLength = rDelim.length;
35577           if (match[3] || match[4]) {
35578             delimTotal += rLength;
35579             continue;
35580           } else if (match[5] || match[6]) {
35581             if (lLength % 3 && !((lLength + rLength) % 3)) {
35582               midDelimTotal += rLength;
35583               continue;
35584             }
35585           }
35586           delimTotal -= rLength;
35587           if (delimTotal > 0)
35588             continue;
35589           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
35590           if (Math.min(lLength, rLength) % 2) {
35591             const text3 = src.slice(1, lLength + match.index + rLength);
35592             return {
35593               type: "em",
35594               raw: src.slice(0, lLength + match.index + rLength + 1),
35595               text: text3,
35596               tokens: this.lexer.inlineTokens(text3)
35597             };
35598           }
35599           const text2 = src.slice(2, lLength + match.index + rLength - 1);
35600           return {
35601             type: "strong",
35602             raw: src.slice(0, lLength + match.index + rLength + 1),
35603             text: text2,
35604             tokens: this.lexer.inlineTokens(text2)
35605           };
35606         }
35607       }
35608     }
35609     codespan(src) {
35610       const cap = this.rules.inline.code.exec(src);
35611       if (cap) {
35612         let text2 = cap[2].replace(/\n/g, " ");
35613         const hasNonSpaceChars = /[^ ]/.test(text2);
35614         const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
35615         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
35616           text2 = text2.substring(1, text2.length - 1);
35617         }
35618         text2 = escape4(text2, true);
35619         return {
35620           type: "codespan",
35621           raw: cap[0],
35622           text: text2
35623         };
35624       }
35625     }
35626     br(src) {
35627       const cap = this.rules.inline.br.exec(src);
35628       if (cap) {
35629         return {
35630           type: "br",
35631           raw: cap[0]
35632         };
35633       }
35634     }
35635     del(src) {
35636       const cap = this.rules.inline.del.exec(src);
35637       if (cap) {
35638         return {
35639           type: "del",
35640           raw: cap[0],
35641           text: cap[2],
35642           tokens: this.lexer.inlineTokens(cap[2])
35643         };
35644       }
35645     }
35646     autolink(src, mangle2) {
35647       const cap = this.rules.inline.autolink.exec(src);
35648       if (cap) {
35649         let text2, href;
35650         if (cap[2] === "@") {
35651           text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
35652           href = "mailto:" + text2;
35653         } else {
35654           text2 = escape4(cap[1]);
35655           href = text2;
35656         }
35657         return {
35658           type: "link",
35659           raw: cap[0],
35660           text: text2,
35661           href,
35662           tokens: [
35663             {
35664               type: "text",
35665               raw: text2,
35666               text: text2
35667             }
35668           ]
35669         };
35670       }
35671     }
35672     url(src, mangle2) {
35673       let cap;
35674       if (cap = this.rules.inline.url.exec(src)) {
35675         let text2, href;
35676         if (cap[2] === "@") {
35677           text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
35678           href = "mailto:" + text2;
35679         } else {
35680           let prevCapZero;
35681           do {
35682             prevCapZero = cap[0];
35683             cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
35684           } while (prevCapZero !== cap[0]);
35685           text2 = escape4(cap[0]);
35686           if (cap[1] === "www.") {
35687             href = "http://" + text2;
35688           } else {
35689             href = text2;
35690           }
35691         }
35692         return {
35693           type: "link",
35694           raw: cap[0],
35695           text: text2,
35696           href,
35697           tokens: [
35698             {
35699               type: "text",
35700               raw: text2,
35701               text: text2
35702             }
35703           ]
35704         };
35705       }
35706     }
35707     inlineText(src, smartypants2) {
35708       const cap = this.rules.inline.text.exec(src);
35709       if (cap) {
35710         let text2;
35711         if (this.lexer.state.inRawBlock) {
35712           text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
35713         } else {
35714           text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
35715         }
35716         return {
35717           type: "text",
35718           raw: cap[0],
35719           text: text2
35720         };
35721       }
35722     }
35723   };
35724   var block = {
35725     newline: /^(?: *(?:\n|$))+/,
35726     code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
35727     fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
35728     hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
35729     heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
35730     blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
35731     list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
35732     html: "^ {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|$))",
35733     def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
35734     table: noopTest,
35735     lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
35736     _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
35737     text: /^[^\n]+/
35738   };
35739   block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
35740   block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
35741   block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
35742   block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
35743   block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
35744   block.list = edit(block.list).replace(/bull/g, block.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + block.def.source + ")").getRegex();
35745   block._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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
35746   block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
35747   block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
35748   block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").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", block._tag).getRegex();
35749   block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
35750   block.normal = merge2({}, block);
35751   block.gfm = merge2({}, block.normal, {
35752     table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
35753   });
35754   block.gfm.table = edit(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").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", block._tag).getRegex();
35755   block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.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", block._tag).getRegex();
35756   block.pedantic = merge2({}, block.normal, {
35757     html: edit(
35758       `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
35759     ).replace("comment", block._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(),
35760     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
35761     heading: /^(#{1,6})(.*)(?:\n+|$)/,
35762     fences: noopTest,
35763     paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
35764   });
35765   var inline = {
35766     escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
35767     autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
35768     url: noopTest,
35769     tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
35770     link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
35771     reflink: /^!?\[(label)\]\[(ref)\]/,
35772     nolink: /^!?\[(ref)\](?:\[\])?/,
35773     reflinkSearch: "reflink|nolink(?!\\()",
35774     emStrong: {
35775       lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
35776       rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
35777       rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
35778     },
35779     code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
35780     br: /^( {2,}|\\)\n(?!\s*$)/,
35781     del: noopTest,
35782     text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
35783     punctuation: /^([\spunctuation])/
35784   };
35785   inline._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
35786   inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
35787   inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
35788   inline.escapedEmSt = /\\\*|\\_/g;
35789   inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
35790   inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
35791   inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex();
35792   inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex();
35793   inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
35794   inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
35795   inline._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])?)+(?![-_])/;
35796   inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
35797   inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
35798   inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
35799   inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
35800   inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
35801   inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
35802   inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
35803   inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
35804   inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
35805   inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
35806   inline.normal = merge2({}, inline);
35807   inline.pedantic = merge2({}, inline.normal, {
35808     strong: {
35809       start: /^__|\*\*/,
35810       middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
35811       endAst: /\*\*(?!\*)/g,
35812       endUnd: /__(?!_)/g
35813     },
35814     em: {
35815       start: /^_|\*/,
35816       middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
35817       endAst: /\*(?!\*)/g,
35818       endUnd: /_(?!_)/g
35819     },
35820     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
35821     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
35822   });
35823   inline.gfm = merge2({}, inline.normal, {
35824     escape: edit(inline.escape).replace("])", "~|])").getRegex(),
35825     _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
35826     url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
35827     _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
35828     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
35829     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
35830   });
35831   inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
35832   inline.breaks = merge2({}, inline.gfm, {
35833     br: edit(inline.br).replace("{2,}", "*").getRegex(),
35834     text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
35835   });
35836   function smartypants(text2) {
35837     return text2.replace(/---/g, "\u2014").replace(/--/g, "\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C").replace(/"/g, "\u201D").replace(/\.{3}/g, "\u2026");
35838   }
35839   function mangle(text2) {
35840     let out = "", i2, ch;
35841     const l = text2.length;
35842     for (i2 = 0; i2 < l; i2++) {
35843       ch = text2.charCodeAt(i2);
35844       if (Math.random() > 0.5) {
35845         ch = "x" + ch.toString(16);
35846       }
35847       out += "&#" + ch + ";";
35848     }
35849     return out;
35850   }
35851   var Lexer = class {
35852     constructor(options2) {
35853       this.tokens = [];
35854       this.tokens.links = /* @__PURE__ */ Object.create(null);
35855       this.options = options2 || defaults;
35856       this.options.tokenizer = this.options.tokenizer || new Tokenizer();
35857       this.tokenizer = this.options.tokenizer;
35858       this.tokenizer.options = this.options;
35859       this.tokenizer.lexer = this;
35860       this.inlineQueue = [];
35861       this.state = {
35862         inLink: false,
35863         inRawBlock: false,
35864         top: true
35865       };
35866       const rules = {
35867         block: block.normal,
35868         inline: inline.normal
35869       };
35870       if (this.options.pedantic) {
35871         rules.block = block.pedantic;
35872         rules.inline = inline.pedantic;
35873       } else if (this.options.gfm) {
35874         rules.block = block.gfm;
35875         if (this.options.breaks) {
35876           rules.inline = inline.breaks;
35877         } else {
35878           rules.inline = inline.gfm;
35879         }
35880       }
35881       this.tokenizer.rules = rules;
35882     }
35883     static get rules() {
35884       return {
35885         block,
35886         inline
35887       };
35888     }
35889     static lex(src, options2) {
35890       const lexer2 = new Lexer(options2);
35891       return lexer2.lex(src);
35892     }
35893     static lexInline(src, options2) {
35894       const lexer2 = new Lexer(options2);
35895       return lexer2.inlineTokens(src);
35896     }
35897     lex(src) {
35898       src = src.replace(/\r\n|\r/g, "\n");
35899       this.blockTokens(src, this.tokens);
35900       let next;
35901       while (next = this.inlineQueue.shift()) {
35902         this.inlineTokens(next.src, next.tokens);
35903       }
35904       return this.tokens;
35905     }
35906     blockTokens(src, tokens = []) {
35907       if (this.options.pedantic) {
35908         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
35909       } else {
35910         src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
35911           return leading + "    ".repeat(tabs.length);
35912         });
35913       }
35914       let token, lastToken, cutSrc, lastParagraphClipped;
35915       while (src) {
35916         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
35917           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
35918             src = src.substring(token.raw.length);
35919             tokens.push(token);
35920             return true;
35921           }
35922           return false;
35923         })) {
35924           continue;
35925         }
35926         if (token = this.tokenizer.space(src)) {
35927           src = src.substring(token.raw.length);
35928           if (token.raw.length === 1 && tokens.length > 0) {
35929             tokens[tokens.length - 1].raw += "\n";
35930           } else {
35931             tokens.push(token);
35932           }
35933           continue;
35934         }
35935         if (token = this.tokenizer.code(src)) {
35936           src = src.substring(token.raw.length);
35937           lastToken = tokens[tokens.length - 1];
35938           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
35939             lastToken.raw += "\n" + token.raw;
35940             lastToken.text += "\n" + token.text;
35941             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35942           } else {
35943             tokens.push(token);
35944           }
35945           continue;
35946         }
35947         if (token = this.tokenizer.fences(src)) {
35948           src = src.substring(token.raw.length);
35949           tokens.push(token);
35950           continue;
35951         }
35952         if (token = this.tokenizer.heading(src)) {
35953           src = src.substring(token.raw.length);
35954           tokens.push(token);
35955           continue;
35956         }
35957         if (token = this.tokenizer.hr(src)) {
35958           src = src.substring(token.raw.length);
35959           tokens.push(token);
35960           continue;
35961         }
35962         if (token = this.tokenizer.blockquote(src)) {
35963           src = src.substring(token.raw.length);
35964           tokens.push(token);
35965           continue;
35966         }
35967         if (token = this.tokenizer.list(src)) {
35968           src = src.substring(token.raw.length);
35969           tokens.push(token);
35970           continue;
35971         }
35972         if (token = this.tokenizer.html(src)) {
35973           src = src.substring(token.raw.length);
35974           tokens.push(token);
35975           continue;
35976         }
35977         if (token = this.tokenizer.def(src)) {
35978           src = src.substring(token.raw.length);
35979           lastToken = tokens[tokens.length - 1];
35980           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
35981             lastToken.raw += "\n" + token.raw;
35982             lastToken.text += "\n" + token.raw;
35983             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
35984           } else if (!this.tokens.links[token.tag]) {
35985             this.tokens.links[token.tag] = {
35986               href: token.href,
35987               title: token.title
35988             };
35989           }
35990           continue;
35991         }
35992         if (token = this.tokenizer.table(src)) {
35993           src = src.substring(token.raw.length);
35994           tokens.push(token);
35995           continue;
35996         }
35997         if (token = this.tokenizer.lheading(src)) {
35998           src = src.substring(token.raw.length);
35999           tokens.push(token);
36000           continue;
36001         }
36002         cutSrc = src;
36003         if (this.options.extensions && this.options.extensions.startBlock) {
36004           let startIndex = Infinity;
36005           const tempSrc = src.slice(1);
36006           let tempStart;
36007           this.options.extensions.startBlock.forEach(function(getStartIndex) {
36008             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
36009             if (typeof tempStart === "number" && tempStart >= 0) {
36010               startIndex = Math.min(startIndex, tempStart);
36011             }
36012           });
36013           if (startIndex < Infinity && startIndex >= 0) {
36014             cutSrc = src.substring(0, startIndex + 1);
36015           }
36016         }
36017         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
36018           lastToken = tokens[tokens.length - 1];
36019           if (lastParagraphClipped && lastToken.type === "paragraph") {
36020             lastToken.raw += "\n" + token.raw;
36021             lastToken.text += "\n" + token.text;
36022             this.inlineQueue.pop();
36023             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
36024           } else {
36025             tokens.push(token);
36026           }
36027           lastParagraphClipped = cutSrc.length !== src.length;
36028           src = src.substring(token.raw.length);
36029           continue;
36030         }
36031         if (token = this.tokenizer.text(src)) {
36032           src = src.substring(token.raw.length);
36033           lastToken = tokens[tokens.length - 1];
36034           if (lastToken && lastToken.type === "text") {
36035             lastToken.raw += "\n" + token.raw;
36036             lastToken.text += "\n" + token.text;
36037             this.inlineQueue.pop();
36038             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
36039           } else {
36040             tokens.push(token);
36041           }
36042           continue;
36043         }
36044         if (src) {
36045           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
36046           if (this.options.silent) {
36047             console.error(errMsg);
36048             break;
36049           } else {
36050             throw new Error(errMsg);
36051           }
36052         }
36053       }
36054       this.state.top = true;
36055       return tokens;
36056     }
36057     inline(src, tokens = []) {
36058       this.inlineQueue.push({ src, tokens });
36059       return tokens;
36060     }
36061     inlineTokens(src, tokens = []) {
36062       let token, lastToken, cutSrc;
36063       let maskedSrc = src;
36064       let match;
36065       let keepPrevChar, prevChar;
36066       if (this.tokens.links) {
36067         const links = Object.keys(this.tokens.links);
36068         if (links.length > 0) {
36069           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
36070             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
36071               maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
36072             }
36073           }
36074         }
36075       }
36076       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
36077         maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
36078       }
36079       while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
36080         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
36081       }
36082       while (src) {
36083         if (!keepPrevChar) {
36084           prevChar = "";
36085         }
36086         keepPrevChar = false;
36087         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
36088           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
36089             src = src.substring(token.raw.length);
36090             tokens.push(token);
36091             return true;
36092           }
36093           return false;
36094         })) {
36095           continue;
36096         }
36097         if (token = this.tokenizer.escape(src)) {
36098           src = src.substring(token.raw.length);
36099           tokens.push(token);
36100           continue;
36101         }
36102         if (token = this.tokenizer.tag(src)) {
36103           src = src.substring(token.raw.length);
36104           lastToken = tokens[tokens.length - 1];
36105           if (lastToken && token.type === "text" && lastToken.type === "text") {
36106             lastToken.raw += token.raw;
36107             lastToken.text += token.text;
36108           } else {
36109             tokens.push(token);
36110           }
36111           continue;
36112         }
36113         if (token = this.tokenizer.link(src)) {
36114           src = src.substring(token.raw.length);
36115           tokens.push(token);
36116           continue;
36117         }
36118         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
36119           src = src.substring(token.raw.length);
36120           lastToken = tokens[tokens.length - 1];
36121           if (lastToken && token.type === "text" && lastToken.type === "text") {
36122             lastToken.raw += token.raw;
36123             lastToken.text += token.text;
36124           } else {
36125             tokens.push(token);
36126           }
36127           continue;
36128         }
36129         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
36130           src = src.substring(token.raw.length);
36131           tokens.push(token);
36132           continue;
36133         }
36134         if (token = this.tokenizer.codespan(src)) {
36135           src = src.substring(token.raw.length);
36136           tokens.push(token);
36137           continue;
36138         }
36139         if (token = this.tokenizer.br(src)) {
36140           src = src.substring(token.raw.length);
36141           tokens.push(token);
36142           continue;
36143         }
36144         if (token = this.tokenizer.del(src)) {
36145           src = src.substring(token.raw.length);
36146           tokens.push(token);
36147           continue;
36148         }
36149         if (token = this.tokenizer.autolink(src, mangle)) {
36150           src = src.substring(token.raw.length);
36151           tokens.push(token);
36152           continue;
36153         }
36154         if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
36155           src = src.substring(token.raw.length);
36156           tokens.push(token);
36157           continue;
36158         }
36159         cutSrc = src;
36160         if (this.options.extensions && this.options.extensions.startInline) {
36161           let startIndex = Infinity;
36162           const tempSrc = src.slice(1);
36163           let tempStart;
36164           this.options.extensions.startInline.forEach(function(getStartIndex) {
36165             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
36166             if (typeof tempStart === "number" && tempStart >= 0) {
36167               startIndex = Math.min(startIndex, tempStart);
36168             }
36169           });
36170           if (startIndex < Infinity && startIndex >= 0) {
36171             cutSrc = src.substring(0, startIndex + 1);
36172           }
36173         }
36174         if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
36175           src = src.substring(token.raw.length);
36176           if (token.raw.slice(-1) !== "_") {
36177             prevChar = token.raw.slice(-1);
36178           }
36179           keepPrevChar = true;
36180           lastToken = tokens[tokens.length - 1];
36181           if (lastToken && lastToken.type === "text") {
36182             lastToken.raw += token.raw;
36183             lastToken.text += token.text;
36184           } else {
36185             tokens.push(token);
36186           }
36187           continue;
36188         }
36189         if (src) {
36190           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
36191           if (this.options.silent) {
36192             console.error(errMsg);
36193             break;
36194           } else {
36195             throw new Error(errMsg);
36196           }
36197         }
36198       }
36199       return tokens;
36200     }
36201   };
36202   var Renderer = class {
36203     constructor(options2) {
36204       this.options = options2 || defaults;
36205     }
36206     code(code, infostring, escaped) {
36207       const lang = (infostring || "").match(/\S*/)[0];
36208       if (this.options.highlight) {
36209         const out = this.options.highlight(code, lang);
36210         if (out != null && out !== code) {
36211           escaped = true;
36212           code = out;
36213         }
36214       }
36215       code = code.replace(/\n$/, "") + "\n";
36216       if (!lang) {
36217         return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
36218       }
36219       return '<pre><code class="' + this.options.langPrefix + escape4(lang, true) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
36220     }
36221     blockquote(quote2) {
36222       return `<blockquote>
36223 ${quote2}</blockquote>
36224 `;
36225     }
36226     html(html2) {
36227       return html2;
36228     }
36229     heading(text2, level, raw, slugger) {
36230       if (this.options.headerIds) {
36231         const id2 = this.options.headerPrefix + slugger.slug(raw);
36232         return `<h${level} id="${id2}">${text2}</h${level}>
36233 `;
36234       }
36235       return `<h${level}>${text2}</h${level}>
36236 `;
36237     }
36238     hr() {
36239       return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
36240     }
36241     list(body, ordered, start2) {
36242       const type3 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
36243       return "<" + type3 + startatt + ">\n" + body + "</" + type3 + ">\n";
36244     }
36245     listitem(text2) {
36246       return `<li>${text2}</li>
36247 `;
36248     }
36249     checkbox(checked) {
36250       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
36251     }
36252     paragraph(text2) {
36253       return `<p>${text2}</p>
36254 `;
36255     }
36256     table(header, body) {
36257       if (body)
36258         body = `<tbody>${body}</tbody>`;
36259       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
36260     }
36261     tablerow(content) {
36262       return `<tr>
36263 ${content}</tr>
36264 `;
36265     }
36266     tablecell(content, flags) {
36267       const type3 = flags.header ? "th" : "td";
36268       const tag = flags.align ? `<${type3} align="${flags.align}">` : `<${type3}>`;
36269       return tag + content + `</${type3}>
36270 `;
36271     }
36272     strong(text2) {
36273       return `<strong>${text2}</strong>`;
36274     }
36275     em(text2) {
36276       return `<em>${text2}</em>`;
36277     }
36278     codespan(text2) {
36279       return `<code>${text2}</code>`;
36280     }
36281     br() {
36282       return this.options.xhtml ? "<br/>" : "<br>";
36283     }
36284     del(text2) {
36285       return `<del>${text2}</del>`;
36286     }
36287     link(href, title, text2) {
36288       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36289       if (href === null) {
36290         return text2;
36291       }
36292       let out = '<a href="' + escape4(href) + '"';
36293       if (title) {
36294         out += ' title="' + title + '"';
36295       }
36296       out += ">" + text2 + "</a>";
36297       return out;
36298     }
36299     image(href, title, text2) {
36300       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
36301       if (href === null) {
36302         return text2;
36303       }
36304       let out = `<img src="${href}" alt="${text2}"`;
36305       if (title) {
36306         out += ` title="${title}"`;
36307       }
36308       out += this.options.xhtml ? "/>" : ">";
36309       return out;
36310     }
36311     text(text2) {
36312       return text2;
36313     }
36314   };
36315   var TextRenderer = class {
36316     strong(text2) {
36317       return text2;
36318     }
36319     em(text2) {
36320       return text2;
36321     }
36322     codespan(text2) {
36323       return text2;
36324     }
36325     del(text2) {
36326       return text2;
36327     }
36328     html(text2) {
36329       return text2;
36330     }
36331     text(text2) {
36332       return text2;
36333     }
36334     link(href, title, text2) {
36335       return "" + text2;
36336     }
36337     image(href, title, text2) {
36338       return "" + text2;
36339     }
36340     br() {
36341       return "";
36342     }
36343   };
36344   var Slugger = class {
36345     constructor() {
36346       this.seen = {};
36347     }
36348     serialize(value) {
36349       return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
36350     }
36351     getNextSafeSlug(originalSlug, isDryRun) {
36352       let slug = originalSlug;
36353       let occurenceAccumulator = 0;
36354       if (this.seen.hasOwnProperty(slug)) {
36355         occurenceAccumulator = this.seen[originalSlug];
36356         do {
36357           occurenceAccumulator++;
36358           slug = originalSlug + "-" + occurenceAccumulator;
36359         } while (this.seen.hasOwnProperty(slug));
36360       }
36361       if (!isDryRun) {
36362         this.seen[originalSlug] = occurenceAccumulator;
36363         this.seen[slug] = 0;
36364       }
36365       return slug;
36366     }
36367     slug(value, options2 = {}) {
36368       const slug = this.serialize(value);
36369       return this.getNextSafeSlug(slug, options2.dryrun);
36370     }
36371   };
36372   var Parser = class {
36373     constructor(options2) {
36374       this.options = options2 || defaults;
36375       this.options.renderer = this.options.renderer || new Renderer();
36376       this.renderer = this.options.renderer;
36377       this.renderer.options = this.options;
36378       this.textRenderer = new TextRenderer();
36379       this.slugger = new Slugger();
36380     }
36381     static parse(tokens, options2) {
36382       const parser3 = new Parser(options2);
36383       return parser3.parse(tokens);
36384     }
36385     static parseInline(tokens, options2) {
36386       const parser3 = new Parser(options2);
36387       return parser3.parseInline(tokens);
36388     }
36389     parse(tokens, top = true) {
36390       let out = "", i2, j2, k, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
36391       const l = tokens.length;
36392       for (i2 = 0; i2 < l; i2++) {
36393         token = tokens[i2];
36394         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36395           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36396           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
36397             out += ret || "";
36398             continue;
36399           }
36400         }
36401         switch (token.type) {
36402           case "space": {
36403             continue;
36404           }
36405           case "hr": {
36406             out += this.renderer.hr();
36407             continue;
36408           }
36409           case "heading": {
36410             out += this.renderer.heading(
36411               this.parseInline(token.tokens),
36412               token.depth,
36413               unescape3(this.parseInline(token.tokens, this.textRenderer)),
36414               this.slugger
36415             );
36416             continue;
36417           }
36418           case "code": {
36419             out += this.renderer.code(
36420               token.text,
36421               token.lang,
36422               token.escaped
36423             );
36424             continue;
36425           }
36426           case "table": {
36427             header = "";
36428             cell = "";
36429             l2 = token.header.length;
36430             for (j2 = 0; j2 < l2; j2++) {
36431               cell += this.renderer.tablecell(
36432                 this.parseInline(token.header[j2].tokens),
36433                 { header: true, align: token.align[j2] }
36434               );
36435             }
36436             header += this.renderer.tablerow(cell);
36437             body = "";
36438             l2 = token.rows.length;
36439             for (j2 = 0; j2 < l2; j2++) {
36440               row = token.rows[j2];
36441               cell = "";
36442               l3 = row.length;
36443               for (k = 0; k < l3; k++) {
36444                 cell += this.renderer.tablecell(
36445                   this.parseInline(row[k].tokens),
36446                   { header: false, align: token.align[k] }
36447                 );
36448               }
36449               body += this.renderer.tablerow(cell);
36450             }
36451             out += this.renderer.table(header, body);
36452             continue;
36453           }
36454           case "blockquote": {
36455             body = this.parse(token.tokens);
36456             out += this.renderer.blockquote(body);
36457             continue;
36458           }
36459           case "list": {
36460             ordered = token.ordered;
36461             start2 = token.start;
36462             loose = token.loose;
36463             l2 = token.items.length;
36464             body = "";
36465             for (j2 = 0; j2 < l2; j2++) {
36466               item = token.items[j2];
36467               checked = item.checked;
36468               task = item.task;
36469               itemBody = "";
36470               if (item.task) {
36471                 checkbox = this.renderer.checkbox(checked);
36472                 if (loose) {
36473                   if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
36474                     item.tokens[0].text = checkbox + " " + item.tokens[0].text;
36475                     if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
36476                       item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
36477                     }
36478                   } else {
36479                     item.tokens.unshift({
36480                       type: "text",
36481                       text: checkbox
36482                     });
36483                   }
36484                 } else {
36485                   itemBody += checkbox;
36486                 }
36487               }
36488               itemBody += this.parse(item.tokens, loose);
36489               body += this.renderer.listitem(itemBody, task, checked);
36490             }
36491             out += this.renderer.list(body, ordered, start2);
36492             continue;
36493           }
36494           case "html": {
36495             out += this.renderer.html(token.text);
36496             continue;
36497           }
36498           case "paragraph": {
36499             out += this.renderer.paragraph(this.parseInline(token.tokens));
36500             continue;
36501           }
36502           case "text": {
36503             body = token.tokens ? this.parseInline(token.tokens) : token.text;
36504             while (i2 + 1 < l && tokens[i2 + 1].type === "text") {
36505               token = tokens[++i2];
36506               body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
36507             }
36508             out += top ? this.renderer.paragraph(body) : body;
36509             continue;
36510           }
36511           default: {
36512             const errMsg = 'Token with "' + token.type + '" type was not found.';
36513             if (this.options.silent) {
36514               console.error(errMsg);
36515               return;
36516             } else {
36517               throw new Error(errMsg);
36518             }
36519           }
36520         }
36521       }
36522       return out;
36523     }
36524     parseInline(tokens, renderer) {
36525       renderer = renderer || this.renderer;
36526       let out = "", i2, token, ret;
36527       const l = tokens.length;
36528       for (i2 = 0; i2 < l; i2++) {
36529         token = tokens[i2];
36530         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
36531           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
36532           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
36533             out += ret || "";
36534             continue;
36535           }
36536         }
36537         switch (token.type) {
36538           case "escape": {
36539             out += renderer.text(token.text);
36540             break;
36541           }
36542           case "html": {
36543             out += renderer.html(token.text);
36544             break;
36545           }
36546           case "link": {
36547             out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
36548             break;
36549           }
36550           case "image": {
36551             out += renderer.image(token.href, token.title, token.text);
36552             break;
36553           }
36554           case "strong": {
36555             out += renderer.strong(this.parseInline(token.tokens, renderer));
36556             break;
36557           }
36558           case "em": {
36559             out += renderer.em(this.parseInline(token.tokens, renderer));
36560             break;
36561           }
36562           case "codespan": {
36563             out += renderer.codespan(token.text);
36564             break;
36565           }
36566           case "br": {
36567             out += renderer.br();
36568             break;
36569           }
36570           case "del": {
36571             out += renderer.del(this.parseInline(token.tokens, renderer));
36572             break;
36573           }
36574           case "text": {
36575             out += renderer.text(token.text);
36576             break;
36577           }
36578           default: {
36579             const errMsg = 'Token with "' + token.type + '" type was not found.';
36580             if (this.options.silent) {
36581               console.error(errMsg);
36582               return;
36583             } else {
36584               throw new Error(errMsg);
36585             }
36586           }
36587         }
36588       }
36589       return out;
36590     }
36591   };
36592   function marked(src, opt, callback) {
36593     if (typeof src === "undefined" || src === null) {
36594       throw new Error("marked(): input parameter is undefined or null");
36595     }
36596     if (typeof src !== "string") {
36597       throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36598     }
36599     if (typeof opt === "function") {
36600       callback = opt;
36601       opt = null;
36602     }
36603     opt = merge2({}, marked.defaults, opt || {});
36604     checkSanitizeDeprecation(opt);
36605     if (callback) {
36606       const highlight = opt.highlight;
36607       let tokens;
36608       try {
36609         tokens = Lexer.lex(src, opt);
36610       } catch (e) {
36611         return callback(e);
36612       }
36613       const done = function(err) {
36614         let out;
36615         if (!err) {
36616           try {
36617             if (opt.walkTokens) {
36618               marked.walkTokens(tokens, opt.walkTokens);
36619             }
36620             out = Parser.parse(tokens, opt);
36621           } catch (e) {
36622             err = e;
36623           }
36624         }
36625         opt.highlight = highlight;
36626         return err ? callback(err) : callback(null, out);
36627       };
36628       if (!highlight || highlight.length < 3) {
36629         return done();
36630       }
36631       delete opt.highlight;
36632       if (!tokens.length)
36633         return done();
36634       let pending = 0;
36635       marked.walkTokens(tokens, function(token) {
36636         if (token.type === "code") {
36637           pending++;
36638           setTimeout(() => {
36639             highlight(token.text, token.lang, function(err, code) {
36640               if (err) {
36641                 return done(err);
36642               }
36643               if (code != null && code !== token.text) {
36644                 token.text = code;
36645                 token.escaped = true;
36646               }
36647               pending--;
36648               if (pending === 0) {
36649                 done();
36650               }
36651             });
36652           }, 0);
36653         }
36654       });
36655       if (pending === 0) {
36656         done();
36657       }
36658       return;
36659     }
36660     function onError(e) {
36661       e.message += "\nPlease report this to https://github.com/markedjs/marked.";
36662       if (opt.silent) {
36663         return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
36664       }
36665       throw e;
36666     }
36667     try {
36668       const tokens = Lexer.lex(src, opt);
36669       if (opt.walkTokens) {
36670         if (opt.async) {
36671           return Promise.all(marked.walkTokens(tokens, opt.walkTokens)).then(() => {
36672             return Parser.parse(tokens, opt);
36673           }).catch(onError);
36674         }
36675         marked.walkTokens(tokens, opt.walkTokens);
36676       }
36677       return Parser.parse(tokens, opt);
36678     } catch (e) {
36679       onError(e);
36680     }
36681   }
36682   marked.options = marked.setOptions = function(opt) {
36683     merge2(marked.defaults, opt);
36684     changeDefaults(marked.defaults);
36685     return marked;
36686   };
36687   marked.getDefaults = getDefaults;
36688   marked.defaults = defaults;
36689   marked.use = function(...args) {
36690     const opts = merge2({}, ...args);
36691     const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} };
36692     let hasExtensions;
36693     args.forEach((pack) => {
36694       if (pack.extensions) {
36695         hasExtensions = true;
36696         pack.extensions.forEach((ext) => {
36697           if (!ext.name) {
36698             throw new Error("extension name required");
36699           }
36700           if (ext.renderer) {
36701             const prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
36702             if (prevRenderer) {
36703               extensions.renderers[ext.name] = function(...args2) {
36704                 let ret = ext.renderer.apply(this, args2);
36705                 if (ret === false) {
36706                   ret = prevRenderer.apply(this, args2);
36707                 }
36708                 return ret;
36709               };
36710             } else {
36711               extensions.renderers[ext.name] = ext.renderer;
36712             }
36713           }
36714           if (ext.tokenizer) {
36715             if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
36716               throw new Error("extension level must be 'block' or 'inline'");
36717             }
36718             if (extensions[ext.level]) {
36719               extensions[ext.level].unshift(ext.tokenizer);
36720             } else {
36721               extensions[ext.level] = [ext.tokenizer];
36722             }
36723             if (ext.start) {
36724               if (ext.level === "block") {
36725                 if (extensions.startBlock) {
36726                   extensions.startBlock.push(ext.start);
36727                 } else {
36728                   extensions.startBlock = [ext.start];
36729                 }
36730               } else if (ext.level === "inline") {
36731                 if (extensions.startInline) {
36732                   extensions.startInline.push(ext.start);
36733                 } else {
36734                   extensions.startInline = [ext.start];
36735                 }
36736               }
36737             }
36738           }
36739           if (ext.childTokens) {
36740             extensions.childTokens[ext.name] = ext.childTokens;
36741           }
36742         });
36743       }
36744       if (pack.renderer) {
36745         const renderer = marked.defaults.renderer || new Renderer();
36746         for (const prop in pack.renderer) {
36747           const prevRenderer = renderer[prop];
36748           renderer[prop] = (...args2) => {
36749             let ret = pack.renderer[prop].apply(renderer, args2);
36750             if (ret === false) {
36751               ret = prevRenderer.apply(renderer, args2);
36752             }
36753             return ret;
36754           };
36755         }
36756         opts.renderer = renderer;
36757       }
36758       if (pack.tokenizer) {
36759         const tokenizer = marked.defaults.tokenizer || new Tokenizer();
36760         for (const prop in pack.tokenizer) {
36761           const prevTokenizer = tokenizer[prop];
36762           tokenizer[prop] = (...args2) => {
36763             let ret = pack.tokenizer[prop].apply(tokenizer, args2);
36764             if (ret === false) {
36765               ret = prevTokenizer.apply(tokenizer, args2);
36766             }
36767             return ret;
36768           };
36769         }
36770         opts.tokenizer = tokenizer;
36771       }
36772       if (pack.walkTokens) {
36773         const walkTokens2 = marked.defaults.walkTokens;
36774         opts.walkTokens = function(token) {
36775           let values = [];
36776           values.push(pack.walkTokens.call(this, token));
36777           if (walkTokens2) {
36778             values = values.concat(walkTokens2.call(this, token));
36779           }
36780           return values;
36781         };
36782       }
36783       if (hasExtensions) {
36784         opts.extensions = extensions;
36785       }
36786       marked.setOptions(opts);
36787     });
36788   };
36789   marked.walkTokens = function(tokens, callback) {
36790     let values = [];
36791     for (const token of tokens) {
36792       values = values.concat(callback.call(marked, token));
36793       switch (token.type) {
36794         case "table": {
36795           for (const cell of token.header) {
36796             values = values.concat(marked.walkTokens(cell.tokens, callback));
36797           }
36798           for (const row of token.rows) {
36799             for (const cell of row) {
36800               values = values.concat(marked.walkTokens(cell.tokens, callback));
36801             }
36802           }
36803           break;
36804         }
36805         case "list": {
36806           values = values.concat(marked.walkTokens(token.items, callback));
36807           break;
36808         }
36809         default: {
36810           if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
36811             marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
36812               values = values.concat(marked.walkTokens(token[childTokens], callback));
36813             });
36814           } else if (token.tokens) {
36815             values = values.concat(marked.walkTokens(token.tokens, callback));
36816           }
36817         }
36818       }
36819     }
36820     return values;
36821   };
36822   marked.parseInline = function(src, opt) {
36823     if (typeof src === "undefined" || src === null) {
36824       throw new Error("marked.parseInline(): input parameter is undefined or null");
36825     }
36826     if (typeof src !== "string") {
36827       throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
36828     }
36829     opt = merge2({}, marked.defaults, opt || {});
36830     checkSanitizeDeprecation(opt);
36831     try {
36832       const tokens = Lexer.lexInline(src, opt);
36833       if (opt.walkTokens) {
36834         marked.walkTokens(tokens, opt.walkTokens);
36835       }
36836       return Parser.parseInline(tokens, opt);
36837     } catch (e) {
36838       e.message += "\nPlease report this to https://github.com/markedjs/marked.";
36839       if (opt.silent) {
36840         return "<p>An error occurred:</p><pre>" + escape4(e.message + "", true) + "</pre>";
36841       }
36842       throw e;
36843     }
36844   };
36845   marked.Parser = Parser;
36846   marked.parser = Parser.parse;
36847   marked.Renderer = Renderer;
36848   marked.TextRenderer = TextRenderer;
36849   marked.Lexer = Lexer;
36850   marked.lexer = Lexer.lex;
36851   marked.Tokenizer = Tokenizer;
36852   marked.Slugger = Slugger;
36853   marked.parse = marked;
36854   var options = marked.options;
36855   var setOptions = marked.setOptions;
36856   var use = marked.use;
36857   var walkTokens = marked.walkTokens;
36858   var parseInline = marked.parseInline;
36859   var parser2 = Parser.parse;
36860   var lexer = Lexer.lex;
36861
36862   // modules/services/osmose.js
36863   var tiler3 = utilTiler();
36864   var dispatch4 = dispatch_default("loaded");
36865   var _tileZoom3 = 14;
36866   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
36867   var _osmoseData = { icons: {}, items: [] };
36868   var _cache3;
36869   function abortRequest3(controller) {
36870     if (controller) {
36871       controller.abort();
36872     }
36873   }
36874   function abortUnwantedRequests3(cache, tiles) {
36875     Object.keys(cache.inflightTile).forEach((k) => {
36876       let wanted = tiles.find((tile) => k === tile.id);
36877       if (!wanted) {
36878         abortRequest3(cache.inflightTile[k]);
36879         delete cache.inflightTile[k];
36880       }
36881     });
36882   }
36883   function encodeIssueRtree3(d) {
36884     return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
36885   }
36886   function updateRtree3(item, replace) {
36887     _cache3.rtree.remove(item, (a, b) => a.data.id === b.data.id);
36888     if (replace) {
36889       _cache3.rtree.insert(item);
36890     }
36891   }
36892   function preventCoincident2(loc) {
36893     let coincident = false;
36894     do {
36895       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
36896       loc = geoVecAdd(loc, delta);
36897       let bbox = geoExtent(loc).bbox();
36898       coincident = _cache3.rtree.search(bbox).length;
36899     } while (coincident);
36900     return loc;
36901   }
36902   var osmose_default = {
36903     title: "osmose",
36904     init() {
36905       _mainFileFetcher.get("qa_data").then((d) => {
36906         _osmoseData = d.osmose;
36907         _osmoseData.items = Object.keys(d.osmose.icons).map((s) => s.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
36908       });
36909       if (!_cache3) {
36910         this.reset();
36911       }
36912       this.event = utilRebind(this, dispatch4, "on");
36913     },
36914     reset() {
36915       let _strings = {};
36916       let _colors = {};
36917       if (_cache3) {
36918         Object.values(_cache3.inflightTile).forEach(abortRequest3);
36919         _strings = _cache3.strings;
36920         _colors = _cache3.colors;
36921       }
36922       _cache3 = {
36923         data: {},
36924         loadedTile: {},
36925         inflightTile: {},
36926         inflightPost: {},
36927         closed: {},
36928         rtree: new import_rbush3.default(),
36929         strings: _strings,
36930         colors: _colors
36931       };
36932     },
36933     loadIssues(projection2) {
36934       let params = {
36935         item: _osmoseData.items
36936       };
36937       let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
36938       abortUnwantedRequests3(_cache3, tiles);
36939       tiles.forEach((tile) => {
36940         if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
36941           return;
36942         let [x, y, z] = tile.xyz;
36943         let url = `${_osmoseUrlRoot}/issues/${z}/${x}/${y}.geojson?` + utilQsString(params);
36944         let controller = new AbortController();
36945         _cache3.inflightTile[tile.id] = controller;
36946         json_default(url, { signal: controller.signal }).then((data) => {
36947           delete _cache3.inflightTile[tile.id];
36948           _cache3.loadedTile[tile.id] = true;
36949           if (data.features) {
36950             data.features.forEach((issue) => {
36951               const { item, class: cl, uuid: id2 } = issue.properties;
36952               const itemType = `${item}-${cl}`;
36953               if (itemType in _osmoseData.icons) {
36954                 let loc = issue.geometry.coordinates;
36955                 loc = preventCoincident2(loc);
36956                 let d = new QAItem(loc, this, itemType, id2, { item });
36957                 if (item === 8300 || item === 8360) {
36958                   d.elems = [];
36959                 }
36960                 _cache3.data[d.id] = d;
36961                 _cache3.rtree.insert(encodeIssueRtree3(d));
36962               }
36963             });
36964           }
36965           dispatch4.call("loaded");
36966         }).catch(() => {
36967           delete _cache3.inflightTile[tile.id];
36968           _cache3.loadedTile[tile.id] = true;
36969         });
36970       });
36971     },
36972     loadIssueDetail(issue) {
36973       if (issue.elems !== void 0) {
36974         return Promise.resolve(issue);
36975       }
36976       const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
36977       const cacheDetails = (data) => {
36978         issue.elems = data.elems.map((e) => e.type.substring(0, 1) + e.id);
36979         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
36980         this.replaceItem(issue);
36981       };
36982       return json_default(url).then(cacheDetails).then(() => issue);
36983     },
36984     loadStrings(locale2 = _mainLocalizer.localeCode()) {
36985       const items = Object.keys(_osmoseData.icons);
36986       if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
36987         return Promise.resolve(_cache3.strings[locale2]);
36988       }
36989       if (!(locale2 in _cache3.strings)) {
36990         _cache3.strings[locale2] = {};
36991       }
36992       const allRequests = items.map((itemType) => {
36993         if (itemType in _cache3.strings[locale2])
36994           return null;
36995         const cacheData = (data) => {
36996           const [cat = { items: [] }] = data.categories;
36997           const [item2 = { class: [] }] = cat.items;
36998           const [cl2 = null] = item2.class;
36999           if (!cl2) {
37000             console.log(`Osmose strings request (${itemType}) had unexpected data`);
37001             return;
37002           }
37003           const { item: itemInt, color: color2 } = item2;
37004           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
37005             _cache3.colors[itemInt] = color2;
37006           }
37007           const { title, detail, fix, trap } = cl2;
37008           let issueStrings = {};
37009           if (title)
37010             issueStrings.title = title.auto;
37011           if (detail)
37012             issueStrings.detail = marked(detail.auto);
37013           if (trap)
37014             issueStrings.trap = marked(trap.auto);
37015           if (fix)
37016             issueStrings.fix = marked(fix.auto);
37017           _cache3.strings[locale2][itemType] = issueStrings;
37018         };
37019         const [item, cl] = itemType.split("-");
37020         const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
37021         return json_default(url).then(cacheData);
37022       }).filter(Boolean);
37023       return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
37024     },
37025     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
37026       return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
37027     },
37028     getColor(itemType) {
37029       return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
37030     },
37031     postUpdate(issue, callback) {
37032       if (_cache3.inflightPost[issue.id]) {
37033         return callback({ message: "Issue update already inflight", status: -2 }, issue);
37034       }
37035       const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
37036       const controller = new AbortController();
37037       const after = () => {
37038         delete _cache3.inflightPost[issue.id];
37039         this.removeItem(issue);
37040         if (issue.newStatus === "done") {
37041           if (!(issue.item in _cache3.closed)) {
37042             _cache3.closed[issue.item] = 0;
37043           }
37044           _cache3.closed[issue.item] += 1;
37045         }
37046         if (callback)
37047           callback(null, issue);
37048       };
37049       _cache3.inflightPost[issue.id] = controller;
37050       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
37051         delete _cache3.inflightPost[issue.id];
37052         if (callback)
37053           callback(err.message);
37054       });
37055     },
37056     getItems(projection2) {
37057       const viewport = projection2.clipExtent();
37058       const min3 = [viewport[0][0], viewport[1][1]];
37059       const max3 = [viewport[1][0], viewport[0][1]];
37060       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37061       return _cache3.rtree.search(bbox).map((d) => d.data);
37062     },
37063     getError(id2) {
37064       return _cache3.data[id2];
37065     },
37066     getIcon(itemType) {
37067       return _osmoseData.icons[itemType];
37068     },
37069     replaceItem(item) {
37070       if (!(item instanceof QAItem) || !item.id)
37071         return;
37072       _cache3.data[item.id] = item;
37073       updateRtree3(encodeIssueRtree3(item), true);
37074       return item;
37075     },
37076     removeItem(item) {
37077       if (!(item instanceof QAItem) || !item.id)
37078         return;
37079       delete _cache3.data[item.id];
37080       updateRtree3(encodeIssueRtree3(item), false);
37081     },
37082     getClosedCounts() {
37083       return _cache3.closed;
37084     },
37085     itemURL(item) {
37086       return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
37087     }
37088   };
37089
37090   // modules/services/mapillary.js
37091   var import_pbf = __toESM(require_pbf());
37092   var import_rbush4 = __toESM(require_rbush_min());
37093   var import_vector_tile = __toESM(require_vector_tile());
37094   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
37095   var apiUrl = "https://graph.mapillary.com/";
37096   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
37097   var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
37098   var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
37099   var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
37100   var viewercss = "mapillary-js/mapillary.css";
37101   var viewerjs = "mapillary-js/mapillary.js";
37102   var minZoom = 14;
37103   var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
37104   var _loadViewerPromise;
37105   var _mlyActiveImage;
37106   var _mlyCache;
37107   var _mlyFallback = false;
37108   var _mlyHighlightedDetection;
37109   var _mlyShowFeatureDetections = false;
37110   var _mlyShowSignDetections = false;
37111   var _mlyViewer;
37112   var _mlyViewerFilter = ["all"];
37113   function loadTiles(which, url, maxZoom2, projection2) {
37114     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
37115     const tiles = tiler8.getTiles(projection2);
37116     tiles.forEach(function(tile) {
37117       loadTile(which, url, tile);
37118     });
37119   }
37120   function loadTile(which, url, tile) {
37121     const cache = _mlyCache.requests;
37122     const tileId = `${tile.id}-${which}`;
37123     if (cache.loaded[tileId] || cache.inflight[tileId])
37124       return;
37125     const controller = new AbortController();
37126     cache.inflight[tileId] = controller;
37127     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
37128     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
37129       if (!response.ok) {
37130         throw new Error(response.status + " " + response.statusText);
37131       }
37132       cache.loaded[tileId] = true;
37133       delete cache.inflight[tileId];
37134       return response.arrayBuffer();
37135     }).then(function(data) {
37136       if (!data) {
37137         throw new Error("No Data");
37138       }
37139       loadTileDataToCache(data, tile, which);
37140       if (which === "images") {
37141         dispatch5.call("loadedImages");
37142       } else if (which === "signs") {
37143         dispatch5.call("loadedSigns");
37144       } else if (which === "points") {
37145         dispatch5.call("loadedMapFeatures");
37146       }
37147     }).catch(function() {
37148       cache.loaded[tileId] = true;
37149       delete cache.inflight[tileId];
37150     });
37151   }
37152   function loadTileDataToCache(data, tile, which) {
37153     const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
37154     let features2, cache, layer, i2, feature3, loc, d;
37155     if (vectorTile.layers.hasOwnProperty("image")) {
37156       features2 = [];
37157       cache = _mlyCache.images;
37158       layer = vectorTile.layers.image;
37159       for (i2 = 0; i2 < layer.length; i2++) {
37160         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37161         loc = feature3.geometry.coordinates;
37162         d = {
37163           loc,
37164           captured_at: feature3.properties.captured_at,
37165           ca: feature3.properties.compass_angle,
37166           id: feature3.properties.id,
37167           is_pano: feature3.properties.is_pano,
37168           sequence_id: feature3.properties.sequence_id
37169         };
37170         cache.forImageId[d.id] = d;
37171         features2.push({
37172           minX: loc[0],
37173           minY: loc[1],
37174           maxX: loc[0],
37175           maxY: loc[1],
37176           data: d
37177         });
37178       }
37179       if (cache.rtree) {
37180         cache.rtree.load(features2);
37181       }
37182     }
37183     if (vectorTile.layers.hasOwnProperty("sequence")) {
37184       features2 = [];
37185       cache = _mlyCache.sequences;
37186       layer = vectorTile.layers.sequence;
37187       for (i2 = 0; i2 < layer.length; i2++) {
37188         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37189         if (cache.lineString[feature3.properties.id]) {
37190           cache.lineString[feature3.properties.id].push(feature3);
37191         } else {
37192           cache.lineString[feature3.properties.id] = [feature3];
37193         }
37194       }
37195     }
37196     if (vectorTile.layers.hasOwnProperty("point")) {
37197       features2 = [];
37198       cache = _mlyCache[which];
37199       layer = vectorTile.layers.point;
37200       for (i2 = 0; i2 < layer.length; i2++) {
37201         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37202         loc = feature3.geometry.coordinates;
37203         d = {
37204           loc,
37205           id: feature3.properties.id,
37206           first_seen_at: feature3.properties.first_seen_at,
37207           last_seen_at: feature3.properties.last_seen_at,
37208           value: feature3.properties.value
37209         };
37210         features2.push({
37211           minX: loc[0],
37212           minY: loc[1],
37213           maxX: loc[0],
37214           maxY: loc[1],
37215           data: d
37216         });
37217       }
37218       if (cache.rtree) {
37219         cache.rtree.load(features2);
37220       }
37221     }
37222     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
37223       features2 = [];
37224       cache = _mlyCache[which];
37225       layer = vectorTile.layers.traffic_sign;
37226       for (i2 = 0; i2 < layer.length; i2++) {
37227         feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
37228         loc = feature3.geometry.coordinates;
37229         d = {
37230           loc,
37231           id: feature3.properties.id,
37232           first_seen_at: feature3.properties.first_seen_at,
37233           last_seen_at: feature3.properties.last_seen_at,
37234           value: feature3.properties.value
37235         };
37236         features2.push({
37237           minX: loc[0],
37238           minY: loc[1],
37239           maxX: loc[0],
37240           maxY: loc[1],
37241           data: d
37242         });
37243       }
37244       if (cache.rtree) {
37245         cache.rtree.load(features2);
37246       }
37247     }
37248   }
37249   function loadData(url) {
37250     return fetch(url).then(function(response) {
37251       if (!response.ok) {
37252         throw new Error(response.status + " " + response.statusText);
37253       }
37254       return response.json();
37255     }).then(function(result) {
37256       if (!result) {
37257         return [];
37258       }
37259       return result.data || [];
37260     });
37261   }
37262   function partitionViewport(projection2) {
37263     const z = geoScaleToZoom(projection2.scale());
37264     const z2 = Math.ceil(z * 2) / 2 + 2.5;
37265     const tiler8 = utilTiler().zoomExtent([z2, z2]);
37266     return tiler8.getTiles(projection2).map(function(tile) {
37267       return tile.extent;
37268     });
37269   }
37270   function searchLimited(limit, projection2, rtree) {
37271     limit = limit || 5;
37272     return partitionViewport(projection2).reduce(function(result, extent) {
37273       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
37274         return d.data;
37275       });
37276       return found.length ? result.concat(found) : result;
37277     }, []);
37278   }
37279   var mapillary_default = {
37280     init: function() {
37281       if (!_mlyCache) {
37282         this.reset();
37283       }
37284       this.event = utilRebind(this, dispatch5, "on");
37285     },
37286     reset: function() {
37287       if (_mlyCache) {
37288         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
37289           request3.abort();
37290         });
37291       }
37292       _mlyCache = {
37293         images: { rtree: new import_rbush4.default(), forImageId: {} },
37294         image_detections: { forImageId: {} },
37295         signs: { rtree: new import_rbush4.default() },
37296         points: { rtree: new import_rbush4.default() },
37297         sequences: { rtree: new import_rbush4.default(), lineString: {} },
37298         requests: { loaded: {}, inflight: {} }
37299       };
37300       _mlyActiveImage = null;
37301     },
37302     images: function(projection2) {
37303       const limit = 5;
37304       return searchLimited(limit, projection2, _mlyCache.images.rtree);
37305     },
37306     signs: function(projection2) {
37307       const limit = 5;
37308       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
37309     },
37310     mapFeatures: function(projection2) {
37311       const limit = 5;
37312       return searchLimited(limit, projection2, _mlyCache.points.rtree);
37313     },
37314     cachedImage: function(imageId) {
37315       return _mlyCache.images.forImageId[imageId];
37316     },
37317     sequences: function(projection2) {
37318       const viewport = projection2.clipExtent();
37319       const min3 = [viewport[0][0], viewport[1][1]];
37320       const max3 = [viewport[1][0], viewport[0][1]];
37321       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37322       const sequenceIds = {};
37323       let lineStrings = [];
37324       _mlyCache.images.rtree.search(bbox).forEach(function(d) {
37325         if (d.data.sequence_id) {
37326           sequenceIds[d.data.sequence_id] = true;
37327         }
37328       });
37329       Object.keys(sequenceIds).forEach(function(sequenceId) {
37330         if (_mlyCache.sequences.lineString[sequenceId]) {
37331           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
37332         }
37333       });
37334       return lineStrings;
37335     },
37336     loadImages: function(projection2) {
37337       loadTiles("images", tileUrl, 14, projection2);
37338     },
37339     loadSigns: function(projection2) {
37340       loadTiles("signs", trafficSignTileUrl, 14, projection2);
37341     },
37342     loadMapFeatures: function(projection2) {
37343       loadTiles("points", mapFeatureTileUrl, 14, projection2);
37344     },
37345     ensureViewerLoaded: function(context) {
37346       if (_loadViewerPromise)
37347         return _loadViewerPromise;
37348       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
37349       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
37350       const that = this;
37351       _loadViewerPromise = new Promise((resolve, reject) => {
37352         let loadedCount = 0;
37353         function loaded() {
37354           loadedCount += 1;
37355           if (loadedCount === 2)
37356             resolve();
37357         }
37358         const head = select_default2("head");
37359         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() {
37360           reject();
37361         });
37362         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() {
37363           reject();
37364         });
37365       }).catch(function() {
37366         _loadViewerPromise = null;
37367       }).then(function() {
37368         that.initViewer(context);
37369       });
37370       return _loadViewerPromise;
37371     },
37372     loadSignResources: function(context) {
37373       context.ui().svgDefs.addSprites(["mapillary-sprite"], false);
37374       return this;
37375     },
37376     loadObjectResources: function(context) {
37377       context.ui().svgDefs.addSprites(["mapillary-object-sprite"], false);
37378       return this;
37379     },
37380     resetTags: function() {
37381       if (_mlyViewer && !_mlyFallback) {
37382         _mlyViewer.getComponent("tag").removeAll();
37383       }
37384     },
37385     showFeatureDetections: function(value) {
37386       _mlyShowFeatureDetections = value;
37387       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37388         this.resetTags();
37389       }
37390     },
37391     showSignDetections: function(value) {
37392       _mlyShowSignDetections = value;
37393       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
37394         this.resetTags();
37395       }
37396     },
37397     filterViewer: function(context) {
37398       const showsPano = context.photos().showsPanoramic();
37399       const showsFlat = context.photos().showsFlat();
37400       const fromDate = context.photos().fromDate();
37401       const toDate = context.photos().toDate();
37402       const filter2 = ["all"];
37403       if (!showsPano)
37404         filter2.push(["!=", "cameraType", "spherical"]);
37405       if (!showsFlat && showsPano)
37406         filter2.push(["==", "pano", true]);
37407       if (fromDate) {
37408         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
37409       }
37410       if (toDate) {
37411         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
37412       }
37413       if (_mlyViewer) {
37414         _mlyViewer.setFilter(filter2);
37415       }
37416       _mlyViewerFilter = filter2;
37417       return filter2;
37418     },
37419     showViewer: function(context) {
37420       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
37421       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
37422       if (isHidden && _mlyViewer) {
37423         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
37424         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
37425         _mlyViewer.resize();
37426       }
37427       return this;
37428     },
37429     hideViewer: function(context) {
37430       _mlyActiveImage = null;
37431       if (!_mlyFallback && _mlyViewer) {
37432         _mlyViewer.getComponent("sequence").stop();
37433       }
37434       const viewer = context.container().select(".photoviewer");
37435       if (!viewer.empty())
37436         viewer.datum(null);
37437       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
37438       this.updateUrlImage(null);
37439       dispatch5.call("imageChanged");
37440       dispatch5.call("loadedMapFeatures");
37441       dispatch5.call("loadedSigns");
37442       return this.setStyles(context, null);
37443     },
37444     updateUrlImage: function(imageId) {
37445       if (!window.mocha) {
37446         const hash = utilStringQs(window.location.hash);
37447         if (imageId) {
37448           hash.photo = "mapillary/" + imageId;
37449         } else {
37450           delete hash.photo;
37451         }
37452         window.location.replace("#" + utilQsString(hash, true));
37453       }
37454     },
37455     highlightDetection: function(detection) {
37456       if (detection) {
37457         _mlyHighlightedDetection = detection.id;
37458       }
37459       return this;
37460     },
37461     initViewer: function(context) {
37462       const that = this;
37463       if (!window.mapillary)
37464         return;
37465       const opts = {
37466         accessToken,
37467         component: {
37468           cover: false,
37469           keyboard: false,
37470           tag: true
37471         },
37472         container: "ideditor-mly"
37473       };
37474       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
37475         _mlyFallback = true;
37476         opts.component = {
37477           cover: false,
37478           direction: false,
37479           imagePlane: false,
37480           keyboard: false,
37481           mouse: false,
37482           sequence: false,
37483           tag: false,
37484           image: true,
37485           navigation: true
37486         };
37487       }
37488       _mlyViewer = new mapillary.Viewer(opts);
37489       _mlyViewer.on("image", imageChanged);
37490       _mlyViewer.on("bearing", bearingChanged);
37491       if (_mlyViewerFilter) {
37492         _mlyViewer.setFilter(_mlyViewerFilter);
37493       }
37494       context.ui().photoviewer.on("resize.mapillary", function() {
37495         if (_mlyViewer)
37496           _mlyViewer.resize();
37497       });
37498       function imageChanged(node) {
37499         that.resetTags();
37500         const image = node.image;
37501         that.setActiveImage(image);
37502         that.setStyles(context, null);
37503         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
37504         context.map().centerEase(loc);
37505         that.updateUrlImage(image.id);
37506         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
37507           that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
37508         }
37509         dispatch5.call("imageChanged");
37510       }
37511       function bearingChanged(e) {
37512         dispatch5.call("bearingChanged", void 0, e);
37513       }
37514     },
37515     selectImage: function(context, imageId) {
37516       if (_mlyViewer && imageId) {
37517         _mlyViewer.moveTo(imageId).catch(function(e) {
37518           console.error("mly3", e);
37519         });
37520       }
37521       return this;
37522     },
37523     getActiveImage: function() {
37524       return _mlyActiveImage;
37525     },
37526     getDetections: function(id2) {
37527       return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
37528     },
37529     setActiveImage: function(image) {
37530       if (image) {
37531         _mlyActiveImage = {
37532           ca: image.originalCompassAngle,
37533           id: image.id,
37534           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
37535           is_pano: image.cameraType === "spherical",
37536           sequence_id: image.sequenceId
37537         };
37538       } else {
37539         _mlyActiveImage = null;
37540       }
37541     },
37542     setStyles: function(context, hovered) {
37543       const hoveredImageId = hovered && hovered.id;
37544       const hoveredSequenceId = hovered && hovered.sequence_id;
37545       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
37546       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d) {
37547         return d.sequence_id === selectedSequenceId || d.id === hoveredImageId;
37548       }).classed("hovered", function(d) {
37549         return d.id === hoveredImageId;
37550       });
37551       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d) {
37552         return d.properties.id === hoveredSequenceId;
37553       }).classed("currentView", function(d) {
37554         return d.properties.id === selectedSequenceId;
37555       });
37556       return this;
37557     },
37558     updateDetections: function(imageId, url) {
37559       if (!_mlyViewer || _mlyFallback)
37560         return;
37561       if (!imageId)
37562         return;
37563       const cache = _mlyCache.image_detections;
37564       if (cache.forImageId[imageId]) {
37565         showDetections(_mlyCache.image_detections.forImageId[imageId]);
37566       } else {
37567         loadData(url).then((detections) => {
37568           detections.forEach(function(detection) {
37569             if (!cache.forImageId[imageId]) {
37570               cache.forImageId[imageId] = [];
37571             }
37572             cache.forImageId[imageId].push({
37573               geometry: detection.geometry,
37574               id: detection.id,
37575               image_id: imageId,
37576               value: detection.value
37577             });
37578           });
37579           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
37580         });
37581       }
37582       function showDetections(detections) {
37583         const tagComponent = _mlyViewer.getComponent("tag");
37584         detections.forEach(function(data) {
37585           const tag = makeTag(data);
37586           if (tag) {
37587             tagComponent.add([tag]);
37588           }
37589         });
37590       }
37591       function makeTag(data) {
37592         const valueParts = data.value.split("--");
37593         if (!valueParts.length)
37594           return;
37595         let tag;
37596         let text2;
37597         let color2 = 16777215;
37598         if (_mlyHighlightedDetection === data.id) {
37599           color2 = 16776960;
37600           text2 = valueParts[1];
37601           if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
37602             text2 = valueParts[2];
37603           }
37604           text2 = text2.replace(/-/g, " ");
37605           text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
37606           _mlyHighlightedDetection = null;
37607         }
37608         var decodedGeometry = window.atob(data.geometry);
37609         var uintArray = new Uint8Array(decodedGeometry.length);
37610         for (var i2 = 0; i2 < decodedGeometry.length; i2++) {
37611           uintArray[i2] = decodedGeometry.charCodeAt(i2);
37612         }
37613         const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
37614         const layer = tile.layers["mpy-or"];
37615         const geometries = layer.feature(0).loadGeometry();
37616         const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
37617         tag = new mapillary.OutlineTag(
37618           data.id,
37619           new mapillary.PolygonGeometry(polygon2[0]),
37620           {
37621             text: text2,
37622             textColor: color2,
37623             lineColor: color2,
37624             lineWidth: 2,
37625             fillColor: color2,
37626             fillOpacity: 0.3
37627           }
37628         );
37629         return tag;
37630       }
37631     },
37632     cache: function() {
37633       return _mlyCache;
37634     }
37635   };
37636
37637   // modules/core/validation/models.js
37638   function validationIssue(attrs) {
37639     this.type = attrs.type;
37640     this.subtype = attrs.subtype;
37641     this.severity = attrs.severity;
37642     this.message = attrs.message;
37643     this.reference = attrs.reference;
37644     this.entityIds = attrs.entityIds;
37645     this.loc = attrs.loc;
37646     this.data = attrs.data;
37647     this.dynamicFixes = attrs.dynamicFixes;
37648     this.hash = attrs.hash;
37649     this.id = generateID.apply(this);
37650     this.key = generateKey.apply(this);
37651     this.autoFix = null;
37652     function generateID() {
37653       var parts = [this.type];
37654       if (this.hash) {
37655         parts.push(this.hash);
37656       }
37657       if (this.subtype) {
37658         parts.push(this.subtype);
37659       }
37660       if (this.entityIds) {
37661         var entityKeys = this.entityIds.slice().sort();
37662         parts.push.apply(parts, entityKeys);
37663       }
37664       return parts.join(":");
37665     }
37666     function generateKey() {
37667       return this.id + ":" + Date.now().toString();
37668     }
37669     this.extent = function(resolver) {
37670       if (this.loc) {
37671         return geoExtent(this.loc);
37672       }
37673       if (this.entityIds && this.entityIds.length) {
37674         return this.entityIds.reduce(function(extent, entityId) {
37675           return extent.extend(resolver.entity(entityId).extent(resolver));
37676         }, geoExtent());
37677       }
37678       return null;
37679     };
37680     this.fixes = function(context) {
37681       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
37682       var issue = this;
37683       if (issue.severity === "warning") {
37684         fixes.push(new validationIssueFix({
37685           title: _t.append("issues.fix.ignore_issue.title"),
37686           icon: "iD-icon-close",
37687           onClick: function() {
37688             context.validator().ignoreIssue(this.issue.id);
37689           }
37690         }));
37691       }
37692       fixes.forEach(function(fix) {
37693         fix.id = fix.title.stringId;
37694         fix.issue = issue;
37695         if (fix.autoArgs) {
37696           issue.autoFix = fix;
37697         }
37698       });
37699       return fixes;
37700     };
37701   }
37702   function validationIssueFix(attrs) {
37703     this.title = attrs.title;
37704     this.onClick = attrs.onClick;
37705     this.disabledReason = attrs.disabledReason;
37706     this.icon = attrs.icon;
37707     this.entityIds = attrs.entityIds || [];
37708     this.autoArgs = attrs.autoArgs;
37709     this.issue = null;
37710   }
37711
37712   // modules/services/maprules.js
37713   var buildRuleChecks = function() {
37714     return {
37715       equals: function(equals) {
37716         return function(tags) {
37717           return Object.keys(equals).every(function(k) {
37718             return equals[k] === tags[k];
37719           });
37720         };
37721       },
37722       notEquals: function(notEquals) {
37723         return function(tags) {
37724           return Object.keys(notEquals).some(function(k) {
37725             return notEquals[k] !== tags[k];
37726           });
37727         };
37728       },
37729       absence: function(absence) {
37730         return function(tags) {
37731           return Object.keys(tags).indexOf(absence) === -1;
37732         };
37733       },
37734       presence: function(presence) {
37735         return function(tags) {
37736           return Object.keys(tags).indexOf(presence) > -1;
37737         };
37738       },
37739       greaterThan: function(greaterThan) {
37740         var key = Object.keys(greaterThan)[0];
37741         var value = greaterThan[key];
37742         return function(tags) {
37743           return tags[key] > value;
37744         };
37745       },
37746       greaterThanEqual: function(greaterThanEqual) {
37747         var key = Object.keys(greaterThanEqual)[0];
37748         var value = greaterThanEqual[key];
37749         return function(tags) {
37750           return tags[key] >= value;
37751         };
37752       },
37753       lessThan: function(lessThan) {
37754         var key = Object.keys(lessThan)[0];
37755         var value = lessThan[key];
37756         return function(tags) {
37757           return tags[key] < value;
37758         };
37759       },
37760       lessThanEqual: function(lessThanEqual) {
37761         var key = Object.keys(lessThanEqual)[0];
37762         var value = lessThanEqual[key];
37763         return function(tags) {
37764           return tags[key] <= value;
37765         };
37766       },
37767       positiveRegex: function(positiveRegex) {
37768         var tagKey = Object.keys(positiveRegex)[0];
37769         var expression = positiveRegex[tagKey].join("|");
37770         var regex = new RegExp(expression);
37771         return function(tags) {
37772           return regex.test(tags[tagKey]);
37773         };
37774       },
37775       negativeRegex: function(negativeRegex) {
37776         var tagKey = Object.keys(negativeRegex)[0];
37777         var expression = negativeRegex[tagKey].join("|");
37778         var regex = new RegExp(expression);
37779         return function(tags) {
37780           return !regex.test(tags[tagKey]);
37781         };
37782       }
37783     };
37784   };
37785   var buildLineKeys = function() {
37786     return {
37787       highway: {
37788         rest_area: true,
37789         services: true
37790       },
37791       railway: {
37792         roundhouse: true,
37793         station: true,
37794         traverser: true,
37795         turntable: true,
37796         wash: true
37797       }
37798     };
37799   };
37800   var maprules_default = {
37801     init: function() {
37802       this._ruleChecks = buildRuleChecks();
37803       this._validationRules = [];
37804       this._areaKeys = osmAreaKeys;
37805       this._lineKeys = buildLineKeys();
37806     },
37807     filterRuleChecks: function(selector) {
37808       var _ruleChecks = this._ruleChecks;
37809       return Object.keys(selector).reduce(function(rules, key) {
37810         if (["geometry", "error", "warning"].indexOf(key) === -1) {
37811           rules.push(_ruleChecks[key](selector[key]));
37812         }
37813         return rules;
37814       }, []);
37815     },
37816     buildTagMap: function(selector) {
37817       var getRegexValues = function(regexes) {
37818         return regexes.map(function(regex) {
37819           return regex.replace(/\$|\^/g, "");
37820         });
37821       };
37822       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
37823         var values;
37824         var isRegex = /regex/gi.test(key);
37825         var isEqual = /equals/gi.test(key);
37826         if (isRegex || isEqual) {
37827           Object.keys(selector[key]).forEach(function(selectorKey) {
37828             values = isEqual ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
37829             if (expectedTags.hasOwnProperty(selectorKey)) {
37830               values = values.concat(expectedTags[selectorKey]);
37831             }
37832             expectedTags[selectorKey] = values;
37833           });
37834         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
37835           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
37836           values = [selector[key][tagKey]];
37837           if (expectedTags.hasOwnProperty(tagKey)) {
37838             values = values.concat(expectedTags[tagKey]);
37839           }
37840           expectedTags[tagKey] = values;
37841         }
37842         return expectedTags;
37843       }, {});
37844       return tagMap;
37845     },
37846     inferGeometry: function(tagMap) {
37847       var _lineKeys = this._lineKeys;
37848       var _areaKeys = this._areaKeys;
37849       var keyValueDoesNotImplyArea = function(key2) {
37850         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
37851       };
37852       var keyValueImpliesLine = function(key2) {
37853         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
37854       };
37855       if (tagMap.hasOwnProperty("area")) {
37856         if (tagMap.area.indexOf("yes") > -1) {
37857           return "area";
37858         }
37859         if (tagMap.area.indexOf("no") > -1) {
37860           return "line";
37861         }
37862       }
37863       for (var key in tagMap) {
37864         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
37865           return "area";
37866         }
37867         if (key in _lineKeys && keyValueImpliesLine(key)) {
37868           return "area";
37869         }
37870       }
37871       return "line";
37872     },
37873     addRule: function(selector) {
37874       var rule = {
37875         checks: this.filterRuleChecks(selector),
37876         matches: function(entity) {
37877           return this.checks.every(function(check) {
37878             return check(entity.tags);
37879           });
37880         },
37881         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
37882         geometryMatches: function(entity, graph) {
37883           if (entity.type === "node" || entity.type === "relation") {
37884             return selector.geometry === entity.type;
37885           } else if (entity.type === "way") {
37886             return this.inferredGeometry === entity.geometry(graph);
37887           }
37888         },
37889         findIssues: function(entity, graph, issues) {
37890           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
37891             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
37892             var message = selector[severity];
37893             issues.push(new validationIssue({
37894               type: "maprules",
37895               severity,
37896               message: function() {
37897                 return message;
37898               },
37899               entityIds: [entity.id]
37900             }));
37901           }
37902         }
37903       };
37904       this._validationRules.push(rule);
37905     },
37906     clearRules: function() {
37907       this._validationRules = [];
37908     },
37909     validationRules: function() {
37910       return this._validationRules;
37911     },
37912     ruleChecks: function() {
37913       return this._ruleChecks;
37914     }
37915   };
37916
37917   // modules/services/nominatim.js
37918   var import_rbush5 = __toESM(require_rbush_min());
37919   var apibase = "https://nominatim.openstreetmap.org/";
37920   var _inflight = {};
37921   var _nominatimCache;
37922   var nominatim_default = {
37923     init: function() {
37924       _inflight = {};
37925       _nominatimCache = new import_rbush5.default();
37926     },
37927     reset: function() {
37928       Object.values(_inflight).forEach(function(controller) {
37929         controller.abort();
37930       });
37931       _inflight = {};
37932       _nominatimCache = new import_rbush5.default();
37933     },
37934     countryCode: function(location, callback) {
37935       this.reverse(location, function(err, result) {
37936         if (err) {
37937           return callback(err);
37938         } else if (result.address) {
37939           return callback(null, result.address.country_code);
37940         } else {
37941           return callback("Unable to geocode", null);
37942         }
37943       });
37944     },
37945     reverse: function(loc, callback) {
37946       var cached = _nominatimCache.search(
37947         { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
37948       );
37949       if (cached.length > 0) {
37950         if (callback)
37951           callback(null, cached[0].data);
37952         return;
37953       }
37954       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
37955       var url = apibase + "reverse?" + utilQsString(params);
37956       if (_inflight[url])
37957         return;
37958       var controller = new AbortController();
37959       _inflight[url] = controller;
37960       json_default(url, { signal: controller.signal }).then(function(result) {
37961         delete _inflight[url];
37962         if (result && result.error) {
37963           throw new Error(result.error);
37964         }
37965         var extent = geoExtent(loc).padByMeters(200);
37966         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
37967         if (callback)
37968           callback(null, result);
37969       }).catch(function(err) {
37970         delete _inflight[url];
37971         if (err.name === "AbortError")
37972           return;
37973         if (callback)
37974           callback(err.message);
37975       });
37976     },
37977     search: function(val, callback) {
37978       var searchVal = encodeURIComponent(val);
37979       var url = apibase + "search/" + searchVal + "?limit=10&format=json";
37980       if (_inflight[url])
37981         return;
37982       var controller = new AbortController();
37983       _inflight[url] = controller;
37984       json_default(url, { signal: controller.signal }).then(function(result) {
37985         delete _inflight[url];
37986         if (result && result.error) {
37987           throw new Error(result.error);
37988         }
37989         if (callback)
37990           callback(null, result);
37991       }).catch(function(err) {
37992         delete _inflight[url];
37993         if (err.name === "AbortError")
37994           return;
37995         if (callback)
37996           callback(err.message);
37997       });
37998     }
37999   };
38000
38001   // node_modules/name-suggestion-index/lib/matcher.js
38002   var import_which_polygon3 = __toESM(require_which_polygon(), 1);
38003
38004   // node_modules/name-suggestion-index/lib/simplify.js
38005   var import_diacritics2 = __toESM(require_diacritics(), 1);
38006   function simplify(str2) {
38007     if (typeof str2 !== "string")
38008       return "";
38009     return import_diacritics2.default.remove(
38010       str2.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()
38011     );
38012   }
38013
38014   // node_modules/name-suggestion-index/config/matchGroups.json
38015   var matchGroups_default = {
38016     matchGroups: {
38017       adult_gaming_centre: [
38018         "amenity/casino",
38019         "amenity/gambling",
38020         "leisure/adult_gaming_centre"
38021       ],
38022       beauty: [
38023         "shop/beauty",
38024         "shop/hairdresser_supply"
38025       ],
38026       bed: [
38027         "shop/bed",
38028         "shop/furniture"
38029       ],
38030       beverages: [
38031         "shop/alcohol",
38032         "shop/beer",
38033         "shop/beverages",
38034         "shop/kiosk",
38035         "shop/wine"
38036       ],
38037       camping: [
38038         "tourism/camp_site",
38039         "tourism/caravan_site"
38040       ],
38041       car_parts: [
38042         "shop/car_parts",
38043         "shop/car_repair",
38044         "shop/tires",
38045         "shop/tyres"
38046       ],
38047       clinic: [
38048         "amenity/clinic",
38049         "amenity/doctors",
38050         "healthcare/clinic",
38051         "healthcare/laboratory",
38052         "healthcare/physiotherapist",
38053         "healthcare/sample_collection",
38054         "healthcare/dialysis"
38055       ],
38056       convenience: [
38057         "shop/beauty",
38058         "shop/chemist",
38059         "shop/convenience",
38060         "shop/cosmetics",
38061         "shop/grocery",
38062         "shop/kiosk",
38063         "shop/newsagent",
38064         "shop/perfumery"
38065       ],
38066       coworking: [
38067         "amenity/coworking_space",
38068         "office/coworking",
38069         "office/coworking_space"
38070       ],
38071       dentist: [
38072         "amenity/dentist",
38073         "amenity/doctors",
38074         "healthcare/dentist"
38075       ],
38076       electronics: [
38077         "office/telecommunication",
38078         "shop/computer",
38079         "shop/electronics",
38080         "shop/hifi",
38081         "shop/kiosk",
38082         "shop/mobile",
38083         "shop/mobile_phone",
38084         "shop/telecommunication"
38085       ],
38086       fabric: [
38087         "shop/fabric",
38088         "shop/haberdashery",
38089         "shop/sewing"
38090       ],
38091       fashion: [
38092         "shop/accessories",
38093         "shop/bag",
38094         "shop/boutique",
38095         "shop/clothes",
38096         "shop/department_store",
38097         "shop/fashion",
38098         "shop/fashion_accessories",
38099         "shop/sports",
38100         "shop/shoes"
38101       ],
38102       financial: [
38103         "amenity/bank",
38104         "office/accountant",
38105         "office/financial",
38106         "office/financial_advisor",
38107         "office/tax_advisor",
38108         "shop/tax"
38109       ],
38110       fitness: [
38111         "leisure/fitness_centre",
38112         "leisure/fitness_center",
38113         "leisure/sports_centre",
38114         "leisure/sports_center"
38115       ],
38116       food: [
38117         "amenity/bar",
38118         "amenity/cafe",
38119         "amenity/fast_food",
38120         "amenity/ice_cream",
38121         "amenity/pub",
38122         "amenity/restaurant",
38123         "shop/bakery",
38124         "shop/candy",
38125         "shop/chocolate",
38126         "shop/coffee",
38127         "shop/confectionary",
38128         "shop/confectionery",
38129         "shop/food",
38130         "shop/kiosk",
38131         "shop/ice_cream",
38132         "shop/pastry",
38133         "shop/tea"
38134       ],
38135       fuel: [
38136         "amenity/fuel",
38137         "shop/gas",
38138         "shop/convenience;gas",
38139         "shop/gas;convenience"
38140       ],
38141       gift: [
38142         "shop/gift",
38143         "shop/card",
38144         "shop/cards",
38145         "shop/kiosk",
38146         "shop/stationery"
38147       ],
38148       hardware: [
38149         "shop/bathroom_furnishing",
38150         "shop/carpet",
38151         "shop/diy",
38152         "shop/doityourself",
38153         "shop/doors",
38154         "shop/electrical",
38155         "shop/flooring",
38156         "shop/hardware",
38157         "shop/hardware_store",
38158         "shop/power_tools",
38159         "shop/tool_hire",
38160         "shop/tools",
38161         "shop/trade"
38162       ],
38163       health_food: [
38164         "shop/health",
38165         "shop/health_food",
38166         "shop/herbalist",
38167         "shop/nutrition_supplements"
38168       ],
38169       hobby: [
38170         "shop/electronics",
38171         "shop/hobby",
38172         "shop/books",
38173         "shop/games",
38174         "shop/collector",
38175         "shop/toys",
38176         "shop/model",
38177         "shop/video_games",
38178         "shop/anime"
38179       ],
38180       hospital: [
38181         "amenity/doctors",
38182         "amenity/hospital",
38183         "healthcare/hospital"
38184       ],
38185       houseware: [
38186         "shop/houseware",
38187         "shop/interior_decoration"
38188       ],
38189       lifeboat_station: [
38190         "amenity/lifeboat_station",
38191         "emergency/lifeboat_station",
38192         "emergency/marine_rescue"
38193       ],
38194       lodging: [
38195         "tourism/hotel",
38196         "tourism/motel"
38197       ],
38198       money_transfer: [
38199         "amenity/money_transfer",
38200         "shop/money_transfer"
38201       ],
38202       office_supplies: [
38203         "shop/office_supplies",
38204         "shop/stationary",
38205         "shop/stationery"
38206       ],
38207       outdoor: [
38208         "shop/clothes",
38209         "shop/outdoor",
38210         "shop/sports"
38211       ],
38212       parcel_locker: [
38213         "amenity/parcel_locker",
38214         "amenity/vending_machine"
38215       ],
38216       pharmacy: [
38217         "amenity/doctors",
38218         "amenity/pharmacy",
38219         "healthcare/pharmacy"
38220       ],
38221       playground: [
38222         "amenity/theme_park",
38223         "leisure/amusement_arcade",
38224         "leisure/playground"
38225       ],
38226       rental: [
38227         "amenity/bicycle_rental",
38228         "amenity/boat_rental",
38229         "amenity/car_rental",
38230         "amenity/truck_rental",
38231         "amenity/vehicle_rental",
38232         "shop/kiosk",
38233         "shop/rental"
38234       ],
38235       school: [
38236         "amenity/childcare",
38237         "amenity/college",
38238         "amenity/kindergarten",
38239         "amenity/language_school",
38240         "amenity/prep_school",
38241         "amenity/school",
38242         "amenity/university"
38243       ],
38244       storage: [
38245         "shop/storage_units",
38246         "shop/storage_rental"
38247       ],
38248       substation: [
38249         "power/station",
38250         "power/substation",
38251         "power/sub_station"
38252       ],
38253       supermarket: [
38254         "shop/food",
38255         "shop/frozen_food",
38256         "shop/greengrocer",
38257         "shop/grocery",
38258         "shop/supermarket",
38259         "shop/wholesale"
38260       ],
38261       variety_store: [
38262         "shop/variety_store",
38263         "shop/discount",
38264         "shop/convenience"
38265       ],
38266       vending: [
38267         "amenity/vending_machine",
38268         "shop/kiosk",
38269         "shop/vending_machine"
38270       ],
38271       weight_loss: [
38272         "amenity/clinic",
38273         "amenity/doctors",
38274         "amenity/weight_clinic",
38275         "healthcare/counselling",
38276         "leisure/fitness_centre",
38277         "office/therapist",
38278         "shop/beauty",
38279         "shop/diet",
38280         "shop/food",
38281         "shop/health_food",
38282         "shop/herbalist",
38283         "shop/nutrition",
38284         "shop/nutrition_supplements",
38285         "shop/weight_loss"
38286       ],
38287       wholesale: [
38288         "shop/wholesale",
38289         "shop/supermarket",
38290         "shop/department_store"
38291       ]
38292     }
38293   };
38294
38295   // node_modules/name-suggestion-index/config/genericWords.json
38296   var genericWords_default = {
38297     genericWords: [
38298       "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
38299       "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
38300       "^(club|green|out|ware)\\s?house$",
38301       "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
38302       "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
38303       "^(hofladen|librairie|magazine?|maison)$",
38304       "^(mobile home|skate)?\\s?park$",
38305       "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
38306       "^\\?+$",
38307       "^private$",
38308       "^tattoo( studio)?$",
38309       "^windmill$",
38310       "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
38311     ]
38312   };
38313
38314   // node_modules/name-suggestion-index/config/trees.json
38315   var trees_default = {
38316     trees: {
38317       brands: {
38318         emoji: "\u{1F354}",
38319         mainTag: "brand:wikidata",
38320         sourceTags: ["brand", "name"],
38321         nameTags: {
38322           primary: "^(name|name:\\w+)$",
38323           alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
38324         }
38325       },
38326       flags: {
38327         emoji: "\u{1F6A9}",
38328         mainTag: "flag:wikidata",
38329         nameTags: {
38330           primary: "^(flag:name|flag:name:\\w+)$",
38331           alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
38332         }
38333       },
38334       operators: {
38335         emoji: "\u{1F4BC}",
38336         mainTag: "operator:wikidata",
38337         sourceTags: ["operator"],
38338         nameTags: {
38339           primary: "^(name|name:\\w+|operator|operator:\\w+)$",
38340           alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
38341         }
38342       },
38343       transit: {
38344         emoji: "\u{1F687}",
38345         mainTag: "network:wikidata",
38346         sourceTags: ["network"],
38347         nameTags: {
38348           primary: "^network$",
38349           alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
38350         }
38351       }
38352     }
38353   };
38354
38355   // node_modules/name-suggestion-index/lib/matcher.js
38356   var matchGroups = matchGroups_default.matchGroups;
38357   var trees = trees_default.trees;
38358   var Matcher = class {
38359     constructor() {
38360       this.matchIndex = void 0;
38361       this.genericWords = /* @__PURE__ */ new Map();
38362       (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i")));
38363       this.itemLocation = void 0;
38364       this.locationSets = void 0;
38365       this.locationIndex = void 0;
38366       this.warnings = [];
38367     }
38368     buildMatchIndex(data) {
38369       const that = this;
38370       if (that.matchIndex)
38371         return;
38372       that.matchIndex = /* @__PURE__ */ new Map();
38373       const seenTree = /* @__PURE__ */ new Map();
38374       Object.keys(data).forEach((tkv) => {
38375         const category = data[tkv];
38376         const parts = tkv.split("/", 3);
38377         const t = parts[0];
38378         const k = parts[1];
38379         const v = parts[2];
38380         const thiskv = `${k}/${v}`;
38381         const tree = trees[t];
38382         let branch = that.matchIndex.get(thiskv);
38383         if (!branch) {
38384           branch = {
38385             primary: /* @__PURE__ */ new Map(),
38386             alternate: /* @__PURE__ */ new Map(),
38387             excludeGeneric: /* @__PURE__ */ new Map(),
38388             excludeNamed: /* @__PURE__ */ new Map()
38389           };
38390           that.matchIndex.set(thiskv, branch);
38391         }
38392         const properties = category.properties || {};
38393         const exclude = properties.exclude || {};
38394         (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i")));
38395         (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i")));
38396         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
38397         let items = category.items;
38398         if (!Array.isArray(items) || !items.length)
38399           return;
38400         const primaryName = new RegExp(tree.nameTags.primary, "i");
38401         const alternateName = new RegExp(tree.nameTags.alternate, "i");
38402         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
38403         const skipGenericKV = skipGenericKVMatches(t, k, v);
38404         const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]);
38405         const matchGroupKV = /* @__PURE__ */ new Set();
38406         Object.values(matchGroups).forEach((matchGroup) => {
38407           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
38408           if (!inGroup)
38409             return;
38410           matchGroup.forEach((otherkv) => {
38411             if (otherkv === thiskv)
38412               return;
38413             matchGroupKV.add(otherkv);
38414             const otherk = otherkv.split("/", 2)[0];
38415             genericKV.add(`${otherk}/yes`);
38416           });
38417         });
38418         items.forEach((item) => {
38419           if (!item.id)
38420             return;
38421           if (Array.isArray(item.matchTags) && item.matchTags.length) {
38422             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
38423             if (!item.matchTags.length)
38424               delete item.matchTags;
38425           }
38426           let kvTags = [`${thiskv}`].concat(item.matchTags || []);
38427           if (!skipGenericKV) {
38428             kvTags = kvTags.concat(Array.from(genericKV));
38429           }
38430           Object.keys(item.tags).forEach((osmkey) => {
38431             if (notName.test(osmkey))
38432               return;
38433             const osmvalue = item.tags[osmkey];
38434             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
38435               return;
38436             if (primaryName.test(osmkey)) {
38437               kvTags.forEach((kv) => insertName("primary", t, kv, simplify(osmvalue), item.id));
38438             } else if (alternateName.test(osmkey)) {
38439               kvTags.forEach((kv) => insertName("alternate", t, kv, simplify(osmvalue), item.id));
38440             }
38441           });
38442           let keepMatchNames = /* @__PURE__ */ new Set();
38443           (item.matchNames || []).forEach((matchName) => {
38444             const nsimple = simplify(matchName);
38445             kvTags.forEach((kv) => {
38446               const branch2 = that.matchIndex.get(kv);
38447               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
38448               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
38449               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
38450               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
38451               if (!inPrimary && !inAlternate) {
38452                 insertName("alternate", t, kv, nsimple, item.id);
38453                 keepMatchNames.add(matchName);
38454               }
38455             });
38456           });
38457           if (keepMatchNames.size) {
38458             item.matchNames = Array.from(keepMatchNames);
38459           } else {
38460             delete item.matchNames;
38461           }
38462         });
38463       });
38464       function insertName(which, t, kv, nsimple, itemID) {
38465         if (!nsimple) {
38466           that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`);
38467           return;
38468         }
38469         let branch = that.matchIndex.get(kv);
38470         if (!branch) {
38471           branch = {
38472             primary: /* @__PURE__ */ new Map(),
38473             alternate: /* @__PURE__ */ new Map(),
38474             excludeGeneric: /* @__PURE__ */ new Map(),
38475             excludeNamed: /* @__PURE__ */ new Map()
38476           };
38477           that.matchIndex.set(kv, branch);
38478         }
38479         let leaf = branch[which].get(nsimple);
38480         if (!leaf) {
38481           leaf = /* @__PURE__ */ new Set();
38482           branch[which].set(nsimple, leaf);
38483         }
38484         leaf.add(itemID);
38485         if (!/yes$/.test(kv)) {
38486           const kvnsimple = `${kv}/${nsimple}`;
38487           const existing = seenTree.get(kvnsimple);
38488           if (existing && existing !== t) {
38489             const items = Array.from(leaf);
38490             that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`);
38491             return;
38492           }
38493           seenTree.set(kvnsimple, t);
38494         }
38495       }
38496       function skipGenericKVMatches(t, k, v) {
38497         return t === "flags" || t === "transit" || k === "landuse" || v === "atm" || v === "bicycle_parking" || v === "car_sharing" || v === "caravan_site" || v === "charging_station" || v === "dog_park" || v === "parking" || v === "phone" || v === "playground" || v === "post_box" || v === "public_bookcase" || v === "recycling" || v === "vending_machine";
38498       }
38499     }
38500     buildLocationIndex(data, loco) {
38501       const that = this;
38502       if (that.locationIndex)
38503         return;
38504       that.itemLocation = /* @__PURE__ */ new Map();
38505       that.locationSets = /* @__PURE__ */ new Map();
38506       Object.keys(data).forEach((tkv) => {
38507         const items = data[tkv].items;
38508         if (!Array.isArray(items) || !items.length)
38509           return;
38510         items.forEach((item) => {
38511           if (that.itemLocation.has(item.id))
38512             return;
38513           let resolved;
38514           try {
38515             resolved = loco.resolveLocationSet(item.locationSet);
38516           } catch (err) {
38517             console.warn(`buildLocationIndex: ${err.message}`);
38518           }
38519           if (!resolved || !resolved.id)
38520             return;
38521           that.itemLocation.set(item.id, resolved.id);
38522           if (that.locationSets.has(resolved.id))
38523             return;
38524           let feature3 = _cloneDeep2(resolved.feature);
38525           feature3.id = resolved.id;
38526           feature3.properties.id = resolved.id;
38527           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
38528             console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
38529             console.warn(JSON.stringify(feature3));
38530             return;
38531           }
38532           that.locationSets.set(resolved.id, feature3);
38533         });
38534       });
38535       that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
38536       function _cloneDeep2(obj) {
38537         return JSON.parse(JSON.stringify(obj));
38538       }
38539     }
38540     match(k, v, n2, loc) {
38541       const that = this;
38542       if (!that.matchIndex) {
38543         throw new Error("match:  matchIndex not built.");
38544       }
38545       let matchLocations;
38546       if (Array.isArray(loc) && that.locationIndex) {
38547         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
38548       }
38549       const nsimple = simplify(n2);
38550       let seen = /* @__PURE__ */ new Set();
38551       let results = [];
38552       gatherResults("primary");
38553       gatherResults("alternate");
38554       if (results.length)
38555         return results;
38556       gatherResults("exclude");
38557       return results.length ? results : null;
38558       function gatherResults(which) {
38559         const kv = `${k}/${v}`;
38560         let didMatch = tryMatch(which, kv);
38561         if (didMatch)
38562           return;
38563         for (let mg in matchGroups) {
38564           const matchGroup = matchGroups[mg];
38565           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
38566           if (!inGroup)
38567             continue;
38568           for (let i2 = 0; i2 < matchGroup.length; i2++) {
38569             const otherkv = matchGroup[i2];
38570             if (otherkv === kv)
38571               continue;
38572             didMatch = tryMatch(which, otherkv);
38573             if (didMatch)
38574               return;
38575           }
38576         }
38577         if (which === "exclude") {
38578           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2));
38579           if (regex) {
38580             results.push({ match: "excludeGeneric", pattern: String(regex) });
38581             return;
38582           }
38583         }
38584       }
38585       function tryMatch(which, kv) {
38586         const branch = that.matchIndex.get(kv);
38587         if (!branch)
38588           return;
38589         if (which === "exclude") {
38590           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2));
38591           if (regex) {
38592             results.push({ match: "excludeNamed", pattern: String(regex), kv });
38593             return;
38594           }
38595           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2));
38596           if (regex) {
38597             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
38598             return;
38599           }
38600           return;
38601         }
38602         const leaf = branch[which].get(nsimple);
38603         if (!leaf || !leaf.size)
38604           return;
38605         let hits = Array.from(leaf).map((itemID) => {
38606           let area = Infinity;
38607           if (that.itemLocation && that.locationSets) {
38608             const location = that.locationSets.get(that.itemLocation.get(itemID));
38609             area = location && location.properties.area || Infinity;
38610           }
38611           return { match: which, itemID, area, kv, nsimple };
38612         });
38613         let sortFn = byAreaDescending;
38614         if (matchLocations) {
38615           hits = hits.filter(isValidLocation);
38616           sortFn = byAreaAscending;
38617         }
38618         if (!hits.length)
38619           return;
38620         hits.sort(sortFn).forEach((hit) => {
38621           if (seen.has(hit.itemID))
38622             return;
38623           seen.add(hit.itemID);
38624           results.push(hit);
38625         });
38626         return true;
38627         function isValidLocation(hit) {
38628           if (!that.itemLocation)
38629             return true;
38630           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
38631         }
38632         function byAreaAscending(hitA, hitB) {
38633           return hitA.area - hitB.area;
38634         }
38635         function byAreaDescending(hitA, hitB) {
38636           return hitB.area - hitA.area;
38637         }
38638       }
38639     }
38640     getWarnings() {
38641       return this.warnings;
38642     }
38643   };
38644
38645   // modules/services/nsi.js
38646   var import_vparse2 = __toESM(require_vparse());
38647
38648   // modules/core/difference.js
38649   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
38650   function coreDifference(base, head) {
38651     var _changes = {};
38652     var _didChange = {};
38653     var _diff = {};
38654     function checkEntityID(id2) {
38655       var h = head.entities[id2];
38656       var b = base.entities[id2];
38657       if (h === b)
38658         return;
38659       if (_changes[id2])
38660         return;
38661       if (!h && b) {
38662         _changes[id2] = { base: b, head: h };
38663         _didChange.deletion = true;
38664         return;
38665       }
38666       if (h && !b) {
38667         _changes[id2] = { base: b, head: h };
38668         _didChange.addition = true;
38669         return;
38670       }
38671       if (h && b) {
38672         if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) {
38673           _changes[id2] = { base: b, head: h };
38674           _didChange.geometry = true;
38675           _didChange.properties = true;
38676           return;
38677         }
38678         if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) {
38679           _changes[id2] = { base: b, head: h };
38680           _didChange.geometry = true;
38681         }
38682         if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) {
38683           _changes[id2] = { base: b, head: h };
38684           _didChange.geometry = true;
38685         }
38686         if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) {
38687           _changes[id2] = { base: b, head: h };
38688           _didChange.properties = true;
38689         }
38690       }
38691     }
38692     function load() {
38693       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
38694       for (var i2 = 0; i2 < ids.length; i2++) {
38695         checkEntityID(ids[i2]);
38696       }
38697     }
38698     load();
38699     _diff.length = function length() {
38700       return Object.keys(_changes).length;
38701     };
38702     _diff.changes = function changes() {
38703       return _changes;
38704     };
38705     _diff.didChange = _didChange;
38706     _diff.extantIDs = function extantIDs(includeRelMembers) {
38707       var result = /* @__PURE__ */ new Set();
38708       Object.keys(_changes).forEach(function(id2) {
38709         if (_changes[id2].head) {
38710           result.add(id2);
38711         }
38712         var h = _changes[id2].head;
38713         var b = _changes[id2].base;
38714         var entity = h || b;
38715         if (includeRelMembers && entity.type === "relation") {
38716           var mh = h ? h.members.map(function(m) {
38717             return m.id;
38718           }) : [];
38719           var mb = b ? b.members.map(function(m) {
38720             return m.id;
38721           }) : [];
38722           utilArrayUnion(mh, mb).forEach(function(memberID) {
38723             if (head.hasEntity(memberID)) {
38724               result.add(memberID);
38725             }
38726           });
38727         }
38728       });
38729       return Array.from(result);
38730     };
38731     _diff.modified = function modified() {
38732       var result = [];
38733       Object.values(_changes).forEach(function(change) {
38734         if (change.base && change.head) {
38735           result.push(change.head);
38736         }
38737       });
38738       return result;
38739     };
38740     _diff.created = function created() {
38741       var result = [];
38742       Object.values(_changes).forEach(function(change) {
38743         if (!change.base && change.head) {
38744           result.push(change.head);
38745         }
38746       });
38747       return result;
38748     };
38749     _diff.deleted = function deleted() {
38750       var result = [];
38751       Object.values(_changes).forEach(function(change) {
38752         if (change.base && !change.head) {
38753           result.push(change.base);
38754         }
38755       });
38756       return result;
38757     };
38758     _diff.summary = function summary() {
38759       var relevant = {};
38760       var keys = Object.keys(_changes);
38761       for (var i2 = 0; i2 < keys.length; i2++) {
38762         var change = _changes[keys[i2]];
38763         if (change.head && change.head.geometry(head) !== "vertex") {
38764           addEntity(change.head, head, change.base ? "modified" : "created");
38765         } else if (change.base && change.base.geometry(base) !== "vertex") {
38766           addEntity(change.base, base, "deleted");
38767         } else if (change.base && change.head) {
38768           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
38769           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
38770           if (moved) {
38771             addParents(change.head);
38772           }
38773           if (retagged || moved && change.head.hasInterestingTags()) {
38774             addEntity(change.head, head, "modified");
38775           }
38776         } else if (change.head && change.head.hasInterestingTags()) {
38777           addEntity(change.head, head, "created");
38778         } else if (change.base && change.base.hasInterestingTags()) {
38779           addEntity(change.base, base, "deleted");
38780         }
38781       }
38782       return Object.values(relevant);
38783       function addEntity(entity, graph, changeType) {
38784         relevant[entity.id] = {
38785           entity,
38786           graph,
38787           changeType
38788         };
38789       }
38790       function addParents(entity) {
38791         var parents = head.parentWays(entity);
38792         for (var j2 = parents.length - 1; j2 >= 0; j2--) {
38793           var parent = parents[j2];
38794           if (!(parent.id in relevant)) {
38795             addEntity(parent, head, "modified");
38796           }
38797         }
38798       }
38799     };
38800     _diff.complete = function complete(extent) {
38801       var result = {};
38802       var id2, change;
38803       for (id2 in _changes) {
38804         change = _changes[id2];
38805         var h = change.head;
38806         var b = change.base;
38807         var entity = h || b;
38808         var i2;
38809         if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) {
38810           continue;
38811         }
38812         result[id2] = h;
38813         if (entity.type === "way") {
38814           var nh = h ? h.nodes : [];
38815           var nb = b ? b.nodes : [];
38816           var diff;
38817           diff = utilArrayDifference(nh, nb);
38818           for (i2 = 0; i2 < diff.length; i2++) {
38819             result[diff[i2]] = head.hasEntity(diff[i2]);
38820           }
38821           diff = utilArrayDifference(nb, nh);
38822           for (i2 = 0; i2 < diff.length; i2++) {
38823             result[diff[i2]] = head.hasEntity(diff[i2]);
38824           }
38825         }
38826         if (entity.type === "relation" && entity.isMultipolygon()) {
38827           var mh = h ? h.members.map(function(m) {
38828             return m.id;
38829           }) : [];
38830           var mb = b ? b.members.map(function(m) {
38831             return m.id;
38832           }) : [];
38833           var ids = utilArrayUnion(mh, mb);
38834           for (i2 = 0; i2 < ids.length; i2++) {
38835             var member = head.hasEntity(ids[i2]);
38836             if (!member)
38837               continue;
38838             if (extent && !member.intersects(extent, head))
38839               continue;
38840             result[ids[i2]] = member;
38841           }
38842         }
38843         addParents(head.parentWays(entity), result);
38844         addParents(head.parentRelations(entity), result);
38845       }
38846       return result;
38847       function addParents(parents, result2) {
38848         for (var i3 = 0; i3 < parents.length; i3++) {
38849           var parent = parents[i3];
38850           if (parent.id in result2)
38851             continue;
38852           result2[parent.id] = parent;
38853           addParents(head.parentRelations(parent), result2);
38854         }
38855       }
38856     };
38857     return _diff;
38858   }
38859
38860   // modules/core/tree.js
38861   var import_rbush6 = __toESM(require_rbush_min());
38862   function coreTree(head) {
38863     var _rtree = new import_rbush6.default();
38864     var _bboxes = {};
38865     var _segmentsRTree = new import_rbush6.default();
38866     var _segmentsBBoxes = {};
38867     var _segmentsByWayId = {};
38868     var tree = {};
38869     function entityBBox(entity) {
38870       var bbox = entity.extent(head).bbox();
38871       bbox.id = entity.id;
38872       _bboxes[entity.id] = bbox;
38873       return bbox;
38874     }
38875     function segmentBBox(segment) {
38876       var extent = segment.extent(head);
38877       if (!extent)
38878         return null;
38879       var bbox = extent.bbox();
38880       bbox.segment = segment;
38881       _segmentsBBoxes[segment.id] = bbox;
38882       return bbox;
38883     }
38884     function removeEntity(entity) {
38885       _rtree.remove(_bboxes[entity.id]);
38886       delete _bboxes[entity.id];
38887       if (_segmentsByWayId[entity.id]) {
38888         _segmentsByWayId[entity.id].forEach(function(segment) {
38889           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
38890           delete _segmentsBBoxes[segment.id];
38891         });
38892         delete _segmentsByWayId[entity.id];
38893       }
38894     }
38895     function loadEntities(entities) {
38896       _rtree.load(entities.map(entityBBox));
38897       var segments = [];
38898       entities.forEach(function(entity) {
38899         if (entity.segments) {
38900           var entitySegments = entity.segments(head);
38901           _segmentsByWayId[entity.id] = entitySegments;
38902           segments = segments.concat(entitySegments);
38903         }
38904       });
38905       if (segments.length)
38906         _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
38907     }
38908     function updateParents(entity, insertions, memo) {
38909       head.parentWays(entity).forEach(function(way) {
38910         if (_bboxes[way.id]) {
38911           removeEntity(way);
38912           insertions[way.id] = way;
38913         }
38914         updateParents(way, insertions, memo);
38915       });
38916       head.parentRelations(entity).forEach(function(relation) {
38917         if (memo[entity.id])
38918           return;
38919         memo[entity.id] = true;
38920         if (_bboxes[relation.id]) {
38921           removeEntity(relation);
38922           insertions[relation.id] = relation;
38923         }
38924         updateParents(relation, insertions, memo);
38925       });
38926     }
38927     tree.rebase = function(entities, force) {
38928       var insertions = {};
38929       for (var i2 = 0; i2 < entities.length; i2++) {
38930         var entity = entities[i2];
38931         if (!entity.visible)
38932           continue;
38933         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
38934           if (!force) {
38935             continue;
38936           } else if (_bboxes[entity.id]) {
38937             removeEntity(entity);
38938           }
38939         }
38940         insertions[entity.id] = entity;
38941         updateParents(entity, insertions, {});
38942       }
38943       loadEntities(Object.values(insertions));
38944       return tree;
38945     };
38946     function updateToGraph(graph) {
38947       if (graph === head)
38948         return;
38949       var diff = coreDifference(head, graph);
38950       head = graph;
38951       var changed = diff.didChange;
38952       if (!changed.addition && !changed.deletion && !changed.geometry)
38953         return;
38954       var insertions = {};
38955       if (changed.deletion) {
38956         diff.deleted().forEach(function(entity) {
38957           removeEntity(entity);
38958         });
38959       }
38960       if (changed.geometry) {
38961         diff.modified().forEach(function(entity) {
38962           removeEntity(entity);
38963           insertions[entity.id] = entity;
38964           updateParents(entity, insertions, {});
38965         });
38966       }
38967       if (changed.addition) {
38968         diff.created().forEach(function(entity) {
38969           insertions[entity.id] = entity;
38970         });
38971       }
38972       loadEntities(Object.values(insertions));
38973     }
38974     tree.intersects = function(extent, graph) {
38975       updateToGraph(graph);
38976       return _rtree.search(extent.bbox()).map(function(bbox) {
38977         return graph.entity(bbox.id);
38978       });
38979     };
38980     tree.waySegments = function(extent, graph) {
38981       updateToGraph(graph);
38982       return _segmentsRTree.search(extent.bbox()).map(function(bbox) {
38983         return bbox.segment;
38984       });
38985     };
38986     return tree;
38987   }
38988
38989   // modules/svg/icon.js
38990   function svgIcon(name, svgklass, useklass) {
38991     return function drawIcon(selection2) {
38992       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);
38993     };
38994   }
38995
38996   // modules/ui/modal.js
38997   function uiModal(selection2, blocking) {
38998     let keybinding = utilKeybinding("modal");
38999     let previous = selection2.select("div.modal");
39000     let animate = previous.empty();
39001     previous.transition().duration(200).style("opacity", 0).remove();
39002     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
39003     shaded.close = () => {
39004       shaded.transition().duration(200).style("opacity", 0).remove();
39005       modal.transition().duration(200).style("top", "0px");
39006       select_default2(document).call(keybinding.unbind);
39007     };
39008     let modal = shaded.append("div").attr("class", "modal fillL");
39009     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
39010     if (!blocking) {
39011       shaded.on("click.remove-modal", (d3_event) => {
39012         if (d3_event.target === this) {
39013           shaded.close();
39014         }
39015       });
39016       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
39017       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
39018       select_default2(document).call(keybinding);
39019     }
39020     modal.append("div").attr("class", "content");
39021     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
39022     if (animate) {
39023       shaded.transition().style("opacity", 1);
39024     } else {
39025       shaded.style("opacity", 1);
39026     }
39027     return shaded;
39028     function moveFocusToFirst() {
39029       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
39030       if (node) {
39031         node.focus();
39032       } else {
39033         select_default2(this).node().blur();
39034       }
39035     }
39036     function moveFocusToLast() {
39037       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
39038       if (nodes.length) {
39039         nodes[nodes.length - 1].focus();
39040       } else {
39041         select_default2(this).node().blur();
39042       }
39043     }
39044   }
39045
39046   // modules/ui/loading.js
39047   function uiLoading(context) {
39048     let _modalSelection = select_default2(null);
39049     let _message = "";
39050     let _blocking = false;
39051     let loading = (selection2) => {
39052       _modalSelection = uiModal(selection2, _blocking);
39053       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
39054       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
39055       loadertext.append("h3").html(_message);
39056       _modalSelection.select("button.close").attr("class", "hide");
39057       return loading;
39058     };
39059     loading.message = function(val) {
39060       if (!arguments.length)
39061         return _message;
39062       _message = val;
39063       return loading;
39064     };
39065     loading.blocking = function(val) {
39066       if (!arguments.length)
39067         return _blocking;
39068       _blocking = val;
39069       return loading;
39070     };
39071     loading.close = () => {
39072       _modalSelection.remove();
39073     };
39074     loading.isShown = () => {
39075       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
39076     };
39077     return loading;
39078   }
39079
39080   // modules/core/history.js
39081   function coreHistory(context) {
39082     var dispatch10 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
39083     var lock = utilSessionMutex("lock");
39084     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
39085     var duration = 150;
39086     var _imageryUsed = [];
39087     var _photoOverlaysUsed = [];
39088     var _checkpoints = {};
39089     var _pausedGraph;
39090     var _stack;
39091     var _index;
39092     var _tree;
39093     function _act(actions, t) {
39094       actions = Array.prototype.slice.call(actions);
39095       var annotation;
39096       if (typeof actions[actions.length - 1] !== "function") {
39097         annotation = actions.pop();
39098       }
39099       var graph = _stack[_index].graph;
39100       for (var i2 = 0; i2 < actions.length; i2++) {
39101         graph = actions[i2](graph, t);
39102       }
39103       return {
39104         graph,
39105         annotation,
39106         imageryUsed: _imageryUsed,
39107         photoOverlaysUsed: _photoOverlaysUsed,
39108         transform: context.projection.transform(),
39109         selectedIDs: context.selectedIDs()
39110       };
39111     }
39112     function _perform(args, t) {
39113       var previous = _stack[_index].graph;
39114       _stack = _stack.slice(0, _index + 1);
39115       var actionResult = _act(args, t);
39116       _stack.push(actionResult);
39117       _index++;
39118       return change(previous);
39119     }
39120     function _replace(args, t) {
39121       var previous = _stack[_index].graph;
39122       var actionResult = _act(args, t);
39123       _stack[_index] = actionResult;
39124       return change(previous);
39125     }
39126     function _overwrite(args, t) {
39127       var previous = _stack[_index].graph;
39128       if (_index > 0) {
39129         _index--;
39130         _stack.pop();
39131       }
39132       _stack = _stack.slice(0, _index + 1);
39133       var actionResult = _act(args, t);
39134       _stack.push(actionResult);
39135       _index++;
39136       return change(previous);
39137     }
39138     function change(previous) {
39139       var difference = coreDifference(previous, history.graph());
39140       if (!_pausedGraph) {
39141         dispatch10.call("change", this, difference);
39142       }
39143       return difference;
39144     }
39145     function getKey(n2) {
39146       return "iD_" + window.location.origin + "_" + n2;
39147     }
39148     var history = {
39149       graph: function() {
39150         return _stack[_index].graph;
39151       },
39152       tree: function() {
39153         return _tree;
39154       },
39155       base: function() {
39156         return _stack[0].graph;
39157       },
39158       merge: function(entities) {
39159         var stack = _stack.map(function(state) {
39160           return state.graph;
39161         });
39162         _stack[0].graph.rebase(entities, stack, false);
39163         _tree.rebase(entities, false);
39164         dispatch10.call("merge", this, entities);
39165       },
39166       perform: function() {
39167         select_default2(document).interrupt("history.perform");
39168         var transitionable = false;
39169         var action0 = arguments[0];
39170         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
39171           transitionable = !!action0.transitionable;
39172         }
39173         if (transitionable) {
39174           var origArguments = arguments;
39175           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
39176             return function(t) {
39177               if (t < 1)
39178                 _overwrite([action0], t);
39179             };
39180           }).on("start", function() {
39181             _perform([action0], 0);
39182           }).on("end interrupt", function() {
39183             _overwrite(origArguments, 1);
39184           });
39185         } else {
39186           return _perform(arguments);
39187         }
39188       },
39189       replace: function() {
39190         select_default2(document).interrupt("history.perform");
39191         return _replace(arguments, 1);
39192       },
39193       overwrite: function() {
39194         select_default2(document).interrupt("history.perform");
39195         return _overwrite(arguments, 1);
39196       },
39197       pop: function(n2) {
39198         select_default2(document).interrupt("history.perform");
39199         var previous = _stack[_index].graph;
39200         if (isNaN(+n2) || +n2 < 0) {
39201           n2 = 1;
39202         }
39203         while (n2-- > 0 && _index > 0) {
39204           _index--;
39205           _stack.pop();
39206         }
39207         return change(previous);
39208       },
39209       undo: function() {
39210         select_default2(document).interrupt("history.perform");
39211         var previousStack = _stack[_index];
39212         var previous = previousStack.graph;
39213         while (_index > 0) {
39214           _index--;
39215           if (_stack[_index].annotation)
39216             break;
39217         }
39218         dispatch10.call("undone", this, _stack[_index], previousStack);
39219         return change(previous);
39220       },
39221       redo: function() {
39222         select_default2(document).interrupt("history.perform");
39223         var previousStack = _stack[_index];
39224         var previous = previousStack.graph;
39225         var tryIndex = _index;
39226         while (tryIndex < _stack.length - 1) {
39227           tryIndex++;
39228           if (_stack[tryIndex].annotation) {
39229             _index = tryIndex;
39230             dispatch10.call("redone", this, _stack[_index], previousStack);
39231             break;
39232           }
39233         }
39234         return change(previous);
39235       },
39236       pauseChangeDispatch: function() {
39237         if (!_pausedGraph) {
39238           _pausedGraph = _stack[_index].graph;
39239         }
39240       },
39241       resumeChangeDispatch: function() {
39242         if (_pausedGraph) {
39243           var previous = _pausedGraph;
39244           _pausedGraph = null;
39245           return change(previous);
39246         }
39247       },
39248       undoAnnotation: function() {
39249         var i2 = _index;
39250         while (i2 >= 0) {
39251           if (_stack[i2].annotation)
39252             return _stack[i2].annotation;
39253           i2--;
39254         }
39255       },
39256       redoAnnotation: function() {
39257         var i2 = _index + 1;
39258         while (i2 <= _stack.length - 1) {
39259           if (_stack[i2].annotation)
39260             return _stack[i2].annotation;
39261           i2++;
39262         }
39263       },
39264       intersects: function(extent) {
39265         return _tree.intersects(extent, _stack[_index].graph);
39266       },
39267       difference: function() {
39268         var base = _stack[0].graph;
39269         var head = _stack[_index].graph;
39270         return coreDifference(base, head);
39271       },
39272       changes: function(action) {
39273         var base = _stack[0].graph;
39274         var head = _stack[_index].graph;
39275         if (action) {
39276           head = action(head);
39277         }
39278         var difference = coreDifference(base, head);
39279         return {
39280           modified: difference.modified(),
39281           created: difference.created(),
39282           deleted: difference.deleted()
39283         };
39284       },
39285       hasChanges: function() {
39286         return this.difference().length() > 0;
39287       },
39288       imageryUsed: function(sources) {
39289         if (sources) {
39290           _imageryUsed = sources;
39291           return history;
39292         } else {
39293           var s = /* @__PURE__ */ new Set();
39294           _stack.slice(1, _index + 1).forEach(function(state) {
39295             state.imageryUsed.forEach(function(source) {
39296               if (source !== "Custom") {
39297                 s.add(source);
39298               }
39299             });
39300           });
39301           return Array.from(s);
39302         }
39303       },
39304       photoOverlaysUsed: function(sources) {
39305         if (sources) {
39306           _photoOverlaysUsed = sources;
39307           return history;
39308         } else {
39309           var s = /* @__PURE__ */ new Set();
39310           _stack.slice(1, _index + 1).forEach(function(state) {
39311             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
39312               state.photoOverlaysUsed.forEach(function(photoOverlay) {
39313                 s.add(photoOverlay);
39314               });
39315             }
39316           });
39317           return Array.from(s);
39318         }
39319       },
39320       checkpoint: function(key) {
39321         _checkpoints[key] = {
39322           stack: _stack,
39323           index: _index
39324         };
39325         return history;
39326       },
39327       reset: function(key) {
39328         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
39329           _stack = _checkpoints[key].stack;
39330           _index = _checkpoints[key].index;
39331         } else {
39332           _stack = [{ graph: coreGraph() }];
39333           _index = 0;
39334           _tree = coreTree(_stack[0].graph);
39335           _checkpoints = {};
39336         }
39337         dispatch10.call("reset");
39338         dispatch10.call("change");
39339         return history;
39340       },
39341       toIntroGraph: function() {
39342         var nextID = { n: 0, r: 0, w: 0 };
39343         var permIDs = {};
39344         var graph = this.graph();
39345         var baseEntities = {};
39346         Object.values(graph.base().entities).forEach(function(entity) {
39347           var copy2 = copyIntroEntity(entity);
39348           baseEntities[copy2.id] = copy2;
39349         });
39350         Object.keys(graph.entities).forEach(function(id2) {
39351           var entity = graph.entities[id2];
39352           if (entity) {
39353             var copy2 = copyIntroEntity(entity);
39354             baseEntities[copy2.id] = copy2;
39355           } else {
39356             delete baseEntities[id2];
39357           }
39358         });
39359         Object.values(baseEntities).forEach(function(entity) {
39360           if (Array.isArray(entity.nodes)) {
39361             entity.nodes = entity.nodes.map(function(node) {
39362               return permIDs[node] || node;
39363             });
39364           }
39365           if (Array.isArray(entity.members)) {
39366             entity.members = entity.members.map(function(member) {
39367               member.id = permIDs[member.id] || member.id;
39368               return member;
39369             });
39370           }
39371         });
39372         return JSON.stringify({ dataIntroGraph: baseEntities });
39373         function copyIntroEntity(source) {
39374           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
39375           if (copy2.tags && !Object.keys(copy2.tags)) {
39376             delete copy2.tags;
39377           }
39378           if (Array.isArray(copy2.loc)) {
39379             copy2.loc[0] = +copy2.loc[0].toFixed(6);
39380             copy2.loc[1] = +copy2.loc[1].toFixed(6);
39381           }
39382           var match = source.id.match(/([nrw])-\d*/);
39383           if (match !== null) {
39384             var nrw = match[1];
39385             var permID;
39386             do {
39387               permID = nrw + ++nextID[nrw];
39388             } while (baseEntities.hasOwnProperty(permID));
39389             copy2.id = permIDs[source.id] = permID;
39390           }
39391           return copy2;
39392         }
39393       },
39394       toJSON: function() {
39395         if (!this.hasChanges())
39396           return;
39397         var allEntities = {};
39398         var baseEntities = {};
39399         var base = _stack[0];
39400         var s = _stack.map(function(i2) {
39401           var modified = [];
39402           var deleted = [];
39403           Object.keys(i2.graph.entities).forEach(function(id2) {
39404             var entity = i2.graph.entities[id2];
39405             if (entity) {
39406               var key = osmEntity.key(entity);
39407               allEntities[key] = entity;
39408               modified.push(key);
39409             } else {
39410               deleted.push(id2);
39411             }
39412             if (id2 in base.graph.entities) {
39413               baseEntities[id2] = base.graph.entities[id2];
39414             }
39415             if (entity && entity.nodes) {
39416               entity.nodes.forEach(function(nodeID) {
39417                 if (nodeID in base.graph.entities) {
39418                   baseEntities[nodeID] = base.graph.entities[nodeID];
39419                 }
39420               });
39421             }
39422             var baseParents = base.graph._parentWays[id2];
39423             if (baseParents) {
39424               baseParents.forEach(function(parentID) {
39425                 if (parentID in base.graph.entities) {
39426                   baseEntities[parentID] = base.graph.entities[parentID];
39427                 }
39428               });
39429             }
39430           });
39431           var x = {};
39432           if (modified.length)
39433             x.modified = modified;
39434           if (deleted.length)
39435             x.deleted = deleted;
39436           if (i2.imageryUsed)
39437             x.imageryUsed = i2.imageryUsed;
39438           if (i2.photoOverlaysUsed)
39439             x.photoOverlaysUsed = i2.photoOverlaysUsed;
39440           if (i2.annotation)
39441             x.annotation = i2.annotation;
39442           if (i2.transform)
39443             x.transform = i2.transform;
39444           if (i2.selectedIDs)
39445             x.selectedIDs = i2.selectedIDs;
39446           return x;
39447         });
39448         return JSON.stringify({
39449           version: 3,
39450           entities: Object.values(allEntities),
39451           baseEntities: Object.values(baseEntities),
39452           stack: s,
39453           nextIDs: osmEntity.id.next,
39454           index: _index,
39455           timestamp: new Date().getTime()
39456         });
39457       },
39458       fromJSON: function(json, loadChildNodes) {
39459         var h = JSON.parse(json);
39460         var loadComplete = true;
39461         osmEntity.id.next = h.nextIDs;
39462         _index = h.index;
39463         if (h.version === 2 || h.version === 3) {
39464           var allEntities = {};
39465           h.entities.forEach(function(entity) {
39466             allEntities[osmEntity.key(entity)] = osmEntity(entity);
39467           });
39468           if (h.version === 3) {
39469             var baseEntities = h.baseEntities.map(function(d) {
39470               return osmEntity(d);
39471             });
39472             var stack = _stack.map(function(state) {
39473               return state.graph;
39474             });
39475             _stack[0].graph.rebase(baseEntities, stack, true);
39476             _tree.rebase(baseEntities, true);
39477             if (loadChildNodes) {
39478               var osm = context.connection();
39479               var baseWays = baseEntities.filter(function(e) {
39480                 return e.type === "way";
39481               });
39482               var nodeIDs = baseWays.reduce(function(acc, way) {
39483                 return utilArrayUnion(acc, way.nodes);
39484               }, []);
39485               var missing = nodeIDs.filter(function(n2) {
39486                 return !_stack[0].graph.hasEntity(n2);
39487               });
39488               if (missing.length && osm) {
39489                 loadComplete = false;
39490                 context.map().redrawEnable(false);
39491                 var loading = uiLoading(context).blocking(true);
39492                 context.container().call(loading);
39493                 var childNodesLoaded = function(err, result) {
39494                   if (!err) {
39495                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
39496                     var visibles = visibleGroups.true || [];
39497                     var invisibles = visibleGroups.false || [];
39498                     if (visibles.length) {
39499                       var visibleIDs = visibles.map(function(entity) {
39500                         return entity.id;
39501                       });
39502                       var stack2 = _stack.map(function(state) {
39503                         return state.graph;
39504                       });
39505                       missing = utilArrayDifference(missing, visibleIDs);
39506                       _stack[0].graph.rebase(visibles, stack2, true);
39507                       _tree.rebase(visibles, true);
39508                     }
39509                     invisibles.forEach(function(entity) {
39510                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
39511                     });
39512                   }
39513                   if (err || !missing.length) {
39514                     loading.close();
39515                     context.map().redrawEnable(true);
39516                     dispatch10.call("change");
39517                     dispatch10.call("restore", this);
39518                   }
39519                 };
39520                 osm.loadMultiple(missing, childNodesLoaded);
39521               }
39522             }
39523           }
39524           _stack = h.stack.map(function(d) {
39525             var entities = {}, entity;
39526             if (d.modified) {
39527               d.modified.forEach(function(key) {
39528                 entity = allEntities[key];
39529                 entities[entity.id] = entity;
39530               });
39531             }
39532             if (d.deleted) {
39533               d.deleted.forEach(function(id2) {
39534                 entities[id2] = void 0;
39535               });
39536             }
39537             return {
39538               graph: coreGraph(_stack[0].graph).load(entities),
39539               annotation: d.annotation,
39540               imageryUsed: d.imageryUsed,
39541               photoOverlaysUsed: d.photoOverlaysUsed,
39542               transform: d.transform,
39543               selectedIDs: d.selectedIDs
39544             };
39545           });
39546         } else {
39547           _stack = h.stack.map(function(d) {
39548             var entities = {};
39549             for (var i2 in d.entities) {
39550               var entity = d.entities[i2];
39551               entities[i2] = entity === "undefined" ? void 0 : osmEntity(entity);
39552             }
39553             d.graph = coreGraph(_stack[0].graph).load(entities);
39554             return d;
39555           });
39556         }
39557         var transform2 = _stack[_index].transform;
39558         if (transform2) {
39559           context.map().transformEase(transform2, 0);
39560         }
39561         if (loadComplete) {
39562           dispatch10.call("change");
39563           dispatch10.call("restore", this);
39564         }
39565         return history;
39566       },
39567       lock: function() {
39568         return lock.lock();
39569       },
39570       unlock: function() {
39571         lock.unlock();
39572       },
39573       save: function() {
39574         if (lock.locked() && !_hasUnresolvedRestorableChanges) {
39575           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
39576           if (!success)
39577             dispatch10.call("storage_error");
39578         }
39579         return history;
39580       },
39581       clearSaved: function() {
39582         context.debouncedSave.cancel();
39583         if (lock.locked()) {
39584           _hasUnresolvedRestorableChanges = false;
39585           corePreferences(getKey("saved_history"), null);
39586           corePreferences("comment", null);
39587           corePreferences("hashtags", null);
39588           corePreferences("source", null);
39589         }
39590         return history;
39591       },
39592       savedHistoryJSON: function() {
39593         return corePreferences(getKey("saved_history"));
39594       },
39595       hasRestorableChanges: function() {
39596         return _hasUnresolvedRestorableChanges;
39597       },
39598       restore: function() {
39599         if (lock.locked()) {
39600           _hasUnresolvedRestorableChanges = false;
39601           var json = this.savedHistoryJSON();
39602           if (json)
39603             history.fromJSON(json, true);
39604         }
39605       },
39606       _getKey: getKey
39607     };
39608     history.reset();
39609     return utilRebind(history, dispatch10, "on");
39610   }
39611
39612   // modules/validations/index.js
39613   var validations_exports = {};
39614   __export(validations_exports, {
39615     validationAlmostJunction: () => validationAlmostJunction,
39616     validationCloseNodes: () => validationCloseNodes,
39617     validationCrossingWays: () => validationCrossingWays,
39618     validationDisconnectedWay: () => validationDisconnectedWay,
39619     validationFormatting: () => validationFormatting,
39620     validationHelpRequest: () => validationHelpRequest,
39621     validationImpossibleOneway: () => validationImpossibleOneway,
39622     validationIncompatibleSource: () => validationIncompatibleSource,
39623     validationMaprules: () => validationMaprules,
39624     validationMismatchedGeometry: () => validationMismatchedGeometry,
39625     validationMissingRole: () => validationMissingRole,
39626     validationMissingTag: () => validationMissingTag,
39627     validationOutdatedTags: () => validationOutdatedTags,
39628     validationPrivateData: () => validationPrivateData,
39629     validationSuspiciousName: () => validationSuspiciousName,
39630     validationUnsquareWay: () => validationUnsquareWay
39631   });
39632
39633   // modules/validations/almost_junction.js
39634   function validationAlmostJunction(context) {
39635     const type3 = "almost_junction";
39636     const EXTEND_TH_METERS = 5;
39637     const WELD_TH_METERS = 0.75;
39638     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
39639     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
39640     function isHighway(entity) {
39641       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
39642     }
39643     function isTaggedAsNotContinuing(node) {
39644       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
39645     }
39646     const validation = function checkAlmostJunction(entity, graph) {
39647       if (!isHighway(entity))
39648         return [];
39649       if (entity.isDegenerate())
39650         return [];
39651       const tree = context.history().tree();
39652       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
39653       let issues = [];
39654       extendableNodeInfos.forEach((extendableNodeInfo) => {
39655         issues.push(new validationIssue({
39656           type: type3,
39657           subtype: "highway-highway",
39658           severity: "warning",
39659           message: function(context2) {
39660             const entity1 = context2.hasEntity(this.entityIds[0]);
39661             if (this.entityIds[0] === this.entityIds[2]) {
39662               return entity1 ? _t.append("issues.almost_junction.self.message", {
39663                 feature: utilDisplayLabel(entity1, context2.graph())
39664               }) : "";
39665             } else {
39666               const entity2 = context2.hasEntity(this.entityIds[2]);
39667               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
39668                 feature: utilDisplayLabel(entity1, context2.graph()),
39669                 feature2: utilDisplayLabel(entity2, context2.graph())
39670               }) : "";
39671             }
39672           },
39673           reference: showReference,
39674           entityIds: [
39675             entity.id,
39676             extendableNodeInfo.node.id,
39677             extendableNodeInfo.wid
39678           ],
39679           loc: extendableNodeInfo.node.loc,
39680           hash: JSON.stringify(extendableNodeInfo.node.loc),
39681           data: {
39682             midId: extendableNodeInfo.mid.id,
39683             edge: extendableNodeInfo.edge,
39684             cross_loc: extendableNodeInfo.cross_loc
39685           },
39686           dynamicFixes: makeFixes
39687         }));
39688       });
39689       return issues;
39690       function makeFixes(context2) {
39691         let fixes = [new validationIssueFix({
39692           icon: "iD-icon-abutment",
39693           title: _t.append("issues.fix.connect_features.title"),
39694           onClick: function(context3) {
39695             const annotation = _t("issues.fix.connect_almost_junction.annotation");
39696             const [, endNodeId, crossWayId] = this.issue.entityIds;
39697             const midNode = context3.entity(this.issue.data.midId);
39698             const endNode = context3.entity(endNodeId);
39699             const crossWay = context3.entity(crossWayId);
39700             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
39701             if (nearEndNodes.length > 0) {
39702               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
39703               if (collinear) {
39704                 context3.perform(
39705                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
39706                   annotation
39707                 );
39708                 return;
39709               }
39710             }
39711             const targetEdge = this.issue.data.edge;
39712             const crossLoc = this.issue.data.cross_loc;
39713             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
39714             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
39715             if (closestNodeInfo.distance < WELD_TH_METERS) {
39716               context3.perform(
39717                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
39718                 annotation
39719               );
39720             } else {
39721               context3.perform(
39722                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
39723                 annotation
39724               );
39725             }
39726           }
39727         })];
39728         const node = context2.hasEntity(this.entityIds[1]);
39729         if (node && !node.hasInterestingTags()) {
39730           fixes.push(new validationIssueFix({
39731             icon: "maki-barrier",
39732             title: _t.append("issues.fix.tag_as_disconnected.title"),
39733             onClick: function(context3) {
39734               const nodeID = this.issue.entityIds[1];
39735               const tags = Object.assign({}, context3.entity(nodeID).tags);
39736               tags.noexit = "yes";
39737               context3.perform(
39738                 actionChangeTags(nodeID, tags),
39739                 _t("issues.fix.tag_as_disconnected.annotation")
39740               );
39741             }
39742           }));
39743         }
39744         return fixes;
39745       }
39746       function showReference(selection2) {
39747         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
39748       }
39749       function isExtendableCandidate(node, way) {
39750         const osm = services.osm;
39751         if (osm && !osm.isDataLoaded(node.loc)) {
39752           return false;
39753         }
39754         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
39755           return false;
39756         }
39757         let occurrences = 0;
39758         for (const index in way.nodes) {
39759           if (way.nodes[index] === node.id) {
39760             occurrences += 1;
39761             if (occurrences > 1) {
39762               return false;
39763             }
39764           }
39765         }
39766         return true;
39767       }
39768       function findConnectableEndNodesByExtension(way) {
39769         let results = [];
39770         if (way.isClosed())
39771           return results;
39772         let testNodes;
39773         const indices = [0, way.nodes.length - 1];
39774         indices.forEach((nodeIndex) => {
39775           const nodeID = way.nodes[nodeIndex];
39776           const node = graph.entity(nodeID);
39777           if (!isExtendableCandidate(node, way))
39778             return;
39779           const connectionInfo = canConnectByExtend(way, nodeIndex);
39780           if (!connectionInfo)
39781             return;
39782           testNodes = graph.childNodes(way).slice();
39783           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
39784           if (geoHasSelfIntersections(testNodes, nodeID))
39785             return;
39786           results.push(connectionInfo);
39787         });
39788         return results;
39789       }
39790       function findNearbyEndNodes(node, way) {
39791         return [
39792           way.nodes[0],
39793           way.nodes[way.nodes.length - 1]
39794         ].map((d) => graph.entity(d)).filter((d) => {
39795           return d.id !== node.id && geoSphericalDistance(node.loc, d.loc) <= CLOSE_NODE_TH;
39796         });
39797       }
39798       function findSmallJoinAngle(midNode, tipNode, endNodes) {
39799         let joinTo;
39800         let minAngle = Infinity;
39801         endNodes.forEach((endNode) => {
39802           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
39803           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
39804           const diff = Math.max(a1, a2) - Math.min(a1, a2);
39805           if (diff < minAngle) {
39806             joinTo = endNode;
39807             minAngle = diff;
39808           }
39809         });
39810         if (minAngle <= SIG_ANGLE_TH)
39811           return joinTo;
39812         return null;
39813       }
39814       function hasTag(tags, key) {
39815         return tags[key] !== void 0 && tags[key] !== "no";
39816       }
39817       function canConnectWays(way, way2) {
39818         if (way.id === way2.id)
39819           return true;
39820         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
39821           return false;
39822         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
39823           return false;
39824         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
39825         if (layer1 !== layer2)
39826           return false;
39827         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
39828         if (level1 !== level2)
39829           return false;
39830         return true;
39831       }
39832       function canConnectByExtend(way, endNodeIdx) {
39833         const tipNid = way.nodes[endNodeIdx];
39834         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
39835         const tipNode = graph.entity(tipNid);
39836         const midNode = graph.entity(midNid);
39837         const lon = tipNode.loc[0];
39838         const lat = tipNode.loc[1];
39839         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
39840         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
39841         const queryExtent = geoExtent([
39842           [lon - lon_range, lat - lat_range],
39843           [lon + lon_range, lat + lat_range]
39844         ]);
39845         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
39846         const t = EXTEND_TH_METERS / edgeLen + 1;
39847         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t);
39848         const segmentInfos = tree.waySegments(queryExtent, graph);
39849         for (let i2 = 0; i2 < segmentInfos.length; i2++) {
39850           let segmentInfo = segmentInfos[i2];
39851           let way2 = graph.entity(segmentInfo.wayId);
39852           if (!isHighway(way2))
39853             continue;
39854           if (!canConnectWays(way, way2))
39855             continue;
39856           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
39857           if (nAid === tipNid || nBid === tipNid)
39858             continue;
39859           let nA = graph.entity(nAid), nB = graph.entity(nBid);
39860           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
39861           if (crossLoc) {
39862             return {
39863               mid: midNode,
39864               node: tipNode,
39865               wid: way2.id,
39866               edge: [nA.id, nB.id],
39867               cross_loc: crossLoc
39868             };
39869           }
39870         }
39871         return null;
39872       }
39873     };
39874     validation.type = type3;
39875     return validation;
39876   }
39877
39878   // modules/validations/close_nodes.js
39879   function validationCloseNodes(context) {
39880     var type3 = "close_nodes";
39881     var pointThresholdMeters = 0.2;
39882     var validation = function(entity, graph) {
39883       if (entity.type === "node") {
39884         return getIssuesForNode(entity);
39885       } else if (entity.type === "way") {
39886         return getIssuesForWay(entity);
39887       }
39888       return [];
39889       function getIssuesForNode(node) {
39890         var parentWays = graph.parentWays(node);
39891         if (parentWays.length) {
39892           return getIssuesForVertex(node, parentWays);
39893         } else {
39894           return getIssuesForDetachedPoint(node);
39895         }
39896       }
39897       function wayTypeFor(way) {
39898         if (way.tags.boundary && way.tags.boundary !== "no")
39899           return "boundary";
39900         if (way.tags.indoor && way.tags.indoor !== "no")
39901           return "indoor";
39902         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
39903           return "building";
39904         if (osmPathHighwayTagValues[way.tags.highway])
39905           return "path";
39906         var parentRelations = graph.parentRelations(way);
39907         for (var i2 in parentRelations) {
39908           var relation = parentRelations[i2];
39909           if (relation.tags.type === "boundary")
39910             return "boundary";
39911           if (relation.isMultipolygon()) {
39912             if (relation.tags.indoor && relation.tags.indoor !== "no")
39913               return "indoor";
39914             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
39915               return "building";
39916           }
39917         }
39918         return "other";
39919       }
39920       function shouldCheckWay(way) {
39921         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
39922           return false;
39923         var bbox = way.extent(graph).bbox();
39924         var hypotenuseMeters = geoSphericalDistance([bbox.minX, bbox.minY], [bbox.maxX, bbox.maxY]);
39925         if (hypotenuseMeters < 1.5)
39926           return false;
39927         return true;
39928       }
39929       function getIssuesForWay(way) {
39930         if (!shouldCheckWay(way))
39931           return [];
39932         var issues = [], nodes = graph.childNodes(way);
39933         for (var i2 = 0; i2 < nodes.length - 1; i2++) {
39934           var node1 = nodes[i2];
39935           var node2 = nodes[i2 + 1];
39936           var issue = getWayIssueIfAny(node1, node2, way);
39937           if (issue)
39938             issues.push(issue);
39939         }
39940         return issues;
39941       }
39942       function getIssuesForVertex(node, parentWays) {
39943         var issues = [];
39944         function checkForCloseness(node1, node2, way) {
39945           var issue = getWayIssueIfAny(node1, node2, way);
39946           if (issue)
39947             issues.push(issue);
39948         }
39949         for (var i2 = 0; i2 < parentWays.length; i2++) {
39950           var parentWay = parentWays[i2];
39951           if (!shouldCheckWay(parentWay))
39952             continue;
39953           var lastIndex = parentWay.nodes.length - 1;
39954           for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
39955             if (j2 !== 0) {
39956               if (parentWay.nodes[j2 - 1] === node.id) {
39957                 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
39958               }
39959             }
39960             if (j2 !== lastIndex) {
39961               if (parentWay.nodes[j2 + 1] === node.id) {
39962                 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
39963               }
39964             }
39965           }
39966         }
39967         return issues;
39968       }
39969       function thresholdMetersForWay(way) {
39970         if (!shouldCheckWay(way))
39971           return 0;
39972         var wayType = wayTypeFor(way);
39973         if (wayType === "boundary")
39974           return 0;
39975         if (wayType === "indoor")
39976           return 0.01;
39977         if (wayType === "building")
39978           return 0.05;
39979         if (wayType === "path")
39980           return 0.1;
39981         return 0.2;
39982       }
39983       function getIssuesForDetachedPoint(node) {
39984         var issues = [];
39985         var lon = node.loc[0];
39986         var lat = node.loc[1];
39987         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
39988         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
39989         var queryExtent = geoExtent([
39990           [lon - lon_range, lat - lat_range],
39991           [lon + lon_range, lat + lat_range]
39992         ]);
39993         var intersected = context.history().tree().intersects(queryExtent, graph);
39994         for (var j2 = 0; j2 < intersected.length; j2++) {
39995           var nearby = intersected[j2];
39996           if (nearby.id === node.id)
39997             continue;
39998           if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
39999             continue;
40000           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
40001             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein")
40002               continue;
40003             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein")
40004               continue;
40005             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
40006             var zAxisDifferentiates = false;
40007             for (var key in zAxisKeys) {
40008               var nodeValue = node.tags[key] || "0";
40009               var nearbyValue = nearby.tags[key] || "0";
40010               if (nodeValue !== nearbyValue) {
40011                 zAxisDifferentiates = true;
40012                 break;
40013               }
40014             }
40015             if (zAxisDifferentiates)
40016               continue;
40017             issues.push(new validationIssue({
40018               type: type3,
40019               subtype: "detached",
40020               severity: "warning",
40021               message: function(context2) {
40022                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
40023                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
40024                   feature: utilDisplayLabel(entity2, context2.graph()),
40025                   feature2: utilDisplayLabel(entity22, context2.graph())
40026                 }) : "";
40027               },
40028               reference: showReference,
40029               entityIds: [node.id, nearby.id],
40030               dynamicFixes: function() {
40031                 return [
40032                   new validationIssueFix({
40033                     icon: "iD-operation-disconnect",
40034                     title: _t.append("issues.fix.move_points_apart.title")
40035                   }),
40036                   new validationIssueFix({
40037                     icon: "iD-icon-layers",
40038                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
40039                   })
40040                 ];
40041               }
40042             }));
40043           }
40044         }
40045         return issues;
40046         function showReference(selection2) {
40047           var referenceText = _t("issues.close_nodes.detached.reference");
40048           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
40049         }
40050       }
40051       function getWayIssueIfAny(node1, node2, way) {
40052         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
40053           return null;
40054         }
40055         if (node1.loc !== node2.loc) {
40056           var parentWays1 = graph.parentWays(node1);
40057           var parentWays2 = new Set(graph.parentWays(node2));
40058           var sharedWays = parentWays1.filter(function(parentWay) {
40059             return parentWays2.has(parentWay);
40060           });
40061           var thresholds = sharedWays.map(function(parentWay) {
40062             return thresholdMetersForWay(parentWay);
40063           });
40064           var threshold = Math.min(...thresholds);
40065           var distance = geoSphericalDistance(node1.loc, node2.loc);
40066           if (distance > threshold)
40067             return null;
40068         }
40069         return new validationIssue({
40070           type: type3,
40071           subtype: "vertices",
40072           severity: "warning",
40073           message: function(context2) {
40074             var entity2 = context2.hasEntity(this.entityIds[0]);
40075             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
40076           },
40077           reference: showReference,
40078           entityIds: [way.id, node1.id, node2.id],
40079           loc: node1.loc,
40080           dynamicFixes: function() {
40081             return [
40082               new validationIssueFix({
40083                 icon: "iD-icon-plus",
40084                 title: _t.append("issues.fix.merge_points.title"),
40085                 onClick: function(context2) {
40086                   var entityIds = this.issue.entityIds;
40087                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
40088                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
40089                 }
40090               }),
40091               new validationIssueFix({
40092                 icon: "iD-operation-disconnect",
40093                 title: _t.append("issues.fix.move_points_apart.title")
40094               })
40095             ];
40096           }
40097         });
40098         function showReference(selection2) {
40099           var referenceText = _t("issues.close_nodes.reference");
40100           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
40101         }
40102       }
40103     };
40104     validation.type = type3;
40105     return validation;
40106   }
40107
40108   // modules/validations/crossing_ways.js
40109   function validationCrossingWays(context) {
40110     var type3 = "crossing_ways";
40111     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
40112       if (getFeatureType(way, graph) === null) {
40113         var parentRels = graph.parentRelations(way);
40114         for (var i2 = 0; i2 < parentRels.length; i2++) {
40115           var rel = parentRels[i2];
40116           if (getFeatureType(rel, graph) !== null) {
40117             return rel;
40118           }
40119         }
40120       }
40121       return way;
40122     }
40123     function hasTag(tags, key) {
40124       return tags[key] !== void 0 && tags[key] !== "no";
40125     }
40126     function taggedAsIndoor(tags) {
40127       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
40128     }
40129     function allowsBridge(featureType) {
40130       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
40131     }
40132     function allowsTunnel(featureType) {
40133       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
40134     }
40135     var ignoredBuildings = {
40136       demolished: true,
40137       dismantled: true,
40138       proposed: true,
40139       razed: true
40140     };
40141     function getFeatureType(entity, graph) {
40142       var geometry = entity.geometry(graph);
40143       if (geometry !== "line" && geometry !== "area")
40144         return null;
40145       var tags = entity.tags;
40146       if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
40147         return "building";
40148       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
40149         return "highway";
40150       if (geometry !== "line")
40151         return null;
40152       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
40153         return "railway";
40154       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
40155         return "waterway";
40156       return null;
40157     }
40158     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
40159       var level1 = tags1.level || "0";
40160       var level2 = tags2.level || "0";
40161       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
40162         return true;
40163       }
40164       var layer1 = tags1.layer || "0";
40165       var layer2 = tags2.layer || "0";
40166       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
40167         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
40168           return true;
40169         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
40170           return true;
40171         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
40172           return true;
40173       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
40174         return true;
40175       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
40176         return true;
40177       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
40178         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
40179           return true;
40180         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
40181           return true;
40182         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
40183           return true;
40184       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
40185         return true;
40186       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
40187         return true;
40188       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
40189         return true;
40190       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
40191         return true;
40192       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
40193         if (layer1 !== layer2)
40194           return true;
40195       }
40196       return false;
40197     }
40198     var highwaysDisallowingFords = {
40199       motorway: true,
40200       motorway_link: true,
40201       trunk: true,
40202       trunk_link: true,
40203       primary: true,
40204       primary_link: true,
40205       secondary: true,
40206       secondary_link: true
40207     };
40208     var nonCrossingHighways = { track: true };
40209     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph) {
40210       var featureType1 = getFeatureType(entity1, graph);
40211       var featureType2 = getFeatureType(entity2, graph);
40212       var geometry1 = entity1.geometry(graph);
40213       var geometry2 = entity2.geometry(graph);
40214       var bothLines = geometry1 === "line" && geometry2 === "line";
40215       if (featureType1 === featureType2) {
40216         if (featureType1 === "highway") {
40217           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
40218           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
40219           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
40220             var roadFeature = entity1IsPath ? entity2 : entity1;
40221             if (nonCrossingHighways[roadFeature.tags.highway]) {
40222               return {};
40223             }
40224             var pathFeature = entity1IsPath ? entity1 : entity2;
40225             if (["marked", "unmarked", "traffic_signals"].indexOf(pathFeature.tags.crossing) !== -1) {
40226               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
40227             }
40228             return bothLines ? { highway: "crossing" } : {};
40229           }
40230           return {};
40231         }
40232         if (featureType1 === "waterway")
40233           return {};
40234         if (featureType1 === "railway")
40235           return {};
40236       } else {
40237         var featureTypes = [featureType1, featureType2];
40238         if (featureTypes.indexOf("highway") !== -1) {
40239           if (featureTypes.indexOf("railway") !== -1) {
40240             if (!bothLines)
40241               return {};
40242             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
40243             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
40244               if (isTram)
40245                 return { railway: "tram_crossing" };
40246               return { railway: "crossing" };
40247             } else {
40248               if (isTram)
40249                 return { railway: "tram_level_crossing" };
40250               return { railway: "level_crossing" };
40251             }
40252           }
40253           if (featureTypes.indexOf("waterway") !== -1) {
40254             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
40255               return null;
40256             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
40257               return null;
40258             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
40259               return null;
40260             }
40261             return bothLines ? { ford: "yes" } : {};
40262           }
40263         }
40264       }
40265       return null;
40266     }
40267     function findCrossingsByWay(way1, graph, tree) {
40268       var edgeCrossInfos = [];
40269       if (way1.type !== "way")
40270         return edgeCrossInfos;
40271       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
40272       var way1FeatureType = getFeatureType(taggedFeature1, graph);
40273       if (way1FeatureType === null)
40274         return edgeCrossInfos;
40275       var checkedSingleCrossingWays = {};
40276       var i2, j2;
40277       var extent;
40278       var n1, n2, nA, nB, nAId, nBId;
40279       var segment1, segment2;
40280       var oneOnly;
40281       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
40282       var way1Nodes = graph.childNodes(way1);
40283       var comparedWays = {};
40284       for (i2 = 0; i2 < way1Nodes.length - 1; i2++) {
40285         n1 = way1Nodes[i2];
40286         n2 = way1Nodes[i2 + 1];
40287         extent = geoExtent([
40288           [
40289             Math.min(n1.loc[0], n2.loc[0]),
40290             Math.min(n1.loc[1], n2.loc[1])
40291           ],
40292           [
40293             Math.max(n1.loc[0], n2.loc[0]),
40294             Math.max(n1.loc[1], n2.loc[1])
40295           ]
40296         ]);
40297         segmentInfos = tree.waySegments(extent, graph);
40298         for (j2 = 0; j2 < segmentInfos.length; j2++) {
40299           segment2Info = segmentInfos[j2];
40300           if (segment2Info.wayId === way1.id)
40301             continue;
40302           if (checkedSingleCrossingWays[segment2Info.wayId])
40303             continue;
40304           comparedWays[segment2Info.wayId] = true;
40305           way2 = graph.hasEntity(segment2Info.wayId);
40306           if (!way2)
40307             continue;
40308           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
40309           way2FeatureType = getFeatureType(taggedFeature2, graph);
40310           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
40311             continue;
40312           }
40313           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
40314           nAId = segment2Info.nodes[0];
40315           nBId = segment2Info.nodes[1];
40316           if (nAId === n1.id || nAId === n2.id || nBId === n1.id || nBId === n2.id) {
40317             continue;
40318           }
40319           nA = graph.hasEntity(nAId);
40320           if (!nA)
40321             continue;
40322           nB = graph.hasEntity(nBId);
40323           if (!nB)
40324             continue;
40325           segment1 = [n1.loc, n2.loc];
40326           segment2 = [nA.loc, nB.loc];
40327           var point = geoLineIntersection(segment1, segment2);
40328           if (point) {
40329             edgeCrossInfos.push({
40330               wayInfos: [
40331                 {
40332                   way: way1,
40333                   featureType: way1FeatureType,
40334                   edge: [n1.id, n2.id]
40335                 },
40336                 {
40337                   way: way2,
40338                   featureType: way2FeatureType,
40339                   edge: [nA.id, nB.id]
40340                 }
40341               ],
40342               crossPoint: point
40343             });
40344             if (oneOnly) {
40345               checkedSingleCrossingWays[way2.id] = true;
40346               break;
40347             }
40348           }
40349         }
40350       }
40351       return edgeCrossInfos;
40352     }
40353     function waysToCheck(entity, graph) {
40354       var featureType = getFeatureType(entity, graph);
40355       if (!featureType)
40356         return [];
40357       if (entity.type === "way") {
40358         return [entity];
40359       } else if (entity.type === "relation") {
40360         return entity.members.reduce(function(array2, member) {
40361           if (member.type === "way" && (!member.role || member.role === "outer" || member.role === "inner")) {
40362             var entity2 = graph.hasEntity(member.id);
40363             if (entity2 && array2.indexOf(entity2) === -1) {
40364               array2.push(entity2);
40365             }
40366           }
40367           return array2;
40368         }, []);
40369       }
40370       return [];
40371     }
40372     var validation = function checkCrossingWays(entity, graph) {
40373       var tree = context.history().tree();
40374       var ways = waysToCheck(entity, graph);
40375       var issues = [];
40376       var wayIndex, crossingIndex, crossings;
40377       for (wayIndex in ways) {
40378         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
40379         for (crossingIndex in crossings) {
40380           issues.push(createIssue(crossings[crossingIndex], graph));
40381         }
40382       }
40383       return issues;
40384     };
40385     function createIssue(crossing, graph) {
40386       crossing.wayInfos.sort(function(way1Info, way2Info) {
40387         var type1 = way1Info.featureType;
40388         var type22 = way2Info.featureType;
40389         if (type1 === type22) {
40390           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
40391         } else if (type1 === "waterway") {
40392           return true;
40393         } else if (type22 === "waterway") {
40394           return false;
40395         }
40396         return type1 < type22;
40397       });
40398       var entities = crossing.wayInfos.map(function(wayInfo) {
40399         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
40400       });
40401       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
40402       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
40403       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
40404       var featureType1 = crossing.wayInfos[0].featureType;
40405       var featureType2 = crossing.wayInfos[1].featureType;
40406       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
40407       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
40408       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
40409       var subtype = [featureType1, featureType2].sort().join("-");
40410       var crossingTypeID = subtype;
40411       if (isCrossingIndoors) {
40412         crossingTypeID = "indoor-indoor";
40413       } else if (isCrossingTunnels) {
40414         crossingTypeID = "tunnel-tunnel";
40415       } else if (isCrossingBridges) {
40416         crossingTypeID = "bridge-bridge";
40417       }
40418       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
40419         crossingTypeID += "_connectable";
40420       }
40421       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
40422       return new validationIssue({
40423         type: type3,
40424         subtype,
40425         severity: "warning",
40426         message: function(context2) {
40427           var graph2 = context2.graph();
40428           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
40429           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
40430             feature: utilDisplayLabel(entity1, graph2),
40431             feature2: utilDisplayLabel(entity2, graph2)
40432           }) : "";
40433         },
40434         reference: showReference,
40435         entityIds: entities.map(function(entity) {
40436           return entity.id;
40437         }),
40438         data: {
40439           edges,
40440           featureTypes,
40441           connectionTags
40442         },
40443         hash: uniqueID,
40444         loc: crossing.crossPoint,
40445         dynamicFixes: function(context2) {
40446           var mode = context2.mode();
40447           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
40448             return [];
40449           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
40450           var selectedFeatureType = this.data.featureTypes[selectedIndex];
40451           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
40452           var fixes = [];
40453           if (connectionTags) {
40454             fixes.push(makeConnectWaysFix(this.data.connectionTags));
40455           }
40456           if (isCrossingIndoors) {
40457             fixes.push(new validationIssueFix({
40458               icon: "iD-icon-layers",
40459               title: _t.append("issues.fix.use_different_levels.title")
40460             }));
40461           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
40462             fixes.push(makeChangeLayerFix("higher"));
40463             fixes.push(makeChangeLayerFix("lower"));
40464           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
40465             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
40466               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
40467             }
40468             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
40469             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
40470               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
40471             }
40472           }
40473           fixes.push(new validationIssueFix({
40474             icon: "iD-operation-move",
40475             title: _t.append("issues.fix.reposition_features.title")
40476           }));
40477           return fixes;
40478         }
40479       });
40480       function showReference(selection2) {
40481         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
40482       }
40483     }
40484     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
40485       return new validationIssueFix({
40486         icon: iconName,
40487         title: _t.append("issues.fix." + fixTitleID + ".title"),
40488         onClick: function(context2) {
40489           var mode = context2.mode();
40490           if (!mode || mode.id !== "select")
40491             return;
40492           var selectedIDs = mode.selectedIDs();
40493           if (selectedIDs.length !== 1)
40494             return;
40495           var selectedWayID = selectedIDs[0];
40496           if (!context2.hasEntity(selectedWayID))
40497             return;
40498           var resultWayIDs = [selectedWayID];
40499           var edge, crossedEdge, crossedWayID;
40500           if (this.issue.entityIds[0] === selectedWayID) {
40501             edge = this.issue.data.edges[0];
40502             crossedEdge = this.issue.data.edges[1];
40503             crossedWayID = this.issue.entityIds[1];
40504           } else {
40505             edge = this.issue.data.edges[1];
40506             crossedEdge = this.issue.data.edges[0];
40507             crossedWayID = this.issue.entityIds[0];
40508           }
40509           var crossingLoc = this.issue.loc;
40510           var projection2 = context2.projection;
40511           var action = function actionAddStructure(graph) {
40512             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40513             var crossedWay = graph.hasEntity(crossedWayID);
40514             var structLengthMeters = crossedWay && crossedWay.tags.width && parseFloat(crossedWay.tags.width);
40515             if (!structLengthMeters) {
40516               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
40517             }
40518             if (structLengthMeters) {
40519               if (getFeatureType(crossedWay, graph) === "railway") {
40520                 structLengthMeters *= 2;
40521               }
40522             } else {
40523               structLengthMeters = 8;
40524             }
40525             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
40526             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
40527             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
40528             if (crossingAngle > Math.PI)
40529               crossingAngle -= Math.PI;
40530             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
40531             structLengthMeters += 4;
40532             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
40533             function geomToProj(geoPoint) {
40534               return [
40535                 geoLonToMeters(geoPoint[0], geoPoint[1]),
40536                 geoLatToMeters(geoPoint[1])
40537               ];
40538             }
40539             function projToGeom(projPoint) {
40540               var lat = geoMetersToLat(projPoint[1]);
40541               return [
40542                 geoMetersToLon(projPoint[0], lat),
40543                 lat
40544               ];
40545             }
40546             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
40547             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
40548             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
40549             var projectedCrossingLoc = geomToProj(crossingLoc);
40550             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
40551             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
40552               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
40553               return projToGeom([
40554                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
40555                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
40556               ]);
40557             }
40558             var endpointLocGetter1 = function(lengthMeters) {
40559               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
40560             };
40561             var endpointLocGetter2 = function(lengthMeters) {
40562               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
40563             };
40564             var minEdgeLengthMeters = 0.55;
40565             function determineEndpoint(edge2, endNode, locGetter) {
40566               var newNode;
40567               var idealLengthMeters = structLengthMeters / 2;
40568               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
40569               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
40570                 var idealNodeLoc = locGetter(idealLengthMeters);
40571                 newNode = osmNode();
40572                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
40573               } else {
40574                 var edgeCount = 0;
40575                 endNode.parentIntersectionWays(graph).forEach(function(way) {
40576                   way.nodes.forEach(function(nodeID) {
40577                     if (nodeID === endNode.id) {
40578                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
40579                         edgeCount += 1;
40580                       } else {
40581                         edgeCount += 2;
40582                       }
40583                     }
40584                   });
40585                 });
40586                 if (edgeCount >= 3) {
40587                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
40588                   if (insetLength > minEdgeLengthMeters) {
40589                     var insetNodeLoc = locGetter(insetLength);
40590                     newNode = osmNode();
40591                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
40592                   }
40593                 }
40594               }
40595               if (!newNode)
40596                 newNode = endNode;
40597               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
40598               graph = splitAction(graph);
40599               if (splitAction.getCreatedWayIDs().length) {
40600                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
40601               }
40602               return newNode;
40603             }
40604             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
40605             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
40606             var structureWay = resultWayIDs.map(function(id2) {
40607               return graph.entity(id2);
40608             }).find(function(way) {
40609               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
40610             });
40611             var tags = Object.assign({}, structureWay.tags);
40612             if (bridgeOrTunnel === "bridge") {
40613               tags.bridge = "yes";
40614               tags.layer = "1";
40615             } else {
40616               var tunnelValue = "yes";
40617               if (getFeatureType(structureWay, graph) === "waterway") {
40618                 tunnelValue = "culvert";
40619               }
40620               tags.tunnel = tunnelValue;
40621               tags.layer = "-1";
40622             }
40623             graph = actionChangeTags(structureWay.id, tags)(graph);
40624             return graph;
40625           };
40626           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
40627           context2.enter(modeSelect(context2, resultWayIDs));
40628         }
40629       });
40630     }
40631     function makeConnectWaysFix(connectionTags) {
40632       var fixTitleID = "connect_features";
40633       if (connectionTags.ford) {
40634         fixTitleID = "connect_using_ford";
40635       }
40636       return new validationIssueFix({
40637         icon: "iD-icon-crossing",
40638         title: _t.append("issues.fix." + fixTitleID + ".title"),
40639         onClick: function(context2) {
40640           var loc = this.issue.loc;
40641           var connectionTags2 = this.issue.data.connectionTags;
40642           var edges = this.issue.data.edges;
40643           context2.perform(
40644             function actionConnectCrossingWays(graph) {
40645               var node = osmNode({ loc, tags: connectionTags2 });
40646               graph = graph.replace(node);
40647               var nodesToMerge = [node.id];
40648               var mergeThresholdInMeters = 0.75;
40649               edges.forEach(function(edge) {
40650                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
40651                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
40652                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
40653                   nodesToMerge.push(nearby.node.id);
40654                 } else {
40655                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
40656                 }
40657               });
40658               if (nodesToMerge.length > 1) {
40659                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
40660               }
40661               return graph;
40662             },
40663             _t("issues.fix.connect_crossing_features.annotation")
40664           );
40665         }
40666       });
40667     }
40668     function makeChangeLayerFix(higherOrLower) {
40669       return new validationIssueFix({
40670         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
40671         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
40672         onClick: function(context2) {
40673           var mode = context2.mode();
40674           if (!mode || mode.id !== "select")
40675             return;
40676           var selectedIDs = mode.selectedIDs();
40677           if (selectedIDs.length !== 1)
40678             return;
40679           var selectedID = selectedIDs[0];
40680           if (!this.issue.entityIds.some(function(entityId) {
40681             return entityId === selectedID;
40682           }))
40683             return;
40684           var entity = context2.hasEntity(selectedID);
40685           if (!entity)
40686             return;
40687           var tags = Object.assign({}, entity.tags);
40688           var layer = tags.layer && Number(tags.layer);
40689           if (layer && !isNaN(layer)) {
40690             if (higherOrLower === "higher") {
40691               layer += 1;
40692             } else {
40693               layer -= 1;
40694             }
40695           } else {
40696             if (higherOrLower === "higher") {
40697               layer = 1;
40698             } else {
40699               layer = -1;
40700             }
40701           }
40702           tags.layer = layer.toString();
40703           context2.perform(
40704             actionChangeTags(entity.id, tags),
40705             _t("operations.change_tags.annotation")
40706           );
40707         }
40708       });
40709     }
40710     validation.type = type3;
40711     return validation;
40712   }
40713
40714   // modules/behavior/draw_way.js
40715   function behaviorDrawWay(context, wayID, mode, startGraph) {
40716     const keybinding = utilKeybinding("drawWay");
40717     var dispatch10 = dispatch_default("rejectedSelfIntersection");
40718     var behavior = behaviorDraw(context);
40719     var _nodeIndex;
40720     var _origWay;
40721     var _wayGeometry;
40722     var _headNodeID;
40723     var _annotation;
40724     var _pointerHasMoved = false;
40725     var _drawNode;
40726     var _didResolveTempEdit = false;
40727     function createDrawNode(loc) {
40728       _drawNode = osmNode({ loc });
40729       context.pauseChangeDispatch();
40730       context.replace(function actionAddDrawNode(graph) {
40731         var way = graph.entity(wayID);
40732         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
40733       }, _annotation);
40734       context.resumeChangeDispatch();
40735       setActiveElements();
40736     }
40737     function removeDrawNode() {
40738       context.pauseChangeDispatch();
40739       context.replace(
40740         function actionDeleteDrawNode(graph) {
40741           var way = graph.entity(wayID);
40742           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
40743         },
40744         _annotation
40745       );
40746       _drawNode = void 0;
40747       context.resumeChangeDispatch();
40748     }
40749     function keydown(d3_event) {
40750       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40751         if (context.surface().classed("nope")) {
40752           context.surface().classed("nope-suppressed", true);
40753         }
40754         context.surface().classed("nope", false).classed("nope-disabled", true);
40755       }
40756     }
40757     function keyup(d3_event) {
40758       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
40759         if (context.surface().classed("nope-suppressed")) {
40760           context.surface().classed("nope", true);
40761         }
40762         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
40763       }
40764     }
40765     function allowsVertex(d) {
40766       return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
40767     }
40768     function move(d3_event, datum2) {
40769       var loc = context.map().mouseCoordinates();
40770       if (!_drawNode)
40771         createDrawNode(loc);
40772       context.surface().classed("nope-disabled", d3_event.altKey);
40773       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
40774       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
40775       if (targetLoc) {
40776         loc = targetLoc;
40777       } else if (targetNodes) {
40778         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
40779         if (choice) {
40780           loc = choice.loc;
40781         }
40782       }
40783       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
40784       _drawNode = context.entity(_drawNode.id);
40785       checkGeometry(true);
40786     }
40787     function checkGeometry(includeDrawNode) {
40788       var nopeDisabled = context.surface().classed("nope-disabled");
40789       var isInvalid = isInvalidGeometry(includeDrawNode);
40790       if (nopeDisabled) {
40791         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
40792       } else {
40793         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
40794       }
40795     }
40796     function isInvalidGeometry(includeDrawNode) {
40797       var testNode = _drawNode;
40798       var parentWay = context.graph().entity(wayID);
40799       var nodes = context.graph().childNodes(parentWay).slice();
40800       if (includeDrawNode) {
40801         if (parentWay.isClosed()) {
40802           nodes.pop();
40803         }
40804       } else {
40805         if (parentWay.isClosed()) {
40806           if (nodes.length < 3)
40807             return false;
40808           if (_drawNode)
40809             nodes.splice(-2, 1);
40810           testNode = nodes[nodes.length - 2];
40811         } else {
40812           return false;
40813         }
40814       }
40815       return testNode && geoHasSelfIntersections(nodes, testNode.id);
40816     }
40817     function undone() {
40818       _didResolveTempEdit = true;
40819       context.pauseChangeDispatch();
40820       var nextMode;
40821       if (context.graph() === startGraph) {
40822         nextMode = modeSelect(context, [wayID]);
40823       } else {
40824         context.pop(1);
40825         nextMode = mode;
40826       }
40827       context.perform(actionNoop());
40828       context.pop(1);
40829       context.resumeChangeDispatch();
40830       context.enter(nextMode);
40831     }
40832     function setActiveElements() {
40833       if (!_drawNode)
40834         return;
40835       context.surface().selectAll("." + _drawNode.id).classed("active", true);
40836     }
40837     function resetToStartGraph() {
40838       while (context.graph() !== startGraph) {
40839         context.pop();
40840       }
40841     }
40842     var drawWay = function(surface) {
40843       _drawNode = void 0;
40844       _didResolveTempEdit = false;
40845       _origWay = context.entity(wayID);
40846       if (typeof _nodeIndex === "number") {
40847         _headNodeID = _origWay.nodes[_nodeIndex];
40848       } else if (_origWay.isClosed()) {
40849         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
40850       } else {
40851         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
40852       }
40853       _wayGeometry = _origWay.geometry(context.graph());
40854       _annotation = _t(
40855         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
40856       );
40857       _pointerHasMoved = false;
40858       context.pauseChangeDispatch();
40859       context.perform(actionNoop(), _annotation);
40860       context.resumeChangeDispatch();
40861       behavior.hover().initialNodeID(_headNodeID);
40862       behavior.on("move", function() {
40863         _pointerHasMoved = true;
40864         move.apply(this, arguments);
40865       }).on("down", function() {
40866         move.apply(this, arguments);
40867       }).on("downcancel", function() {
40868         if (_drawNode)
40869           removeDrawNode();
40870       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
40871       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
40872       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
40873       setActiveElements();
40874       surface.call(behavior);
40875       context.history().on("undone.draw", undone);
40876     };
40877     drawWay.off = function(surface) {
40878       if (!_didResolveTempEdit) {
40879         context.pauseChangeDispatch();
40880         resetToStartGraph();
40881         context.resumeChangeDispatch();
40882       }
40883       _drawNode = void 0;
40884       _nodeIndex = void 0;
40885       context.map().on("drawn.draw", null);
40886       surface.call(behavior.off).selectAll(".active").classed("active", false);
40887       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
40888       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
40889       context.history().on("undone.draw", null);
40890     };
40891     function attemptAdd(d, loc, doAdd) {
40892       if (_drawNode) {
40893         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
40894         _drawNode = context.entity(_drawNode.id);
40895       } else {
40896         createDrawNode(loc);
40897       }
40898       checkGeometry(true);
40899       if (d && d.properties && d.properties.nope || context.surface().classed("nope")) {
40900         if (!_pointerHasMoved) {
40901           removeDrawNode();
40902         }
40903         dispatch10.call("rejectedSelfIntersection", this);
40904         return;
40905       }
40906       context.pauseChangeDispatch();
40907       doAdd();
40908       _didResolveTempEdit = true;
40909       context.resumeChangeDispatch();
40910       context.enter(mode);
40911     }
40912     drawWay.add = function(loc, d) {
40913       attemptAdd(d, loc, function() {
40914       });
40915     };
40916     drawWay.addWay = function(loc, edge, d) {
40917       attemptAdd(d, loc, function() {
40918         context.replace(
40919           actionAddMidpoint({ loc, edge }, _drawNode),
40920           _annotation
40921         );
40922       });
40923     };
40924     drawWay.addNode = function(node, d) {
40925       if (node.id === _headNodeID || _origWay.isClosed() && node.id === _origWay.first()) {
40926         drawWay.finish();
40927         return;
40928       }
40929       attemptAdd(d, node.loc, function() {
40930         context.replace(
40931           function actionReplaceDrawNode(graph) {
40932             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
40933             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
40934           },
40935           _annotation
40936         );
40937       });
40938     };
40939     function getFeatureType(ways) {
40940       if (ways.every((way) => way.isClosed()))
40941         return "area";
40942       if (ways.every((way) => !way.isClosed()))
40943         return "line";
40944       return "generic";
40945     }
40946     function followMode() {
40947       if (_didResolveTempEdit)
40948         return;
40949       try {
40950         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
40951         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
40952         const historyGraph = context.history().graph();
40953         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
40954           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
40955           return;
40956         }
40957         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w) => w.id !== wayID);
40958         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w) => w.id !== wayID);
40959         const featureType = getFeatureType(lastNodesParents);
40960         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
40961           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
40962           return;
40963         }
40964         if (!secondLastNodesParents.some((n2) => n2.id === lastNodesParents[0].id)) {
40965           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
40966           return;
40967         }
40968         const way = lastNodesParents[0];
40969         const indexOfLast = way.nodes.indexOf(lastNodeId);
40970         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
40971         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
40972         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
40973         if (nextNodeIndex === -1)
40974           nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
40975         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
40976         drawWay.addNode(nextNode, {
40977           geometry: { type: "Point", coordinates: nextNode.loc },
40978           id: nextNode.id,
40979           properties: { target: true, entity: nextNode }
40980         });
40981       } catch (ex) {
40982         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
40983       }
40984     }
40985     keybinding.on(_t("operations.follow.key"), followMode);
40986     select_default2(document).call(keybinding);
40987     drawWay.finish = function() {
40988       checkGeometry(false);
40989       if (context.surface().classed("nope")) {
40990         dispatch10.call("rejectedSelfIntersection", this);
40991         return;
40992       }
40993       context.pauseChangeDispatch();
40994       context.pop(1);
40995       _didResolveTempEdit = true;
40996       context.resumeChangeDispatch();
40997       var way = context.hasEntity(wayID);
40998       if (!way || way.isDegenerate()) {
40999         drawWay.cancel();
41000         return;
41001       }
41002       window.setTimeout(function() {
41003         context.map().dblclickZoomEnable(true);
41004       }, 1e3);
41005       var isNewFeature = !mode.isContinuing;
41006       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
41007     };
41008     drawWay.cancel = function() {
41009       context.pauseChangeDispatch();
41010       resetToStartGraph();
41011       context.resumeChangeDispatch();
41012       window.setTimeout(function() {
41013         context.map().dblclickZoomEnable(true);
41014       }, 1e3);
41015       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
41016       context.enter(modeBrowse(context));
41017     };
41018     drawWay.nodeIndex = function(val) {
41019       if (!arguments.length)
41020         return _nodeIndex;
41021       _nodeIndex = val;
41022       return drawWay;
41023     };
41024     drawWay.activeID = function() {
41025       if (!arguments.length)
41026         return _drawNode && _drawNode.id;
41027       return drawWay;
41028     };
41029     return utilRebind(drawWay, dispatch10, "on");
41030   }
41031
41032   // modules/modes/draw_line.js
41033   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
41034     var mode = {
41035       button,
41036       id: "draw-line"
41037     };
41038     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
41039       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
41040     });
41041     mode.wayID = wayID;
41042     mode.isContinuing = continuing;
41043     mode.enter = function() {
41044       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
41045       context.install(behavior);
41046     };
41047     mode.exit = function() {
41048       context.uninstall(behavior);
41049     };
41050     mode.selectedIDs = function() {
41051       return [wayID];
41052     };
41053     mode.activeID = function() {
41054       return behavior && behavior.activeID() || [];
41055     };
41056     return mode;
41057   }
41058
41059   // modules/validations/disconnected_way.js
41060   function validationDisconnectedWay() {
41061     var type3 = "disconnected_way";
41062     function isTaggedAsHighway(entity) {
41063       return osmRoutableHighwayTagValues[entity.tags.highway];
41064     }
41065     var validation = function checkDisconnectedWay(entity, graph) {
41066       var routingIslandWays = routingIslandForEntity(entity);
41067       if (!routingIslandWays)
41068         return [];
41069       return [new validationIssue({
41070         type: type3,
41071         subtype: "highway",
41072         severity: "warning",
41073         message: function(context) {
41074           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
41075           var label = entity2 && utilDisplayLabel(entity2, context.graph());
41076           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
41077         },
41078         reference: showReference,
41079         entityIds: Array.from(routingIslandWays).map(function(way) {
41080           return way.id;
41081         }),
41082         dynamicFixes: makeFixes
41083       })];
41084       function makeFixes(context) {
41085         var fixes = [];
41086         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
41087         if (singleEntity) {
41088           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
41089             var textDirection = _mainLocalizer.textDirection();
41090             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
41091             if (startFix)
41092               fixes.push(startFix);
41093             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
41094             if (endFix)
41095               fixes.push(endFix);
41096           }
41097           if (!fixes.length) {
41098             fixes.push(new validationIssueFix({
41099               title: _t.append("issues.fix.connect_feature.title")
41100             }));
41101           }
41102           fixes.push(new validationIssueFix({
41103             icon: "iD-operation-delete",
41104             title: _t.append("issues.fix.delete_feature.title"),
41105             entityIds: [singleEntity.id],
41106             onClick: function(context2) {
41107               var id2 = this.issue.entityIds[0];
41108               var operation = operationDelete(context2, [id2]);
41109               if (!operation.disabled()) {
41110                 operation();
41111               }
41112             }
41113           }));
41114         } else {
41115           fixes.push(new validationIssueFix({
41116             title: _t.append("issues.fix.connect_features.title")
41117           }));
41118         }
41119         return fixes;
41120       }
41121       function showReference(selection2) {
41122         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
41123       }
41124       function routingIslandForEntity(entity2) {
41125         var routingIsland = /* @__PURE__ */ new Set();
41126         var waysToCheck = [];
41127         function queueParentWays(node) {
41128           graph.parentWays(node).forEach(function(parentWay) {
41129             if (!routingIsland.has(parentWay) && isRoutableWay(parentWay, false)) {
41130               routingIsland.add(parentWay);
41131               waysToCheck.push(parentWay);
41132             }
41133           });
41134         }
41135         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
41136           routingIsland.add(entity2);
41137           waysToCheck.push(entity2);
41138         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
41139           routingIsland.add(entity2);
41140           queueParentWays(entity2);
41141         } else {
41142           return null;
41143         }
41144         while (waysToCheck.length) {
41145           var wayToCheck = waysToCheck.pop();
41146           var childNodes = graph.childNodes(wayToCheck);
41147           for (var i2 in childNodes) {
41148             var vertex = childNodes[i2];
41149             if (isConnectedVertex(vertex)) {
41150               return null;
41151             }
41152             if (isRoutableNode(vertex)) {
41153               routingIsland.add(vertex);
41154             }
41155             queueParentWays(vertex);
41156           }
41157         }
41158         return routingIsland;
41159       }
41160       function isConnectedVertex(vertex) {
41161         var osm = services.osm;
41162         if (osm && !osm.isDataLoaded(vertex.loc))
41163           return true;
41164         if (vertex.tags.entrance && vertex.tags.entrance !== "no")
41165           return true;
41166         if (vertex.tags.amenity === "parking_entrance")
41167           return true;
41168         return false;
41169       }
41170       function isRoutableNode(node) {
41171         if (node.tags.highway === "elevator")
41172           return true;
41173         return false;
41174       }
41175       function isRoutableWay(way, ignoreInnerWays) {
41176         if (isTaggedAsHighway(way) || way.tags.route === "ferry")
41177           return true;
41178         return graph.parentRelations(way).some(function(parentRelation) {
41179           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
41180             return true;
41181           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
41182             return true;
41183           return false;
41184         });
41185       }
41186       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
41187         var vertex = graph.hasEntity(vertexID);
41188         if (!vertex || vertex.tags.noexit === "yes")
41189           return null;
41190         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
41191         return new validationIssueFix({
41192           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
41193           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
41194           entityIds: [vertexID],
41195           onClick: function(context) {
41196             var wayId = this.issue.entityIds[0];
41197             var way = context.hasEntity(wayId);
41198             var vertexId = this.entityIds[0];
41199             var vertex2 = context.hasEntity(vertexId);
41200             if (!way || !vertex2)
41201               return;
41202             var map2 = context.map();
41203             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
41204               map2.zoomToEase(vertex2);
41205             }
41206             context.enter(
41207               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
41208             );
41209           }
41210         });
41211       }
41212     };
41213     validation.type = type3;
41214     return validation;
41215   }
41216
41217   // modules/validations/invalid_format.js
41218   function validationFormatting() {
41219     var type3 = "invalid_format";
41220     var validation = function(entity) {
41221       var issues = [];
41222       function isValidEmail(email) {
41223         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
41224         return !email || valid_email.test(email);
41225       }
41226       function showReferenceEmail(selection2) {
41227         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
41228       }
41229       if (entity.tags.email) {
41230         var emails = entity.tags.email.split(";").map(function(s) {
41231           return s.trim();
41232         }).filter(function(x) {
41233           return !isValidEmail(x);
41234         });
41235         if (emails.length) {
41236           issues.push(new validationIssue({
41237             type: type3,
41238             subtype: "email",
41239             severity: "warning",
41240             message: function(context) {
41241               var entity2 = context.hasEntity(this.entityIds[0]);
41242               return entity2 ? _t.append(
41243                 "issues.invalid_format.email.message" + this.data,
41244                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
41245               ) : "";
41246             },
41247             reference: showReferenceEmail,
41248             entityIds: [entity.id],
41249             hash: emails.join(),
41250             data: emails.length > 1 ? "_multi" : ""
41251           }));
41252         }
41253       }
41254       return issues;
41255     };
41256     validation.type = type3;
41257     return validation;
41258   }
41259
41260   // modules/validations/help_request.js
41261   function validationHelpRequest(context) {
41262     var type3 = "help_request";
41263     var validation = function checkFixmeTag(entity) {
41264       if (!entity.tags.fixme)
41265         return [];
41266       if (entity.version === void 0)
41267         return [];
41268       if (entity.v !== void 0) {
41269         var baseEntity = context.history().base().hasEntity(entity.id);
41270         if (!baseEntity || !baseEntity.tags.fixme)
41271           return [];
41272       }
41273       return [new validationIssue({
41274         type: type3,
41275         subtype: "fixme_tag",
41276         severity: "warning",
41277         message: function(context2) {
41278           var entity2 = context2.hasEntity(this.entityIds[0]);
41279           return entity2 ? _t.append("issues.fixme_tag.message", {
41280             feature: utilDisplayLabel(entity2, context2.graph(), true)
41281           }) : "";
41282         },
41283         dynamicFixes: function() {
41284           return [
41285             new validationIssueFix({
41286               title: _t.append("issues.fix.address_the_concern.title")
41287             })
41288           ];
41289         },
41290         reference: showReference,
41291         entityIds: [entity.id]
41292       })];
41293       function showReference(selection2) {
41294         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
41295       }
41296     };
41297     validation.type = type3;
41298     return validation;
41299   }
41300
41301   // modules/validations/impossible_oneway.js
41302   function validationImpossibleOneway() {
41303     var type3 = "impossible_oneway";
41304     var validation = function checkImpossibleOneway(entity, graph) {
41305       if (entity.type !== "way" || entity.geometry(graph) !== "line")
41306         return [];
41307       if (entity.isClosed())
41308         return [];
41309       if (!typeForWay(entity))
41310         return [];
41311       if (!isOneway(entity))
41312         return [];
41313       var firstIssues = issuesForNode(entity, entity.first());
41314       var lastIssues = issuesForNode(entity, entity.last());
41315       return firstIssues.concat(lastIssues);
41316       function typeForWay(way) {
41317         if (way.geometry(graph) !== "line")
41318           return null;
41319         if (osmRoutableHighwayTagValues[way.tags.highway])
41320           return "highway";
41321         if (osmFlowingWaterwayTagValues[way.tags.waterway])
41322           return "waterway";
41323         return null;
41324       }
41325       function isOneway(way) {
41326         if (way.tags.oneway === "yes")
41327           return true;
41328         if (way.tags.oneway)
41329           return false;
41330         for (var key in way.tags) {
41331           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
41332             return true;
41333           }
41334         }
41335         return false;
41336       }
41337       function nodeOccursMoreThanOnce(way, nodeID) {
41338         var occurrences = 0;
41339         for (var index in way.nodes) {
41340           if (way.nodes[index] === nodeID) {
41341             occurrences += 1;
41342             if (occurrences > 1)
41343               return true;
41344           }
41345         }
41346         return false;
41347       }
41348       function isConnectedViaOtherTypes(way, node) {
41349         var wayType = typeForWay(way);
41350         if (wayType === "highway") {
41351           if (node.tags.entrance && node.tags.entrance !== "no")
41352             return true;
41353           if (node.tags.amenity === "parking_entrance")
41354             return true;
41355         } else if (wayType === "waterway") {
41356           if (node.id === way.first()) {
41357             if (node.tags.natural === "spring")
41358               return true;
41359           } else {
41360             if (node.tags.manhole === "drain")
41361               return true;
41362           }
41363         }
41364         return graph.parentWays(node).some(function(parentWay) {
41365           if (parentWay.id === way.id)
41366             return false;
41367           if (wayType === "highway") {
41368             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
41369               return true;
41370             if (parentWay.tags.route === "ferry")
41371               return true;
41372             return graph.parentRelations(parentWay).some(function(parentRelation) {
41373               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
41374                 return true;
41375               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
41376             });
41377           } else if (wayType === "waterway") {
41378             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
41379               return true;
41380           }
41381           return false;
41382         });
41383       }
41384       function issuesForNode(way, nodeID) {
41385         var isFirst = nodeID === way.first();
41386         var wayType = typeForWay(way);
41387         if (nodeOccursMoreThanOnce(way, nodeID))
41388           return [];
41389         var osm = services.osm;
41390         if (!osm)
41391           return [];
41392         var node = graph.hasEntity(nodeID);
41393         if (!node || !osm.isDataLoaded(node.loc))
41394           return [];
41395         if (isConnectedViaOtherTypes(way, node))
41396           return [];
41397         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
41398           if (parentWay.id === way.id)
41399             return false;
41400           return typeForWay(parentWay) === wayType;
41401         });
41402         if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
41403           return [];
41404         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
41405           return isOneway(attachedWay);
41406         });
41407         if (attachedOneways.length < attachedWaysOfSameType.length)
41408           return [];
41409         if (attachedOneways.length) {
41410           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
41411             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
41412               return true;
41413             if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
41414               return true;
41415             return false;
41416           });
41417           if (connectedEndpointsOkay)
41418             return [];
41419         }
41420         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
41421         if (wayType === "waterway") {
41422           messageID += "connected." + placement;
41423           referenceID += "connected";
41424         } else {
41425           messageID += placement;
41426           referenceID += placement;
41427         }
41428         return [new validationIssue({
41429           type: type3,
41430           subtype: wayType,
41431           severity: "warning",
41432           message: function(context) {
41433             var entity2 = context.hasEntity(this.entityIds[0]);
41434             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
41435               feature: utilDisplayLabel(entity2, context.graph())
41436             }) : "";
41437           },
41438           reference: getReference(referenceID),
41439           entityIds: [way.id, node.id],
41440           dynamicFixes: function() {
41441             var fixes = [];
41442             if (attachedOneways.length) {
41443               fixes.push(new validationIssueFix({
41444                 icon: "iD-operation-reverse",
41445                 title: _t.append("issues.fix.reverse_feature.title"),
41446                 entityIds: [way.id],
41447                 onClick: function(context) {
41448                   var id2 = this.issue.entityIds[0];
41449                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
41450                 }
41451               }));
41452             }
41453             if (node.tags.noexit !== "yes") {
41454               var textDirection = _mainLocalizer.textDirection();
41455               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
41456               fixes.push(new validationIssueFix({
41457                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
41458                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
41459                 onClick: function(context) {
41460                   var entityID = this.issue.entityIds[0];
41461                   var vertexID = this.issue.entityIds[1];
41462                   var way2 = context.entity(entityID);
41463                   var vertex = context.entity(vertexID);
41464                   continueDrawing(way2, vertex, context);
41465                 }
41466               }));
41467             }
41468             return fixes;
41469           },
41470           loc: node.loc
41471         })];
41472         function getReference(referenceID2) {
41473           return function showReference(selection2) {
41474             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
41475           };
41476         }
41477       }
41478     };
41479     function continueDrawing(way, vertex, context) {
41480       var map2 = context.map();
41481       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
41482         map2.zoomToEase(vertex);
41483       }
41484       context.enter(
41485         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
41486       );
41487     }
41488     validation.type = type3;
41489     return validation;
41490   }
41491
41492   // modules/validations/incompatible_source.js
41493   function validationIncompatibleSource() {
41494     const type3 = "incompatible_source";
41495     const incompatibleRules = [
41496       {
41497         id: "amap",
41498         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
41499       },
41500       {
41501         id: "baidu",
41502         regex: /(baidu|mapbar|百度)/i
41503       },
41504       {
41505         id: "google",
41506         regex: /google/i,
41507         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
41508       }
41509     ];
41510     const validation = function checkIncompatibleSource(entity) {
41511       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
41512       if (!entitySources)
41513         return [];
41514       const entityID = entity.id;
41515       return entitySources.map((source) => {
41516         const matchRule = incompatibleRules.find((rule) => {
41517           if (!rule.regex.test(source))
41518             return false;
41519           if (rule.exceptRegex && rule.exceptRegex.test(source))
41520             return false;
41521           return true;
41522         });
41523         if (!matchRule)
41524           return null;
41525         return new validationIssue({
41526           type: type3,
41527           severity: "warning",
41528           message: (context) => {
41529             const entity2 = context.hasEntity(entityID);
41530             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
41531               feature: utilDisplayLabel(entity2, context.graph(), true),
41532               value: source
41533             }) : "";
41534           },
41535           reference: getReference(matchRule.id),
41536           entityIds: [entityID],
41537           hash: source,
41538           dynamicFixes: () => {
41539             return [
41540               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
41541             ];
41542           }
41543         });
41544       }).filter(Boolean);
41545       function getReference(id2) {
41546         return function showReference(selection2) {
41547           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
41548         };
41549       }
41550     };
41551     validation.type = type3;
41552     return validation;
41553   }
41554
41555   // modules/validations/maprules.js
41556   function validationMaprules() {
41557     var type3 = "maprules";
41558     var validation = function checkMaprules(entity, graph) {
41559       if (!services.maprules)
41560         return [];
41561       var rules = services.maprules.validationRules();
41562       var issues = [];
41563       for (var i2 = 0; i2 < rules.length; i2++) {
41564         var rule = rules[i2];
41565         rule.findIssues(entity, graph, issues);
41566       }
41567       return issues;
41568     };
41569     validation.type = type3;
41570     return validation;
41571   }
41572
41573   // modules/validations/mismatched_geometry.js
41574   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
41575   function validationMismatchedGeometry() {
41576     var type3 = "mismatched_geometry";
41577     function tagSuggestingLineIsArea(entity) {
41578       if (entity.type !== "way" || entity.isClosed())
41579         return null;
41580       var tagSuggestingArea = entity.tagSuggestingArea();
41581       if (!tagSuggestingArea) {
41582         return null;
41583       }
41584       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
41585       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
41586       if (asLine && asArea && asLine === asArea) {
41587         return null;
41588       }
41589       return tagSuggestingArea;
41590     }
41591     function makeConnectEndpointsFixOnClick(way, graph) {
41592       if (way.nodes.length < 3)
41593         return null;
41594       var nodes = graph.childNodes(way), testNodes;
41595       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
41596       if (firstToLastDistanceMeters < 0.75) {
41597         testNodes = nodes.slice();
41598         testNodes.pop();
41599         testNodes.push(testNodes[0]);
41600         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41601           return function(context) {
41602             var way2 = context.entity(this.issue.entityIds[0]);
41603             context.perform(
41604               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
41605               _t("issues.fix.connect_endpoints.annotation")
41606             );
41607           };
41608         }
41609       }
41610       testNodes = nodes.slice();
41611       testNodes.push(testNodes[0]);
41612       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
41613         return function(context) {
41614           var wayId = this.issue.entityIds[0];
41615           var way2 = context.entity(wayId);
41616           var nodeId = way2.nodes[0];
41617           var index = way2.nodes.length;
41618           context.perform(
41619             actionAddVertex(wayId, nodeId, index),
41620             _t("issues.fix.connect_endpoints.annotation")
41621           );
41622         };
41623       }
41624     }
41625     function lineTaggedAsAreaIssue(entity) {
41626       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
41627       if (!tagSuggestingArea)
41628         return null;
41629       return new validationIssue({
41630         type: type3,
41631         subtype: "area_as_line",
41632         severity: "warning",
41633         message: function(context) {
41634           var entity2 = context.hasEntity(this.entityIds[0]);
41635           return entity2 ? _t.append("issues.tag_suggests_area.message", {
41636             feature: utilDisplayLabel(entity2, "area", true),
41637             tag: utilTagText({ tags: tagSuggestingArea })
41638           }) : "";
41639         },
41640         reference: showReference,
41641         entityIds: [entity.id],
41642         hash: JSON.stringify(tagSuggestingArea),
41643         dynamicFixes: function(context) {
41644           var fixes = [];
41645           var entity2 = context.entity(this.entityIds[0]);
41646           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
41647           fixes.push(new validationIssueFix({
41648             title: _t.append("issues.fix.connect_endpoints.title"),
41649             onClick: connectEndsOnClick
41650           }));
41651           fixes.push(new validationIssueFix({
41652             icon: "iD-operation-delete",
41653             title: _t.append("issues.fix.remove_tag.title"),
41654             onClick: function(context2) {
41655               var entityId = this.issue.entityIds[0];
41656               var entity3 = context2.entity(entityId);
41657               var tags = Object.assign({}, entity3.tags);
41658               for (var key in tagSuggestingArea) {
41659                 delete tags[key];
41660               }
41661               context2.perform(
41662                 actionChangeTags(entityId, tags),
41663                 _t("issues.fix.remove_tag.annotation")
41664               );
41665             }
41666           }));
41667           return fixes;
41668         }
41669       });
41670       function showReference(selection2) {
41671         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
41672       }
41673     }
41674     function vertexPointIssue(entity, graph) {
41675       if (entity.type !== "node")
41676         return null;
41677       if (Object.keys(entity.tags).length === 0)
41678         return null;
41679       if (entity.isOnAddressLine(graph))
41680         return null;
41681       var geometry = entity.geometry(graph);
41682       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
41683       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
41684         return new validationIssue({
41685           type: type3,
41686           subtype: "vertex_as_point",
41687           severity: "warning",
41688           message: function(context) {
41689             var entity2 = context.hasEntity(this.entityIds[0]);
41690             return entity2 ? _t.append("issues.vertex_as_point.message", {
41691               feature: utilDisplayLabel(entity2, "vertex", true)
41692             }) : "";
41693           },
41694           reference: function showReference(selection2) {
41695             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
41696           },
41697           entityIds: [entity.id]
41698         });
41699       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
41700         return new validationIssue({
41701           type: type3,
41702           subtype: "point_as_vertex",
41703           severity: "warning",
41704           message: function(context) {
41705             var entity2 = context.hasEntity(this.entityIds[0]);
41706             return entity2 ? _t.append("issues.point_as_vertex.message", {
41707               feature: utilDisplayLabel(entity2, "point", true)
41708             }) : "";
41709           },
41710           reference: function showReference(selection2) {
41711             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
41712           },
41713           entityIds: [entity.id],
41714           dynamicFixes: extractPointDynamicFixes
41715         });
41716       }
41717       return null;
41718     }
41719     function otherMismatchIssue(entity, graph) {
41720       if (!entity.hasInterestingTags())
41721         return null;
41722       if (entity.type !== "node" && entity.type !== "way")
41723         return null;
41724       if (entity.type === "node" && entity.isOnAddressLine(graph))
41725         return null;
41726       var sourceGeom = entity.geometry(graph);
41727       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
41728       if (sourceGeom === "area")
41729         targetGeoms.unshift("line");
41730       var asSource = _mainPresetIndex.match(entity, graph);
41731       var targetGeom = targetGeoms.find((nodeGeom) => {
41732         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
41733         if (!asSource || !asTarget || asSource === asTarget || (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
41734           return false;
41735         if (asTarget.isFallback())
41736           return false;
41737         var primaryKey = Object.keys(asTarget.tags)[0];
41738         if (primaryKey === "building")
41739           return false;
41740         if (asTarget.tags[primaryKey] === "*")
41741           return false;
41742         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
41743       });
41744       if (!targetGeom)
41745         return null;
41746       var subtype = targetGeom + "_as_" + sourceGeom;
41747       if (targetGeom === "vertex")
41748         targetGeom = "point";
41749       if (sourceGeom === "vertex")
41750         sourceGeom = "point";
41751       var referenceId = targetGeom + "_as_" + sourceGeom;
41752       var dynamicFixes;
41753       if (targetGeom === "point") {
41754         dynamicFixes = extractPointDynamicFixes;
41755       } else if (sourceGeom === "area" && targetGeom === "line") {
41756         dynamicFixes = lineToAreaDynamicFixes;
41757       }
41758       return new validationIssue({
41759         type: type3,
41760         subtype,
41761         severity: "warning",
41762         message: function(context) {
41763           var entity2 = context.hasEntity(this.entityIds[0]);
41764           return entity2 ? _t.append("issues." + referenceId + ".message", {
41765             feature: utilDisplayLabel(entity2, targetGeom, true)
41766           }) : "";
41767         },
41768         reference: function showReference(selection2) {
41769           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
41770         },
41771         entityIds: [entity.id],
41772         dynamicFixes
41773       });
41774     }
41775     function lineToAreaDynamicFixes(context) {
41776       var convertOnClick;
41777       var entityId = this.entityIds[0];
41778       var entity = context.entity(entityId);
41779       var tags = Object.assign({}, entity.tags);
41780       delete tags.area;
41781       if (!osmTagSuggestingArea(tags)) {
41782         convertOnClick = function(context2) {
41783           var entityId2 = this.issue.entityIds[0];
41784           var entity2 = context2.entity(entityId2);
41785           var tags2 = Object.assign({}, entity2.tags);
41786           if (tags2.area) {
41787             delete tags2.area;
41788           }
41789           context2.perform(
41790             actionChangeTags(entityId2, tags2),
41791             _t("issues.fix.convert_to_line.annotation")
41792           );
41793         };
41794       }
41795       return [
41796         new validationIssueFix({
41797           icon: "iD-icon-line",
41798           title: _t.append("issues.fix.convert_to_line.title"),
41799           onClick: convertOnClick
41800         })
41801       ];
41802     }
41803     function extractPointDynamicFixes(context) {
41804       var entityId = this.entityIds[0];
41805       var extractOnClick = null;
41806       if (!context.hasHiddenConnections(entityId)) {
41807         extractOnClick = function(context2) {
41808           var entityId2 = this.issue.entityIds[0];
41809           var action = actionExtract(entityId2, context2.projection);
41810           context2.perform(
41811             action,
41812             _t("operations.extract.annotation", { n: 1 })
41813           );
41814           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
41815         };
41816       }
41817       return [
41818         new validationIssueFix({
41819           icon: "iD-operation-extract",
41820           title: _t.append("issues.fix.extract_point.title"),
41821           onClick: extractOnClick
41822         })
41823       ];
41824     }
41825     function unclosedMultipolygonPartIssues(entity, graph) {
41826       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || !entity.isComplete(graph))
41827         return [];
41828       var sequences = osmJoinWays(entity.members, graph);
41829       var issues = [];
41830       for (var i2 in sequences) {
41831         var sequence = sequences[i2];
41832         if (!sequence.nodes)
41833           continue;
41834         var firstNode = sequence.nodes[0];
41835         var lastNode = sequence.nodes[sequence.nodes.length - 1];
41836         if (firstNode === lastNode)
41837           continue;
41838         var issue = new validationIssue({
41839           type: type3,
41840           subtype: "unclosed_multipolygon_part",
41841           severity: "warning",
41842           message: function(context) {
41843             var entity2 = context.hasEntity(this.entityIds[0]);
41844             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
41845               feature: utilDisplayLabel(entity2, context.graph(), true)
41846             }) : "";
41847           },
41848           reference: showReference,
41849           loc: sequence.nodes[0].loc,
41850           entityIds: [entity.id],
41851           hash: sequence.map(function(way) {
41852             return way.id;
41853           }).join()
41854         });
41855         issues.push(issue);
41856       }
41857       return issues;
41858       function showReference(selection2) {
41859         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
41860       }
41861     }
41862     var validation = function checkMismatchedGeometry(entity, graph) {
41863       var vertexPoint = vertexPointIssue(entity, graph);
41864       if (vertexPoint)
41865         return [vertexPoint];
41866       var lineAsArea = lineTaggedAsAreaIssue(entity);
41867       if (lineAsArea)
41868         return [lineAsArea];
41869       var mismatch = otherMismatchIssue(entity, graph);
41870       if (mismatch)
41871         return [mismatch];
41872       return unclosedMultipolygonPartIssues(entity, graph);
41873     };
41874     validation.type = type3;
41875     return validation;
41876   }
41877
41878   // modules/validations/missing_role.js
41879   function validationMissingRole() {
41880     var type3 = "missing_role";
41881     var validation = function checkMissingRole(entity, graph) {
41882       var issues = [];
41883       if (entity.type === "way") {
41884         graph.parentRelations(entity).forEach(function(relation) {
41885           if (!relation.isMultipolygon())
41886             return;
41887           var member = relation.memberById(entity.id);
41888           if (member && isMissingRole(member)) {
41889             issues.push(makeIssue(entity, relation, member));
41890           }
41891         });
41892       } else if (entity.type === "relation" && entity.isMultipolygon()) {
41893         entity.indexedMembers().forEach(function(member) {
41894           var way = graph.hasEntity(member.id);
41895           if (way && isMissingRole(member)) {
41896             issues.push(makeIssue(way, entity, member));
41897           }
41898         });
41899       }
41900       return issues;
41901     };
41902     function isMissingRole(member) {
41903       return !member.role || !member.role.trim().length;
41904     }
41905     function makeIssue(way, relation, member) {
41906       return new validationIssue({
41907         type: type3,
41908         severity: "warning",
41909         message: function(context) {
41910           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
41911           return member2 && relation2 ? _t.append("issues.missing_role.message", {
41912             member: utilDisplayLabel(member2, context.graph()),
41913             relation: utilDisplayLabel(relation2, context.graph())
41914           }) : "";
41915         },
41916         reference: showReference,
41917         entityIds: [relation.id, way.id],
41918         data: {
41919           member
41920         },
41921         hash: member.index.toString(),
41922         dynamicFixes: function() {
41923           return [
41924             makeAddRoleFix("inner"),
41925             makeAddRoleFix("outer"),
41926             new validationIssueFix({
41927               icon: "iD-operation-delete",
41928               title: _t.append("issues.fix.remove_from_relation.title"),
41929               onClick: function(context) {
41930                 context.perform(
41931                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
41932                   _t("operations.delete_member.annotation", {
41933                     n: 1
41934                   })
41935                 );
41936               }
41937             })
41938           ];
41939         }
41940       });
41941       function showReference(selection2) {
41942         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
41943       }
41944     }
41945     function makeAddRoleFix(role) {
41946       return new validationIssueFix({
41947         title: _t.append("issues.fix.set_as_" + role + ".title"),
41948         onClick: function(context) {
41949           var oldMember = this.issue.data.member;
41950           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
41951           context.perform(
41952             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
41953             _t("operations.change_role.annotation", {
41954               n: 1
41955             })
41956           );
41957         }
41958       });
41959     }
41960     validation.type = type3;
41961     return validation;
41962   }
41963
41964   // modules/validations/missing_tag.js
41965   function validationMissingTag(context) {
41966     var type3 = "missing_tag";
41967     function hasDescriptiveTags(entity, graph) {
41968       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
41969       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k) {
41970         if (k === "area" || !osmIsInterestingTag(k))
41971           return false;
41972         return !onlyAttributeKeys.some(function(attributeKey) {
41973           return k === attributeKey || k.indexOf(attributeKey + ":") === 0;
41974         });
41975       });
41976       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
41977         return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
41978       }
41979       return entityDescriptiveKeys.length > 0;
41980     }
41981     function isUnknownRoad(entity) {
41982       return entity.type === "way" && entity.tags.highway === "road";
41983     }
41984     function isUntypedRelation(entity) {
41985       return entity.type === "relation" && !entity.tags.type;
41986     }
41987     var validation = function checkMissingTag(entity, graph) {
41988       var subtype;
41989       var osm = context.connection();
41990       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
41991       if (!isUnloadedNode && entity.geometry(graph) !== "vertex" && !entity.hasParentRelations(graph)) {
41992         if (Object.keys(entity.tags).length === 0) {
41993           subtype = "any";
41994         } else if (!hasDescriptiveTags(entity, graph)) {
41995           subtype = "descriptive";
41996         } else if (isUntypedRelation(entity)) {
41997           subtype = "relation_type";
41998         }
41999       }
42000       if (!subtype && isUnknownRoad(entity)) {
42001         subtype = "highway_classification";
42002       }
42003       if (!subtype)
42004         return [];
42005       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
42006       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
42007       var canDelete = entity.version === void 0 || entity.v !== void 0;
42008       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
42009       return [new validationIssue({
42010         type: type3,
42011         subtype,
42012         severity,
42013         message: function(context2) {
42014           var entity2 = context2.hasEntity(this.entityIds[0]);
42015           return entity2 ? _t.append("issues." + messageID + ".message", {
42016             feature: utilDisplayLabel(entity2, context2.graph())
42017           }) : "";
42018         },
42019         reference: showReference,
42020         entityIds: [entity.id],
42021         dynamicFixes: function(context2) {
42022           var fixes = [];
42023           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
42024           fixes.push(new validationIssueFix({
42025             icon: "iD-icon-search",
42026             title: _t.append("issues.fix." + selectFixType + ".title"),
42027             onClick: function(context3) {
42028               context3.ui().sidebar.showPresetList();
42029             }
42030           }));
42031           var deleteOnClick;
42032           var id2 = this.entityIds[0];
42033           var operation = operationDelete(context2, [id2]);
42034           var disabledReasonID = operation.disabled();
42035           if (!disabledReasonID) {
42036             deleteOnClick = function(context3) {
42037               var id3 = this.issue.entityIds[0];
42038               var operation2 = operationDelete(context3, [id3]);
42039               if (!operation2.disabled()) {
42040                 operation2();
42041               }
42042             };
42043           }
42044           fixes.push(
42045             new validationIssueFix({
42046               icon: "iD-operation-delete",
42047               title: _t.append("issues.fix.delete_feature.title"),
42048               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
42049               onClick: deleteOnClick
42050             })
42051           );
42052           return fixes;
42053         }
42054       })];
42055       function showReference(selection2) {
42056         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
42057       }
42058     };
42059     validation.type = type3;
42060     return validation;
42061   }
42062
42063   // modules/validations/outdated_tags.js
42064   function validationOutdatedTags() {
42065     const type3 = "outdated_tags";
42066     let _waitingForDeprecated = true;
42067     let _dataDeprecated;
42068     _mainFileFetcher.get("deprecated").then((d) => _dataDeprecated = d).catch(() => {
42069     }).finally(() => _waitingForDeprecated = false);
42070     function oldTagIssues(entity, graph) {
42071       const oldTags = Object.assign({}, entity.tags);
42072       let preset = _mainPresetIndex.match(entity, graph);
42073       let subtype = "deprecated_tags";
42074       if (!preset)
42075         return [];
42076       if (!entity.hasInterestingTags())
42077         return [];
42078       if (preset.replacement) {
42079         const newPreset = _mainPresetIndex.item(preset.replacement);
42080         graph = actionChangePreset(entity.id, preset, newPreset, true)(graph);
42081         entity = graph.entity(entity.id);
42082         preset = newPreset;
42083       }
42084       if (_dataDeprecated) {
42085         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
42086         if (deprecatedTags.length) {
42087           deprecatedTags.forEach((tag) => {
42088             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
42089           });
42090           entity = graph.entity(entity.id);
42091         }
42092       }
42093       let newTags = Object.assign({}, entity.tags);
42094       if (preset.tags !== preset.addTags) {
42095         Object.keys(preset.addTags).forEach((k) => {
42096           if (!newTags[k]) {
42097             if (preset.addTags[k] === "*") {
42098               newTags[k] = "yes";
42099             } else {
42100               newTags[k] = preset.addTags[k];
42101             }
42102           }
42103         });
42104       }
42105       const nsi = services.nsi;
42106       let waitingForNsi = false;
42107       let nsiResult;
42108       if (nsi) {
42109         waitingForNsi = nsi.status() === "loading";
42110         if (!waitingForNsi) {
42111           const loc = entity.extent(graph).center();
42112           nsiResult = nsi.upgradeTags(newTags, loc);
42113           if (nsiResult) {
42114             newTags = nsiResult.newTags;
42115             subtype = "noncanonical_brand";
42116           }
42117         }
42118       }
42119       let issues = [];
42120       issues.provisional = _waitingForDeprecated || waitingForNsi;
42121       const tagDiff = utilTagDiff(oldTags, newTags);
42122       if (!tagDiff.length)
42123         return issues;
42124       const isOnlyAddingTags = tagDiff.every((d) => d.type === "+");
42125       let prefix = "";
42126       if (nsiResult) {
42127         prefix = "noncanonical_brand.";
42128       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
42129         subtype = "incomplete_tags";
42130         prefix = "incomplete.";
42131       }
42132       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
42133       issues.push(new validationIssue({
42134         type: type3,
42135         subtype,
42136         severity: "warning",
42137         message: showMessage,
42138         reference: showReference,
42139         entityIds: [entity.id],
42140         hash: utilHashcode(JSON.stringify(tagDiff)),
42141         dynamicFixes: () => {
42142           let fixes = [
42143             new validationIssueFix({
42144               autoArgs,
42145               title: _t.append("issues.fix.upgrade_tags.title"),
42146               onClick: (context) => {
42147                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
42148               }
42149             })
42150           ];
42151           const item = nsiResult && nsiResult.matched;
42152           if (item) {
42153             fixes.push(
42154               new validationIssueFix({
42155                 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
42156                 onClick: (context) => {
42157                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
42158                 }
42159               })
42160             );
42161           }
42162           return fixes;
42163         }
42164       }));
42165       return issues;
42166       function doUpgrade(graph2) {
42167         const currEntity = graph2.hasEntity(entity.id);
42168         if (!currEntity)
42169           return graph2;
42170         let newTags2 = Object.assign({}, currEntity.tags);
42171         tagDiff.forEach((diff) => {
42172           if (diff.type === "-") {
42173             delete newTags2[diff.key];
42174           } else if (diff.type === "+") {
42175             newTags2[diff.key] = diff.newVal;
42176           }
42177         });
42178         return actionChangeTags(currEntity.id, newTags2)(graph2);
42179       }
42180       function addNotTag(graph2) {
42181         const currEntity = graph2.hasEntity(entity.id);
42182         if (!currEntity)
42183           return graph2;
42184         const item = nsiResult && nsiResult.matched;
42185         if (!item)
42186           return graph2;
42187         let newTags2 = Object.assign({}, currEntity.tags);
42188         const wd = item.mainTag;
42189         const notwd = `not:${wd}`;
42190         const qid = item.tags[wd];
42191         newTags2[notwd] = qid;
42192         if (newTags2[wd] === qid) {
42193           const wp = item.mainTag.replace("wikidata", "wikipedia");
42194           delete newTags2[wd];
42195           delete newTags2[wp];
42196         }
42197         return actionChangeTags(currEntity.id, newTags2)(graph2);
42198       }
42199       function showMessage(context) {
42200         const currEntity = context.hasEntity(entity.id);
42201         if (!currEntity)
42202           return "";
42203         let messageID = `issues.outdated_tags.${prefix}message`;
42204         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
42205           messageID += "_incomplete";
42206         }
42207         return _t.append(messageID, {
42208           feature: utilDisplayLabel(currEntity, context.graph(), true)
42209         });
42210       }
42211       function showReference(selection2) {
42212         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
42213         enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
42214         enter.append("strong").call(_t.append("issues.suggested"));
42215         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d) => {
42216           let klass = d.type === "+" ? "add" : "remove";
42217           return `tagDiff-cell tagDiff-cell-${klass}`;
42218         }).html((d) => d.display);
42219       }
42220     }
42221     function oldMultipolygonIssues(entity, graph) {
42222       let multipolygon, outerWay;
42223       if (entity.type === "relation") {
42224         outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
42225         multipolygon = entity;
42226       } else if (entity.type === "way") {
42227         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
42228         outerWay = entity;
42229       } else {
42230         return [];
42231       }
42232       if (!multipolygon || !outerWay)
42233         return [];
42234       return [new validationIssue({
42235         type: type3,
42236         subtype: "old_multipolygon",
42237         severity: "warning",
42238         message: showMessage,
42239         reference: showReference,
42240         entityIds: [outerWay.id, multipolygon.id],
42241         dynamicFixes: () => {
42242           return [
42243             new validationIssueFix({
42244               autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
42245               title: _t.append("issues.fix.move_tags.title"),
42246               onClick: (context) => {
42247                 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
42248               }
42249             })
42250           ];
42251         }
42252       })];
42253       function doUpgrade(graph2) {
42254         let currMultipolygon = graph2.hasEntity(multipolygon.id);
42255         let currOuterWay = graph2.hasEntity(outerWay.id);
42256         if (!currMultipolygon || !currOuterWay)
42257           return graph2;
42258         currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
42259         graph2 = graph2.replace(currMultipolygon);
42260         return actionChangeTags(currOuterWay.id, {})(graph2);
42261       }
42262       function showMessage(context) {
42263         let currMultipolygon = context.hasEntity(multipolygon.id);
42264         if (!currMultipolygon)
42265           return "";
42266         return _t.append(
42267           "issues.old_multipolygon.message",
42268           { multipolygon: utilDisplayLabel(currMultipolygon, context.graph(), true) }
42269         );
42270       }
42271       function showReference(selection2) {
42272         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
42273       }
42274     }
42275     let validation = function checkOutdatedTags(entity, graph) {
42276       let issues = oldMultipolygonIssues(entity, graph);
42277       if (!issues.length)
42278         issues = oldTagIssues(entity, graph);
42279       return issues;
42280     };
42281     validation.type = type3;
42282     return validation;
42283   }
42284
42285   // modules/validations/private_data.js
42286   function validationPrivateData() {
42287     var type3 = "private_data";
42288     var privateBuildingValues = {
42289       detached: true,
42290       farm: true,
42291       house: true,
42292       houseboat: true,
42293       residential: true,
42294       semidetached_house: true,
42295       static_caravan: true
42296     };
42297     var publicKeys = {
42298       amenity: true,
42299       craft: true,
42300       historic: true,
42301       leisure: true,
42302       office: true,
42303       shop: true,
42304       tourism: true
42305     };
42306     var personalTags = {
42307       "contact:email": true,
42308       "contact:fax": true,
42309       "contact:phone": true,
42310       email: true,
42311       fax: true,
42312       phone: true
42313     };
42314     var validation = function checkPrivateData(entity) {
42315       var tags = entity.tags;
42316       if (!tags.building || !privateBuildingValues[tags.building])
42317         return [];
42318       var keepTags = {};
42319       for (var k in tags) {
42320         if (publicKeys[k])
42321           return [];
42322         if (!personalTags[k]) {
42323           keepTags[k] = tags[k];
42324         }
42325       }
42326       var tagDiff = utilTagDiff(tags, keepTags);
42327       if (!tagDiff.length)
42328         return [];
42329       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
42330       return [new validationIssue({
42331         type: type3,
42332         severity: "warning",
42333         message: showMessage,
42334         reference: showReference,
42335         entityIds: [entity.id],
42336         dynamicFixes: function() {
42337           return [
42338             new validationIssueFix({
42339               icon: "iD-operation-delete",
42340               title: _t.append("issues.fix." + fixID + ".title"),
42341               onClick: function(context) {
42342                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
42343               }
42344             })
42345           ];
42346         }
42347       })];
42348       function doUpgrade(graph) {
42349         var currEntity = graph.hasEntity(entity.id);
42350         if (!currEntity)
42351           return graph;
42352         var newTags = Object.assign({}, currEntity.tags);
42353         tagDiff.forEach(function(diff) {
42354           if (diff.type === "-") {
42355             delete newTags[diff.key];
42356           } else if (diff.type === "+") {
42357             newTags[diff.key] = diff.newVal;
42358           }
42359         });
42360         return actionChangeTags(currEntity.id, newTags)(graph);
42361       }
42362       function showMessage(context) {
42363         var currEntity = context.hasEntity(this.entityIds[0]);
42364         if (!currEntity)
42365           return "";
42366         return _t.append(
42367           "issues.private_data.contact.message",
42368           { feature: utilDisplayLabel(currEntity, context.graph()) }
42369         );
42370       }
42371       function showReference(selection2) {
42372         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
42373         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
42374         enter.append("strong").call(_t.append("issues.suggested"));
42375         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", function(d) {
42376           var klass = d.type === "+" ? "add" : "remove";
42377           return "tagDiff-cell tagDiff-cell-" + klass;
42378         }).html(function(d) {
42379           return d.display;
42380         });
42381       }
42382     };
42383     validation.type = type3;
42384     return validation;
42385   }
42386
42387   // modules/validations/suspicious_name.js
42388   function validationSuspiciousName() {
42389     const type3 = "suspicious_name";
42390     const keysToTestForGenericValues = [
42391       "aerialway",
42392       "aeroway",
42393       "amenity",
42394       "building",
42395       "craft",
42396       "highway",
42397       "leisure",
42398       "railway",
42399       "man_made",
42400       "office",
42401       "shop",
42402       "tourism",
42403       "waterway"
42404     ];
42405     let _waitingForNsi = false;
42406     function isGenericMatchInNsi(tags) {
42407       const nsi = services.nsi;
42408       if (nsi) {
42409         _waitingForNsi = nsi.status() === "loading";
42410         if (!_waitingForNsi) {
42411           return nsi.isGenericName(tags);
42412         }
42413       }
42414       return false;
42415     }
42416     function nameMatchesRawTag(lowercaseName, tags) {
42417       for (let i2 = 0; i2 < keysToTestForGenericValues.length; i2++) {
42418         let key = keysToTestForGenericValues[i2];
42419         let val = tags[key];
42420         if (val) {
42421           val = val.toLowerCase();
42422           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
42423             return true;
42424           }
42425         }
42426       }
42427       return false;
42428     }
42429     function isGenericName(name, tags) {
42430       name = name.toLowerCase();
42431       return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
42432     }
42433     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
42434       return new validationIssue({
42435         type: type3,
42436         subtype: "generic_name",
42437         severity: "warning",
42438         message: function(context) {
42439           let entity = context.hasEntity(this.entityIds[0]);
42440           if (!entity)
42441             return "";
42442           let preset = _mainPresetIndex.match(entity, context.graph());
42443           let langName = langCode && _mainLocalizer.languageName(langCode);
42444           return _t.append(
42445             "issues.generic_name.message" + (langName ? "_language" : ""),
42446             { feature: preset.name(), name: genericName, language: langName }
42447           );
42448         },
42449         reference: showReference,
42450         entityIds: [entityId],
42451         hash: `${nameKey}=${genericName}`,
42452         dynamicFixes: function() {
42453           return [
42454             new validationIssueFix({
42455               icon: "iD-operation-delete",
42456               title: _t.append("issues.fix.remove_the_name.title"),
42457               onClick: function(context) {
42458                 let entityId2 = this.issue.entityIds[0];
42459                 let entity = context.entity(entityId2);
42460                 let tags = Object.assign({}, entity.tags);
42461                 delete tags[nameKey];
42462                 context.perform(
42463                   actionChangeTags(entityId2, tags),
42464                   _t("issues.fix.remove_generic_name.annotation")
42465                 );
42466               }
42467             })
42468           ];
42469         }
42470       });
42471       function showReference(selection2) {
42472         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42473       }
42474     }
42475     function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
42476       return new validationIssue({
42477         type: type3,
42478         subtype: "not_name",
42479         severity: "warning",
42480         message: function(context) {
42481           const entity = context.hasEntity(this.entityIds[0]);
42482           if (!entity)
42483             return "";
42484           const preset = _mainPresetIndex.match(entity, context.graph());
42485           const langName = langCode && _mainLocalizer.languageName(langCode);
42486           return _t.append(
42487             "issues.incorrect_name.message" + (langName ? "_language" : ""),
42488             { feature: preset.name(), name: incorrectName, language: langName }
42489           );
42490         },
42491         reference: showReference,
42492         entityIds: [entityId],
42493         hash: `${nameKey}=${incorrectName}`,
42494         dynamicFixes: function() {
42495           return [
42496             new validationIssueFix({
42497               icon: "iD-operation-delete",
42498               title: _t.append("issues.fix.remove_the_name.title"),
42499               onClick: function(context) {
42500                 const entityId2 = this.issue.entityIds[0];
42501                 const entity = context.entity(entityId2);
42502                 let tags = Object.assign({}, entity.tags);
42503                 delete tags[nameKey];
42504                 context.perform(
42505                   actionChangeTags(entityId2, tags),
42506                   _t("issues.fix.remove_mistaken_name.annotation")
42507                 );
42508               }
42509             })
42510           ];
42511         }
42512       });
42513       function showReference(selection2) {
42514         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
42515       }
42516     }
42517     let validation = function checkGenericName(entity) {
42518       const tags = entity.tags;
42519       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
42520       if (hasWikidata)
42521         return [];
42522       let issues = [];
42523       const notNames2 = (tags["not:name"] || "").split(";");
42524       for (let key in tags) {
42525         const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
42526         if (!m)
42527           continue;
42528         const langCode = m.length >= 2 ? m[1] : null;
42529         const value = tags[key];
42530         if (notNames2.length) {
42531           for (let i2 in notNames2) {
42532             const notName = notNames2[i2];
42533             if (notName && value === notName) {
42534               issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
42535               continue;
42536             }
42537           }
42538         }
42539         if (isGenericName(value, tags)) {
42540           issues.provisional = _waitingForNsi;
42541           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
42542         }
42543       }
42544       return issues;
42545     };
42546     validation.type = type3;
42547     return validation;
42548   }
42549
42550   // modules/validations/unsquare_way.js
42551   function validationUnsquareWay(context) {
42552     var type3 = "unsquare_way";
42553     var DEFAULT_DEG_THRESHOLD = 5;
42554     var epsilon3 = 0.05;
42555     var nodeThreshold = 10;
42556     function isBuilding(entity, graph) {
42557       if (entity.type !== "way" || entity.geometry(graph) !== "area")
42558         return false;
42559       return entity.tags.building && entity.tags.building !== "no";
42560     }
42561     var validation = function checkUnsquareWay(entity, graph) {
42562       if (!isBuilding(entity, graph))
42563         return [];
42564       if (entity.tags.nonsquare === "yes")
42565         return [];
42566       var isClosed = entity.isClosed();
42567       if (!isClosed)
42568         return [];
42569       var nodes = graph.childNodes(entity).slice();
42570       if (nodes.length > nodeThreshold + 1)
42571         return [];
42572       var osm = services.osm;
42573       if (!osm || nodes.some(function(node) {
42574         return !osm.isDataLoaded(node.loc);
42575       }))
42576         return [];
42577       var hasConnectedSquarableWays = nodes.some(function(node) {
42578         return graph.parentWays(node).some(function(way) {
42579           if (way.id === entity.id)
42580             return false;
42581           if (isBuilding(way, graph))
42582             return true;
42583           return graph.parentRelations(way).some(function(parentRelation) {
42584             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
42585           });
42586         });
42587       });
42588       if (hasConnectedSquarableWays)
42589         return [];
42590       var storedDegreeThreshold = corePreferences("validate-square-degrees");
42591       var degreeThreshold = isNaN(storedDegreeThreshold) ? DEFAULT_DEG_THRESHOLD : parseFloat(storedDegreeThreshold);
42592       var points = nodes.map(function(node) {
42593         return context.projection(node.loc);
42594       });
42595       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
42596         return [];
42597       var autoArgs;
42598       if (!entity.tags.wikidata) {
42599         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
42600         autoAction.transitionable = false;
42601         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
42602       }
42603       return [new validationIssue({
42604         type: type3,
42605         subtype: "building",
42606         severity: "warning",
42607         message: function(context2) {
42608           var entity2 = context2.hasEntity(this.entityIds[0]);
42609           return entity2 ? _t.append("issues.unsquare_way.message", {
42610             feature: utilDisplayLabel(entity2, context2.graph())
42611           }) : "";
42612         },
42613         reference: showReference,
42614         entityIds: [entity.id],
42615         hash: degreeThreshold,
42616         dynamicFixes: function() {
42617           return [
42618             new validationIssueFix({
42619               icon: "iD-operation-orthogonalize",
42620               title: _t.append("issues.fix.square_feature.title"),
42621               autoArgs,
42622               onClick: function(context2, completionHandler) {
42623                 var entityId = this.issue.entityIds[0];
42624                 context2.perform(
42625                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
42626                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
42627                 );
42628                 window.setTimeout(function() {
42629                   completionHandler();
42630                 }, 175);
42631               }
42632             })
42633           ];
42634         }
42635       })];
42636       function showReference(selection2) {
42637         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
42638       }
42639     };
42640     validation.type = type3;
42641     return validation;
42642   }
42643
42644   // modules/core/validator.js
42645   function coreValidator(context) {
42646     let dispatch10 = dispatch_default("validated", "focusedIssue");
42647     let validator = utilRebind({}, dispatch10, "on");
42648     let _rules = {};
42649     let _disabledRules = {};
42650     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
42651     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
42652     let _baseCache = validationCache("base");
42653     let _headCache = validationCache("head");
42654     let _completeDiff = {};
42655     let _headIsCurrent = false;
42656     let _deferredRIC = {};
42657     let _deferredST = /* @__PURE__ */ new Set();
42658     let _headPromise;
42659     const RETRY = 5e3;
42660     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
42661     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
42662     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
42663     function parseHashParam(param) {
42664       let result = [];
42665       let rules = (param || "").split(",");
42666       rules.forEach((rule) => {
42667         rule = rule.trim();
42668         const parts = rule.split("/", 2);
42669         const type3 = parts[0];
42670         const subtype = parts[1] || "*";
42671         if (!type3 || !subtype)
42672           return;
42673         result.push({ type: makeRegExp(type3), subtype: makeRegExp(subtype) });
42674       });
42675       return result;
42676       function makeRegExp(str2) {
42677         const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
42678         return new RegExp("^" + escaped + "$");
42679       }
42680     }
42681     validator.init = () => {
42682       Object.values(validations_exports).forEach((validation) => {
42683         if (typeof validation !== "function")
42684           return;
42685         const fn = validation(context);
42686         const key = fn.type;
42687         _rules[key] = fn;
42688       });
42689       let disabledRules = corePreferences("validate-disabledRules");
42690       if (disabledRules) {
42691         disabledRules.split(",").forEach((k) => _disabledRules[k] = true);
42692       }
42693     };
42694     function reset(resetIgnored) {
42695       _baseCache.queue = [];
42696       _headCache.queue = [];
42697       Object.keys(_deferredRIC).forEach((key) => {
42698         window.cancelIdleCallback(key);
42699         _deferredRIC[key]();
42700       });
42701       _deferredRIC = {};
42702       _deferredST.forEach(window.clearTimeout);
42703       _deferredST.clear();
42704       if (resetIgnored)
42705         _ignoredIssueIDs.clear();
42706       _resolvedIssueIDs.clear();
42707       _baseCache = validationCache("base");
42708       _headCache = validationCache("head");
42709       _completeDiff = {};
42710       _headIsCurrent = false;
42711     }
42712     validator.reset = () => {
42713       reset(true);
42714     };
42715     validator.resetIgnoredIssues = () => {
42716       _ignoredIssueIDs.clear();
42717       dispatch10.call("validated");
42718     };
42719     validator.revalidateUnsquare = () => {
42720       revalidateUnsquare(_headCache);
42721       revalidateUnsquare(_baseCache);
42722       dispatch10.call("validated");
42723     };
42724     function revalidateUnsquare(cache) {
42725       const checkUnsquareWay = _rules.unsquare_way;
42726       if (!cache.graph || typeof checkUnsquareWay !== "function")
42727         return;
42728       cache.uncacheIssuesOfType("unsquare_way");
42729       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");
42730       buildings.forEach((entity) => {
42731         const detected = checkUnsquareWay(entity, cache.graph);
42732         if (!detected.length)
42733           return;
42734         cache.cacheIssues(detected);
42735       });
42736     }
42737     validator.getIssues = (options2) => {
42738       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
42739       const view = context.map().extent();
42740       let seen = /* @__PURE__ */ new Set();
42741       let results = [];
42742       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
42743         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
42744           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
42745           if (opts.what === "edited" && !userModified)
42746             return;
42747           if (!filter2(issue))
42748             return;
42749           seen.add(issue.id);
42750           results.push(issue);
42751         });
42752       }
42753       if (opts.what === "all") {
42754         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
42755           if (!filter2(issue))
42756             return;
42757           seen.add(issue.id);
42758           results.push(issue);
42759         });
42760       }
42761       return results;
42762       function filter2(issue) {
42763         if (!issue)
42764           return false;
42765         if (seen.has(issue.id))
42766           return false;
42767         if (_resolvedIssueIDs.has(issue.id))
42768           return false;
42769         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
42770           return false;
42771         if (!opts.includeDisabledRules && _disabledRules[issue.type])
42772           return false;
42773         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
42774           return false;
42775         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
42776           return false;
42777         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
42778           return false;
42779         if (opts.where === "visible") {
42780           const extent = issue.extent(context.graph());
42781           if (!view.intersects(extent))
42782             return false;
42783         }
42784         return true;
42785       }
42786     };
42787     validator.getResolvedIssues = () => {
42788       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
42789     };
42790     validator.focusIssue = (issue) => {
42791       const graph = context.graph();
42792       let selectID;
42793       let focusCenter;
42794       const issueExtent = issue.extent(graph);
42795       if (issueExtent) {
42796         focusCenter = issueExtent.center();
42797       }
42798       if (issue.entityIds && issue.entityIds.length) {
42799         selectID = issue.entityIds[0];
42800         if (selectID && selectID.charAt(0) === "r") {
42801           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
42802           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
42803           if (!nodeID) {
42804             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
42805             if (wayID) {
42806               nodeID = graph.entity(wayID).first();
42807             }
42808           }
42809           if (nodeID) {
42810             focusCenter = graph.entity(nodeID).loc;
42811           }
42812         }
42813       }
42814       if (focusCenter) {
42815         const setZoom = Math.max(context.map().zoom(), 19);
42816         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
42817       }
42818       if (selectID) {
42819         window.setTimeout(() => {
42820           context.enter(modeSelect(context, [selectID]));
42821           dispatch10.call("focusedIssue", this, issue);
42822         }, 250);
42823       }
42824     };
42825     validator.getIssuesBySeverity = (options2) => {
42826       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
42827       groups.error = groups.error || [];
42828       groups.warning = groups.warning || [];
42829       return groups;
42830     };
42831     validator.getSharedEntityIssues = (entityIDs, options2) => {
42832       const orderedIssueTypes = [
42833         "missing_tag",
42834         "missing_role",
42835         "outdated_tags",
42836         "mismatched_geometry",
42837         "crossing_ways",
42838         "almost_junction",
42839         "disconnected_way",
42840         "impossible_oneway"
42841       ];
42842       const allIssues = validator.getIssues(options2);
42843       const forEntityIDs = new Set(entityIDs);
42844       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
42845         if (issue1.type === issue2.type) {
42846           return issue1.id < issue2.id ? -1 : 1;
42847         }
42848         const index1 = orderedIssueTypes.indexOf(issue1.type);
42849         const index2 = orderedIssueTypes.indexOf(issue2.type);
42850         if (index1 !== -1 && index2 !== -1) {
42851           return index1 - index2;
42852         } else if (index1 === -1 && index2 === -1) {
42853           return issue1.type < issue2.type ? -1 : 1;
42854         } else {
42855           return index1 !== -1 ? -1 : 1;
42856         }
42857       });
42858     };
42859     validator.getEntityIssues = (entityID, options2) => {
42860       return validator.getSharedEntityIssues([entityID], options2);
42861     };
42862     validator.getRuleKeys = () => {
42863       return Object.keys(_rules);
42864     };
42865     validator.isRuleEnabled = (key) => {
42866       return !_disabledRules[key];
42867     };
42868     validator.toggleRule = (key) => {
42869       if (_disabledRules[key]) {
42870         delete _disabledRules[key];
42871       } else {
42872         _disabledRules[key] = true;
42873       }
42874       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
42875       validator.validate();
42876     };
42877     validator.disableRules = (keys) => {
42878       _disabledRules = {};
42879       keys.forEach((k) => _disabledRules[k] = true);
42880       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
42881       validator.validate();
42882     };
42883     validator.ignoreIssue = (issueID) => {
42884       _ignoredIssueIDs.add(issueID);
42885     };
42886     validator.validate = () => {
42887       const baseGraph = context.history().base();
42888       if (!_headCache.graph)
42889         _headCache.graph = baseGraph;
42890       if (!_baseCache.graph)
42891         _baseCache.graph = baseGraph;
42892       const prevGraph = _headCache.graph;
42893       const currGraph = context.graph();
42894       if (currGraph === prevGraph) {
42895         _headIsCurrent = true;
42896         dispatch10.call("validated");
42897         return Promise.resolve();
42898       }
42899       if (_headPromise) {
42900         _headIsCurrent = false;
42901         return _headPromise;
42902       }
42903       _headCache.graph = currGraph;
42904       _completeDiff = context.history().difference().complete();
42905       const incrementalDiff = coreDifference(prevGraph, currGraph);
42906       let entityIDs = Object.keys(incrementalDiff.complete());
42907       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
42908       if (!entityIDs.size) {
42909         dispatch10.call("validated");
42910         return Promise.resolve();
42911       }
42912       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch10.call("validated")).catch(() => {
42913       }).then(() => {
42914         _headPromise = null;
42915         if (!_headIsCurrent) {
42916           validator.validate();
42917         }
42918       });
42919       return _headPromise;
42920     };
42921     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
42922       reset(false);
42923       validator.validate();
42924     });
42925     context.on("exit.validator", validator.validate);
42926     context.history().on("merge.validator", (entities) => {
42927       if (!entities)
42928         return;
42929       const baseGraph = context.history().base();
42930       if (!_headCache.graph)
42931         _headCache.graph = baseGraph;
42932       if (!_baseCache.graph)
42933         _baseCache.graph = baseGraph;
42934       let entityIDs = entities.map((entity) => entity.id);
42935       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
42936       validateEntitiesAsync(entityIDs, _baseCache);
42937     });
42938     function validateEntity(entity, graph) {
42939       let result = { issues: [], provisional: false };
42940       Object.keys(_rules).forEach(runValidation);
42941       return result;
42942       function runValidation(key) {
42943         const fn = _rules[key];
42944         if (typeof fn !== "function") {
42945           console.error("no such validation rule = " + key);
42946           return;
42947         }
42948         let detected = fn(entity, graph);
42949         if (detected.provisional) {
42950           result.provisional = true;
42951         }
42952         detected = detected.filter(applySeverityOverrides);
42953         result.issues = result.issues.concat(detected);
42954         function applySeverityOverrides(issue) {
42955           const type3 = issue.type;
42956           const subtype = issue.subtype || "";
42957           let i2;
42958           for (i2 = 0; i2 < _errorOverrides.length; i2++) {
42959             if (_errorOverrides[i2].type.test(type3) && _errorOverrides[i2].subtype.test(subtype)) {
42960               issue.severity = "error";
42961               return true;
42962             }
42963           }
42964           for (i2 = 0; i2 < _warningOverrides.length; i2++) {
42965             if (_warningOverrides[i2].type.test(type3) && _warningOverrides[i2].subtype.test(subtype)) {
42966               issue.severity = "warning";
42967               return true;
42968             }
42969           }
42970           for (i2 = 0; i2 < _disableOverrides.length; i2++) {
42971             if (_disableOverrides[i2].type.test(type3) && _disableOverrides[i2].subtype.test(subtype)) {
42972               return false;
42973             }
42974           }
42975           return true;
42976         }
42977       }
42978     }
42979     function updateResolvedIssues(entityIDs) {
42980       entityIDs.forEach((entityID) => {
42981         const baseIssues = _baseCache.issuesByEntityID[entityID];
42982         if (!baseIssues)
42983           return;
42984         baseIssues.forEach((issueID) => {
42985           const issue = _baseCache.issuesByIssueID[issueID];
42986           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
42987           if (userModified && !_headCache.issuesByIssueID[issueID]) {
42988             _resolvedIssueIDs.add(issueID);
42989           } else {
42990             _resolvedIssueIDs.delete(issueID);
42991           }
42992         });
42993       });
42994     }
42995     function validateEntitiesAsync(entityIDs, cache) {
42996       const jobs = Array.from(entityIDs).map((entityID) => {
42997         if (cache.queuedEntityIDs.has(entityID))
42998           return null;
42999         cache.queuedEntityIDs.add(entityID);
43000         cache.uncacheEntityID(entityID);
43001         return () => {
43002           cache.queuedEntityIDs.delete(entityID);
43003           const graph = cache.graph;
43004           if (!graph)
43005             return;
43006           const entity = graph.hasEntity(entityID);
43007           if (!entity)
43008             return;
43009           const result = validateEntity(entity, graph);
43010           if (result.provisional) {
43011             cache.provisionalEntityIDs.add(entityID);
43012           }
43013           cache.cacheIssues(result.issues);
43014         };
43015       }).filter(Boolean);
43016       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
43017       if (cache.queuePromise)
43018         return cache.queuePromise;
43019       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
43020       }).finally(() => cache.queuePromise = null);
43021       return cache.queuePromise;
43022     }
43023     function revalidateProvisionalEntities(cache) {
43024       if (!cache.provisionalEntityIDs.size)
43025         return;
43026       const handle = window.setTimeout(() => {
43027         _deferredST.delete(handle);
43028         if (!cache.provisionalEntityIDs.size)
43029           return;
43030         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
43031       }, RETRY);
43032       _deferredST.add(handle);
43033     }
43034     function processQueue(cache) {
43035       if (!cache.queue.length)
43036         return Promise.resolve();
43037       const chunk = cache.queue.pop();
43038       return new Promise((resolvePromise, rejectPromise) => {
43039         const handle = window.requestIdleCallback(() => {
43040           delete _deferredRIC[handle];
43041           chunk.forEach((job) => job());
43042           resolvePromise();
43043         });
43044         _deferredRIC[handle] = rejectPromise;
43045       }).then(() => {
43046         if (cache.queue.length % 25 === 0)
43047           dispatch10.call("validated");
43048       }).then(() => processQueue(cache));
43049     }
43050     return validator;
43051   }
43052   function validationCache(which) {
43053     let cache = {
43054       which,
43055       graph: null,
43056       queue: [],
43057       queuePromise: null,
43058       queuedEntityIDs: /* @__PURE__ */ new Set(),
43059       provisionalEntityIDs: /* @__PURE__ */ new Set(),
43060       issuesByIssueID: {},
43061       issuesByEntityID: {}
43062     };
43063     cache.cacheIssue = (issue) => {
43064       (issue.entityIds || []).forEach((entityID) => {
43065         if (!cache.issuesByEntityID[entityID]) {
43066           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
43067         }
43068         cache.issuesByEntityID[entityID].add(issue.id);
43069       });
43070       cache.issuesByIssueID[issue.id] = issue;
43071     };
43072     cache.uncacheIssue = (issue) => {
43073       (issue.entityIds || []).forEach((entityID) => {
43074         if (cache.issuesByEntityID[entityID]) {
43075           cache.issuesByEntityID[entityID].delete(issue.id);
43076         }
43077       });
43078       delete cache.issuesByIssueID[issue.id];
43079     };
43080     cache.cacheIssues = (issues) => {
43081       issues.forEach(cache.cacheIssue);
43082     };
43083     cache.uncacheIssues = (issues) => {
43084       issues.forEach(cache.uncacheIssue);
43085     };
43086     cache.uncacheIssuesOfType = (type3) => {
43087       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type3);
43088       cache.uncacheIssues(issuesOfType);
43089     };
43090     cache.uncacheEntityID = (entityID) => {
43091       const entityIssueIDs = cache.issuesByEntityID[entityID];
43092       if (entityIssueIDs) {
43093         entityIssueIDs.forEach((issueID) => {
43094           const issue = cache.issuesByIssueID[issueID];
43095           if (issue) {
43096             cache.uncacheIssue(issue);
43097           } else {
43098             delete cache.issuesByIssueID[issueID];
43099           }
43100         });
43101       }
43102       delete cache.issuesByEntityID[entityID];
43103       cache.provisionalEntityIDs.delete(entityID);
43104     };
43105     cache.withAllRelatedEntities = (entityIDs) => {
43106       let result = /* @__PURE__ */ new Set();
43107       (entityIDs || []).forEach((entityID) => {
43108         result.add(entityID);
43109         const entityIssueIDs = cache.issuesByEntityID[entityID];
43110         if (entityIssueIDs) {
43111           entityIssueIDs.forEach((issueID) => {
43112             const issue = cache.issuesByIssueID[issueID];
43113             if (issue) {
43114               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
43115             } else {
43116               delete cache.issuesByIssueID[issueID];
43117             }
43118           });
43119         }
43120       });
43121       return result;
43122     };
43123     return cache;
43124   }
43125
43126   // modules/core/uploader.js
43127   function coreUploader(context) {
43128     var dispatch10 = dispatch_default(
43129       "saveStarted",
43130       "saveEnded",
43131       "willAttemptUpload",
43132       "progressChanged",
43133       "resultNoChanges",
43134       "resultErrors",
43135       "resultConflicts",
43136       "resultSuccess"
43137     );
43138     var _isSaving = false;
43139     var _conflicts = [];
43140     var _errors = [];
43141     var _origChanges;
43142     var _discardTags = {};
43143     _mainFileFetcher.get("discarded").then(function(d) {
43144       _discardTags = d;
43145     }).catch(function() {
43146     });
43147     var uploader = utilRebind({}, dispatch10, "on");
43148     uploader.isSaving = function() {
43149       return _isSaving;
43150     };
43151     uploader.save = function(changeset, tryAgain, checkConflicts) {
43152       if (_isSaving && !tryAgain) {
43153         return;
43154       }
43155       var osm = context.connection();
43156       if (!osm)
43157         return;
43158       if (!osm.authenticated()) {
43159         osm.authenticate(function(err) {
43160           if (!err) {
43161             uploader.save(changeset, tryAgain, checkConflicts);
43162           }
43163         });
43164         return;
43165       }
43166       if (!_isSaving) {
43167         _isSaving = true;
43168         dispatch10.call("saveStarted", this);
43169       }
43170       var history = context.history();
43171       _conflicts = [];
43172       _errors = [];
43173       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
43174       if (!tryAgain) {
43175         history.perform(actionNoop());
43176       }
43177       if (!checkConflicts) {
43178         upload(changeset);
43179       } else {
43180         performFullConflictCheck(changeset);
43181       }
43182     };
43183     function performFullConflictCheck(changeset) {
43184       var osm = context.connection();
43185       if (!osm)
43186         return;
43187       var history = context.history();
43188       var localGraph = context.graph();
43189       var remoteGraph = coreGraph(history.base(), true);
43190       var summary = history.difference().summary();
43191       var _toCheck = [];
43192       for (var i2 = 0; i2 < summary.length; i2++) {
43193         var item = summary[i2];
43194         if (item.changeType === "modified") {
43195           _toCheck.push(item.entity.id);
43196         }
43197       }
43198       var _toLoad = withChildNodes(_toCheck, localGraph);
43199       var _loaded = {};
43200       var _toLoadCount = 0;
43201       var _toLoadTotal = _toLoad.length;
43202       if (_toCheck.length) {
43203         dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
43204         _toLoad.forEach(function(id2) {
43205           _loaded[id2] = false;
43206         });
43207         osm.loadMultiple(_toLoad, loaded);
43208       } else {
43209         upload(changeset);
43210       }
43211       return;
43212       function withChildNodes(ids, graph) {
43213         var s = new Set(ids);
43214         ids.forEach(function(id2) {
43215           var entity = graph.entity(id2);
43216           if (entity.type !== "way")
43217             return;
43218           graph.childNodes(entity).forEach(function(child) {
43219             if (child.version !== void 0) {
43220               s.add(child.id);
43221             }
43222           });
43223         });
43224         return Array.from(s);
43225       }
43226       function loaded(err, result) {
43227         if (_errors.length)
43228           return;
43229         if (err) {
43230           _errors.push({
43231             msg: err.message || err.responseText,
43232             details: [_t("save.status_code", { code: err.status })]
43233           });
43234           didResultInErrors();
43235         } else {
43236           var loadMore = [];
43237           result.data.forEach(function(entity) {
43238             remoteGraph.replace(entity);
43239             _loaded[entity.id] = true;
43240             _toLoad = _toLoad.filter(function(val) {
43241               return val !== entity.id;
43242             });
43243             if (!entity.visible)
43244               return;
43245             var i3, id2;
43246             if (entity.type === "way") {
43247               for (i3 = 0; i3 < entity.nodes.length; i3++) {
43248                 id2 = entity.nodes[i3];
43249                 if (_loaded[id2] === void 0) {
43250                   _loaded[id2] = false;
43251                   loadMore.push(id2);
43252                 }
43253               }
43254             } else if (entity.type === "relation" && entity.isMultipolygon()) {
43255               for (i3 = 0; i3 < entity.members.length; i3++) {
43256                 id2 = entity.members[i3].id;
43257                 if (_loaded[id2] === void 0) {
43258                   _loaded[id2] = false;
43259                   loadMore.push(id2);
43260                 }
43261               }
43262             }
43263           });
43264           _toLoadCount += result.data.length;
43265           _toLoadTotal += loadMore.length;
43266           dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
43267           if (loadMore.length) {
43268             _toLoad.push.apply(_toLoad, loadMore);
43269             osm.loadMultiple(loadMore, loaded);
43270           }
43271           if (!_toLoad.length) {
43272             detectConflicts();
43273             upload(changeset);
43274           }
43275         }
43276       }
43277       function detectConflicts() {
43278         function choice(id2, text2, action) {
43279           return {
43280             id: id2,
43281             text: text2,
43282             action: function() {
43283               history.replace(action);
43284             }
43285           };
43286         }
43287         function formatUser(d) {
43288           return '<a href="' + osm.userURL(d) + '" target="_blank">' + escape_default(d) + "</a>";
43289         }
43290         function entityName(entity) {
43291           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
43292         }
43293         function sameVersions(local, remote) {
43294           if (local.version !== remote.version)
43295             return false;
43296           if (local.type === "way") {
43297             var children2 = utilArrayUnion(local.nodes, remote.nodes);
43298             for (var i3 = 0; i3 < children2.length; i3++) {
43299               var a = localGraph.hasEntity(children2[i3]);
43300               var b = remoteGraph.hasEntity(children2[i3]);
43301               if (a && b && a.version !== b.version)
43302                 return false;
43303             }
43304           }
43305           return true;
43306         }
43307         _toCheck.forEach(function(id2) {
43308           var local = localGraph.entity(id2);
43309           var remote = remoteGraph.entity(id2);
43310           if (sameVersions(local, remote))
43311             return;
43312           var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
43313           history.replace(merge3);
43314           var mergeConflicts = merge3.conflicts();
43315           if (!mergeConflicts.length)
43316             return;
43317           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
43318           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
43319           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
43320           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
43321           _conflicts.push({
43322             id: id2,
43323             name: entityName(local),
43324             details: mergeConflicts,
43325             chosen: 1,
43326             choices: [
43327               choice(id2, keepMine, forceLocal),
43328               choice(id2, keepTheirs, forceRemote)
43329             ]
43330           });
43331         });
43332       }
43333     }
43334     function upload(changeset) {
43335       var osm = context.connection();
43336       if (!osm) {
43337         _errors.push({ msg: "No OSM Service" });
43338       }
43339       if (_conflicts.length) {
43340         didResultInConflicts(changeset);
43341       } else if (_errors.length) {
43342         didResultInErrors();
43343       } else {
43344         var history = context.history();
43345         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
43346         if (changes.modified.length || changes.created.length || changes.deleted.length) {
43347           dispatch10.call("willAttemptUpload", this);
43348           osm.putChangeset(changeset, changes, uploadCallback);
43349         } else {
43350           didResultInNoChanges();
43351         }
43352       }
43353     }
43354     function uploadCallback(err, changeset) {
43355       if (err) {
43356         if (err.status === 409) {
43357           uploader.save(changeset, true, true);
43358         } else {
43359           _errors.push({
43360             msg: err.message || err.responseText,
43361             details: [_t("save.status_code", { code: err.status })]
43362           });
43363           didResultInErrors();
43364         }
43365       } else {
43366         didResultInSuccess(changeset);
43367       }
43368     }
43369     function didResultInNoChanges() {
43370       dispatch10.call("resultNoChanges", this);
43371       endSave();
43372       context.flush();
43373     }
43374     function didResultInErrors() {
43375       context.history().pop();
43376       dispatch10.call("resultErrors", this, _errors);
43377       endSave();
43378     }
43379     function didResultInConflicts(changeset) {
43380       _conflicts.sort(function(a, b) {
43381         return b.id.localeCompare(a.id);
43382       });
43383       dispatch10.call("resultConflicts", this, changeset, _conflicts, _origChanges);
43384       endSave();
43385     }
43386     function didResultInSuccess(changeset) {
43387       context.history().clearSaved();
43388       dispatch10.call("resultSuccess", this, changeset);
43389       window.setTimeout(function() {
43390         endSave();
43391         context.flush();
43392       }, 2500);
43393     }
43394     function endSave() {
43395       _isSaving = false;
43396       dispatch10.call("saveEnded", this);
43397     }
43398     uploader.cancelConflictResolution = function() {
43399       context.history().pop();
43400     };
43401     uploader.processResolvedConflicts = function(changeset) {
43402       var history = context.history();
43403       for (var i2 = 0; i2 < _conflicts.length; i2++) {
43404         if (_conflicts[i2].chosen === 1) {
43405           var entity = context.hasEntity(_conflicts[i2].id);
43406           if (entity && entity.type === "way") {
43407             var children2 = utilArrayUniq(entity.nodes);
43408             for (var j2 = 0; j2 < children2.length; j2++) {
43409               history.replace(actionRevert(children2[j2]));
43410             }
43411           }
43412           history.replace(actionRevert(_conflicts[i2].id));
43413         }
43414       }
43415       uploader.save(changeset, true, false);
43416     };
43417     uploader.reset = function() {
43418     };
43419     return uploader;
43420   }
43421
43422   // modules/renderer/background_source.js
43423   var import_lodash2 = __toESM(require_lodash());
43424
43425   // modules/util/IntervalTasksQueue.js
43426   var IntervalTasksQueue = class {
43427     constructor(intervalInMs) {
43428       this.intervalInMs = intervalInMs;
43429       this.pendingHandles = [];
43430       this.time = 0;
43431     }
43432     enqueue(task) {
43433       let taskTimeout = this.time;
43434       this.time += this.intervalInMs;
43435       this.pendingHandles.push(setTimeout(() => {
43436         this.time -= this.intervalInMs;
43437         task();
43438       }, taskTimeout));
43439     }
43440     clear() {
43441       this.pendingHandles.forEach((timeoutHandle) => {
43442         clearTimeout(timeoutHandle);
43443       });
43444       this.pendingHandles = [];
43445       this.time = 0;
43446     }
43447   };
43448
43449   // modules/renderer/background_source.js
43450   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43451   window.matchMedia(`
43452         (-webkit-min-device-pixel-ratio: 2), /* Safari */
43453         (min-resolution: 2dppx),             /* standard */
43454         (min-resolution: 192dpi)             /* fallback */
43455     `).addListener(function() {
43456     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
43457   });
43458   function localeDateString(s) {
43459     if (!s)
43460       return null;
43461     var options2 = { day: "numeric", month: "short", year: "numeric" };
43462     var d = new Date(s);
43463     if (isNaN(d.getTime()))
43464       return null;
43465     return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
43466   }
43467   function vintageRange(vintage) {
43468     var s;
43469     if (vintage.start || vintage.end) {
43470       s = vintage.start || "?";
43471       if (vintage.start !== vintage.end) {
43472         s += " - " + (vintage.end || "?");
43473       }
43474     }
43475     return s;
43476   }
43477   function rendererBackgroundSource(data) {
43478     var source = Object.assign({}, data);
43479     var _offset = [0, 0];
43480     var _name = source.name;
43481     var _description = source.description;
43482     var _best = !!source.best;
43483     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
43484     source.tileSize = data.tileSize || 256;
43485     source.zoomExtent = data.zoomExtent || [0, 22];
43486     source.overzoom = data.overzoom !== false;
43487     source.offset = function(val) {
43488       if (!arguments.length)
43489         return _offset;
43490       _offset = val;
43491       return source;
43492     };
43493     source.nudge = function(val, zoomlevel) {
43494       _offset[0] += val[0] / Math.pow(2, zoomlevel);
43495       _offset[1] += val[1] / Math.pow(2, zoomlevel);
43496       return source;
43497     };
43498     source.name = function() {
43499       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43500       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43501     };
43502     source.label = function() {
43503       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43504       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
43505     };
43506     source.description = function() {
43507       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
43508       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) });
43509     };
43510     source.best = function() {
43511       return _best;
43512     };
43513     source.area = function() {
43514       if (!data.polygon)
43515         return Number.MAX_VALUE;
43516       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
43517       return isNaN(area) ? 0 : area;
43518     };
43519     source.imageryUsed = function() {
43520       return _name || source.id;
43521     };
43522     source.template = function(val) {
43523       if (!arguments.length)
43524         return _template;
43525       if (source.id === "custom" || source.id === "Bing") {
43526         _template = val;
43527       }
43528       return source;
43529     };
43530     source.url = function(coord2) {
43531       var result = _template.replace(/#[\s\S]*/u, "");
43532       if (result === "")
43533         return result;
43534       if (!source.type || source.id === "custom") {
43535         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
43536           source.type = "wms";
43537           source.projection = "EPSG:3857";
43538         } else if (/\{(x|y)\}/.test(result)) {
43539           source.type = "tms";
43540         } else if (/\{u\}/.test(result)) {
43541           source.type = "bing";
43542         }
43543       }
43544       if (source.type === "wms") {
43545         var tileToProjectedCoords = function(x, y, z) {
43546           var zoomSize = Math.pow(2, z);
43547           var lon = x / zoomSize * Math.PI * 2 - Math.PI;
43548           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zoomSize)));
43549           switch (source.projection) {
43550             case "EPSG:4326":
43551               return {
43552                 x: lon * 180 / Math.PI,
43553                 y: lat * 180 / Math.PI
43554               };
43555             default:
43556               var mercCoords = mercatorRaw(lon, lat);
43557               return {
43558                 x: 2003750834e-2 / Math.PI * mercCoords[0],
43559                 y: 2003750834e-2 / Math.PI * mercCoords[1]
43560               };
43561           }
43562         };
43563         var tileSize = source.tileSize;
43564         var projection2 = source.projection;
43565         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
43566         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
43567         result = result.replace(/\{(\w+)\}/g, function(token, key) {
43568           switch (key) {
43569             case "width":
43570             case "height":
43571               return tileSize;
43572             case "proj":
43573               return projection2;
43574             case "wkid":
43575               return projection2.replace(/^EPSG:/, "");
43576             case "bbox":
43577               if (projection2 === "EPSG:4326" && /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
43578                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
43579               } else {
43580                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
43581               }
43582             case "w":
43583               return minXmaxY.x;
43584             case "s":
43585               return maxXminY.y;
43586             case "n":
43587               return maxXminY.x;
43588             case "e":
43589               return minXmaxY.y;
43590             default:
43591               return token;
43592           }
43593         });
43594       } else if (source.type === "tms") {
43595         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" : "");
43596       } else if (source.type === "bing") {
43597         result = result.replace("{u}", function() {
43598           var u = "";
43599           for (var zoom = coord2[2]; zoom > 0; zoom--) {
43600             var b = 0;
43601             var mask = 1 << zoom - 1;
43602             if ((coord2[0] & mask) !== 0)
43603               b++;
43604             if ((coord2[1] & mask) !== 0)
43605               b += 2;
43606             u += b.toString();
43607           }
43608           return u;
43609         });
43610       }
43611       result = result.replace(/\{switch:([^}]+)\}/, function(s, r) {
43612         var subdomains = r.split(",");
43613         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
43614       });
43615       return result;
43616     };
43617     source.validZoom = function(z) {
43618       return source.zoomExtent[0] <= z && (source.overzoom || source.zoomExtent[1] > z);
43619     };
43620     source.isLocatorOverlay = function() {
43621       return source.id === "mapbox_locator_overlay";
43622     };
43623     source.isHidden = function() {
43624       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
43625     };
43626     source.copyrightNotices = function() {
43627     };
43628     source.getMetadata = function(center, tileCoord, callback) {
43629       var vintage = {
43630         start: localeDateString(source.startDate),
43631         end: localeDateString(source.endDate)
43632       };
43633       vintage.range = vintageRange(vintage);
43634       var metadata = { vintage };
43635       callback(null, metadata);
43636     };
43637     return source;
43638   }
43639   rendererBackgroundSource.Bing = function(data, dispatch10) {
43640     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
43641     var bing = rendererBackgroundSource(data);
43642     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
43643     const strictParam = "n";
43644     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
43645     var cache = {};
43646     var inflight = {};
43647     var providers = [];
43648     var taskQueue = new IntervalTasksQueue(250);
43649     var metadataLastZoom = -1;
43650     json_default(url).then(function(json) {
43651       let imageryResource = json.resourceSets[0].resources[0];
43652       let template = imageryResource.imageUrl;
43653       let subDomains = imageryResource.imageUrlSubdomains;
43654       let subDomainNumbers = subDomains.map((subDomain) => {
43655         return subDomain.substring(1);
43656       }).join(",");
43657       template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
43658       if (!new URLSearchParams(template).has(strictParam)) {
43659         template += `&${strictParam}=z`;
43660       }
43661       bing.template(template);
43662       providers = imageryResource.imageryProviders.map(function(provider) {
43663         return {
43664           attribution: provider.attribution,
43665           areas: provider.coverageAreas.map(function(area) {
43666             return {
43667               zoom: [area.zoomMin, area.zoomMax],
43668               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
43669             };
43670           })
43671         };
43672       });
43673       dispatch10.call("change");
43674     }).catch(function() {
43675     });
43676     bing.copyrightNotices = function(zoom, extent) {
43677       zoom = Math.min(zoom, 21);
43678       return providers.filter(function(provider) {
43679         return provider.areas.some(function(area) {
43680           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
43681         });
43682       }).map(function(provider) {
43683         return provider.attribution;
43684       }).join(", ");
43685     };
43686     bing.getMetadata = function(center, tileCoord, callback) {
43687       var tileID = tileCoord.slice(0, 3).join("/");
43688       var zoom = Math.min(tileCoord[2], 21);
43689       var centerPoint = center[1] + "," + center[0];
43690       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
43691       if (inflight[tileID])
43692         return;
43693       if (!cache[tileID]) {
43694         cache[tileID] = {};
43695       }
43696       if (cache[tileID] && cache[tileID].metadata) {
43697         return callback(null, cache[tileID].metadata);
43698       }
43699       inflight[tileID] = true;
43700       if (metadataLastZoom !== tileCoord[2]) {
43701         metadataLastZoom = tileCoord[2];
43702         taskQueue.clear();
43703       }
43704       taskQueue.enqueue(() => {
43705         json_default(url2).then(function(result) {
43706           delete inflight[tileID];
43707           if (!result) {
43708             throw new Error("Unknown Error");
43709           }
43710           var vintage = {
43711             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
43712             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
43713           };
43714           vintage.range = vintageRange(vintage);
43715           var metadata = { vintage };
43716           cache[tileID].metadata = metadata;
43717           if (callback)
43718             callback(null, metadata);
43719         }).catch(function(err) {
43720           delete inflight[tileID];
43721           if (callback)
43722             callback(err.message);
43723         });
43724       });
43725     };
43726     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
43727     return bing;
43728   };
43729   rendererBackgroundSource.Esri = function(data) {
43730     if (data.template.match(/blankTile/) === null) {
43731       data.template = data.template + "?blankTile=false";
43732     }
43733     var esri = rendererBackgroundSource(data);
43734     var cache = {};
43735     var inflight = {};
43736     var _prevCenter;
43737     esri.fetchTilemap = function(center) {
43738       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
43739         return;
43740       _prevCenter = center;
43741       var z = 20;
43742       var dummyUrl = esri.url([1, 2, 3]);
43743       var x = Math.floor((center[0] + 180) / 360 * Math.pow(2, z));
43744       var y = 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, z));
43745       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z + "/" + y + "/" + x + "/8/8";
43746       json_default(tilemapUrl).then(function(tilemap) {
43747         if (!tilemap) {
43748           throw new Error("Unknown Error");
43749         }
43750         var hasTiles = true;
43751         for (var i2 = 0; i2 < tilemap.data.length; i2++) {
43752           if (!tilemap.data[i2]) {
43753             hasTiles = false;
43754             break;
43755           }
43756         }
43757         esri.zoomExtent[1] = hasTiles ? 22 : 19;
43758       }).catch(function() {
43759       });
43760     };
43761     esri.getMetadata = function(center, tileCoord, callback) {
43762       if (esri.id !== "EsriWorldImagery") {
43763         return callback(null, {});
43764       }
43765       var tileID = tileCoord.slice(0, 3).join("/");
43766       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
43767       var centerPoint = center[0] + "," + center[1];
43768       var unknown = _t("info_panels.background.unknown");
43769       var vintage = {};
43770       var metadata = {};
43771       if (inflight[tileID])
43772         return;
43773       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
43774       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
43775       if (!cache[tileID]) {
43776         cache[tileID] = {};
43777       }
43778       if (cache[tileID] && cache[tileID].metadata) {
43779         return callback(null, cache[tileID].metadata);
43780       }
43781       inflight[tileID] = true;
43782       json_default(url).then(function(result) {
43783         delete inflight[tileID];
43784         result = result.features.map((f2) => f2.attributes).filter((a) => a.MinMapLevel <= zoom && a.MaxMapLevel >= zoom)[0];
43785         if (!result) {
43786           throw new Error("Unknown Error");
43787         } else if (result.features && result.features.length < 1) {
43788           throw new Error("No Results");
43789         } else if (result.error && result.error.message) {
43790           throw new Error(result.error.message);
43791         }
43792         var captureDate = localeDateString(result.SRC_DATE2);
43793         vintage = {
43794           start: captureDate,
43795           end: captureDate,
43796           range: captureDate
43797         };
43798         metadata = {
43799           vintage,
43800           source: clean2(result.NICE_NAME),
43801           description: clean2(result.NICE_DESC),
43802           resolution: clean2(+parseFloat(result.SRC_RES).toFixed(4)),
43803           accuracy: clean2(+parseFloat(result.SRC_ACC).toFixed(4))
43804         };
43805         if (isFinite(metadata.resolution)) {
43806           metadata.resolution += " m";
43807         }
43808         if (isFinite(metadata.accuracy)) {
43809           metadata.accuracy += " m";
43810         }
43811         cache[tileID].metadata = metadata;
43812         if (callback)
43813           callback(null, metadata);
43814       }).catch(function(err) {
43815         delete inflight[tileID];
43816         if (callback)
43817           callback(err.message);
43818       });
43819       function clean2(val) {
43820         return String(val).trim() || unknown;
43821       }
43822     };
43823     return esri;
43824   };
43825   rendererBackgroundSource.None = function() {
43826     var source = rendererBackgroundSource({ id: "none", template: "" });
43827     source.name = function() {
43828       return _t("background.none");
43829     };
43830     source.label = function() {
43831       return _t.append("background.none");
43832     };
43833     source.imageryUsed = function() {
43834       return null;
43835     };
43836     source.area = function() {
43837       return -1;
43838     };
43839     return source;
43840   };
43841   rendererBackgroundSource.Custom = function(template) {
43842     var source = rendererBackgroundSource({ id: "custom", template });
43843     source.name = function() {
43844       return _t("background.custom");
43845     };
43846     source.label = function() {
43847       return _t.append("background.custom");
43848     };
43849     source.imageryUsed = function() {
43850       var cleaned = source.template();
43851       if (cleaned.indexOf("?") !== -1) {
43852         var parts = cleaned.split("?", 2);
43853         var qs = utilStringQs(parts[1]);
43854         ["access_token", "connectId", "token"].forEach(function(param) {
43855           if (qs[param]) {
43856             qs[param] = "{apikey}";
43857           }
43858         });
43859         cleaned = parts[0] + "?" + utilQsString(qs, true);
43860       }
43861       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
43862       return "Custom (" + cleaned + " )";
43863     };
43864     source.area = function() {
43865       return -2;
43866     };
43867     return source;
43868   };
43869
43870   // modules/renderer/background.js
43871   var import_which_polygon4 = __toESM(require_which_polygon());
43872
43873   // modules/renderer/tile_layer.js
43874   function rendererTileLayer(context) {
43875     var transformProp = utilPrefixCSSProperty("Transform");
43876     var tiler8 = utilTiler();
43877     var _tileSize = 256;
43878     var _projection;
43879     var _cache4 = {};
43880     var _tileOrigin;
43881     var _zoom;
43882     var _source;
43883     function tileSizeAtZoom(d, z) {
43884       var EPSILON = 2e-3;
43885       return _tileSize * Math.pow(2, z - d[2]) / _tileSize + EPSILON;
43886     }
43887     function atZoom(t, distance) {
43888       var power = Math.pow(2, distance);
43889       return [
43890         Math.floor(t[0] * power),
43891         Math.floor(t[1] * power),
43892         t[2] + distance
43893       ];
43894     }
43895     function lookUp(d) {
43896       for (var up = -1; up > -d[2]; up--) {
43897         var tile = atZoom(d, up);
43898         if (_cache4[_source.url(tile)] !== false) {
43899           return tile;
43900         }
43901       }
43902     }
43903     function uniqueBy(a, n2) {
43904       var o = [];
43905       var seen = {};
43906       for (var i2 = 0; i2 < a.length; i2++) {
43907         if (seen[a[i2][n2]] === void 0) {
43908           o.push(a[i2]);
43909           seen[a[i2][n2]] = true;
43910         }
43911       }
43912       return o;
43913     }
43914     function addSource(d) {
43915       d.push(_source.url(d));
43916       return d;
43917     }
43918     function background(selection2) {
43919       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
43920       var pixelOffset;
43921       if (_source) {
43922         pixelOffset = [
43923           _source.offset()[0] * Math.pow(2, _zoom),
43924           _source.offset()[1] * Math.pow(2, _zoom)
43925         ];
43926       } else {
43927         pixelOffset = [0, 0];
43928       }
43929       var translate = [
43930         _projection.translate()[0] + pixelOffset[0],
43931         _projection.translate()[1] + pixelOffset[1]
43932       ];
43933       tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
43934       _tileOrigin = [
43935         _projection.scale() * Math.PI - translate[0],
43936         _projection.scale() * Math.PI - translate[1]
43937       ];
43938       render(selection2);
43939     }
43940     function render(selection2) {
43941       if (!_source)
43942         return;
43943       var requests = [];
43944       var showDebug = context.getDebug("tile") && !_source.overlay;
43945       if (_source.validZoom(_zoom)) {
43946         tiler8.skipNullIsland(!!_source.overlay);
43947         tiler8().forEach(function(d) {
43948           addSource(d);
43949           if (d[3] === "")
43950             return;
43951           if (typeof d[3] !== "string")
43952             return;
43953           requests.push(d);
43954           if (_cache4[d[3]] === false && lookUp(d)) {
43955             requests.push(addSource(lookUp(d)));
43956           }
43957         });
43958         requests = uniqueBy(requests, 3).filter(function(r) {
43959           return _cache4[r[3]] !== false;
43960         });
43961       }
43962       function load(d3_event, d) {
43963         _cache4[d[3]] = true;
43964         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
43965         render(selection2);
43966       }
43967       function error(d3_event, d) {
43968         _cache4[d[3]] = false;
43969         select_default2(this).on("error", null).on("load", null).remove();
43970         render(selection2);
43971       }
43972       function imageTransform(d) {
43973         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
43974         var scale = tileSizeAtZoom(d, _zoom);
43975         return "translate(" + (d[0] * ts - _tileOrigin[0]) + "px," + (d[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
43976       }
43977       function tileCenter(d) {
43978         var ts = _tileSize * Math.pow(2, _zoom - d[2]);
43979         return [
43980           d[0] * ts - _tileOrigin[0] + ts / 2,
43981           d[1] * ts - _tileOrigin[1] + ts / 2
43982         ];
43983       }
43984       function debugTransform(d) {
43985         var coord2 = tileCenter(d);
43986         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
43987       }
43988       var dims = tiler8.size();
43989       var mapCenter = [dims[0] / 2, dims[1] / 2];
43990       var minDist = Math.max(dims[0], dims[1]);
43991       var nearCenter;
43992       requests.forEach(function(d) {
43993         var c = tileCenter(d);
43994         var dist = geoVecLength(c, mapCenter);
43995         if (dist < minDist) {
43996           minDist = dist;
43997           nearCenter = d;
43998         }
43999       });
44000       var image = selection2.selectAll("img").data(requests, function(d) {
44001         return d[3];
44002       });
44003       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
44004         var tile = select_default2(this);
44005         window.setTimeout(function() {
44006           if (tile.classed("tile-removing")) {
44007             tile.remove();
44008           }
44009         }, 300);
44010       });
44011       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d) {
44012         return d[3];
44013       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d) {
44014         return d === nearCenter;
44015       });
44016       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d) {
44017         return d[3];
44018       });
44019       debug2.exit().remove();
44020       if (showDebug) {
44021         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
44022         debugEnter.append("div").attr("class", "tile-label-debug-coord");
44023         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
44024         debug2 = debug2.merge(debugEnter);
44025         debug2.style(transformProp, debugTransform);
44026         debug2.selectAll(".tile-label-debug-coord").text(function(d) {
44027           return d[2] + " / " + d[0] + " / " + d[1];
44028         });
44029         debug2.selectAll(".tile-label-debug-vintage").each(function(d) {
44030           var span = select_default2(this);
44031           var center = context.projection.invert(tileCenter(d));
44032           _source.getMetadata(center, d, function(err, result) {
44033             if (result && result.vintage && result.vintage.range) {
44034               span.text(result.vintage.range);
44035             } else {
44036               span.call(_t.append("info_panels.background.vintage"));
44037               span.append("span").text(": ");
44038               span.call(_t.append("info_panels.background.unknown"));
44039             }
44040           });
44041         });
44042       }
44043     }
44044     background.projection = function(val) {
44045       if (!arguments.length)
44046         return _projection;
44047       _projection = val;
44048       return background;
44049     };
44050     background.dimensions = function(val) {
44051       if (!arguments.length)
44052         return tiler8.size();
44053       tiler8.size(val);
44054       return background;
44055     };
44056     background.source = function(val) {
44057       if (!arguments.length)
44058         return _source;
44059       _source = val;
44060       _tileSize = _source.tileSize;
44061       _cache4 = {};
44062       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
44063       return background;
44064     };
44065     return background;
44066   }
44067
44068   // modules/renderer/background.js
44069   var _imageryIndex = null;
44070   function rendererBackground(context) {
44071     const dispatch10 = dispatch_default("change");
44072     const baseLayer = rendererTileLayer(context).projection(context.projection);
44073     let _checkedBlocklists = [];
44074     let _isValid = true;
44075     let _overlayLayers = [];
44076     let _brightness = 1;
44077     let _contrast = 1;
44078     let _saturation = 1;
44079     let _sharpness = 1;
44080     function ensureImageryIndex() {
44081       return _mainFileFetcher.get("imagery").then((sources) => {
44082         if (_imageryIndex)
44083           return _imageryIndex;
44084         _imageryIndex = {
44085           imagery: sources,
44086           features: {}
44087         };
44088         const features2 = sources.map((source) => {
44089           if (!source.polygon)
44090             return null;
44091           const rings = source.polygon.map((ring) => [ring]);
44092           const feature3 = {
44093             type: "Feature",
44094             properties: { id: source.id },
44095             geometry: { type: "MultiPolygon", coordinates: rings }
44096           };
44097           _imageryIndex.features[source.id] = feature3;
44098           return feature3;
44099         }).filter(Boolean);
44100         _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: features2 });
44101         _imageryIndex.backgrounds = sources.map((source) => {
44102           if (source.type === "bing") {
44103             return rendererBackgroundSource.Bing(source, dispatch10);
44104           } else if (/^EsriWorldImagery/.test(source.id)) {
44105             return rendererBackgroundSource.Esri(source);
44106           } else {
44107             return rendererBackgroundSource(source);
44108           }
44109         });
44110         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
44111         let template = corePreferences("background-custom-template") || "";
44112         const custom = rendererBackgroundSource.Custom(template);
44113         _imageryIndex.backgrounds.unshift(custom);
44114         return _imageryIndex;
44115       });
44116     }
44117     function background(selection2) {
44118       const currSource = baseLayer.source();
44119       if (context.map().zoom() > 18) {
44120         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
44121           const center = context.map().center();
44122           currSource.fetchTilemap(center);
44123         }
44124       }
44125       const sources = background.sources(context.map().extent());
44126       const wasValid = _isValid;
44127       _isValid = !!sources.filter((d) => d === currSource).length;
44128       if (wasValid !== _isValid) {
44129         background.updateImagery();
44130       }
44131       let baseFilter = "";
44132       if (_brightness !== 1) {
44133         baseFilter += ` brightness(${_brightness})`;
44134       }
44135       if (_contrast !== 1) {
44136         baseFilter += ` contrast(${_contrast})`;
44137       }
44138       if (_saturation !== 1) {
44139         baseFilter += ` saturate(${_saturation})`;
44140       }
44141       if (_sharpness < 1) {
44142         const blur = number_default(0.5, 5)(1 - _sharpness);
44143         baseFilter += ` blur(${blur}px)`;
44144       }
44145       let base = selection2.selectAll(".layer-background").data([0]);
44146       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
44147       base.style("filter", baseFilter || null);
44148       let imagery = base.selectAll(".layer-imagery").data([0]);
44149       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
44150       let maskFilter = "";
44151       let mixBlendMode = "";
44152       if (_sharpness > 1) {
44153         mixBlendMode = "overlay";
44154         maskFilter = "saturate(0) blur(3px) invert(1)";
44155         let contrast = _sharpness - 1;
44156         maskFilter += ` contrast(${contrast})`;
44157         let brightness = number_default(1, 0.85)(_sharpness - 1);
44158         maskFilter += ` brightness(${brightness})`;
44159       }
44160       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
44161       mask.exit().remove();
44162       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);
44163       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d) => d.source().name());
44164       overlays.exit().remove();
44165       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i2, nodes) => select_default2(nodes[i2]).call(layer));
44166     }
44167     background.updateImagery = function() {
44168       let currSource = baseLayer.source();
44169       if (context.inIntro() || !currSource)
44170         return;
44171       let o = _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).map((d) => d.source().id).join(",");
44172       const meters = geoOffsetToMeters(currSource.offset());
44173       const EPSILON = 0.01;
44174       const x = +meters[0].toFixed(2);
44175       const y = +meters[1].toFixed(2);
44176       let hash = utilStringQs(window.location.hash);
44177       let id2 = currSource.id;
44178       if (id2 === "custom") {
44179         id2 = `custom:${currSource.template()}`;
44180       }
44181       if (id2) {
44182         hash.background = id2;
44183       } else {
44184         delete hash.background;
44185       }
44186       if (o) {
44187         hash.overlays = o;
44188       } else {
44189         delete hash.overlays;
44190       }
44191       if (Math.abs(x) > EPSILON || Math.abs(y) > EPSILON) {
44192         hash.offset = `${x},${y}`;
44193       } else {
44194         delete hash.offset;
44195       }
44196       if (!window.mocha) {
44197         window.location.replace("#" + utilQsString(hash, true));
44198       }
44199       let imageryUsed = [];
44200       let photoOverlaysUsed = [];
44201       const currUsed = currSource.imageryUsed();
44202       if (currUsed && _isValid) {
44203         imageryUsed.push(currUsed);
44204       }
44205       _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).forEach((d) => imageryUsed.push(d.source().imageryUsed()));
44206       const dataLayer = context.layers().layer("data");
44207       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
44208         imageryUsed.push(dataLayer.getSrc());
44209       }
44210       const photoOverlayLayers = {
44211         streetside: "Bing Streetside",
44212         mapillary: "Mapillary Images",
44213         "mapillary-map-features": "Mapillary Map Features",
44214         "mapillary-signs": "Mapillary Signs",
44215         kartaview: "KartaView Images"
44216       };
44217       for (let layerID in photoOverlayLayers) {
44218         const layer = context.layers().layer(layerID);
44219         if (layer && layer.enabled()) {
44220           photoOverlaysUsed.push(layerID);
44221           imageryUsed.push(photoOverlayLayers[layerID]);
44222         }
44223       }
44224       context.history().imageryUsed(imageryUsed);
44225       context.history().photoOverlaysUsed(photoOverlaysUsed);
44226     };
44227     background.sources = (extent, zoom, includeCurrent) => {
44228       if (!_imageryIndex)
44229         return [];
44230       let visible = {};
44231       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d) => visible[d.id] = true);
44232       const currSource = baseLayer.source();
44233       const osm = context.connection();
44234       const blocklists = osm && osm.imageryBlocklists() || [];
44235       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
44236       if (blocklistChanged) {
44237         _imageryIndex.backgrounds.forEach((source) => {
44238           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
44239         });
44240         _checkedBlocklists = blocklists.map((regex) => String(regex));
44241       }
44242       return _imageryIndex.backgrounds.filter((source) => {
44243         if (includeCurrent && currSource === source)
44244           return true;
44245         if (source.isBlocked)
44246           return false;
44247         if (!source.polygon)
44248           return true;
44249         if (zoom && zoom < 6)
44250           return false;
44251         return visible[source.id];
44252       });
44253     };
44254     background.dimensions = (val) => {
44255       if (!val)
44256         return;
44257       baseLayer.dimensions(val);
44258       _overlayLayers.forEach((layer) => layer.dimensions(val));
44259     };
44260     background.baseLayerSource = function(d) {
44261       if (!arguments.length)
44262         return baseLayer.source();
44263       const osm = context.connection();
44264       if (!osm)
44265         return background;
44266       const blocklists = osm.imageryBlocklists();
44267       const template = d.template();
44268       let fail = false;
44269       let tested = 0;
44270       let regex;
44271       for (let i2 = 0; i2 < blocklists.length; i2++) {
44272         regex = blocklists[i2];
44273         fail = regex.test(template);
44274         tested++;
44275         if (fail)
44276           break;
44277       }
44278       if (!tested) {
44279         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
44280         fail = regex.test(template);
44281       }
44282       baseLayer.source(!fail ? d : background.findSource("none"));
44283       dispatch10.call("change");
44284       background.updateImagery();
44285       return background;
44286     };
44287     background.findSource = (id2) => {
44288       if (!id2 || !_imageryIndex)
44289         return null;
44290       return _imageryIndex.backgrounds.find((d) => d.id && d.id === id2);
44291     };
44292     background.bing = () => {
44293       background.baseLayerSource(background.findSource("Bing"));
44294     };
44295     background.showsLayer = (d) => {
44296       const currSource = baseLayer.source();
44297       if (!d || !currSource)
44298         return false;
44299       return d.id === currSource.id || _overlayLayers.some((layer) => d.id === layer.source().id);
44300     };
44301     background.overlayLayerSources = () => {
44302       return _overlayLayers.map((layer) => layer.source());
44303     };
44304     background.toggleOverlayLayer = (d) => {
44305       let layer;
44306       for (let i2 = 0; i2 < _overlayLayers.length; i2++) {
44307         layer = _overlayLayers[i2];
44308         if (layer.source() === d) {
44309           _overlayLayers.splice(i2, 1);
44310           dispatch10.call("change");
44311           background.updateImagery();
44312           return;
44313         }
44314       }
44315       layer = rendererTileLayer(context).source(d).projection(context.projection).dimensions(
44316         baseLayer.dimensions()
44317       );
44318       _overlayLayers.push(layer);
44319       dispatch10.call("change");
44320       background.updateImagery();
44321     };
44322     background.nudge = (d, zoom) => {
44323       const currSource = baseLayer.source();
44324       if (currSource) {
44325         currSource.nudge(d, zoom);
44326         dispatch10.call("change");
44327         background.updateImagery();
44328       }
44329       return background;
44330     };
44331     background.offset = function(d) {
44332       const currSource = baseLayer.source();
44333       if (!arguments.length) {
44334         return currSource && currSource.offset() || [0, 0];
44335       }
44336       if (currSource) {
44337         currSource.offset(d);
44338         dispatch10.call("change");
44339         background.updateImagery();
44340       }
44341       return background;
44342     };
44343     background.brightness = function(d) {
44344       if (!arguments.length)
44345         return _brightness;
44346       _brightness = d;
44347       if (context.mode())
44348         dispatch10.call("change");
44349       return background;
44350     };
44351     background.contrast = function(d) {
44352       if (!arguments.length)
44353         return _contrast;
44354       _contrast = d;
44355       if (context.mode())
44356         dispatch10.call("change");
44357       return background;
44358     };
44359     background.saturation = function(d) {
44360       if (!arguments.length)
44361         return _saturation;
44362       _saturation = d;
44363       if (context.mode())
44364         dispatch10.call("change");
44365       return background;
44366     };
44367     background.sharpness = function(d) {
44368       if (!arguments.length)
44369         return _sharpness;
44370       _sharpness = d;
44371       if (context.mode())
44372         dispatch10.call("change");
44373       return background;
44374     };
44375     let _loadPromise;
44376     background.ensureLoaded = () => {
44377       if (_loadPromise)
44378         return _loadPromise;
44379       return _loadPromise = ensureImageryIndex();
44380     };
44381     background.init = () => {
44382       const loadPromise = background.ensureLoaded();
44383       const hash = utilStringQs(window.location.hash);
44384       const requestedBackground = hash.background || hash.layer;
44385       const lastUsedBackground = corePreferences("background-last-used");
44386       return loadPromise.then((imageryIndex) => {
44387         const extent = context.map().extent();
44388         const validBackgrounds = background.sources(extent).filter((d) => d.id !== "none" && d.id !== "custom");
44389         const first = validBackgrounds.length && validBackgrounds[0];
44390         const isLastUsedValid = !!validBackgrounds.find((d) => d.id && d.id === lastUsedBackground);
44391         let best;
44392         if (!requestedBackground && extent) {
44393           best = validBackgrounds.find((s) => s.best());
44394         }
44395         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
44396           const template = requestedBackground.replace(/^custom:/, "");
44397           const custom = background.findSource("custom");
44398           background.baseLayerSource(custom.template(template));
44399           corePreferences("background-custom-template", template);
44400         } else {
44401           background.baseLayerSource(
44402             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
44403           );
44404         }
44405         const locator = imageryIndex.backgrounds.find((d) => d.overlay && d.default);
44406         if (locator) {
44407           background.toggleOverlayLayer(locator);
44408         }
44409         const overlays = (hash.overlays || "").split(",");
44410         overlays.forEach((overlay) => {
44411           overlay = background.findSource(overlay);
44412           if (overlay) {
44413             background.toggleOverlayLayer(overlay);
44414           }
44415         });
44416         if (hash.gpx) {
44417           const gpx2 = context.layers().layer("data");
44418           if (gpx2) {
44419             gpx2.url(hash.gpx, ".gpx");
44420           }
44421         }
44422         if (hash.offset) {
44423           const offset = hash.offset.replace(/;/g, ",").split(",").map((n2) => !isNaN(n2) && n2);
44424           if (offset.length === 2) {
44425             background.offset(geoMetersToOffset(offset));
44426           }
44427         }
44428       }).catch((err) => {
44429         console.error(err);
44430       });
44431     };
44432     return utilRebind(background, dispatch10, "on");
44433   }
44434
44435   // modules/renderer/features.js
44436   function rendererFeatures(context) {
44437     var dispatch10 = dispatch_default("change", "redraw");
44438     var features2 = utilRebind({}, dispatch10, "on");
44439     var _deferred2 = /* @__PURE__ */ new Set();
44440     var traffic_roads = {
44441       "motorway": true,
44442       "motorway_link": true,
44443       "trunk": true,
44444       "trunk_link": true,
44445       "primary": true,
44446       "primary_link": true,
44447       "secondary": true,
44448       "secondary_link": true,
44449       "tertiary": true,
44450       "tertiary_link": true,
44451       "residential": true,
44452       "unclassified": true,
44453       "living_street": true
44454     };
44455     var service_roads = {
44456       "service": true,
44457       "road": true,
44458       "track": true
44459     };
44460     var paths = {
44461       "path": true,
44462       "footway": true,
44463       "cycleway": true,
44464       "bridleway": true,
44465       "steps": true,
44466       "pedestrian": true
44467     };
44468     var _cullFactor = 1;
44469     var _cache4 = {};
44470     var _rules = {};
44471     var _stats = {};
44472     var _keys = [];
44473     var _hidden = [];
44474     var _forceVisible = {};
44475     function update() {
44476       if (!window.mocha) {
44477         var hash = utilStringQs(window.location.hash);
44478         var disabled = features2.disabled();
44479         if (disabled.length) {
44480           hash.disable_features = disabled.join(",");
44481         } else {
44482           delete hash.disable_features;
44483         }
44484         window.location.replace("#" + utilQsString(hash, true));
44485         corePreferences("disabled-features", disabled.join(","));
44486       }
44487       _hidden = features2.hidden();
44488       dispatch10.call("change");
44489       dispatch10.call("redraw");
44490     }
44491     function defineRule(k, filter2, max3) {
44492       var isEnabled = true;
44493       _keys.push(k);
44494       _rules[k] = {
44495         filter: filter2,
44496         enabled: isEnabled,
44497         count: 0,
44498         currentMax: max3 || Infinity,
44499         defaultMax: max3 || Infinity,
44500         enable: function() {
44501           this.enabled = true;
44502           this.currentMax = this.defaultMax;
44503         },
44504         disable: function() {
44505           this.enabled = false;
44506           this.currentMax = 0;
44507         },
44508         hidden: function() {
44509           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
44510         },
44511         autoHidden: function() {
44512           return this.hidden() && this.currentMax > 0;
44513         }
44514       };
44515     }
44516     defineRule("points", function isPoint(tags, geometry) {
44517       return geometry === "point";
44518     }, 200);
44519     defineRule("traffic_roads", function isTrafficRoad(tags) {
44520       return traffic_roads[tags.highway];
44521     });
44522     defineRule("service_roads", function isServiceRoad(tags) {
44523       return service_roads[tags.highway];
44524     });
44525     defineRule("paths", function isPath(tags) {
44526       return paths[tags.highway];
44527     });
44528     defineRule("buildings", function isBuilding(tags) {
44529       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
44530     }, 250);
44531     defineRule("building_parts", function isBuildingPart(tags) {
44532       return tags["building:part"];
44533     });
44534     defineRule("indoor", function isIndoor(tags) {
44535       return tags.indoor;
44536     });
44537     defineRule("landuse", function isLanduse(tags, geometry) {
44538       return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
44539     });
44540     defineRule("boundaries", function isBoundary(tags, geometry) {
44541       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);
44542     });
44543     defineRule("water", function isWater(tags) {
44544       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";
44545     });
44546     defineRule("rail", function isRail(tags) {
44547       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
44548     });
44549     defineRule("pistes", function isPiste(tags) {
44550       return tags["piste:type"];
44551     });
44552     defineRule("aerialways", function isPiste(tags) {
44553       return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
44554     });
44555     defineRule("power", function isPower(tags) {
44556       return !!tags.power;
44557     });
44558     defineRule("past_future", function isPastFuture(tags) {
44559       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
44560         return false;
44561       }
44562       var strings = Object.keys(tags);
44563       for (var i2 = 0; i2 < strings.length; i2++) {
44564         var s = strings[i2];
44565         if (osmLifecyclePrefixes[s] || osmLifecyclePrefixes[tags[s]])
44566           return true;
44567       }
44568       return false;
44569     });
44570     defineRule("others", function isOther(tags, geometry) {
44571       return geometry === "line" || geometry === "area";
44572     });
44573     features2.features = function() {
44574       return _rules;
44575     };
44576     features2.keys = function() {
44577       return _keys;
44578     };
44579     features2.enabled = function(k) {
44580       if (!arguments.length) {
44581         return _keys.filter(function(k2) {
44582           return _rules[k2].enabled;
44583         });
44584       }
44585       return _rules[k] && _rules[k].enabled;
44586     };
44587     features2.disabled = function(k) {
44588       if (!arguments.length) {
44589         return _keys.filter(function(k2) {
44590           return !_rules[k2].enabled;
44591         });
44592       }
44593       return _rules[k] && !_rules[k].enabled;
44594     };
44595     features2.hidden = function(k) {
44596       if (!arguments.length) {
44597         return _keys.filter(function(k2) {
44598           return _rules[k2].hidden();
44599         });
44600       }
44601       return _rules[k] && _rules[k].hidden();
44602     };
44603     features2.autoHidden = function(k) {
44604       if (!arguments.length) {
44605         return _keys.filter(function(k2) {
44606           return _rules[k2].autoHidden();
44607         });
44608       }
44609       return _rules[k] && _rules[k].autoHidden();
44610     };
44611     features2.enable = function(k) {
44612       if (_rules[k] && !_rules[k].enabled) {
44613         _rules[k].enable();
44614         update();
44615       }
44616     };
44617     features2.enableAll = function() {
44618       var didEnable = false;
44619       for (var k in _rules) {
44620         if (!_rules[k].enabled) {
44621           didEnable = true;
44622           _rules[k].enable();
44623         }
44624       }
44625       if (didEnable)
44626         update();
44627     };
44628     features2.disable = function(k) {
44629       if (_rules[k] && _rules[k].enabled) {
44630         _rules[k].disable();
44631         update();
44632       }
44633     };
44634     features2.disableAll = function() {
44635       var didDisable = false;
44636       for (var k in _rules) {
44637         if (_rules[k].enabled) {
44638           didDisable = true;
44639           _rules[k].disable();
44640         }
44641       }
44642       if (didDisable)
44643         update();
44644     };
44645     features2.toggle = function(k) {
44646       if (_rules[k]) {
44647         (function(f2) {
44648           return f2.enabled ? f2.disable() : f2.enable();
44649         })(_rules[k]);
44650         update();
44651       }
44652     };
44653     features2.resetStats = function() {
44654       for (var i2 = 0; i2 < _keys.length; i2++) {
44655         _rules[_keys[i2]].count = 0;
44656       }
44657       dispatch10.call("change");
44658     };
44659     features2.gatherStats = function(d, resolver, dimensions) {
44660       var needsRedraw = false;
44661       var types = utilArrayGroupBy(d, "type");
44662       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
44663       var currHidden, geometry, matches, i2, j2;
44664       for (i2 = 0; i2 < _keys.length; i2++) {
44665         _rules[_keys[i2]].count = 0;
44666       }
44667       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
44668       for (i2 = 0; i2 < entities.length; i2++) {
44669         geometry = entities[i2].geometry(resolver);
44670         matches = Object.keys(features2.getMatches(entities[i2], resolver, geometry));
44671         for (j2 = 0; j2 < matches.length; j2++) {
44672           _rules[matches[j2]].count++;
44673         }
44674       }
44675       currHidden = features2.hidden();
44676       if (currHidden !== _hidden) {
44677         _hidden = currHidden;
44678         needsRedraw = true;
44679         dispatch10.call("change");
44680       }
44681       return needsRedraw;
44682     };
44683     features2.stats = function() {
44684       for (var i2 = 0; i2 < _keys.length; i2++) {
44685         _stats[_keys[i2]] = _rules[_keys[i2]].count;
44686       }
44687       return _stats;
44688     };
44689     features2.clear = function(d) {
44690       for (var i2 = 0; i2 < d.length; i2++) {
44691         features2.clearEntity(d[i2]);
44692       }
44693     };
44694     features2.clearEntity = function(entity) {
44695       delete _cache4[osmEntity.key(entity)];
44696     };
44697     features2.reset = function() {
44698       Array.from(_deferred2).forEach(function(handle) {
44699         window.cancelIdleCallback(handle);
44700         _deferred2.delete(handle);
44701       });
44702       _cache4 = {};
44703     };
44704     function relationShouldBeChecked(relation) {
44705       return relation.tags.type === "boundary";
44706     }
44707     features2.getMatches = function(entity, resolver, geometry) {
44708       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
44709         return {};
44710       var ent = osmEntity.key(entity);
44711       if (!_cache4[ent]) {
44712         _cache4[ent] = {};
44713       }
44714       if (!_cache4[ent].matches) {
44715         var matches = {};
44716         var hasMatch = false;
44717         for (var i2 = 0; i2 < _keys.length; i2++) {
44718           if (_keys[i2] === "others") {
44719             if (hasMatch)
44720               continue;
44721             if (entity.type === "way") {
44722               var parents = features2.getParents(entity, resolver, geometry);
44723               if (parents.length === 1 && parents[0].isMultipolygon() || parents.length > 0 && parents.every(function(parent) {
44724                 return parent.tags.type === "boundary";
44725               })) {
44726                 var pkey = osmEntity.key(parents[0]);
44727                 if (_cache4[pkey] && _cache4[pkey].matches) {
44728                   matches = Object.assign({}, _cache4[pkey].matches);
44729                   continue;
44730                 }
44731               }
44732             }
44733           }
44734           if (_rules[_keys[i2]].filter(entity.tags, geometry)) {
44735             matches[_keys[i2]] = hasMatch = true;
44736           }
44737         }
44738         _cache4[ent].matches = matches;
44739       }
44740       return _cache4[ent].matches;
44741     };
44742     features2.getParents = function(entity, resolver, geometry) {
44743       if (geometry === "point")
44744         return [];
44745       var ent = osmEntity.key(entity);
44746       if (!_cache4[ent]) {
44747         _cache4[ent] = {};
44748       }
44749       if (!_cache4[ent].parents) {
44750         var parents = [];
44751         if (geometry === "vertex") {
44752           parents = resolver.parentWays(entity);
44753         } else {
44754           parents = resolver.parentRelations(entity);
44755         }
44756         _cache4[ent].parents = parents;
44757       }
44758       return _cache4[ent].parents;
44759     };
44760     features2.isHiddenPreset = function(preset, geometry) {
44761       if (!_hidden.length)
44762         return false;
44763       if (!preset.tags)
44764         return false;
44765       var test = preset.setTags({}, geometry);
44766       for (var key in _rules) {
44767         if (_rules[key].filter(test, geometry)) {
44768           if (_hidden.indexOf(key) !== -1) {
44769             return key;
44770           }
44771           return false;
44772         }
44773       }
44774       return false;
44775     };
44776     features2.isHiddenFeature = function(entity, resolver, geometry) {
44777       if (!_hidden.length)
44778         return false;
44779       if (!entity.version)
44780         return false;
44781       if (_forceVisible[entity.id])
44782         return false;
44783       var matches = Object.keys(features2.getMatches(entity, resolver, geometry));
44784       return matches.length && matches.every(function(k) {
44785         return features2.hidden(k);
44786       });
44787     };
44788     features2.isHiddenChild = function(entity, resolver, geometry) {
44789       if (!_hidden.length)
44790         return false;
44791       if (!entity.version || geometry === "point")
44792         return false;
44793       if (_forceVisible[entity.id])
44794         return false;
44795       var parents = features2.getParents(entity, resolver, geometry);
44796       if (!parents.length)
44797         return false;
44798       for (var i2 = 0; i2 < parents.length; i2++) {
44799         if (!features2.isHidden(parents[i2], resolver, parents[i2].geometry(resolver))) {
44800           return false;
44801         }
44802       }
44803       return true;
44804     };
44805     features2.hasHiddenConnections = function(entity, resolver) {
44806       if (!_hidden.length)
44807         return false;
44808       var childNodes, connections;
44809       if (entity.type === "midpoint") {
44810         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
44811         connections = [];
44812       } else {
44813         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
44814         connections = features2.getParents(entity, resolver, entity.geometry(resolver));
44815       }
44816       connections = childNodes.reduce(function(result, e) {
44817         return resolver.isShared(e) ? utilArrayUnion(result, resolver.parentWays(e)) : result;
44818       }, connections);
44819       return connections.some(function(e) {
44820         return features2.isHidden(e, resolver, e.geometry(resolver));
44821       });
44822     };
44823     features2.isHidden = function(entity, resolver, geometry) {
44824       if (!_hidden.length)
44825         return false;
44826       if (!entity.version)
44827         return false;
44828       var fn = geometry === "vertex" ? features2.isHiddenChild : features2.isHiddenFeature;
44829       return fn(entity, resolver, geometry);
44830     };
44831     features2.filter = function(d, resolver) {
44832       if (!_hidden.length)
44833         return d;
44834       var result = [];
44835       for (var i2 = 0; i2 < d.length; i2++) {
44836         var entity = d[i2];
44837         if (!features2.isHidden(entity, resolver, entity.geometry(resolver))) {
44838           result.push(entity);
44839         }
44840       }
44841       return result;
44842     };
44843     features2.forceVisible = function(entityIDs) {
44844       if (!arguments.length)
44845         return Object.keys(_forceVisible);
44846       _forceVisible = {};
44847       for (var i2 = 0; i2 < entityIDs.length; i2++) {
44848         _forceVisible[entityIDs[i2]] = true;
44849         var entity = context.hasEntity(entityIDs[i2]);
44850         if (entity && entity.type === "relation") {
44851           for (var j2 in entity.members) {
44852             _forceVisible[entity.members[j2].id] = true;
44853           }
44854         }
44855       }
44856       return features2;
44857     };
44858     features2.init = function() {
44859       var storage = corePreferences("disabled-features");
44860       if (storage) {
44861         var storageDisabled = storage.replace(/;/g, ",").split(",");
44862         storageDisabled.forEach(features2.disable);
44863       }
44864       var hash = utilStringQs(window.location.hash);
44865       if (hash.disable_features) {
44866         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
44867         hashDisabled.forEach(features2.disable);
44868       }
44869     };
44870     context.history().on("merge.features", function(newEntities) {
44871       if (!newEntities)
44872         return;
44873       var handle = window.requestIdleCallback(function() {
44874         var graph = context.graph();
44875         var types = utilArrayGroupBy(newEntities, "type");
44876         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
44877         for (var i2 = 0; i2 < entities.length; i2++) {
44878           var geometry = entities[i2].geometry(graph);
44879           features2.getMatches(entities[i2], graph, geometry);
44880         }
44881       });
44882       _deferred2.add(handle);
44883     });
44884     return features2;
44885   }
44886
44887   // modules/svg/areas.js
44888   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
44889
44890   // modules/svg/helpers.js
44891   function svgPassiveVertex(node, graph, activeID) {
44892     if (!activeID)
44893       return 1;
44894     if (activeID === node.id)
44895       return 0;
44896     var parents = graph.parentWays(node);
44897     var i2, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
44898     for (i2 = 0; i2 < parents.length; i2++) {
44899       nodes = parents[i2].nodes;
44900       isClosed = parents[i2].isClosed();
44901       for (j2 = 0; j2 < nodes.length; j2++) {
44902         if (nodes[j2] === node.id) {
44903           ix1 = j2 - 2;
44904           ix2 = j2 - 1;
44905           ix3 = j2 + 1;
44906           ix4 = j2 + 2;
44907           if (isClosed) {
44908             max3 = nodes.length - 1;
44909             if (ix1 < 0)
44910               ix1 = max3 + ix1;
44911             if (ix2 < 0)
44912               ix2 = max3 + ix2;
44913             if (ix3 > max3)
44914               ix3 = ix3 - max3;
44915             if (ix4 > max3)
44916               ix4 = ix4 - max3;
44917           }
44918           if (nodes[ix1] === activeID)
44919             return 0;
44920           else if (nodes[ix2] === activeID)
44921             return 2;
44922           else if (nodes[ix3] === activeID)
44923             return 2;
44924           else if (nodes[ix4] === activeID)
44925             return 0;
44926           else if (isClosed && nodes.indexOf(activeID) !== -1)
44927             return 0;
44928         }
44929       }
44930     }
44931     return 1;
44932   }
44933   function svgMarkerSegments(projection2, graph, dt, shouldReverse, bothDirections) {
44934     return function(entity) {
44935       var i2 = 0;
44936       var offset = dt;
44937       var segments = [];
44938       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
44939       var coordinates = graph.childNodes(entity).map(function(n2) {
44940         return n2.loc;
44941       });
44942       var a, b;
44943       if (shouldReverse(entity)) {
44944         coordinates.reverse();
44945       }
44946       stream_default({
44947         type: "LineString",
44948         coordinates
44949       }, projection2.stream(clip({
44950         lineStart: function() {
44951         },
44952         lineEnd: function() {
44953           a = null;
44954         },
44955         point: function(x, y) {
44956           b = [x, y];
44957           if (a) {
44958             var span = geoVecLength(a, b) - offset;
44959             if (span >= 0) {
44960               var heading = geoVecAngle(a, b);
44961               var dx = dt * Math.cos(heading);
44962               var dy = dt * Math.sin(heading);
44963               var p = [
44964                 a[0] + offset * Math.cos(heading),
44965                 a[1] + offset * Math.sin(heading)
44966               ];
44967               var coord2 = [a, p];
44968               for (span -= dt; span >= 0; span -= dt) {
44969                 p = geoVecAdd(p, [dx, dy]);
44970                 coord2.push(p);
44971               }
44972               coord2.push(b);
44973               var segment = "";
44974               var j2;
44975               for (j2 = 0; j2 < coord2.length; j2++) {
44976                 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
44977               }
44978               segments.push({ id: entity.id, index: i2++, d: segment });
44979               if (bothDirections(entity)) {
44980                 segment = "";
44981                 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
44982                   segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
44983                 }
44984                 segments.push({ id: entity.id, index: i2++, d: segment });
44985               }
44986             }
44987             offset = -span;
44988           }
44989           a = b;
44990         }
44991       })));
44992       return segments;
44993     };
44994   }
44995   function svgPath(projection2, graph, isArea) {
44996     var cache = {};
44997     var padding = isArea ? 65 : 5;
44998     var viewport = projection2.clipExtent();
44999     var paddedExtent = [
45000       [viewport[0][0] - padding, viewport[0][1] - padding],
45001       [viewport[1][0] + padding, viewport[1][1] + padding]
45002     ];
45003     var clip = identity_default2().clipExtent(paddedExtent).stream;
45004     var project = projection2.stream;
45005     var path = path_default().projection({ stream: function(output) {
45006       return project(clip(output));
45007     } });
45008     var svgpath = function(entity) {
45009       if (entity.id in cache) {
45010         return cache[entity.id];
45011       } else {
45012         return cache[entity.id] = path(entity.asGeoJSON(graph));
45013       }
45014     };
45015     svgpath.geojson = function(d) {
45016       if (d.__featurehash__ !== void 0) {
45017         if (d.__featurehash__ in cache) {
45018           return cache[d.__featurehash__];
45019         } else {
45020           return cache[d.__featurehash__] = path(d);
45021         }
45022       } else {
45023         return path(d);
45024       }
45025     };
45026     return svgpath;
45027   }
45028   function svgPointTransform(projection2) {
45029     var svgpoint = function(entity) {
45030       var pt = projection2(entity.loc);
45031       return "translate(" + pt[0] + "," + pt[1] + ")";
45032     };
45033     svgpoint.geojson = function(d) {
45034       return svgpoint(d.properties.entity);
45035     };
45036     return svgpoint;
45037   }
45038   function svgRelationMemberTags(graph) {
45039     return function(entity) {
45040       var tags = entity.tags;
45041       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
45042       graph.parentRelations(entity).forEach(function(relation) {
45043         var type3 = relation.tags.type;
45044         if (type3 === "multipolygon" && shouldCopyMultipolygonTags || type3 === "boundary") {
45045           tags = Object.assign({}, relation.tags, tags);
45046         }
45047       });
45048       return tags;
45049     };
45050   }
45051   function svgSegmentWay(way, graph, activeID) {
45052     if (activeID === void 0) {
45053       return graph.transient(way, "waySegments", getWaySegments);
45054     } else {
45055       return getWaySegments();
45056     }
45057     function getWaySegments() {
45058       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
45059       var features2 = { passive: [], active: [] };
45060       var start2 = {};
45061       var end = {};
45062       var node, type3;
45063       for (var i2 = 0; i2 < way.nodes.length; i2++) {
45064         node = graph.entity(way.nodes[i2]);
45065         type3 = svgPassiveVertex(node, graph, activeID);
45066         end = { node, type: type3 };
45067         if (start2.type !== void 0) {
45068           if (start2.node.id === activeID || end.node.id === activeID) {
45069           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
45070             pushActive(start2, end, i2);
45071           } else if (start2.type === 0 && end.type === 0) {
45072             pushActive(start2, end, i2);
45073           } else {
45074             pushPassive(start2, end, i2);
45075           }
45076         }
45077         start2 = end;
45078       }
45079       return features2;
45080       function pushActive(start3, end2, index) {
45081         features2.active.push({
45082           type: "Feature",
45083           id: way.id + "-" + index + "-nope",
45084           properties: {
45085             nope: true,
45086             target: true,
45087             entity: way,
45088             nodes: [start3.node, end2.node],
45089             index
45090           },
45091           geometry: {
45092             type: "LineString",
45093             coordinates: [start3.node.loc, end2.node.loc]
45094           }
45095         });
45096       }
45097       function pushPassive(start3, end2, index) {
45098         features2.passive.push({
45099           type: "Feature",
45100           id: way.id + "-" + index,
45101           properties: {
45102             target: true,
45103             entity: way,
45104             nodes: [start3.node, end2.node],
45105             index
45106           },
45107           geometry: {
45108             type: "LineString",
45109             coordinates: [start3.node.loc, end2.node.loc]
45110           }
45111         });
45112       }
45113     }
45114   }
45115
45116   // modules/svg/tag_classes.js
45117   function svgTagClasses() {
45118     var primaries = [
45119       "building",
45120       "highway",
45121       "railway",
45122       "waterway",
45123       "aeroway",
45124       "aerialway",
45125       "piste:type",
45126       "boundary",
45127       "power",
45128       "amenity",
45129       "natural",
45130       "landuse",
45131       "leisure",
45132       "military",
45133       "place",
45134       "man_made",
45135       "route",
45136       "attraction",
45137       "building:part",
45138       "indoor"
45139     ];
45140     var statuses = Object.keys(osmLifecyclePrefixes);
45141     var secondaries = [
45142       "oneway",
45143       "bridge",
45144       "tunnel",
45145       "embankment",
45146       "cutting",
45147       "barrier",
45148       "surface",
45149       "tracktype",
45150       "footway",
45151       "crossing",
45152       "service",
45153       "sport",
45154       "public_transport",
45155       "location",
45156       "parking",
45157       "golf",
45158       "type",
45159       "leisure",
45160       "man_made",
45161       "indoor",
45162       "construction",
45163       "proposed"
45164     ];
45165     var _tags = function(entity) {
45166       return entity.tags;
45167     };
45168     var tagClasses = function(selection2) {
45169       selection2.each(function tagClassesEach(entity) {
45170         var value = this.className;
45171         if (value.baseVal !== void 0) {
45172           value = value.baseVal;
45173         }
45174         var t = _tags(entity);
45175         var computed = tagClasses.getClassesString(t, value);
45176         if (computed !== value) {
45177           select_default2(this).attr("class", computed);
45178         }
45179       });
45180     };
45181     tagClasses.getClassesString = function(t, value) {
45182       var primary, status;
45183       var i2, j2, k, v;
45184       var overrideGeometry;
45185       if (/\bstroke\b/.test(value)) {
45186         if (!!t.barrier && t.barrier !== "no") {
45187           overrideGeometry = "line";
45188         }
45189       }
45190       var classes = value.trim().split(/\s+/).filter(function(klass) {
45191         return klass.length && !/^tag-/.test(klass);
45192       }).map(function(klass) {
45193         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
45194       });
45195       for (i2 = 0; i2 < primaries.length; i2++) {
45196         k = primaries[i2];
45197         v = t[k];
45198         if (!v || v === "no")
45199           continue;
45200         if (k === "piste:type") {
45201           k = "piste";
45202         } else if (k === "building:part") {
45203           k = "building_part";
45204         }
45205         primary = k;
45206         if (statuses.indexOf(v) !== -1) {
45207           status = v;
45208           classes.push("tag-" + k);
45209         } else {
45210           classes.push("tag-" + k);
45211           classes.push("tag-" + k + "-" + v);
45212         }
45213         break;
45214       }
45215       if (!primary) {
45216         for (i2 = 0; i2 < statuses.length; i2++) {
45217           for (j2 = 0; j2 < primaries.length; j2++) {
45218             k = statuses[i2] + ":" + primaries[j2];
45219             v = t[k];
45220             if (!v || v === "no")
45221               continue;
45222             status = statuses[i2];
45223             break;
45224           }
45225         }
45226       }
45227       if (!status) {
45228         for (i2 = 0; i2 < statuses.length; i2++) {
45229           k = statuses[i2];
45230           v = t[k];
45231           if (!v || v === "no")
45232             continue;
45233           if (v === "yes") {
45234             status = k;
45235           } else if (primary && primary === v) {
45236             status = k;
45237           } else if (!primary && primaries.indexOf(v) !== -1) {
45238             status = k;
45239             primary = v;
45240             classes.push("tag-" + v);
45241           }
45242           if (status)
45243             break;
45244         }
45245       }
45246       if (status) {
45247         classes.push("tag-status");
45248         classes.push("tag-status-" + status);
45249       }
45250       for (i2 = 0; i2 < secondaries.length; i2++) {
45251         k = secondaries[i2];
45252         v = t[k];
45253         if (!v || v === "no" || k === primary)
45254           continue;
45255         classes.push("tag-" + k);
45256         classes.push("tag-" + k + "-" + v);
45257       }
45258       if (primary === "highway" && !osmPathHighwayTagValues[t.highway] || primary === "aeroway") {
45259         var surface = t.highway === "track" ? "unpaved" : "paved";
45260         for (k in t) {
45261           v = t[k];
45262           if (k in osmPavedTags) {
45263             surface = osmPavedTags[k][v] ? "paved" : "unpaved";
45264           }
45265           if (k in osmSemipavedTags && !!osmSemipavedTags[k][v]) {
45266             surface = "semipaved";
45267           }
45268         }
45269         classes.push("tag-" + surface);
45270       }
45271       var qid = t.wikidata || t["flag:wikidata"] || t["brand:wikidata"] || t["network:wikidata"] || t["operator:wikidata"];
45272       if (qid) {
45273         classes.push("tag-wikidata");
45274       }
45275       return classes.join(" ").trim();
45276     };
45277     tagClasses.tags = function(val) {
45278       if (!arguments.length)
45279         return _tags;
45280       _tags = val;
45281       return tagClasses;
45282     };
45283     return tagClasses;
45284   }
45285
45286   // modules/svg/tag_pattern.js
45287   var patterns = {
45288     amenity: {
45289       grave_yard: "cemetery",
45290       fountain: "water_standing"
45291     },
45292     landuse: {
45293       cemetery: [
45294         { religion: "christian", pattern: "cemetery_christian" },
45295         { religion: "buddhist", pattern: "cemetery_buddhist" },
45296         { religion: "muslim", pattern: "cemetery_muslim" },
45297         { religion: "jewish", pattern: "cemetery_jewish" },
45298         { pattern: "cemetery" }
45299       ],
45300       construction: "construction",
45301       farmland: "farmland",
45302       farmyard: "farmyard",
45303       forest: [
45304         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
45305         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
45306         { leaf_type: "leafless", pattern: "forest_leafless" },
45307         { pattern: "forest" }
45308       ],
45309       grave_yard: "cemetery",
45310       grass: "grass",
45311       landfill: "landfill",
45312       meadow: "meadow",
45313       military: "construction",
45314       orchard: "orchard",
45315       quarry: "quarry",
45316       vineyard: "vineyard"
45317     },
45318     leisure: {
45319       horse_riding: "farmyard"
45320     },
45321     natural: {
45322       beach: "beach",
45323       grassland: "grass",
45324       sand: "beach",
45325       scrub: "scrub",
45326       water: [
45327         { water: "pond", pattern: "pond" },
45328         { water: "reservoir", pattern: "water_standing" },
45329         { pattern: "waves" }
45330       ],
45331       wetland: [
45332         { wetland: "marsh", pattern: "wetland_marsh" },
45333         { wetland: "swamp", pattern: "wetland_swamp" },
45334         { wetland: "bog", pattern: "wetland_bog" },
45335         { wetland: "reedbed", pattern: "wetland_reedbed" },
45336         { pattern: "wetland" }
45337       ],
45338       wood: [
45339         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
45340         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
45341         { leaf_type: "leafless", pattern: "forest_leafless" },
45342         { pattern: "forest" }
45343       ]
45344     },
45345     golf: {
45346       green: "golf_green",
45347       tee: "grass",
45348       fairway: "grass",
45349       rough: "scrub"
45350     },
45351     surface: {
45352       grass: "grass",
45353       sand: "beach"
45354     }
45355   };
45356   function svgTagPattern(tags) {
45357     if (tags.building && tags.building !== "no") {
45358       return null;
45359     }
45360     for (var tag in patterns) {
45361       var entityValue = tags[tag];
45362       if (!entityValue)
45363         continue;
45364       if (typeof patterns[tag] === "string") {
45365         return "pattern-" + patterns[tag];
45366       } else {
45367         var values = patterns[tag];
45368         for (var value in values) {
45369           if (entityValue !== value)
45370             continue;
45371           var rules = values[value];
45372           if (typeof rules === "string") {
45373             return "pattern-" + rules;
45374           }
45375           for (var ruleKey in rules) {
45376             var rule = rules[ruleKey];
45377             var pass = true;
45378             for (var criterion in rule) {
45379               if (criterion !== "pattern") {
45380                 var v = tags[criterion];
45381                 if (!v || v !== rule[criterion]) {
45382                   pass = false;
45383                   break;
45384                 }
45385               }
45386             }
45387             if (pass) {
45388               return "pattern-" + rule.pattern;
45389             }
45390           }
45391         }
45392       }
45393     }
45394     return null;
45395   }
45396
45397   // modules/svg/areas.js
45398   function svgAreas(projection2, context) {
45399     function getPatternStyle(tags) {
45400       var imageID = svgTagPattern(tags);
45401       if (imageID) {
45402         return 'url("#ideditor-' + imageID + '")';
45403       }
45404       return "";
45405     }
45406     function drawTargets(selection2, graph, entities, filter2) {
45407       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
45408       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
45409       var getPath = svgPath(projection2).geojson;
45410       var activeID = context.activeID();
45411       var base = context.history().base();
45412       var data = { targets: [], nopes: [] };
45413       entities.forEach(function(way) {
45414         var features2 = svgSegmentWay(way, graph, activeID);
45415         data.targets.push.apply(data.targets, features2.passive);
45416         data.nopes.push.apply(data.nopes, features2.active);
45417       });
45418       var targetData = data.targets.filter(getPath);
45419       var targets = selection2.selectAll(".area.target-allowed").filter(function(d) {
45420         return filter2(d.properties.entity);
45421       }).data(targetData, function key(d) {
45422         return d.id;
45423       });
45424       targets.exit().remove();
45425       var segmentWasEdited = function(d) {
45426         var wayID = d.properties.entity.id;
45427         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
45428           return false;
45429         }
45430         return d.properties.nodes.some(function(n2) {
45431           return !base.entities[n2.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
45432         });
45433       };
45434       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
45435         return "way area target target-allowed " + targetClass + d.id;
45436       }).classed("segment-edited", segmentWasEdited);
45437       var nopeData = data.nopes.filter(getPath);
45438       var nopes = selection2.selectAll(".area.target-nope").filter(function(d) {
45439         return filter2(d.properties.entity);
45440       }).data(nopeData, function key(d) {
45441         return d.id;
45442       });
45443       nopes.exit().remove();
45444       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
45445         return "way area target target-nope " + nopeClass + d.id;
45446       }).classed("segment-edited", segmentWasEdited);
45447     }
45448     function drawAreas(selection2, graph, entities, filter2) {
45449       var path = svgPath(projection2, graph, true);
45450       var areas = {};
45451       var multipolygon;
45452       var base = context.history().base();
45453       for (var i2 = 0; i2 < entities.length; i2++) {
45454         var entity = entities[i2];
45455         if (entity.geometry(graph) !== "area")
45456           continue;
45457         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
45458         if (multipolygon) {
45459           areas[multipolygon.id] = {
45460             entity: multipolygon.mergeTags(entity.tags),
45461             area: Math.abs(entity.area(graph))
45462           };
45463         } else if (!areas[entity.id]) {
45464           areas[entity.id] = {
45465             entity,
45466             area: Math.abs(entity.area(graph))
45467           };
45468         }
45469       }
45470       var fills = Object.values(areas).filter(function hasPath(a) {
45471         return path(a.entity);
45472       });
45473       fills.sort(function areaSort(a, b) {
45474         return b.area - a.area;
45475       });
45476       fills = fills.map(function(a) {
45477         return a.entity;
45478       });
45479       var strokes = fills.filter(function(area) {
45480         return area.type === "way";
45481       });
45482       var data = {
45483         clip: fills,
45484         shadow: strokes,
45485         stroke: strokes,
45486         fill: fills
45487       };
45488       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
45489       clipPaths.exit().remove();
45490       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
45491         return "ideditor-" + entity2.id + "-clippath";
45492       });
45493       clipPathsEnter.append("path");
45494       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
45495       var drawLayer = selection2.selectAll(".layer-osm.areas");
45496       var touchLayer = selection2.selectAll(".layer-touch.areas");
45497       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
45498       areagroup = areagroup.enter().append("g").attr("class", function(d) {
45499         return "areagroup area-" + d;
45500       }).merge(areagroup);
45501       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
45502         return data[layer];
45503       }, osmEntity.key);
45504       paths.exit().remove();
45505       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
45506       var bisect = bisector(function(node) {
45507         return -node.__data__.area(graph);
45508       }).left;
45509       function sortedByArea(entity2) {
45510         if (this._parent.__data__ === "fill") {
45511           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
45512         }
45513       }
45514       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
45515         var layer = this.parentNode.__data__;
45516         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
45517         if (layer === "fill") {
45518           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
45519           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
45520         }
45521       }).classed("added", function(d) {
45522         return !base.entities[d.id];
45523       }).classed("geometry-edited", function(d) {
45524         return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d.id].nodes, base.entities[d.id].nodes);
45525       }).classed("retagged", function(d) {
45526         return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
45527       }).call(svgTagClasses()).attr("d", path);
45528       touchLayer.call(drawTargets, graph, data.stroke, filter2);
45529     }
45530     return drawAreas;
45531   }
45532
45533   // modules/svg/data.js
45534   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
45535
45536   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
45537   function $(element, tagName) {
45538     return Array.from(element.getElementsByTagName(tagName));
45539   }
45540   function normalizeId(id2) {
45541     return id2[0] === "#" ? id2 : `#${id2}`;
45542   }
45543   function $ns(element, tagName, ns) {
45544     return Array.from(element.getElementsByTagNameNS(ns, tagName));
45545   }
45546   function nodeVal(node) {
45547     node?.normalize();
45548     return node && node.textContent || "";
45549   }
45550   function get1(node, tagName, callback) {
45551     const n2 = node.getElementsByTagName(tagName);
45552     const result = n2.length ? n2[0] : null;
45553     if (result && callback)
45554       callback(result);
45555     return result;
45556   }
45557   function get3(node, tagName, callback) {
45558     const properties = {};
45559     if (!node)
45560       return properties;
45561     const n2 = node.getElementsByTagName(tagName);
45562     const result = n2.length ? n2[0] : null;
45563     if (result && callback) {
45564       return callback(result, properties);
45565     }
45566     return properties;
45567   }
45568   function val1(node, tagName, callback) {
45569     const val = nodeVal(get1(node, tagName));
45570     if (val && callback)
45571       return callback(val) || {};
45572     return {};
45573   }
45574   function $num(node, tagName, callback) {
45575     const val = parseFloat(nodeVal(get1(node, tagName)));
45576     if (isNaN(val))
45577       return void 0;
45578     if (val && callback)
45579       return callback(val) || {};
45580     return {};
45581   }
45582   function num1(node, tagName, callback) {
45583     const val = parseFloat(nodeVal(get1(node, tagName)));
45584     if (isNaN(val))
45585       return void 0;
45586     if (val && callback)
45587       callback(val);
45588     return val;
45589   }
45590   function getMulti(node, propertyNames) {
45591     const properties = {};
45592     for (const property of propertyNames) {
45593       val1(node, property, (val) => {
45594         properties[property] = val;
45595       });
45596     }
45597     return properties;
45598   }
45599   function isElement(node) {
45600     return node?.nodeType === 1;
45601   }
45602   function getLineStyle(node) {
45603     return get3(node, "line", (lineStyle) => {
45604       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
45605         return { stroke: `#${color2}` };
45606       }), $num(lineStyle, "opacity", (opacity) => {
45607         return { "stroke-opacity": opacity };
45608       }), $num(lineStyle, "width", (width) => {
45609         return { "stroke-width": width * 96 / 25.4 };
45610       }));
45611       return val;
45612     });
45613   }
45614   function getExtensions(node) {
45615     let values = [];
45616     if (node === null)
45617       return values;
45618     for (const child of Array.from(node.childNodes)) {
45619       if (!isElement(child))
45620         continue;
45621       const name = abbreviateName(child.nodeName);
45622       if (name === "gpxtpx:TrackPointExtension") {
45623         values = values.concat(getExtensions(child));
45624       } else {
45625         const val = nodeVal(child);
45626         values.push([name, parseNumeric(val)]);
45627       }
45628     }
45629     return values;
45630   }
45631   function abbreviateName(name) {
45632     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
45633   }
45634   function parseNumeric(val) {
45635     const num = parseFloat(val);
45636     return isNaN(num) ? val : num;
45637   }
45638   function coordPair$1(node) {
45639     const ll = [
45640       parseFloat(node.getAttribute("lon") || ""),
45641       parseFloat(node.getAttribute("lat") || "")
45642     ];
45643     if (isNaN(ll[0]) || isNaN(ll[1])) {
45644       return null;
45645     }
45646     num1(node, "ele", (val) => {
45647       ll.push(val);
45648     });
45649     const time = get1(node, "time");
45650     return {
45651       coordinates: ll,
45652       time: time ? nodeVal(time) : null,
45653       extendedValues: getExtensions(get1(node, "extensions"))
45654     };
45655   }
45656   function extractProperties(node) {
45657     const properties = getMulti(node, [
45658       "name",
45659       "cmt",
45660       "desc",
45661       "type",
45662       "time",
45663       "keywords"
45664     ]);
45665     const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
45666     for (const child of extensions) {
45667       if (child.parentNode?.parentNode === node) {
45668         properties[child.tagName.replace(":", "_")] = nodeVal(child);
45669       }
45670     }
45671     const links = $(node, "link");
45672     if (links.length) {
45673       properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
45674     }
45675     return properties;
45676   }
45677   function getPoints$1(node, pointname) {
45678     const pts = $(node, pointname);
45679     const line = [];
45680     const times = [];
45681     const extendedValues = {};
45682     for (let i2 = 0; i2 < pts.length; i2++) {
45683       const c = coordPair$1(pts[i2]);
45684       if (!c) {
45685         continue;
45686       }
45687       line.push(c.coordinates);
45688       if (c.time)
45689         times.push(c.time);
45690       for (const [name, val] of c.extendedValues) {
45691         const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
45692         if (!extendedValues[plural]) {
45693           extendedValues[plural] = Array(pts.length).fill(null);
45694         }
45695         extendedValues[plural][i2] = val;
45696       }
45697     }
45698     if (line.length < 2)
45699       return;
45700     return {
45701       line,
45702       times,
45703       extendedValues
45704     };
45705   }
45706   function getRoute(node) {
45707     const line = getPoints$1(node, "rtept");
45708     if (!line)
45709       return;
45710     return {
45711       type: "Feature",
45712       properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
45713       geometry: {
45714         type: "LineString",
45715         coordinates: line.line
45716       }
45717     };
45718   }
45719   function getTrack(node) {
45720     const segments = $(node, "trkseg");
45721     const track = [];
45722     const times = [];
45723     const extractedLines = [];
45724     for (const segment of segments) {
45725       const line = getPoints$1(segment, "trkpt");
45726       if (line) {
45727         extractedLines.push(line);
45728         if (line.times && line.times.length)
45729           times.push(line.times);
45730       }
45731     }
45732     if (extractedLines.length === 0)
45733       return null;
45734     const multi = extractedLines.length > 1;
45735     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
45736       coordinateProperties: {
45737         times: multi ? times : times[0]
45738       }
45739     } : {});
45740     for (const line of extractedLines) {
45741       track.push(line.line);
45742       if (!properties.coordinateProperties) {
45743         properties.coordinateProperties = {};
45744       }
45745       const props = properties.coordinateProperties;
45746       const entries = Object.entries(line.extendedValues);
45747       for (let i2 = 0; i2 < entries.length; i2++) {
45748         const [name, val] = entries[i2];
45749         if (multi) {
45750           if (!props[name]) {
45751             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
45752           }
45753           props[name][i2] = val;
45754         } else {
45755           props[name] = val;
45756         }
45757       }
45758     }
45759     return {
45760       type: "Feature",
45761       properties,
45762       geometry: multi ? {
45763         type: "MultiLineString",
45764         coordinates: track
45765       } : {
45766         type: "LineString",
45767         coordinates: track[0]
45768       }
45769     };
45770   }
45771   function getPoint(node) {
45772     const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
45773     const pair2 = coordPair$1(node);
45774     if (!pair2)
45775       return null;
45776     return {
45777       type: "Feature",
45778       properties,
45779       geometry: {
45780         type: "Point",
45781         coordinates: pair2.coordinates
45782       }
45783     };
45784   }
45785   function* gpxGen(node) {
45786     for (const track of $(node, "trk")) {
45787       const feature3 = getTrack(track);
45788       if (feature3)
45789         yield feature3;
45790     }
45791     for (const route of $(node, "rte")) {
45792       const feature3 = getRoute(route);
45793       if (feature3)
45794         yield feature3;
45795     }
45796     for (const waypoint of $(node, "wpt")) {
45797       const point = getPoint(waypoint);
45798       if (point)
45799         yield point;
45800     }
45801   }
45802   function gpx(node) {
45803     return {
45804       type: "FeatureCollection",
45805       features: Array.from(gpxGen(node))
45806     };
45807   }
45808   function fixColor(v, prefix) {
45809     const properties = {};
45810     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
45811     if (v[0] === "#") {
45812       v = v.substring(1);
45813     }
45814     if (v.length === 6 || v.length === 3) {
45815       properties[colorProp] = "#" + v;
45816     } else if (v.length === 8) {
45817       properties[prefix + "-opacity"] = parseInt(v.substring(0, 2), 16) / 255;
45818       properties[colorProp] = "#" + v.substring(6, 8) + v.substring(4, 6) + v.substring(2, 4);
45819     }
45820     return properties;
45821   }
45822   function numericProperty(node, source, target) {
45823     const properties = {};
45824     num1(node, source, (val) => {
45825       properties[target] = val;
45826     });
45827     return properties;
45828   }
45829   function getColor(node, output) {
45830     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
45831   }
45832   function extractIcon(node) {
45833     return get3(node, "IconStyle", (iconStyle) => {
45834       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
45835         const left = parseFloat(hotspot.getAttribute("x") || "");
45836         const top = parseFloat(hotspot.getAttribute("y") || "");
45837         const xunits = hotspot.getAttribute("xunits") || "";
45838         const yunits = hotspot.getAttribute("yunits") || "";
45839         if (!isNaN(left) && !isNaN(top))
45840           return {
45841             "icon-offset": [left, top],
45842             "icon-offset-units": [xunits, yunits]
45843           };
45844         return {};
45845       }), get3(iconStyle, "Icon", (icon2, properties) => {
45846         val1(icon2, "href", (href) => {
45847           properties.icon = href;
45848         });
45849         return properties;
45850       }));
45851     });
45852   }
45853   function extractLabel(node) {
45854     return get3(node, "LabelStyle", (labelStyle) => {
45855       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
45856     });
45857   }
45858   function extractLine(node) {
45859     return get3(node, "LineStyle", (lineStyle) => {
45860       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
45861     });
45862   }
45863   function extractPoly(node) {
45864     return get3(node, "PolyStyle", (polyStyle, properties) => {
45865       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
45866         if (fill === "0")
45867           return { "fill-opacity": 0 };
45868       }), val1(polyStyle, "outline", (outline) => {
45869         if (outline === "0")
45870           return { "stroke-opacity": 0 };
45871       }));
45872     });
45873   }
45874   function extractStyle(node) {
45875     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
45876   }
45877   var removeSpace = /\s*/g;
45878   var trimSpace = /^\s*|\s*$/g;
45879   var splitSpace = /\s+/;
45880   function coord1(value) {
45881     return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
45882   }
45883   function coord(value) {
45884     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
45885       return coord2.length >= 2;
45886     });
45887   }
45888   function gxCoords(node) {
45889     let elems = $(node, "coord");
45890     if (elems.length === 0) {
45891       elems = $ns(node, "coord", "*");
45892     }
45893     const coordinates = elems.map((elem) => {
45894       return nodeVal(elem).split(" ").map(parseFloat);
45895     });
45896     if (coordinates.length === 0) {
45897       return null;
45898     }
45899     return {
45900       geometry: coordinates.length > 2 ? {
45901         type: "LineString",
45902         coordinates
45903       } : {
45904         type: "Point",
45905         coordinates: coordinates[0]
45906       },
45907       times: $(node, "when").map((elem) => nodeVal(elem))
45908     };
45909   }
45910   function fixRing(ring) {
45911     if (ring.length === 0)
45912       return ring;
45913     const first = ring[0];
45914     const last = ring[ring.length - 1];
45915     let equal = true;
45916     for (let i2 = 0; i2 < Math.max(first.length, last.length); i2++) {
45917       if (first[i2] !== last[i2]) {
45918         equal = false;
45919         break;
45920       }
45921     }
45922     if (!equal) {
45923       return ring.concat([ring[0]]);
45924     }
45925     return ring;
45926   }
45927   var GEO_TYPES = [
45928     "Polygon",
45929     "LineString",
45930     "Point",
45931     "Track",
45932     "gx:Track"
45933   ];
45934   function getCoordinates(node) {
45935     return nodeVal(get1(node, "coordinates"));
45936   }
45937   function getGeometry(node) {
45938     const geometries = [];
45939     const coordTimes = [];
45940     for (const t of ["MultiGeometry", "MultiTrack", "gx:MultiTrack"]) {
45941       const elem = get1(node, t);
45942       if (elem) {
45943         return getGeometry(elem);
45944       }
45945     }
45946     for (const geoType of GEO_TYPES) {
45947       for (const geomNode of $(node, geoType)) {
45948         switch (geoType) {
45949           case "Point": {
45950             const coordinates = coord1(getCoordinates(geomNode));
45951             if (coordinates.length >= 2) {
45952               geometries.push({
45953                 type: "Point",
45954                 coordinates
45955               });
45956             }
45957             break;
45958           }
45959           case "LineString": {
45960             const coordinates = coord(getCoordinates(geomNode));
45961             if (coordinates.length >= 2) {
45962               geometries.push({
45963                 type: "LineString",
45964                 coordinates
45965               });
45966             }
45967             break;
45968           }
45969           case "Polygon": {
45970             const coords = [];
45971             for (const linearRing of $(geomNode, "LinearRing")) {
45972               const ring = fixRing(coord(getCoordinates(linearRing)));
45973               if (ring.length >= 4) {
45974                 coords.push(ring);
45975               }
45976             }
45977             if (coords.length) {
45978               geometries.push({
45979                 type: "Polygon",
45980                 coordinates: coords
45981               });
45982             }
45983             break;
45984           }
45985           case "Track":
45986           case "gx:Track": {
45987             const gx = gxCoords(geomNode);
45988             if (!gx)
45989               break;
45990             const { times, geometry } = gx;
45991             geometries.push(geometry);
45992             if (times.length)
45993               coordTimes.push(times);
45994             break;
45995           }
45996         }
45997       }
45998     }
45999     return {
46000       geometries,
46001       coordTimes
46002     };
46003   }
46004   function extractExtendedData(node) {
46005     return get3(node, "ExtendedData", (extendedData, properties) => {
46006       for (const data of $(extendedData, "Data")) {
46007         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
46008       }
46009       for (const simpleData of $(extendedData, "SimpleData")) {
46010         properties[simpleData.getAttribute("name") || ""] = nodeVal(simpleData);
46011       }
46012       return properties;
46013     });
46014   }
46015   function geometryListToGeometry(geometries) {
46016     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
46017       type: "GeometryCollection",
46018       geometries
46019     };
46020   }
46021   function extractTimeSpan(node) {
46022     return get3(node, "TimeSpan", (timeSpan) => {
46023       return {
46024         timespan: {
46025           begin: nodeVal(get1(timeSpan, "begin")),
46026           end: nodeVal(get1(timeSpan, "end"))
46027         }
46028       };
46029     });
46030   }
46031   function extractTimeStamp(node) {
46032     return get3(node, "TimeStamp", (timeStamp) => {
46033       return { timestamp: nodeVal(get1(timeStamp, "when")) };
46034     });
46035   }
46036   function extractCascadedStyle(node, styleMap) {
46037     return val1(node, "styleUrl", (styleUrl) => {
46038       styleUrl = normalizeId(styleUrl);
46039       if (styleMap[styleUrl]) {
46040         return Object.assign({ styleUrl }, styleMap[styleUrl]);
46041       }
46042       return { styleUrl };
46043     });
46044   }
46045   function getMaybeHTMLDescription(node) {
46046     const descriptionNode = get1(node, "description");
46047     for (const c of Array.from(descriptionNode?.childNodes || [])) {
46048       if (c.nodeType === 4) {
46049         return {
46050           description: {
46051             "@type": "html",
46052             value: nodeVal(c)
46053           }
46054         };
46055       }
46056     }
46057     return {};
46058   }
46059   function getPlacemark(node, styleMap) {
46060     const { coordTimes, geometries } = getGeometry(node);
46061     const feature3 = {
46062       type: "Feature",
46063       geometry: geometryListToGeometry(geometries),
46064       properties: Object.assign(getMulti(node, [
46065         "name",
46066         "address",
46067         "visibility",
46068         "open",
46069         "phoneNumber",
46070         "description"
46071       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
46072         coordinateProperties: {
46073           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
46074         }
46075       } : {})
46076     };
46077     if (feature3.properties?.visibility !== void 0) {
46078       feature3.properties.visibility = feature3.properties.visibility !== "0";
46079     }
46080     const id2 = node.getAttribute("id");
46081     if (id2 !== null && id2 !== "")
46082       feature3.id = id2;
46083     return feature3;
46084   }
46085   function getStyleId(style) {
46086     let id2 = style.getAttribute("id");
46087     const parentNode = style.parentNode;
46088     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
46089       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
46090     }
46091     return normalizeId(id2 || "");
46092   }
46093   function buildStyleMap(node) {
46094     const styleMap = {};
46095     for (const style of $(node, "Style")) {
46096       styleMap[getStyleId(style)] = extractStyle(style);
46097     }
46098     for (const map2 of $(node, "StyleMap")) {
46099       const id2 = normalizeId(map2.getAttribute("id") || "");
46100       val1(map2, "styleUrl", (styleUrl) => {
46101         styleUrl = normalizeId(styleUrl);
46102         if (styleMap[styleUrl]) {
46103           styleMap[id2] = styleMap[styleUrl];
46104         }
46105       });
46106     }
46107     return styleMap;
46108   }
46109   function* kmlGen(node) {
46110     const styleMap = buildStyleMap(node);
46111     for (const placemark of $(node, "Placemark")) {
46112       const feature3 = getPlacemark(placemark, styleMap);
46113       if (feature3)
46114         yield feature3;
46115     }
46116   }
46117   function kml(node) {
46118     return {
46119       type: "FeatureCollection",
46120       features: Array.from(kmlGen(node))
46121     };
46122   }
46123
46124   // modules/svg/data.js
46125   var _initialized = false;
46126   var _enabled = false;
46127   var _geojson;
46128   function svgData(projection2, context, dispatch10) {
46129     var throttledRedraw = throttle_default(function() {
46130       dispatch10.call("change");
46131     }, 1e3);
46132     var _showLabels = true;
46133     var detected = utilDetect();
46134     var layer = select_default2(null);
46135     var _vtService;
46136     var _fileList;
46137     var _template;
46138     var _src;
46139     function init2() {
46140       if (_initialized)
46141         return;
46142       _geojson = {};
46143       _enabled = true;
46144       function over(d3_event) {
46145         d3_event.stopPropagation();
46146         d3_event.preventDefault();
46147         d3_event.dataTransfer.dropEffect = "copy";
46148       }
46149       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
46150         d3_event.stopPropagation();
46151         d3_event.preventDefault();
46152         if (!detected.filedrop)
46153           return;
46154         drawData.fileList(d3_event.dataTransfer.files);
46155       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
46156       _initialized = true;
46157     }
46158     function getService() {
46159       if (services.vectorTile && !_vtService) {
46160         _vtService = services.vectorTile;
46161         _vtService.event.on("loadedData", throttledRedraw);
46162       } else if (!services.vectorTile && _vtService) {
46163         _vtService = null;
46164       }
46165       return _vtService;
46166     }
46167     function showLayer() {
46168       layerOn();
46169       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
46170         dispatch10.call("change");
46171       });
46172     }
46173     function hideLayer() {
46174       throttledRedraw.cancel();
46175       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
46176     }
46177     function layerOn() {
46178       layer.style("display", "block");
46179     }
46180     function layerOff() {
46181       layer.selectAll(".viewfield-group").remove();
46182       layer.style("display", "none");
46183     }
46184     function ensureIDs(gj) {
46185       if (!gj)
46186         return null;
46187       if (gj.type === "FeatureCollection") {
46188         for (var i2 = 0; i2 < gj.features.length; i2++) {
46189           ensureFeatureID(gj.features[i2]);
46190         }
46191       } else {
46192         ensureFeatureID(gj);
46193       }
46194       return gj;
46195     }
46196     function ensureFeatureID(feature3) {
46197       if (!feature3)
46198         return;
46199       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
46200       return feature3;
46201     }
46202     function getFeatures(gj) {
46203       if (!gj)
46204         return [];
46205       if (gj.type === "FeatureCollection") {
46206         return gj.features;
46207       } else {
46208         return [gj];
46209       }
46210     }
46211     function featureKey(d) {
46212       return d.__featurehash__;
46213     }
46214     function isPolygon(d) {
46215       return d.geometry.type === "Polygon" || d.geometry.type === "MultiPolygon";
46216     }
46217     function clipPathID(d) {
46218       return "ideditor-data-" + d.__featurehash__ + "-clippath";
46219     }
46220     function featureClasses(d) {
46221       return [
46222         "data" + d.__featurehash__,
46223         d.geometry.type,
46224         isPolygon(d) ? "area" : "",
46225         d.__layerID__ || ""
46226       ].filter(Boolean).join(" ");
46227     }
46228     function drawData(selection2) {
46229       var vtService = getService();
46230       var getPath = svgPath(projection2).geojson;
46231       var getAreaPath = svgPath(projection2, null, true).geojson;
46232       var hasData = drawData.hasData();
46233       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
46234       layer.exit().remove();
46235       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
46236       var surface = context.surface();
46237       if (!surface || surface.empty())
46238         return;
46239       var geoData, polygonData;
46240       if (_template && vtService) {
46241         var sourceID = _template;
46242         vtService.loadTiles(sourceID, _template, projection2);
46243         geoData = vtService.data(sourceID, projection2);
46244       } else {
46245         geoData = getFeatures(_geojson);
46246       }
46247       geoData = geoData.filter(getPath);
46248       polygonData = geoData.filter(isPolygon);
46249       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
46250       clipPaths.exit().remove();
46251       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
46252       clipPathsEnter.append("path");
46253       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
46254       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
46255       datagroups = datagroups.enter().append("g").attr("class", function(d) {
46256         return "datagroup datagroup-" + d;
46257       }).merge(datagroups);
46258       var pathData = {
46259         fill: polygonData,
46260         shadow: geoData,
46261         stroke: geoData
46262       };
46263       var paths = datagroups.selectAll("path").data(function(layer2) {
46264         return pathData[layer2];
46265       }, featureKey);
46266       paths.exit().remove();
46267       paths = paths.enter().append("path").attr("class", function(d) {
46268         var datagroup = this.parentNode.__data__;
46269         return "pathdata " + datagroup + " " + featureClasses(d);
46270       }).attr("clip-path", function(d) {
46271         var datagroup = this.parentNode.__data__;
46272         return datagroup === "fill" ? "url(#" + clipPathID(d) + ")" : null;
46273       }).merge(paths).attr("d", function(d) {
46274         var datagroup = this.parentNode.__data__;
46275         return datagroup === "fill" ? getAreaPath(d) : getPath(d);
46276       });
46277       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
46278       function drawLabels(selection3, textClass, data) {
46279         var labelPath = path_default(projection2);
46280         var labelData = data.filter(function(d) {
46281           return _showLabels && d.properties && (d.properties.desc || d.properties.name);
46282         });
46283         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
46284         labels.exit().remove();
46285         labels = labels.enter().append("text").attr("class", function(d) {
46286           return textClass + " " + featureClasses(d);
46287         }).merge(labels).text(function(d) {
46288           return d.properties.desc || d.properties.name;
46289         }).attr("x", function(d) {
46290           var centroid = labelPath.centroid(d);
46291           return centroid[0] + 11;
46292         }).attr("y", function(d) {
46293           var centroid = labelPath.centroid(d);
46294           return centroid[1];
46295         });
46296       }
46297     }
46298     function getExtension(fileName) {
46299       if (!fileName)
46300         return;
46301       var re2 = /\.(gpx|kml|(geo)?json)$/i;
46302       var match = fileName.toLowerCase().match(re2);
46303       return match && match.length && match[0];
46304     }
46305     function xmlToDom(textdata) {
46306       return new DOMParser().parseFromString(textdata, "text/xml");
46307     }
46308     function stringifyGeojsonProperties(feature3) {
46309       const properties = feature3.properties;
46310       for (const key in properties) {
46311         const property = properties[key];
46312         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
46313           properties[key] = property.toString();
46314         } else if (property === null) {
46315           properties[key] = "null";
46316         } else if (typeof property === "object") {
46317           properties[key] = JSON.stringify(property);
46318         }
46319       }
46320     }
46321     drawData.setFile = function(extension, data) {
46322       _template = null;
46323       _fileList = null;
46324       _geojson = null;
46325       _src = null;
46326       var gj;
46327       switch (extension) {
46328         case ".gpx":
46329           gj = gpx(xmlToDom(data));
46330           break;
46331         case ".kml":
46332           gj = kml(xmlToDom(data));
46333           break;
46334         case ".geojson":
46335         case ".json":
46336           gj = JSON.parse(data);
46337           if (gj.type === "FeatureCollection") {
46338             gj.features.forEach(stringifyGeojsonProperties);
46339           } else if (gj.type === "Feature") {
46340             stringifyGeojsonProperties(gj);
46341           }
46342           break;
46343       }
46344       gj = gj || {};
46345       if (Object.keys(gj).length) {
46346         _geojson = ensureIDs(gj);
46347         _src = extension + " data file";
46348         this.fitZoom();
46349       }
46350       dispatch10.call("change");
46351       return this;
46352     };
46353     drawData.showLabels = function(val) {
46354       if (!arguments.length)
46355         return _showLabels;
46356       _showLabels = val;
46357       return this;
46358     };
46359     drawData.enabled = function(val) {
46360       if (!arguments.length)
46361         return _enabled;
46362       _enabled = val;
46363       if (_enabled) {
46364         showLayer();
46365       } else {
46366         hideLayer();
46367       }
46368       dispatch10.call("change");
46369       return this;
46370     };
46371     drawData.hasData = function() {
46372       var gj = _geojson || {};
46373       return !!(_template || Object.keys(gj).length);
46374     };
46375     drawData.template = function(val, src) {
46376       if (!arguments.length)
46377         return _template;
46378       var osm = context.connection();
46379       if (osm) {
46380         var blocklists = osm.imageryBlocklists();
46381         var fail = false;
46382         var tested = 0;
46383         var regex;
46384         for (var i2 = 0; i2 < blocklists.length; i2++) {
46385           regex = blocklists[i2];
46386           fail = regex.test(val);
46387           tested++;
46388           if (fail)
46389             break;
46390         }
46391         if (!tested) {
46392           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
46393           fail = regex.test(val);
46394         }
46395       }
46396       _template = val;
46397       _fileList = null;
46398       _geojson = null;
46399       _src = src || "vectortile:" + val.split(/[?#]/)[0];
46400       dispatch10.call("change");
46401       return this;
46402     };
46403     drawData.geojson = function(gj, src) {
46404       if (!arguments.length)
46405         return _geojson;
46406       _template = null;
46407       _fileList = null;
46408       _geojson = null;
46409       _src = null;
46410       gj = gj || {};
46411       if (Object.keys(gj).length) {
46412         _geojson = ensureIDs(gj);
46413         _src = src || "unknown.geojson";
46414       }
46415       dispatch10.call("change");
46416       return this;
46417     };
46418     drawData.fileList = function(fileList) {
46419       if (!arguments.length)
46420         return _fileList;
46421       _template = null;
46422       _fileList = fileList;
46423       _geojson = null;
46424       _src = null;
46425       if (!fileList || !fileList.length)
46426         return this;
46427       var f2 = fileList[0];
46428       var extension = getExtension(f2.name);
46429       var reader = new FileReader();
46430       reader.onload = function() {
46431         return function(e) {
46432           drawData.setFile(extension, e.target.result);
46433         };
46434       }(f2);
46435       reader.readAsText(f2);
46436       return this;
46437     };
46438     drawData.url = function(url, defaultExtension) {
46439       _template = null;
46440       _fileList = null;
46441       _geojson = null;
46442       _src = null;
46443       var testUrl = url.split(/[?#]/)[0];
46444       var extension = getExtension(testUrl) || defaultExtension;
46445       if (extension) {
46446         _template = null;
46447         text_default3(url).then(function(data) {
46448           drawData.setFile(extension, data);
46449         }).catch(function() {
46450         });
46451       } else {
46452         drawData.template(url);
46453       }
46454       return this;
46455     };
46456     drawData.getSrc = function() {
46457       return _src || "";
46458     };
46459     drawData.fitZoom = function() {
46460       var features2 = getFeatures(_geojson);
46461       if (!features2.length)
46462         return;
46463       var map2 = context.map();
46464       var viewport = map2.trimmedExtent().polygon();
46465       var coords = features2.reduce(function(coords2, feature3) {
46466         var geom = feature3.geometry;
46467         if (!geom)
46468           return coords2;
46469         var c = geom.coordinates;
46470         switch (geom.type) {
46471           case "Point":
46472             c = [c];
46473           case "MultiPoint":
46474           case "LineString":
46475             break;
46476           case "MultiPolygon":
46477             c = utilArrayFlatten(c);
46478           case "Polygon":
46479           case "MultiLineString":
46480             c = utilArrayFlatten(c);
46481             break;
46482         }
46483         return utilArrayUnion(coords2, c);
46484       }, []);
46485       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
46486         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
46487         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
46488       }
46489       return this;
46490     };
46491     init2();
46492     return drawData;
46493   }
46494
46495   // modules/svg/debug.js
46496   function svgDebug(projection2, context) {
46497     function drawDebug(selection2) {
46498       const showTile = context.getDebug("tile");
46499       const showCollision = context.getDebug("collision");
46500       const showImagery = context.getDebug("imagery");
46501       const showTouchTargets = context.getDebug("target");
46502       const showDownloaded = context.getDebug("downloaded");
46503       let debugData = [];
46504       if (showTile) {
46505         debugData.push({ class: "red", label: "tile" });
46506       }
46507       if (showCollision) {
46508         debugData.push({ class: "yellow", label: "collision" });
46509       }
46510       if (showImagery) {
46511         debugData.push({ class: "orange", label: "imagery" });
46512       }
46513       if (showTouchTargets) {
46514         debugData.push({ class: "pink", label: "touchTargets" });
46515       }
46516       if (showDownloaded) {
46517         debugData.push({ class: "purple", label: "downloaded" });
46518       }
46519       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
46520       legend.exit().remove();
46521       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
46522       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d) => d.label);
46523       legendItems.exit().remove();
46524       legendItems.enter().append("span").attr("class", (d) => `debug-legend-item ${d.class}`).text((d) => d.label);
46525       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
46526       layer.exit().remove();
46527       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
46528       const extent = context.map().extent();
46529       _mainFileFetcher.get("imagery").then((d) => {
46530         const hits = showImagery && d.query.bbox(extent.rectangle(), true) || [];
46531         const features2 = hits.map((d2) => d2.features[d2.id]);
46532         let imagery = layer.selectAll("path.debug-imagery").data(features2);
46533         imagery.exit().remove();
46534         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
46535       }).catch(() => {
46536       });
46537       const osm = context.connection();
46538       let dataDownloaded = [];
46539       if (osm && showDownloaded) {
46540         const rtree = osm.caches("get").tile.rtree;
46541         dataDownloaded = rtree.all().map((bbox) => {
46542           return {
46543             type: "Feature",
46544             properties: { id: bbox.id },
46545             geometry: {
46546               type: "Polygon",
46547               coordinates: [[
46548                 [bbox.minX, bbox.minY],
46549                 [bbox.minX, bbox.maxY],
46550                 [bbox.maxX, bbox.maxY],
46551                 [bbox.maxX, bbox.minY],
46552                 [bbox.minX, bbox.minY]
46553               ]]
46554             }
46555           };
46556         });
46557       }
46558       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
46559       downloaded.exit().remove();
46560       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
46561       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
46562     }
46563     drawDebug.enabled = function() {
46564       if (!arguments.length) {
46565         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
46566       } else {
46567         return this;
46568       }
46569     };
46570     return drawDebug;
46571   }
46572
46573   // modules/svg/defs.js
46574   function svgDefs(context) {
46575     var _defsSelection = select_default2(null);
46576     var _spritesheetIds = [
46577       "iD-sprite",
46578       "maki-sprite",
46579       "temaki-sprite",
46580       "fa-sprite",
46581       "community-sprite"
46582     ];
46583     function drawDefs(selection2) {
46584       _defsSelection = selection2.append("defs");
46585       _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");
46586       function addSidedMarker(name, color2, offset) {
46587         _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);
46588       }
46589       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
46590       addSidedMarker("coastline", "#77dede", 1);
46591       addSidedMarker("waterway", "#77dede", 1);
46592       addSidedMarker("barrier", "#ddd", 1);
46593       addSidedMarker("man_made", "#fff", 0);
46594       _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");
46595       _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");
46596       var patterns2 = _defsSelection.selectAll("pattern").data([
46597         ["beach", "dots"],
46598         ["construction", "construction"],
46599         ["cemetery", "cemetery"],
46600         ["cemetery_christian", "cemetery_christian"],
46601         ["cemetery_buddhist", "cemetery_buddhist"],
46602         ["cemetery_muslim", "cemetery_muslim"],
46603         ["cemetery_jewish", "cemetery_jewish"],
46604         ["farmland", "farmland"],
46605         ["farmyard", "farmyard"],
46606         ["forest", "forest"],
46607         ["forest_broadleaved", "forest_broadleaved"],
46608         ["forest_needleleaved", "forest_needleleaved"],
46609         ["forest_leafless", "forest_leafless"],
46610         ["golf_green", "grass"],
46611         ["grass", "grass"],
46612         ["landfill", "landfill"],
46613         ["meadow", "grass"],
46614         ["orchard", "orchard"],
46615         ["pond", "pond"],
46616         ["quarry", "quarry"],
46617         ["scrub", "bushes"],
46618         ["vineyard", "vineyard"],
46619         ["water_standing", "lines"],
46620         ["waves", "waves"],
46621         ["wetland", "wetland"],
46622         ["wetland_marsh", "wetland_marsh"],
46623         ["wetland_swamp", "wetland_swamp"],
46624         ["wetland_bog", "wetland_bog"],
46625         ["wetland_reedbed", "wetland_reedbed"]
46626       ]).enter().append("pattern").attr("id", function(d) {
46627         return "ideditor-pattern-" + d[0];
46628       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
46629       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d) {
46630         return "pattern-color-" + d[0];
46631       });
46632       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d) {
46633         return context.imagePath("pattern/" + d[1] + ".png");
46634       });
46635       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d) {
46636         return "ideditor-clip-square-" + d;
46637       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d) {
46638         return d;
46639       }).attr("height", function(d) {
46640         return d;
46641       });
46642       addSprites(_spritesheetIds, true);
46643     }
46644     function addSprites(ids, overrideColors) {
46645       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
46646       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
46647       spritesheets.enter().append("g").attr("class", function(d) {
46648         return "spritesheet spritesheet-" + d;
46649       }).each(function(d) {
46650         var url = context.imagePath(d + ".svg");
46651         var node = select_default2(this).node();
46652         svg(url).then(function(svg2) {
46653           node.appendChild(
46654             select_default2(svg2.documentElement).attr("id", "ideditor-" + d).node()
46655           );
46656           if (overrideColors && d !== "iD-sprite") {
46657             select_default2(node).selectAll("path").attr("fill", "currentColor");
46658           }
46659         }).catch(function() {
46660         });
46661       });
46662       spritesheets.exit().remove();
46663     }
46664     drawDefs.addSprites = addSprites;
46665     return drawDefs;
46666   }
46667
46668   // modules/svg/keepRight.js
46669   var _layerEnabled = false;
46670   var _qaService;
46671   function svgKeepRight(projection2, context, dispatch10) {
46672     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
46673     const minZoom3 = 12;
46674     let touchLayer = select_default2(null);
46675     let drawLayer = select_default2(null);
46676     let layerVisible = false;
46677     function markerPath(selection2, klass) {
46678       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");
46679     }
46680     function getService() {
46681       if (services.keepRight && !_qaService) {
46682         _qaService = services.keepRight;
46683         _qaService.on("loaded", throttledRedraw);
46684       } else if (!services.keepRight && _qaService) {
46685         _qaService = null;
46686       }
46687       return _qaService;
46688     }
46689     function editOn() {
46690       if (!layerVisible) {
46691         layerVisible = true;
46692         drawLayer.style("display", "block");
46693       }
46694     }
46695     function editOff() {
46696       if (layerVisible) {
46697         layerVisible = false;
46698         drawLayer.style("display", "none");
46699         drawLayer.selectAll(".qaItem.keepRight").remove();
46700         touchLayer.selectAll(".qaItem.keepRight").remove();
46701       }
46702     }
46703     function layerOn() {
46704       editOn();
46705       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
46706     }
46707     function layerOff() {
46708       throttledRedraw.cancel();
46709       drawLayer.interrupt();
46710       touchLayer.selectAll(".qaItem.keepRight").remove();
46711       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
46712         editOff();
46713         dispatch10.call("change");
46714       });
46715     }
46716     function updateMarkers() {
46717       if (!layerVisible || !_layerEnabled)
46718         return;
46719       const service = getService();
46720       const selectedID = context.selectedErrorID();
46721       const data = service ? service.getItems(projection2) : [];
46722       const getTransform = svgPointTransform(projection2);
46723       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
46724       markers.exit().remove();
46725       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`);
46726       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
46727       markersEnter.append("path").call(markerPath, "shadow");
46728       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");
46729       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
46730       if (touchLayer.empty())
46731         return;
46732       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
46733       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
46734       targets.exit().remove();
46735       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
46736       function sortY(a, b) {
46737         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : a.severity === "error" && b.severity !== "error" ? 1 : b.severity === "error" && a.severity !== "error" ? -1 : b.loc[1] - a.loc[1];
46738       }
46739     }
46740     function drawKeepRight(selection2) {
46741       const service = getService();
46742       const surface = context.surface();
46743       if (surface && !surface.empty()) {
46744         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
46745       }
46746       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
46747       drawLayer.exit().remove();
46748       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
46749       if (_layerEnabled) {
46750         if (service && ~~context.map().zoom() >= minZoom3) {
46751           editOn();
46752           service.loadIssues(projection2);
46753           updateMarkers();
46754         } else {
46755           editOff();
46756         }
46757       }
46758     }
46759     drawKeepRight.enabled = function(val) {
46760       if (!arguments.length)
46761         return _layerEnabled;
46762       _layerEnabled = val;
46763       if (_layerEnabled) {
46764         layerOn();
46765       } else {
46766         layerOff();
46767         if (context.selectedErrorID()) {
46768           context.enter(modeBrowse(context));
46769         }
46770       }
46771       dispatch10.call("change");
46772       return this;
46773     };
46774     drawKeepRight.supported = () => !!getService();
46775     return drawKeepRight;
46776   }
46777
46778   // modules/svg/geolocate.js
46779   function svgGeolocate(projection2) {
46780     var layer = select_default2(null);
46781     var _position;
46782     function init2() {
46783       if (svgGeolocate.initialized)
46784         return;
46785       svgGeolocate.enabled = false;
46786       svgGeolocate.initialized = true;
46787     }
46788     function showLayer() {
46789       layer.style("display", "block");
46790     }
46791     function hideLayer() {
46792       layer.transition().duration(250).style("opacity", 0);
46793     }
46794     function layerOn() {
46795       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
46796     }
46797     function layerOff() {
46798       layer.style("display", "none");
46799     }
46800     function transform2(d) {
46801       return svgPointTransform(projection2)(d);
46802     }
46803     function accuracy(accuracy2, loc) {
46804       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
46805       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
46806     }
46807     function update() {
46808       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
46809       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
46810       groups.exit().remove();
46811       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
46812       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");
46813       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");
46814       groups.merge(pointsEnter).attr("transform", transform2);
46815       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
46816     }
46817     function drawLocation(selection2) {
46818       var enabled = svgGeolocate.enabled;
46819       layer = selection2.selectAll(".layer-geolocate").data([0]);
46820       layer.exit().remove();
46821       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
46822       layerEnter.append("g").attr("class", "geolocations");
46823       layer = layerEnter.merge(layer);
46824       if (enabled) {
46825         update();
46826       } else {
46827         layerOff();
46828       }
46829     }
46830     drawLocation.enabled = function(position, enabled) {
46831       if (!arguments.length)
46832         return svgGeolocate.enabled;
46833       _position = position;
46834       svgGeolocate.enabled = enabled;
46835       if (svgGeolocate.enabled) {
46836         showLayer();
46837         layerOn();
46838       } else {
46839         hideLayer();
46840       }
46841       return this;
46842     };
46843     init2();
46844     return drawLocation;
46845   }
46846
46847   // modules/svg/labels.js
46848   var import_rbush7 = __toESM(require_rbush_min());
46849   function svgLabels(projection2, context) {
46850     var path = path_default(projection2);
46851     var detected = utilDetect();
46852     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
46853     var _rdrawn = new import_rbush7.default();
46854     var _rskipped = new import_rbush7.default();
46855     var _textWidthCache = {};
46856     var _entitybboxes = {};
46857     var labelStack = [
46858       ["line", "aeroway", "*", 12],
46859       ["line", "highway", "motorway", 12],
46860       ["line", "highway", "trunk", 12],
46861       ["line", "highway", "primary", 12],
46862       ["line", "highway", "secondary", 12],
46863       ["line", "highway", "tertiary", 12],
46864       ["line", "highway", "*", 12],
46865       ["line", "railway", "*", 12],
46866       ["line", "waterway", "*", 12],
46867       ["area", "aeroway", "*", 12],
46868       ["area", "amenity", "*", 12],
46869       ["area", "building", "*", 12],
46870       ["area", "historic", "*", 12],
46871       ["area", "leisure", "*", 12],
46872       ["area", "man_made", "*", 12],
46873       ["area", "natural", "*", 12],
46874       ["area", "shop", "*", 12],
46875       ["area", "tourism", "*", 12],
46876       ["area", "camp_site", "*", 12],
46877       ["point", "aeroway", "*", 10],
46878       ["point", "amenity", "*", 10],
46879       ["point", "building", "*", 10],
46880       ["point", "historic", "*", 10],
46881       ["point", "leisure", "*", 10],
46882       ["point", "man_made", "*", 10],
46883       ["point", "natural", "*", 10],
46884       ["point", "shop", "*", 10],
46885       ["point", "tourism", "*", 10],
46886       ["point", "camp_site", "*", 10],
46887       ["line", "ref", "*", 12],
46888       ["area", "ref", "*", 12],
46889       ["point", "ref", "*", 10],
46890       ["line", "name", "*", 12],
46891       ["area", "name", "*", 12],
46892       ["point", "name", "*", 10]
46893     ];
46894     function shouldSkipIcon(preset) {
46895       var noIcons = ["building", "landuse", "natural"];
46896       return noIcons.some(function(s) {
46897         return preset.id.indexOf(s) >= 0;
46898       });
46899     }
46900     function get4(array2, prop) {
46901       return function(d, i2) {
46902         return array2[i2][prop];
46903       };
46904     }
46905     function textWidth(text2, size, elem) {
46906       var c = _textWidthCache[size];
46907       if (!c)
46908         c = _textWidthCache[size] = {};
46909       if (c[text2]) {
46910         return c[text2];
46911       } else if (elem) {
46912         c[text2] = elem.getComputedTextLength();
46913         return c[text2];
46914       } else {
46915         var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
46916         if (str2 === null) {
46917           return size / 3 * 2 * text2.length;
46918         } else {
46919           return size / 3 * (2 * text2.length + str2.length);
46920         }
46921       }
46922     }
46923     function drawLinePaths(selection2, entities, filter2, classes, labels) {
46924       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
46925       paths.exit().remove();
46926       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d) {
46927         return "ideditor-labelpath-" + d.id;
46928       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
46929     }
46930     function drawLineLabels(selection2, entities, filter2, classes, labels) {
46931       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
46932       texts.exit().remove();
46933       texts.enter().append("text").attr("class", function(d, i2) {
46934         return classes + " " + labels[i2].classes + " " + d.id;
46935       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
46936       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d) {
46937         return "#ideditor-labelpath-" + d.id;
46938       }).text(utilDisplayNameForPath);
46939     }
46940     function drawPointLabels(selection2, entities, filter2, classes, labels) {
46941       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
46942       texts.exit().remove();
46943       texts.enter().append("text").attr("class", function(d, i2) {
46944         return classes + " " + labels[i2].classes + " " + d.id;
46945       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d, i2) {
46946         textWidth(utilDisplayName(d), labels[i2].height, this);
46947       });
46948     }
46949     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
46950       entities = entities.filter(hasText);
46951       labels = labels.filter(hasText);
46952       drawPointLabels(selection2, entities, filter2, classes, labels);
46953       function hasText(d, i2) {
46954         return labels[i2].hasOwnProperty("x") && labels[i2].hasOwnProperty("y");
46955       }
46956     }
46957     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
46958       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
46959       icons.exit().remove();
46960       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(d) {
46961         var preset = _mainPresetIndex.match(d, context.graph());
46962         var picon = preset && preset.icon;
46963         return picon ? "#" + picon : "";
46964       });
46965     }
46966     function drawCollisionBoxes(selection2, rtree, which) {
46967       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
46968       var gj = [];
46969       if (context.getDebug("collision")) {
46970         gj = rtree.all().map(function(d) {
46971           return { type: "Polygon", coordinates: [[
46972             [d.minX, d.minY],
46973             [d.maxX, d.minY],
46974             [d.maxX, d.maxY],
46975             [d.minX, d.maxY],
46976             [d.minX, d.minY]
46977           ]] };
46978         });
46979       }
46980       var boxes = selection2.selectAll("." + which).data(gj);
46981       boxes.exit().remove();
46982       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
46983     }
46984     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
46985       var wireframe = context.surface().classed("fill-wireframe");
46986       var zoom = geoScaleToZoom(projection2.scale());
46987       var labelable = [];
46988       var renderNodeAs = {};
46989       var i2, j2, k, entity, geometry;
46990       for (i2 = 0; i2 < labelStack.length; i2++) {
46991         labelable.push([]);
46992       }
46993       if (fullRedraw) {
46994         _rdrawn.clear();
46995         _rskipped.clear();
46996         _entitybboxes = {};
46997       } else {
46998         for (i2 = 0; i2 < entities.length; i2++) {
46999           entity = entities[i2];
47000           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
47001           for (j2 = 0; j2 < toRemove.length; j2++) {
47002             _rdrawn.remove(toRemove[j2]);
47003             _rskipped.remove(toRemove[j2]);
47004           }
47005         }
47006       }
47007       for (i2 = 0; i2 < entities.length; i2++) {
47008         entity = entities[i2];
47009         geometry = entity.geometry(graph);
47010         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
47011           var hasDirections = entity.directions(graph, projection2).length;
47012           var markerPadding;
47013           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
47014             renderNodeAs[entity.id] = "point";
47015             markerPadding = 20;
47016           } else {
47017             renderNodeAs[entity.id] = "vertex";
47018             markerPadding = 0;
47019           }
47020           var coord2 = projection2(entity.loc);
47021           var nodePadding = 10;
47022           var bbox = {
47023             minX: coord2[0] - nodePadding,
47024             minY: coord2[1] - nodePadding - markerPadding,
47025             maxX: coord2[0] + nodePadding,
47026             maxY: coord2[1] + nodePadding
47027           };
47028           doInsert(bbox, entity.id + "P");
47029         }
47030         if (geometry === "vertex") {
47031           geometry = "point";
47032         }
47033         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
47034         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
47035         if (!icon2 && !utilDisplayName(entity))
47036           continue;
47037         for (k = 0; k < labelStack.length; k++) {
47038           var matchGeom = labelStack[k][0];
47039           var matchKey = labelStack[k][1];
47040           var matchVal = labelStack[k][2];
47041           var hasVal = entity.tags[matchKey];
47042           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
47043             labelable[k].push(entity);
47044             break;
47045           }
47046         }
47047       }
47048       var positions = {
47049         point: [],
47050         line: [],
47051         area: []
47052       };
47053       var labelled = {
47054         point: [],
47055         line: [],
47056         area: []
47057       };
47058       for (k = 0; k < labelable.length; k++) {
47059         var fontSize = labelStack[k][3];
47060         for (i2 = 0; i2 < labelable[k].length; i2++) {
47061           entity = labelable[k][i2];
47062           geometry = entity.geometry(graph);
47063           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
47064           var name = getName(entity);
47065           var width = name && textWidth(name, fontSize);
47066           var p = null;
47067           if (geometry === "point" || geometry === "vertex") {
47068             if (wireframe)
47069               continue;
47070             var renderAs = renderNodeAs[entity.id];
47071             if (renderAs === "vertex" && zoom < 17)
47072               continue;
47073             p = getPointLabel(entity, width, fontSize, renderAs);
47074           } else if (geometry === "line") {
47075             p = getLineLabel(entity, width, fontSize);
47076           } else if (geometry === "area") {
47077             p = getAreaLabel(entity, width, fontSize);
47078           }
47079           if (p) {
47080             if (geometry === "vertex") {
47081               geometry = "point";
47082             }
47083             p.classes = geometry + " tag-" + labelStack[k][1];
47084             positions[geometry].push(p);
47085             labelled[geometry].push(entity);
47086           }
47087         }
47088       }
47089       function isInterestingVertex(entity2) {
47090         var selectedIDs = context.selectedIDs();
47091         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
47092           return selectedIDs.indexOf(parent.id) !== -1;
47093         });
47094       }
47095       function getPointLabel(entity2, width2, height, geometry2) {
47096         var y = geometry2 === "point" ? -12 : 0;
47097         var pointOffsets = {
47098           ltr: [15, y, "start"],
47099           rtl: [-15, y, "end"]
47100         };
47101         var textDirection = _mainLocalizer.textDirection();
47102         var coord3 = projection2(entity2.loc);
47103         var textPadding = 2;
47104         var offset = pointOffsets[textDirection];
47105         var p2 = {
47106           height,
47107           width: width2,
47108           x: coord3[0] + offset[0],
47109           y: coord3[1] + offset[1],
47110           textAnchor: offset[2]
47111         };
47112         var bbox2;
47113         if (textDirection === "rtl") {
47114           bbox2 = {
47115             minX: p2.x - width2 - textPadding,
47116             minY: p2.y - height / 2 - textPadding,
47117             maxX: p2.x + textPadding,
47118             maxY: p2.y + height / 2 + textPadding
47119           };
47120         } else {
47121           bbox2 = {
47122             minX: p2.x - textPadding,
47123             minY: p2.y - height / 2 - textPadding,
47124             maxX: p2.x + width2 + textPadding,
47125             maxY: p2.y + height / 2 + textPadding
47126           };
47127         }
47128         if (tryInsert([bbox2], entity2.id, true)) {
47129           return p2;
47130         }
47131       }
47132       function getLineLabel(entity2, width2, height) {
47133         var viewport = geoExtent(context.projection.clipExtent()).polygon();
47134         var points = graph.childNodes(entity2).map(function(node) {
47135           return projection2(node.loc);
47136         });
47137         var length = geoPathLength(points);
47138         if (length < width2 + 20)
47139           return;
47140         var lineOffsets = [
47141           50,
47142           45,
47143           55,
47144           40,
47145           60,
47146           35,
47147           65,
47148           30,
47149           70,
47150           25,
47151           75,
47152           20,
47153           80,
47154           15,
47155           95,
47156           10,
47157           90,
47158           5,
47159           95
47160         ];
47161         var padding = 3;
47162         for (var i3 = 0; i3 < lineOffsets.length; i3++) {
47163           var offset = lineOffsets[i3];
47164           var middle = offset / 100 * length;
47165           var start2 = middle - width2 / 2;
47166           if (start2 < 0 || start2 + width2 > length)
47167             continue;
47168           var sub = subpath(points, start2, start2 + width2);
47169           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
47170             continue;
47171           }
47172           var isReverse = reverse(sub);
47173           if (isReverse) {
47174             sub = sub.reverse();
47175           }
47176           var bboxes = [];
47177           var boxsize = (height + 2) / 2;
47178           for (var j3 = 0; j3 < sub.length - 1; j3++) {
47179             var a = sub[j3];
47180             var b = sub[j3 + 1];
47181             var num = Math.max(1, Math.floor(geoVecLength(a, b) / boxsize / 2));
47182             for (var box = 0; box < num; box++) {
47183               var p2 = geoVecInterp(a, b, box / num);
47184               var x05 = p2[0] - boxsize - padding;
47185               var y05 = p2[1] - boxsize - padding;
47186               var x12 = p2[0] + boxsize + padding;
47187               var y12 = p2[1] + boxsize + padding;
47188               bboxes.push({
47189                 minX: Math.min(x05, x12),
47190                 minY: Math.min(y05, y12),
47191                 maxX: Math.max(x05, x12),
47192                 maxY: Math.max(y05, y12)
47193               });
47194             }
47195           }
47196           if (tryInsert(bboxes, entity2.id, false)) {
47197             return {
47198               "font-size": height + 2,
47199               lineString: lineString2(sub),
47200               startOffset: offset + "%"
47201             };
47202           }
47203         }
47204         function reverse(p3) {
47205           var angle2 = Math.atan2(p3[1][1] - p3[0][1], p3[1][0] - p3[0][0]);
47206           return !(p3[0][0] < p3[p3.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
47207         }
47208         function lineString2(points2) {
47209           return "M" + points2.join("L");
47210         }
47211         function subpath(points2, from, to) {
47212           var sofar = 0;
47213           var start3, end, i0, i1;
47214           for (var i4 = 0; i4 < points2.length - 1; i4++) {
47215             var a2 = points2[i4];
47216             var b2 = points2[i4 + 1];
47217             var current = geoVecLength(a2, b2);
47218             var portion;
47219             if (!start3 && sofar + current >= from) {
47220               portion = (from - sofar) / current;
47221               start3 = [
47222                 a2[0] + portion * (b2[0] - a2[0]),
47223                 a2[1] + portion * (b2[1] - a2[1])
47224               ];
47225               i0 = i4 + 1;
47226             }
47227             if (!end && sofar + current >= to) {
47228               portion = (to - sofar) / current;
47229               end = [
47230                 a2[0] + portion * (b2[0] - a2[0]),
47231                 a2[1] + portion * (b2[1] - a2[1])
47232               ];
47233               i1 = i4 + 1;
47234             }
47235             sofar += current;
47236           }
47237           var result = points2.slice(i0, i1);
47238           result.unshift(start3);
47239           result.push(end);
47240           return result;
47241         }
47242       }
47243       function getAreaLabel(entity2, width2, height) {
47244         var centroid = path.centroid(entity2.asGeoJSON(graph));
47245         var extent = entity2.extent(graph);
47246         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
47247         if (isNaN(centroid[0]) || areaWidth < 20)
47248           return;
47249         var preset2 = _mainPresetIndex.match(entity2, context.graph());
47250         var picon = preset2 && preset2.icon;
47251         var iconSize = 17;
47252         var padding = 2;
47253         var p2 = {};
47254         if (picon) {
47255           if (addIcon()) {
47256             addLabel(iconSize + padding);
47257             return p2;
47258           }
47259         } else {
47260           if (addLabel(0)) {
47261             return p2;
47262           }
47263         }
47264         function addIcon() {
47265           var iconX = centroid[0] - iconSize / 2;
47266           var iconY = centroid[1] - iconSize / 2;
47267           var bbox2 = {
47268             minX: iconX,
47269             minY: iconY,
47270             maxX: iconX + iconSize,
47271             maxY: iconY + iconSize
47272           };
47273           if (tryInsert([bbox2], entity2.id + "I", true)) {
47274             p2.transform = "translate(" + iconX + "," + iconY + ")";
47275             return true;
47276           }
47277           return false;
47278         }
47279         function addLabel(yOffset) {
47280           if (width2 && areaWidth >= width2 + 20) {
47281             var labelX = centroid[0];
47282             var labelY = centroid[1] + yOffset;
47283             var bbox2 = {
47284               minX: labelX - width2 / 2 - padding,
47285               minY: labelY - height / 2 - padding,
47286               maxX: labelX + width2 / 2 + padding,
47287               maxY: labelY + height / 2 + padding
47288             };
47289             if (tryInsert([bbox2], entity2.id, true)) {
47290               p2.x = labelX;
47291               p2.y = labelY;
47292               p2.textAnchor = "middle";
47293               p2.height = height;
47294               return true;
47295             }
47296           }
47297           return false;
47298         }
47299       }
47300       function doInsert(bbox2, id2) {
47301         bbox2.id = id2;
47302         var oldbox = _entitybboxes[id2];
47303         if (oldbox) {
47304           _rdrawn.remove(oldbox);
47305         }
47306         _entitybboxes[id2] = bbox2;
47307         _rdrawn.insert(bbox2);
47308       }
47309       function tryInsert(bboxes, id2, saveSkipped) {
47310         var skipped = false;
47311         for (var i3 = 0; i3 < bboxes.length; i3++) {
47312           var bbox2 = bboxes[i3];
47313           bbox2.id = id2;
47314           if (bbox2.minX < 0 || bbox2.minY < 0 || bbox2.maxX > dimensions[0] || bbox2.maxY > dimensions[1]) {
47315             skipped = true;
47316             break;
47317           }
47318           if (_rdrawn.collides(bbox2)) {
47319             skipped = true;
47320             break;
47321           }
47322         }
47323         _entitybboxes[id2] = bboxes;
47324         if (skipped) {
47325           if (saveSkipped) {
47326             _rskipped.load(bboxes);
47327           }
47328         } else {
47329           _rdrawn.load(bboxes);
47330         }
47331         return !skipped;
47332       }
47333       var layer = selection2.selectAll(".layer-osm.labels");
47334       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d) {
47335         return "labels-group " + d;
47336       });
47337       var halo = layer.selectAll(".labels-group.halo");
47338       var label = layer.selectAll(".labels-group.label");
47339       var debug2 = layer.selectAll(".labels-group.debug");
47340       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
47341       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
47342       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
47343       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
47344       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
47345       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
47346       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
47347       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
47348       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
47349       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
47350       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
47351       layer.call(filterLabels);
47352     }
47353     function filterLabels(selection2) {
47354       var drawLayer = selection2.selectAll(".layer-osm.labels");
47355       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
47356       layers.selectAll(".nolabel").classed("nolabel", false);
47357       var mouse = context.map().mouse();
47358       var graph = context.graph();
47359       var selectedIDs = context.selectedIDs();
47360       var ids = [];
47361       var pad2, bbox;
47362       if (mouse) {
47363         pad2 = 20;
47364         bbox = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
47365         var nearMouse = _rdrawn.search(bbox).map(function(entity2) {
47366           return entity2.id;
47367         });
47368         ids.push.apply(ids, nearMouse);
47369       }
47370       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
47371         var entity = graph.hasEntity(selectedIDs[i2]);
47372         if (entity && entity.type === "node") {
47373           ids.push(selectedIDs[i2]);
47374         }
47375       }
47376       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
47377       var debug2 = selection2.selectAll(".labels-group.debug");
47378       var gj = [];
47379       if (context.getDebug("collision")) {
47380         gj = bbox ? [{
47381           type: "Polygon",
47382           coordinates: [[
47383             [bbox.minX, bbox.minY],
47384             [bbox.maxX, bbox.minY],
47385             [bbox.maxX, bbox.maxY],
47386             [bbox.minX, bbox.maxY],
47387             [bbox.minX, bbox.minY]
47388           ]]
47389         }] : [];
47390       }
47391       var box = debug2.selectAll(".debug-mouse").data(gj);
47392       box.exit().remove();
47393       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
47394     }
47395     var throttleFilterLabels = throttle_default(filterLabels, 100);
47396     drawLabels.observe = function(selection2) {
47397       var listener = function() {
47398         throttleFilterLabels(selection2);
47399       };
47400       selection2.on("mousemove.hidelabels", listener);
47401       context.on("enter.hidelabels", listener);
47402     };
47403     drawLabels.off = function(selection2) {
47404       throttleFilterLabels.cancel();
47405       selection2.on("mousemove.hidelabels", null);
47406       context.on("enter.hidelabels", null);
47407     };
47408     return drawLabels;
47409   }
47410
47411   // modules/svg/improveOSM.js
47412   var _layerEnabled2 = false;
47413   var _qaService2;
47414   function svgImproveOSM(projection2, context, dispatch10) {
47415     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
47416     const minZoom3 = 12;
47417     let touchLayer = select_default2(null);
47418     let drawLayer = select_default2(null);
47419     let layerVisible = false;
47420     function markerPath(selection2, klass) {
47421       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");
47422     }
47423     function getService() {
47424       if (services.improveOSM && !_qaService2) {
47425         _qaService2 = services.improveOSM;
47426         _qaService2.on("loaded", throttledRedraw);
47427       } else if (!services.improveOSM && _qaService2) {
47428         _qaService2 = null;
47429       }
47430       return _qaService2;
47431     }
47432     function editOn() {
47433       if (!layerVisible) {
47434         layerVisible = true;
47435         drawLayer.style("display", "block");
47436       }
47437     }
47438     function editOff() {
47439       if (layerVisible) {
47440         layerVisible = false;
47441         drawLayer.style("display", "none");
47442         drawLayer.selectAll(".qaItem.improveOSM").remove();
47443         touchLayer.selectAll(".qaItem.improveOSM").remove();
47444       }
47445     }
47446     function layerOn() {
47447       editOn();
47448       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
47449     }
47450     function layerOff() {
47451       throttledRedraw.cancel();
47452       drawLayer.interrupt();
47453       touchLayer.selectAll(".qaItem.improveOSM").remove();
47454       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
47455         editOff();
47456         dispatch10.call("change");
47457       });
47458     }
47459     function updateMarkers() {
47460       if (!layerVisible || !_layerEnabled2)
47461         return;
47462       const service = getService();
47463       const selectedID = context.selectedErrorID();
47464       const data = service ? service.getItems(projection2) : [];
47465       const getTransform = svgPointTransform(projection2);
47466       const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
47467       markers.exit().remove();
47468       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
47469       markersEnter.append("polygon").call(markerPath, "shadow");
47470       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
47471       markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
47472       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
47473       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
47474       if (touchLayer.empty())
47475         return;
47476       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
47477       const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
47478       targets.exit().remove();
47479       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
47480       function sortY(a, b) {
47481         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
47482       }
47483     }
47484     function drawImproveOSM(selection2) {
47485       const service = getService();
47486       const surface = context.surface();
47487       if (surface && !surface.empty()) {
47488         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
47489       }
47490       drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
47491       drawLayer.exit().remove();
47492       drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
47493       if (_layerEnabled2) {
47494         if (service && ~~context.map().zoom() >= minZoom3) {
47495           editOn();
47496           service.loadIssues(projection2);
47497           updateMarkers();
47498         } else {
47499           editOff();
47500         }
47501       }
47502     }
47503     drawImproveOSM.enabled = function(val) {
47504       if (!arguments.length)
47505         return _layerEnabled2;
47506       _layerEnabled2 = val;
47507       if (_layerEnabled2) {
47508         layerOn();
47509       } else {
47510         layerOff();
47511         if (context.selectedErrorID()) {
47512           context.enter(modeBrowse(context));
47513         }
47514       }
47515       dispatch10.call("change");
47516       return this;
47517     };
47518     drawImproveOSM.supported = () => !!getService();
47519     return drawImproveOSM;
47520   }
47521
47522   // modules/svg/osmose.js
47523   var _layerEnabled3 = false;
47524   var _qaService3;
47525   function svgOsmose(projection2, context, dispatch10) {
47526     const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
47527     const minZoom3 = 12;
47528     let touchLayer = select_default2(null);
47529     let drawLayer = select_default2(null);
47530     let layerVisible = false;
47531     function markerPath(selection2, klass) {
47532       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");
47533     }
47534     function getService() {
47535       if (services.osmose && !_qaService3) {
47536         _qaService3 = services.osmose;
47537         _qaService3.on("loaded", throttledRedraw);
47538       } else if (!services.osmose && _qaService3) {
47539         _qaService3 = null;
47540       }
47541       return _qaService3;
47542     }
47543     function editOn() {
47544       if (!layerVisible) {
47545         layerVisible = true;
47546         drawLayer.style("display", "block");
47547       }
47548     }
47549     function editOff() {
47550       if (layerVisible) {
47551         layerVisible = false;
47552         drawLayer.style("display", "none");
47553         drawLayer.selectAll(".qaItem.osmose").remove();
47554         touchLayer.selectAll(".qaItem.osmose").remove();
47555       }
47556     }
47557     function layerOn() {
47558       editOn();
47559       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
47560     }
47561     function layerOff() {
47562       throttledRedraw.cancel();
47563       drawLayer.interrupt();
47564       touchLayer.selectAll(".qaItem.osmose").remove();
47565       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
47566         editOff();
47567         dispatch10.call("change");
47568       });
47569     }
47570     function updateMarkers() {
47571       if (!layerVisible || !_layerEnabled3)
47572         return;
47573       const service = getService();
47574       const selectedID = context.selectedErrorID();
47575       const data = service ? service.getItems(projection2) : [];
47576       const getTransform = svgPointTransform(projection2);
47577       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
47578       markers.exit().remove();
47579       const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
47580       markersEnter.append("polygon").call(markerPath, "shadow");
47581       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
47582       markersEnter.append("polygon").attr("fill", (d) => service.getColor(d.item)).call(markerPath, "qaItem-fill");
47583       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
47584       markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
47585       if (touchLayer.empty())
47586         return;
47587       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
47588       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
47589       targets.exit().remove();
47590       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
47591       function sortY(a, b) {
47592         return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
47593       }
47594     }
47595     function drawOsmose(selection2) {
47596       const service = getService();
47597       const surface = context.surface();
47598       if (surface && !surface.empty()) {
47599         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
47600       }
47601       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
47602       drawLayer.exit().remove();
47603       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
47604       if (_layerEnabled3) {
47605         if (service && ~~context.map().zoom() >= minZoom3) {
47606           editOn();
47607           service.loadIssues(projection2);
47608           updateMarkers();
47609         } else {
47610           editOff();
47611         }
47612       }
47613     }
47614     drawOsmose.enabled = function(val) {
47615       if (!arguments.length)
47616         return _layerEnabled3;
47617       _layerEnabled3 = val;
47618       if (_layerEnabled3) {
47619         getService().loadStrings().then(layerOn).catch((err) => {
47620           console.log(err);
47621         });
47622       } else {
47623         layerOff();
47624         if (context.selectedErrorID()) {
47625           context.enter(modeBrowse(context));
47626         }
47627       }
47628       dispatch10.call("change");
47629       return this;
47630     };
47631     drawOsmose.supported = () => !!getService();
47632     return drawOsmose;
47633   }
47634
47635   // modules/svg/streetside.js
47636   function svgStreetside(projection2, context, dispatch10) {
47637     var throttledRedraw = throttle_default(function() {
47638       dispatch10.call("change");
47639     }, 1e3);
47640     var minZoom3 = 14;
47641     var minMarkerZoom = 16;
47642     var minViewfieldZoom = 18;
47643     var layer = select_default2(null);
47644     var _viewerYaw = 0;
47645     var _selectedSequence = null;
47646     var _streetside;
47647     function init2() {
47648       if (svgStreetside.initialized)
47649         return;
47650       svgStreetside.enabled = false;
47651       svgStreetside.initialized = true;
47652     }
47653     function getService() {
47654       if (services.streetside && !_streetside) {
47655         _streetside = services.streetside;
47656         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
47657       } else if (!services.streetside && _streetside) {
47658         _streetside = null;
47659       }
47660       return _streetside;
47661     }
47662     function showLayer() {
47663       var service = getService();
47664       if (!service)
47665         return;
47666       editOn();
47667       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
47668         dispatch10.call("change");
47669       });
47670     }
47671     function hideLayer() {
47672       throttledRedraw.cancel();
47673       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
47674     }
47675     function editOn() {
47676       layer.style("display", "block");
47677     }
47678     function editOff() {
47679       layer.selectAll(".viewfield-group").remove();
47680       layer.style("display", "none");
47681     }
47682     function click(d3_event, d) {
47683       var service = getService();
47684       if (!service)
47685         return;
47686       if (d.sequenceKey !== _selectedSequence) {
47687         _viewerYaw = 0;
47688       }
47689       _selectedSequence = d.sequenceKey;
47690       service.ensureViewerLoaded(context).then(function() {
47691         service.selectImage(context, d.key).yaw(_viewerYaw).showViewer(context);
47692       });
47693       context.map().centerEase(d.loc);
47694     }
47695     function mouseover(d3_event, d) {
47696       var service = getService();
47697       if (service)
47698         service.setStyles(context, d);
47699     }
47700     function mouseout() {
47701       var service = getService();
47702       if (service)
47703         service.setStyles(context, null);
47704     }
47705     function transform2(d) {
47706       var t = svgPointTransform(projection2)(d);
47707       var rot = d.ca + _viewerYaw;
47708       if (rot) {
47709         t += " rotate(" + Math.floor(rot) + ",0,0)";
47710       }
47711       return t;
47712     }
47713     function viewerChanged() {
47714       var service = getService();
47715       if (!service)
47716         return;
47717       var viewer = service.viewer();
47718       if (!viewer)
47719         return;
47720       _viewerYaw = viewer.getYaw();
47721       if (context.map().isTransformed())
47722         return;
47723       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
47724     }
47725     function filterBubbles(bubbles) {
47726       var fromDate = context.photos().fromDate();
47727       var toDate = context.photos().toDate();
47728       var usernames = context.photos().usernames();
47729       if (fromDate) {
47730         var fromTimestamp = new Date(fromDate).getTime();
47731         bubbles = bubbles.filter(function(bubble) {
47732           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
47733         });
47734       }
47735       if (toDate) {
47736         var toTimestamp = new Date(toDate).getTime();
47737         bubbles = bubbles.filter(function(bubble) {
47738           return new Date(bubble.captured_at).getTime() <= toTimestamp;
47739         });
47740       }
47741       if (usernames) {
47742         bubbles = bubbles.filter(function(bubble) {
47743           return usernames.indexOf(bubble.captured_by) !== -1;
47744         });
47745       }
47746       return bubbles;
47747     }
47748     function filterSequences(sequences) {
47749       var fromDate = context.photos().fromDate();
47750       var toDate = context.photos().toDate();
47751       var usernames = context.photos().usernames();
47752       if (fromDate) {
47753         var fromTimestamp = new Date(fromDate).getTime();
47754         sequences = sequences.filter(function(sequences2) {
47755           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
47756         });
47757       }
47758       if (toDate) {
47759         var toTimestamp = new Date(toDate).getTime();
47760         sequences = sequences.filter(function(sequences2) {
47761           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
47762         });
47763       }
47764       if (usernames) {
47765         sequences = sequences.filter(function(sequences2) {
47766           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
47767         });
47768       }
47769       return sequences;
47770     }
47771     function update() {
47772       var viewer = context.container().select(".photoviewer");
47773       var selected = viewer.empty() ? void 0 : viewer.datum();
47774       var z = ~~context.map().zoom();
47775       var showMarkers = z >= minMarkerZoom;
47776       var showViewfields = z >= minViewfieldZoom;
47777       var service = getService();
47778       var sequences = [];
47779       var bubbles = [];
47780       if (context.photos().showsPanoramic()) {
47781         sequences = service ? service.sequences(projection2) : [];
47782         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
47783         sequences = filterSequences(sequences);
47784         bubbles = filterBubbles(bubbles);
47785       }
47786       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
47787         return d.properties.key;
47788       });
47789       traces.exit().remove();
47790       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
47791       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d) {
47792         return d.key + (d.sequenceKey ? "v1" : "v0");
47793       });
47794       groups.exit().remove();
47795       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
47796       groupsEnter.append("g").attr("class", "viewfield-scale");
47797       var markers = groups.merge(groupsEnter).sort(function(a, b) {
47798         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
47799       }).attr("transform", transform2).select(".viewfield-scale");
47800       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
47801       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
47802       viewfields.exit().remove();
47803       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
47804       function viewfieldPath() {
47805         var d = this.parentNode.__data__;
47806         if (d.pano) {
47807           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
47808         } else {
47809           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
47810         }
47811       }
47812     }
47813     function drawImages(selection2) {
47814       var enabled = svgStreetside.enabled;
47815       var service = getService();
47816       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
47817       layer.exit().remove();
47818       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
47819       layerEnter.append("g").attr("class", "sequences");
47820       layerEnter.append("g").attr("class", "markers");
47821       layer = layerEnter.merge(layer);
47822       if (enabled) {
47823         if (service && ~~context.map().zoom() >= minZoom3) {
47824           editOn();
47825           update();
47826           service.loadBubbles(projection2);
47827         } else {
47828           editOff();
47829         }
47830       }
47831     }
47832     drawImages.enabled = function(_) {
47833       if (!arguments.length)
47834         return svgStreetside.enabled;
47835       svgStreetside.enabled = _;
47836       if (svgStreetside.enabled) {
47837         showLayer();
47838         context.photos().on("change.streetside", update);
47839       } else {
47840         hideLayer();
47841         context.photos().on("change.streetside", null);
47842       }
47843       dispatch10.call("change");
47844       return this;
47845     };
47846     drawImages.supported = function() {
47847       return !!getService();
47848     };
47849     init2();
47850     return drawImages;
47851   }
47852
47853   // modules/svg/mapillary_images.js
47854   function svgMapillaryImages(projection2, context, dispatch10) {
47855     const throttledRedraw = throttle_default(function() {
47856       dispatch10.call("change");
47857     }, 1e3);
47858     const minZoom3 = 12;
47859     const minMarkerZoom = 16;
47860     const minViewfieldZoom = 18;
47861     let layer = select_default2(null);
47862     let _mapillary;
47863     function init2() {
47864       if (svgMapillaryImages.initialized)
47865         return;
47866       svgMapillaryImages.enabled = false;
47867       svgMapillaryImages.initialized = true;
47868     }
47869     function getService() {
47870       if (services.mapillary && !_mapillary) {
47871         _mapillary = services.mapillary;
47872         _mapillary.event.on("loadedImages", throttledRedraw);
47873       } else if (!services.mapillary && _mapillary) {
47874         _mapillary = null;
47875       }
47876       return _mapillary;
47877     }
47878     function showLayer() {
47879       const service = getService();
47880       if (!service)
47881         return;
47882       editOn();
47883       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
47884         dispatch10.call("change");
47885       });
47886     }
47887     function hideLayer() {
47888       throttledRedraw.cancel();
47889       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
47890     }
47891     function editOn() {
47892       layer.style("display", "block");
47893     }
47894     function editOff() {
47895       layer.selectAll(".viewfield-group").remove();
47896       layer.style("display", "none");
47897     }
47898     function click(d3_event, image) {
47899       const service = getService();
47900       if (!service)
47901         return;
47902       service.ensureViewerLoaded(context).then(function() {
47903         service.selectImage(context, image.id).showViewer(context);
47904       });
47905       context.map().centerEase(image.loc);
47906     }
47907     function mouseover(d3_event, image) {
47908       const service = getService();
47909       if (service)
47910         service.setStyles(context, image);
47911     }
47912     function mouseout() {
47913       const service = getService();
47914       if (service)
47915         service.setStyles(context, null);
47916     }
47917     function transform2(d) {
47918       let t = svgPointTransform(projection2)(d);
47919       if (d.ca) {
47920         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
47921       }
47922       return t;
47923     }
47924     function filterImages(images) {
47925       const showsPano = context.photos().showsPanoramic();
47926       const showsFlat = context.photos().showsFlat();
47927       const fromDate = context.photos().fromDate();
47928       const toDate = context.photos().toDate();
47929       if (!showsPano || !showsFlat) {
47930         images = images.filter(function(image) {
47931           if (image.is_pano)
47932             return showsPano;
47933           return showsFlat;
47934         });
47935       }
47936       if (fromDate) {
47937         images = images.filter(function(image) {
47938           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
47939         });
47940       }
47941       if (toDate) {
47942         images = images.filter(function(image) {
47943           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
47944         });
47945       }
47946       return images;
47947     }
47948     function filterSequences(sequences) {
47949       const showsPano = context.photos().showsPanoramic();
47950       const showsFlat = context.photos().showsFlat();
47951       const fromDate = context.photos().fromDate();
47952       const toDate = context.photos().toDate();
47953       if (!showsPano || !showsFlat) {
47954         sequences = sequences.filter(function(sequence) {
47955           if (sequence.properties.hasOwnProperty("is_pano")) {
47956             if (sequence.properties.is_pano)
47957               return showsPano;
47958             return showsFlat;
47959           }
47960           return false;
47961         });
47962       }
47963       if (fromDate) {
47964         sequences = sequences.filter(function(sequence) {
47965           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
47966         });
47967       }
47968       if (toDate) {
47969         sequences = sequences.filter(function(sequence) {
47970           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
47971         });
47972       }
47973       return sequences;
47974     }
47975     function update() {
47976       const z = ~~context.map().zoom();
47977       const showMarkers = z >= minMarkerZoom;
47978       const showViewfields = z >= minViewfieldZoom;
47979       const service = getService();
47980       let sequences = service ? service.sequences(projection2) : [];
47981       let images = service && showMarkers ? service.images(projection2) : [];
47982       images = filterImages(images);
47983       sequences = filterSequences(sequences, service);
47984       service.filterViewer(context);
47985       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
47986         return d.properties.id;
47987       });
47988       traces.exit().remove();
47989       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
47990       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
47991         return d.id;
47992       });
47993       groups.exit().remove();
47994       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
47995       groupsEnter.append("g").attr("class", "viewfield-scale");
47996       const markers = groups.merge(groupsEnter).sort(function(a, b) {
47997         return b.loc[1] - a.loc[1];
47998       }).attr("transform", transform2).select(".viewfield-scale");
47999       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48000       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48001       viewfields.exit().remove();
48002       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
48003         return this.parentNode.__data__.is_pano;
48004       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
48005       function viewfieldPath() {
48006         if (this.parentNode.__data__.is_pano) {
48007           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
48008         } else {
48009           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
48010         }
48011       }
48012     }
48013     function drawImages(selection2) {
48014       const enabled = svgMapillaryImages.enabled;
48015       const service = getService();
48016       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
48017       layer.exit().remove();
48018       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
48019       layerEnter.append("g").attr("class", "sequences");
48020       layerEnter.append("g").attr("class", "markers");
48021       layer = layerEnter.merge(layer);
48022       if (enabled) {
48023         if (service && ~~context.map().zoom() >= minZoom3) {
48024           editOn();
48025           update();
48026           service.loadImages(projection2);
48027         } else {
48028           editOff();
48029         }
48030       }
48031     }
48032     drawImages.enabled = function(_) {
48033       if (!arguments.length)
48034         return svgMapillaryImages.enabled;
48035       svgMapillaryImages.enabled = _;
48036       if (svgMapillaryImages.enabled) {
48037         showLayer();
48038         context.photos().on("change.mapillary_images", update);
48039       } else {
48040         hideLayer();
48041         context.photos().on("change.mapillary_images", null);
48042       }
48043       dispatch10.call("change");
48044       return this;
48045     };
48046     drawImages.supported = function() {
48047       return !!getService();
48048     };
48049     init2();
48050     return drawImages;
48051   }
48052
48053   // modules/svg/mapillary_position.js
48054   function svgMapillaryPosition(projection2, context) {
48055     const throttledRedraw = throttle_default(function() {
48056       update();
48057     }, 1e3);
48058     const minZoom3 = 12;
48059     const minViewfieldZoom = 18;
48060     let layer = select_default2(null);
48061     let _mapillary;
48062     let viewerCompassAngle;
48063     function init2() {
48064       if (svgMapillaryPosition.initialized)
48065         return;
48066       svgMapillaryPosition.initialized = true;
48067     }
48068     function getService() {
48069       if (services.mapillary && !_mapillary) {
48070         _mapillary = services.mapillary;
48071         _mapillary.event.on("imageChanged", throttledRedraw);
48072         _mapillary.event.on("bearingChanged", function(e) {
48073           viewerCompassAngle = e.bearing;
48074           if (context.map().isTransformed())
48075             return;
48076           layer.selectAll(".viewfield-group.currentView").filter(function(d) {
48077             return d.is_pano;
48078           }).attr("transform", transform2);
48079         });
48080       } else if (!services.mapillary && _mapillary) {
48081         _mapillary = null;
48082       }
48083       return _mapillary;
48084     }
48085     function editOn() {
48086       layer.style("display", "block");
48087     }
48088     function editOff() {
48089       layer.selectAll(".viewfield-group").remove();
48090       layer.style("display", "none");
48091     }
48092     function transform2(d) {
48093       let t = svgPointTransform(projection2)(d);
48094       if (d.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
48095         t += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
48096       } else if (d.ca) {
48097         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
48098       }
48099       return t;
48100     }
48101     function update() {
48102       const z = ~~context.map().zoom();
48103       const showViewfields = z >= minViewfieldZoom;
48104       const service = getService();
48105       const image = service && service.getActiveImage();
48106       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d) {
48107         return d.id;
48108       });
48109       groups.exit().remove();
48110       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
48111       groupsEnter.append("g").attr("class", "viewfield-scale");
48112       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
48113       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48114       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48115       viewfields.exit().remove();
48116       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");
48117     }
48118     function drawImages(selection2) {
48119       const service = getService();
48120       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
48121       layer.exit().remove();
48122       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
48123       layerEnter.append("g").attr("class", "markers");
48124       layer = layerEnter.merge(layer);
48125       if (service && ~~context.map().zoom() >= minZoom3) {
48126         editOn();
48127         update();
48128       } else {
48129         editOff();
48130       }
48131     }
48132     drawImages.enabled = function() {
48133       update();
48134       return this;
48135     };
48136     drawImages.supported = function() {
48137       return !!getService();
48138     };
48139     init2();
48140     return drawImages;
48141   }
48142
48143   // modules/svg/mapillary_signs.js
48144   function svgMapillarySigns(projection2, context, dispatch10) {
48145     const throttledRedraw = throttle_default(function() {
48146       dispatch10.call("change");
48147     }, 1e3);
48148     const minZoom3 = 12;
48149     let layer = select_default2(null);
48150     let _mapillary;
48151     function init2() {
48152       if (svgMapillarySigns.initialized)
48153         return;
48154       svgMapillarySigns.enabled = false;
48155       svgMapillarySigns.initialized = true;
48156     }
48157     function getService() {
48158       if (services.mapillary && !_mapillary) {
48159         _mapillary = services.mapillary;
48160         _mapillary.event.on("loadedSigns", throttledRedraw);
48161       } else if (!services.mapillary && _mapillary) {
48162         _mapillary = null;
48163       }
48164       return _mapillary;
48165     }
48166     function showLayer() {
48167       const service = getService();
48168       if (!service)
48169         return;
48170       service.loadSignResources(context);
48171       editOn();
48172     }
48173     function hideLayer() {
48174       throttledRedraw.cancel();
48175       editOff();
48176     }
48177     function editOn() {
48178       layer.style("display", "block");
48179     }
48180     function editOff() {
48181       layer.selectAll(".icon-sign").remove();
48182       layer.style("display", "none");
48183     }
48184     function click(d3_event, d) {
48185       const service = getService();
48186       if (!service)
48187         return;
48188       context.map().centerEase(d.loc);
48189       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
48190       service.getDetections(d.id).then((detections) => {
48191         if (detections.length) {
48192           const imageId = detections[0].image.id;
48193           if (imageId === selectedImageId) {
48194             service.highlightDetection(detections[0]).selectImage(context, imageId);
48195           } else {
48196             service.ensureViewerLoaded(context).then(function() {
48197               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
48198             });
48199           }
48200         }
48201       });
48202     }
48203     function filterData(detectedFeatures) {
48204       var fromDate = context.photos().fromDate();
48205       var toDate = context.photos().toDate();
48206       if (fromDate) {
48207         var fromTimestamp = new Date(fromDate).getTime();
48208         detectedFeatures = detectedFeatures.filter(function(feature3) {
48209           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
48210         });
48211       }
48212       if (toDate) {
48213         var toTimestamp = new Date(toDate).getTime();
48214         detectedFeatures = detectedFeatures.filter(function(feature3) {
48215           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
48216         });
48217       }
48218       return detectedFeatures;
48219     }
48220     function update() {
48221       const service = getService();
48222       let data = service ? service.signs(projection2) : [];
48223       data = filterData(data);
48224       const transform2 = svgPointTransform(projection2);
48225       const signs = layer.selectAll(".icon-sign").data(data, function(d) {
48226         return d.id;
48227       });
48228       signs.exit().remove();
48229       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
48230       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
48231         return "#" + d.value;
48232       });
48233       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
48234       signs.merge(enter).attr("transform", transform2);
48235     }
48236     function drawSigns(selection2) {
48237       const enabled = svgMapillarySigns.enabled;
48238       const service = getService();
48239       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
48240       layer.exit().remove();
48241       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
48242       if (enabled) {
48243         if (service && ~~context.map().zoom() >= minZoom3) {
48244           editOn();
48245           update();
48246           service.loadSigns(projection2);
48247           service.showSignDetections(true);
48248         } else {
48249           editOff();
48250         }
48251       } else if (service) {
48252         service.showSignDetections(false);
48253       }
48254     }
48255     drawSigns.enabled = function(_) {
48256       if (!arguments.length)
48257         return svgMapillarySigns.enabled;
48258       svgMapillarySigns.enabled = _;
48259       if (svgMapillarySigns.enabled) {
48260         showLayer();
48261         context.photos().on("change.mapillary_signs", update);
48262       } else {
48263         hideLayer();
48264         context.photos().on("change.mapillary_signs", null);
48265       }
48266       dispatch10.call("change");
48267       return this;
48268     };
48269     drawSigns.supported = function() {
48270       return !!getService();
48271     };
48272     init2();
48273     return drawSigns;
48274   }
48275
48276   // modules/svg/mapillary_map_features.js
48277   function svgMapillaryMapFeatures(projection2, context, dispatch10) {
48278     const throttledRedraw = throttle_default(function() {
48279       dispatch10.call("change");
48280     }, 1e3);
48281     const minZoom3 = 12;
48282     let layer = select_default2(null);
48283     let _mapillary;
48284     function init2() {
48285       if (svgMapillaryMapFeatures.initialized)
48286         return;
48287       svgMapillaryMapFeatures.enabled = false;
48288       svgMapillaryMapFeatures.initialized = true;
48289     }
48290     function getService() {
48291       if (services.mapillary && !_mapillary) {
48292         _mapillary = services.mapillary;
48293         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
48294       } else if (!services.mapillary && _mapillary) {
48295         _mapillary = null;
48296       }
48297       return _mapillary;
48298     }
48299     function showLayer() {
48300       const service = getService();
48301       if (!service)
48302         return;
48303       service.loadObjectResources(context);
48304       editOn();
48305     }
48306     function hideLayer() {
48307       throttledRedraw.cancel();
48308       editOff();
48309     }
48310     function editOn() {
48311       layer.style("display", "block");
48312     }
48313     function editOff() {
48314       layer.selectAll(".icon-map-feature").remove();
48315       layer.style("display", "none");
48316     }
48317     function click(d3_event, d) {
48318       const service = getService();
48319       if (!service)
48320         return;
48321       context.map().centerEase(d.loc);
48322       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
48323       service.getDetections(d.id).then((detections) => {
48324         if (detections.length) {
48325           const imageId = detections[0].image.id;
48326           if (imageId === selectedImageId) {
48327             service.highlightDetection(detections[0]).selectImage(context, imageId);
48328           } else {
48329             service.ensureViewerLoaded(context).then(function() {
48330               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
48331             });
48332           }
48333         }
48334       });
48335     }
48336     function filterData(detectedFeatures) {
48337       const fromDate = context.photos().fromDate();
48338       const toDate = context.photos().toDate();
48339       if (fromDate) {
48340         detectedFeatures = detectedFeatures.filter(function(feature3) {
48341           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
48342         });
48343       }
48344       if (toDate) {
48345         detectedFeatures = detectedFeatures.filter(function(feature3) {
48346           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
48347         });
48348       }
48349       return detectedFeatures;
48350     }
48351     function update() {
48352       const service = getService();
48353       let data = service ? service.mapFeatures(projection2) : [];
48354       data = filterData(data);
48355       const transform2 = svgPointTransform(projection2);
48356       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d) {
48357         return d.id;
48358       });
48359       mapFeatures.exit().remove();
48360       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
48361       enter.append("title").text(function(d) {
48362         var id2 = d.value.replace(/--/g, ".").replace(/-/g, "_");
48363         return _t("mapillary_map_features." + id2);
48364       });
48365       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
48366         if (d.value === "object--billboard") {
48367           return "#object--sign--advertisement";
48368         }
48369         return "#" + d.value;
48370       });
48371       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
48372       mapFeatures.merge(enter).attr("transform", transform2);
48373     }
48374     function drawMapFeatures(selection2) {
48375       const enabled = svgMapillaryMapFeatures.enabled;
48376       const service = getService();
48377       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
48378       layer.exit().remove();
48379       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
48380       if (enabled) {
48381         if (service && ~~context.map().zoom() >= minZoom3) {
48382           editOn();
48383           update();
48384           service.loadMapFeatures(projection2);
48385           service.showFeatureDetections(true);
48386         } else {
48387           editOff();
48388         }
48389       } else if (service) {
48390         service.showFeatureDetections(false);
48391       }
48392     }
48393     drawMapFeatures.enabled = function(_) {
48394       if (!arguments.length)
48395         return svgMapillaryMapFeatures.enabled;
48396       svgMapillaryMapFeatures.enabled = _;
48397       if (svgMapillaryMapFeatures.enabled) {
48398         showLayer();
48399         context.photos().on("change.mapillary_map_features", update);
48400       } else {
48401         hideLayer();
48402         context.photos().on("change.mapillary_map_features", null);
48403       }
48404       dispatch10.call("change");
48405       return this;
48406     };
48407     drawMapFeatures.supported = function() {
48408       return !!getService();
48409     };
48410     init2();
48411     return drawMapFeatures;
48412   }
48413
48414   // modules/svg/kartaview_images.js
48415   function svgKartaviewImages(projection2, context, dispatch10) {
48416     var throttledRedraw = throttle_default(function() {
48417       dispatch10.call("change");
48418     }, 1e3);
48419     var minZoom3 = 12;
48420     var minMarkerZoom = 16;
48421     var minViewfieldZoom = 18;
48422     var layer = select_default2(null);
48423     var _kartaview;
48424     function init2() {
48425       if (svgKartaviewImages.initialized)
48426         return;
48427       svgKartaviewImages.enabled = false;
48428       svgKartaviewImages.initialized = true;
48429     }
48430     function getService() {
48431       if (services.kartaview && !_kartaview) {
48432         _kartaview = services.kartaview;
48433         _kartaview.event.on("loadedImages", throttledRedraw);
48434       } else if (!services.kartaview && _kartaview) {
48435         _kartaview = null;
48436       }
48437       return _kartaview;
48438     }
48439     function showLayer() {
48440       var service = getService();
48441       if (!service)
48442         return;
48443       editOn();
48444       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48445         dispatch10.call("change");
48446       });
48447     }
48448     function hideLayer() {
48449       throttledRedraw.cancel();
48450       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
48451     }
48452     function editOn() {
48453       layer.style("display", "block");
48454     }
48455     function editOff() {
48456       layer.selectAll(".viewfield-group").remove();
48457       layer.style("display", "none");
48458     }
48459     function click(d3_event, d) {
48460       var service = getService();
48461       if (!service)
48462         return;
48463       service.ensureViewerLoaded(context).then(function() {
48464         service.selectImage(context, d.key).showViewer(context);
48465       });
48466       context.map().centerEase(d.loc);
48467     }
48468     function mouseover(d3_event, d) {
48469       var service = getService();
48470       if (service)
48471         service.setStyles(context, d);
48472     }
48473     function mouseout() {
48474       var service = getService();
48475       if (service)
48476         service.setStyles(context, null);
48477     }
48478     function transform2(d) {
48479       var t = svgPointTransform(projection2)(d);
48480       if (d.ca) {
48481         t += " rotate(" + Math.floor(d.ca) + ",0,0)";
48482       }
48483       return t;
48484     }
48485     function filterImages(images) {
48486       var fromDate = context.photos().fromDate();
48487       var toDate = context.photos().toDate();
48488       var usernames = context.photos().usernames();
48489       if (fromDate) {
48490         var fromTimestamp = new Date(fromDate).getTime();
48491         images = images.filter(function(item) {
48492           return new Date(item.captured_at).getTime() >= fromTimestamp;
48493         });
48494       }
48495       if (toDate) {
48496         var toTimestamp = new Date(toDate).getTime();
48497         images = images.filter(function(item) {
48498           return new Date(item.captured_at).getTime() <= toTimestamp;
48499         });
48500       }
48501       if (usernames) {
48502         images = images.filter(function(item) {
48503           return usernames.indexOf(item.captured_by) !== -1;
48504         });
48505       }
48506       return images;
48507     }
48508     function filterSequences(sequences) {
48509       var fromDate = context.photos().fromDate();
48510       var toDate = context.photos().toDate();
48511       var usernames = context.photos().usernames();
48512       if (fromDate) {
48513         var fromTimestamp = new Date(fromDate).getTime();
48514         sequences = sequences.filter(function(image) {
48515           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
48516         });
48517       }
48518       if (toDate) {
48519         var toTimestamp = new Date(toDate).getTime();
48520         sequences = sequences.filter(function(image) {
48521           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
48522         });
48523       }
48524       if (usernames) {
48525         sequences = sequences.filter(function(image) {
48526           return usernames.indexOf(image.properties.captured_by) !== -1;
48527         });
48528       }
48529       return sequences;
48530     }
48531     function update() {
48532       var viewer = context.container().select(".photoviewer");
48533       var selected = viewer.empty() ? void 0 : viewer.datum();
48534       var z = ~~context.map().zoom();
48535       var showMarkers = z >= minMarkerZoom;
48536       var showViewfields = z >= minViewfieldZoom;
48537       var service = getService();
48538       var sequences = [];
48539       var images = [];
48540       if (context.photos().showsFlat()) {
48541         sequences = service ? service.sequences(projection2) : [];
48542         images = service && showMarkers ? service.images(projection2) : [];
48543         sequences = filterSequences(sequences);
48544         images = filterImages(images);
48545       }
48546       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
48547         return d.properties.key;
48548       });
48549       traces.exit().remove();
48550       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
48551       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
48552         return d.key;
48553       });
48554       groups.exit().remove();
48555       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
48556       groupsEnter.append("g").attr("class", "viewfield-scale");
48557       var markers = groups.merge(groupsEnter).sort(function(a, b) {
48558         return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
48559       }).attr("transform", transform2).select(".viewfield-scale");
48560       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
48561       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
48562       viewfields.exit().remove();
48563       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");
48564     }
48565     function drawImages(selection2) {
48566       var enabled = svgKartaviewImages.enabled, service = getService();
48567       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
48568       layer.exit().remove();
48569       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
48570       layerEnter.append("g").attr("class", "sequences");
48571       layerEnter.append("g").attr("class", "markers");
48572       layer = layerEnter.merge(layer);
48573       if (enabled) {
48574         if (service && ~~context.map().zoom() >= minZoom3) {
48575           editOn();
48576           update();
48577           service.loadImages(projection2);
48578         } else {
48579           editOff();
48580         }
48581       }
48582     }
48583     drawImages.enabled = function(_) {
48584       if (!arguments.length)
48585         return svgKartaviewImages.enabled;
48586       svgKartaviewImages.enabled = _;
48587       if (svgKartaviewImages.enabled) {
48588         showLayer();
48589         context.photos().on("change.kartaview_images", update);
48590       } else {
48591         hideLayer();
48592         context.photos().on("change.kartaview_images", null);
48593       }
48594       dispatch10.call("change");
48595       return this;
48596     };
48597     drawImages.supported = function() {
48598       return !!getService();
48599     };
48600     init2();
48601     return drawImages;
48602   }
48603
48604   // modules/svg/osm.js
48605   function svgOsm(projection2, context, dispatch10) {
48606     var enabled = true;
48607     function drawOsm(selection2) {
48608       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d) {
48609         return "layer-osm " + d;
48610       });
48611       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d) {
48612         return "points-group " + d;
48613       });
48614     }
48615     function showLayer() {
48616       var layer = context.surface().selectAll(".data-layer.osm");
48617       layer.interrupt();
48618       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
48619         dispatch10.call("change");
48620       });
48621     }
48622     function hideLayer() {
48623       var layer = context.surface().selectAll(".data-layer.osm");
48624       layer.interrupt();
48625       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
48626         layer.classed("disabled", true);
48627         dispatch10.call("change");
48628       });
48629     }
48630     drawOsm.enabled = function(val) {
48631       if (!arguments.length)
48632         return enabled;
48633       enabled = val;
48634       if (enabled) {
48635         showLayer();
48636       } else {
48637         hideLayer();
48638       }
48639       dispatch10.call("change");
48640       return this;
48641     };
48642     return drawOsm;
48643   }
48644
48645   // modules/svg/notes.js
48646   var _notesEnabled = false;
48647   var _osmService;
48648   function svgNotes(projection2, context, dispatch10) {
48649     if (!dispatch10) {
48650       dispatch10 = dispatch_default("change");
48651     }
48652     var throttledRedraw = throttle_default(function() {
48653       dispatch10.call("change");
48654     }, 1e3);
48655     var minZoom3 = 12;
48656     var touchLayer = select_default2(null);
48657     var drawLayer = select_default2(null);
48658     var _notesVisible = false;
48659     function markerPath(selection2, klass) {
48660       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");
48661     }
48662     function getService() {
48663       if (services.osm && !_osmService) {
48664         _osmService = services.osm;
48665         _osmService.on("loadedNotes", throttledRedraw);
48666       } else if (!services.osm && _osmService) {
48667         _osmService = null;
48668       }
48669       return _osmService;
48670     }
48671     function editOn() {
48672       if (!_notesVisible) {
48673         _notesVisible = true;
48674         drawLayer.style("display", "block");
48675       }
48676     }
48677     function editOff() {
48678       if (_notesVisible) {
48679         _notesVisible = false;
48680         drawLayer.style("display", "none");
48681         drawLayer.selectAll(".note").remove();
48682         touchLayer.selectAll(".note").remove();
48683       }
48684     }
48685     function layerOn() {
48686       editOn();
48687       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
48688         dispatch10.call("change");
48689       });
48690     }
48691     function layerOff() {
48692       throttledRedraw.cancel();
48693       drawLayer.interrupt();
48694       touchLayer.selectAll(".note").remove();
48695       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
48696         editOff();
48697         dispatch10.call("change");
48698       });
48699     }
48700     function updateMarkers() {
48701       if (!_notesVisible || !_notesEnabled)
48702         return;
48703       var service = getService();
48704       var selectedID = context.selectedNoteID();
48705       var data = service ? service.notes(projection2) : [];
48706       var getTransform = svgPointTransform(projection2);
48707       var notes = drawLayer.selectAll(".note").data(data, function(d) {
48708         return d.status + d.id;
48709       });
48710       notes.exit().remove();
48711       var notesEnter = notes.enter().append("g").attr("class", function(d) {
48712         return "note note-" + d.id + " " + d.status;
48713       }).classed("new", function(d) {
48714         return d.id < 0;
48715       });
48716       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48717       notesEnter.append("path").call(markerPath, "shadow");
48718       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");
48719       notesEnter.selectAll(".icon-annotation").data(function(d) {
48720         return [d];
48721       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d) {
48722         if (d.id < 0)
48723           return "#iD-icon-plus";
48724         if (d.status === "open")
48725           return "#iD-icon-close";
48726         return "#iD-icon-apply";
48727       });
48728       notes.merge(notesEnter).sort(sortY).classed("selected", function(d) {
48729         var mode = context.mode();
48730         var isMoving = mode && mode.id === "drag-note";
48731         return !isMoving && d.id === selectedID;
48732       }).attr("transform", getTransform);
48733       if (touchLayer.empty())
48734         return;
48735       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48736       var targets = touchLayer.selectAll(".note").data(data, function(d) {
48737         return d.id;
48738       });
48739       targets.exit().remove();
48740       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d) {
48741         var newClass = d.id < 0 ? "new" : "";
48742         return "note target note-" + d.id + " " + fillClass + newClass;
48743       }).attr("transform", getTransform);
48744       function sortY(a, b) {
48745         if (a.id === selectedID)
48746           return 1;
48747         if (b.id === selectedID)
48748           return -1;
48749         return b.loc[1] - a.loc[1];
48750       }
48751     }
48752     function drawNotes(selection2) {
48753       var service = getService();
48754       var surface = context.surface();
48755       if (surface && !surface.empty()) {
48756         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48757       }
48758       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
48759       drawLayer.exit().remove();
48760       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
48761       if (_notesEnabled) {
48762         if (service && ~~context.map().zoom() >= minZoom3) {
48763           editOn();
48764           service.loadNotes(projection2);
48765           updateMarkers();
48766         } else {
48767           editOff();
48768         }
48769       }
48770     }
48771     drawNotes.enabled = function(val) {
48772       if (!arguments.length)
48773         return _notesEnabled;
48774       _notesEnabled = val;
48775       if (_notesEnabled) {
48776         layerOn();
48777       } else {
48778         layerOff();
48779         if (context.selectedNoteID()) {
48780           context.enter(modeBrowse(context));
48781         }
48782       }
48783       dispatch10.call("change");
48784       return this;
48785     };
48786     return drawNotes;
48787   }
48788
48789   // modules/svg/touch.js
48790   function svgTouch() {
48791     function drawTouch(selection2) {
48792       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d) {
48793         return "layer-touch " + d;
48794       });
48795     }
48796     return drawTouch;
48797   }
48798
48799   // modules/util/dimensions.js
48800   function refresh(selection2, node) {
48801     var cr = node.getBoundingClientRect();
48802     var prop = [cr.width, cr.height];
48803     selection2.property("__dimensions__", prop);
48804     return prop;
48805   }
48806   function utilGetDimensions(selection2, force) {
48807     if (!selection2 || selection2.empty()) {
48808       return [0, 0];
48809     }
48810     var node = selection2.node(), cached = selection2.property("__dimensions__");
48811     return !cached || force ? refresh(selection2, node) : cached;
48812   }
48813   function utilSetDimensions(selection2, dimensions) {
48814     if (!selection2 || selection2.empty()) {
48815       return selection2;
48816     }
48817     var node = selection2.node();
48818     if (dimensions === null) {
48819       refresh(selection2, node);
48820       return selection2;
48821     }
48822     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
48823   }
48824
48825   // modules/svg/layers.js
48826   function svgLayers(projection2, context) {
48827     var dispatch10 = dispatch_default("change");
48828     var svg2 = select_default2(null);
48829     var _layers = [
48830       { id: "osm", layer: svgOsm(projection2, context, dispatch10) },
48831       { id: "notes", layer: svgNotes(projection2, context, dispatch10) },
48832       { id: "data", layer: svgData(projection2, context, dispatch10) },
48833       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch10) },
48834       { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch10) },
48835       { id: "osmose", layer: svgOsmose(projection2, context, dispatch10) },
48836       { id: "streetside", layer: svgStreetside(projection2, context, dispatch10) },
48837       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch10) },
48838       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch10) },
48839       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch10) },
48840       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch10) },
48841       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch10) },
48842       { id: "debug", layer: svgDebug(projection2, context, dispatch10) },
48843       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch10) },
48844       { id: "touch", layer: svgTouch(projection2, context, dispatch10) }
48845     ];
48846     function drawLayers(selection2) {
48847       svg2 = selection2.selectAll(".surface").data([0]);
48848       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
48849       var defs = svg2.selectAll(".surface-defs").data([0]);
48850       defs.enter().append("defs").attr("class", "surface-defs");
48851       var groups = svg2.selectAll(".data-layer").data(_layers);
48852       groups.exit().remove();
48853       groups.enter().append("g").attr("class", function(d) {
48854         return "data-layer " + d.id;
48855       }).merge(groups).each(function(d) {
48856         select_default2(this).call(d.layer);
48857       });
48858     }
48859     drawLayers.all = function() {
48860       return _layers;
48861     };
48862     drawLayers.layer = function(id2) {
48863       var obj = _layers.find(function(o) {
48864         return o.id === id2;
48865       });
48866       return obj && obj.layer;
48867     };
48868     drawLayers.only = function(what) {
48869       var arr = [].concat(what);
48870       var all = _layers.map(function(layer) {
48871         return layer.id;
48872       });
48873       return drawLayers.remove(utilArrayDifference(all, arr));
48874     };
48875     drawLayers.remove = function(what) {
48876       var arr = [].concat(what);
48877       arr.forEach(function(id2) {
48878         _layers = _layers.filter(function(o) {
48879           return o.id !== id2;
48880         });
48881       });
48882       dispatch10.call("change");
48883       return this;
48884     };
48885     drawLayers.add = function(what) {
48886       var arr = [].concat(what);
48887       arr.forEach(function(obj) {
48888         if ("id" in obj && "layer" in obj) {
48889           _layers.push(obj);
48890         }
48891       });
48892       dispatch10.call("change");
48893       return this;
48894     };
48895     drawLayers.dimensions = function(val) {
48896       if (!arguments.length)
48897         return utilGetDimensions(svg2);
48898       utilSetDimensions(svg2, val);
48899       return this;
48900     };
48901     return utilRebind(drawLayers, dispatch10, "on");
48902   }
48903
48904   // modules/svg/lines.js
48905   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
48906   function svgLines(projection2, context) {
48907     var detected = utilDetect();
48908     var highway_stack = {
48909       motorway: 0,
48910       motorway_link: 1,
48911       trunk: 2,
48912       trunk_link: 3,
48913       primary: 4,
48914       primary_link: 5,
48915       secondary: 6,
48916       tertiary: 7,
48917       unclassified: 8,
48918       residential: 9,
48919       service: 10,
48920       footway: 11
48921     };
48922     function drawTargets(selection2, graph, entities, filter2) {
48923       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
48924       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
48925       var getPath = svgPath(projection2).geojson;
48926       var activeID = context.activeID();
48927       var base = context.history().base();
48928       var data = { targets: [], nopes: [] };
48929       entities.forEach(function(way) {
48930         var features2 = svgSegmentWay(way, graph, activeID);
48931         data.targets.push.apply(data.targets, features2.passive);
48932         data.nopes.push.apply(data.nopes, features2.active);
48933       });
48934       var targetData = data.targets.filter(getPath);
48935       var targets = selection2.selectAll(".line.target-allowed").filter(function(d) {
48936         return filter2(d.properties.entity);
48937       }).data(targetData, function key(d) {
48938         return d.id;
48939       });
48940       targets.exit().remove();
48941       var segmentWasEdited = function(d) {
48942         var wayID = d.properties.entity.id;
48943         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
48944           return false;
48945         }
48946         return d.properties.nodes.some(function(n2) {
48947           return !base.entities[n2.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
48948         });
48949       };
48950       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
48951         return "way line target target-allowed " + targetClass + d.id;
48952       }).classed("segment-edited", segmentWasEdited);
48953       var nopeData = data.nopes.filter(getPath);
48954       var nopes = selection2.selectAll(".line.target-nope").filter(function(d) {
48955         return filter2(d.properties.entity);
48956       }).data(nopeData, function key(d) {
48957         return d.id;
48958       });
48959       nopes.exit().remove();
48960       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
48961         return "way line target target-nope " + nopeClass + d.id;
48962       }).classed("segment-edited", segmentWasEdited);
48963     }
48964     function drawLines(selection2, graph, entities, filter2) {
48965       var base = context.history().base();
48966       function waystack(a, b) {
48967         var selected = context.selectedIDs();
48968         var scoreA = selected.indexOf(a.id) !== -1 ? 20 : 0;
48969         var scoreB = selected.indexOf(b.id) !== -1 ? 20 : 0;
48970         if (a.tags.highway) {
48971           scoreA -= highway_stack[a.tags.highway];
48972         }
48973         if (b.tags.highway) {
48974           scoreB -= highway_stack[b.tags.highway];
48975         }
48976         return scoreA - scoreB;
48977       }
48978       function drawLineGroup(selection3, klass, isSelected) {
48979         var mode = context.mode();
48980         var isDrawing = mode && /^draw/.test(mode.id);
48981         var selectedClass = !isDrawing && isSelected ? "selected " : "";
48982         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
48983         lines.exit().remove();
48984         lines.enter().append("path").attr("class", function(d) {
48985           var prefix = "way line";
48986           if (!d.hasInterestingTags()) {
48987             var parentRelations = graph.parentRelations(d);
48988             var parentMultipolygons = parentRelations.filter(function(relation) {
48989               return relation.isMultipolygon();
48990             });
48991             if (parentMultipolygons.length > 0 && parentRelations.length === parentMultipolygons.length) {
48992               prefix = "relation area";
48993             }
48994           }
48995           var oldMPClass = oldMultiPolygonOuters[d.id] ? "old-multipolygon " : "";
48996           return prefix + " " + klass + " " + selectedClass + oldMPClass + d.id;
48997         }).classed("added", function(d) {
48998           return !base.entities[d.id];
48999         }).classed("geometry-edited", function(d) {
49000           return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d.id].nodes, base.entities[d.id].nodes);
49001         }).classed("retagged", function(d) {
49002           return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
49003         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
49004         return selection3;
49005       }
49006       function getPathData(isSelected) {
49007         return function() {
49008           var layer = this.parentNode.__data__;
49009           var data = pathdata[layer] || [];
49010           return data.filter(function(d) {
49011             if (isSelected) {
49012               return context.selectedIDs().indexOf(d.id) !== -1;
49013             } else {
49014               return context.selectedIDs().indexOf(d.id) === -1;
49015             }
49016           });
49017         };
49018       }
49019       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
49020         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
49021         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
49022         var markers = markergroup.selectAll("path").filter(filter2).data(
49023           function data() {
49024             return groupdata[this.parentNode.__data__] || [];
49025           },
49026           function key(d) {
49027             return [d.id, d.index];
49028           }
49029         );
49030         markers.exit().remove();
49031         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d) {
49032           return d.d;
49033         });
49034         if (detected.ie) {
49035           markers.each(function() {
49036             this.parentNode.insertBefore(this, this);
49037           });
49038         }
49039       }
49040       var getPath = svgPath(projection2, graph);
49041       var ways = [];
49042       var onewaydata = {};
49043       var sideddata = {};
49044       var oldMultiPolygonOuters = {};
49045       for (var i2 = 0; i2 < entities.length; i2++) {
49046         var entity = entities[i2];
49047         var outer = osmOldMultipolygonOuterMember(entity, graph);
49048         if (outer) {
49049           ways.push(entity.mergeTags(outer.tags));
49050           oldMultiPolygonOuters[outer.id] = true;
49051         } else if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
49052           ways.push(entity);
49053         }
49054       }
49055       ways = ways.filter(getPath);
49056       var pathdata = utilArrayGroupBy(ways, function(way) {
49057         return way.layer();
49058       });
49059       Object.keys(pathdata).forEach(function(k) {
49060         var v = pathdata[k];
49061         var onewayArr = v.filter(function(d) {
49062           return d.isOneWay();
49063         });
49064         var onewaySegments = svgMarkerSegments(
49065           projection2,
49066           graph,
49067           35,
49068           function shouldReverse(entity2) {
49069             return entity2.tags.oneway === "-1";
49070           },
49071           function bothDirections(entity2) {
49072             return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
49073           }
49074         );
49075         onewaydata[k] = utilArrayFlatten(onewayArr.map(onewaySegments));
49076         var sidedArr = v.filter(function(d) {
49077           return d.isSided();
49078         });
49079         var sidedSegments = svgMarkerSegments(
49080           projection2,
49081           graph,
49082           30,
49083           function shouldReverse() {
49084             return false;
49085           },
49086           function bothDirections() {
49087             return false;
49088           }
49089         );
49090         sideddata[k] = utilArrayFlatten(sidedArr.map(sidedSegments));
49091       });
49092       var covered = selection2.selectAll(".layer-osm.covered");
49093       var uncovered = selection2.selectAll(".layer-osm.lines");
49094       var touchLayer = selection2.selectAll(".layer-touch.lines");
49095       [covered, uncovered].forEach(function(selection3) {
49096         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
49097         var layergroup = selection3.selectAll("g.layergroup").data(range3);
49098         layergroup = layergroup.enter().append("g").attr("class", function(d) {
49099           return "layergroup layer" + String(d);
49100         }).merge(layergroup);
49101         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d) {
49102           return "linegroup line-" + d;
49103         });
49104         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
49105         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
49106         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
49107         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
49108         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
49109         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
49110         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
49111         addMarkers(
49112           layergroup,
49113           "sided",
49114           "sidedgroup",
49115           sideddata,
49116           function marker(d) {
49117             var category = graph.entity(d.id).sidednessIdentifier();
49118             return "url(#ideditor-sided-marker-" + category + ")";
49119           }
49120         );
49121       });
49122       touchLayer.call(drawTargets, graph, ways, filter2);
49123     }
49124     return drawLines;
49125   }
49126
49127   // modules/svg/midpoints.js
49128   function svgMidpoints(projection2, context) {
49129     var targetRadius = 8;
49130     function drawTargets(selection2, graph, entities, filter2) {
49131       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49132       var getTransform = svgPointTransform(projection2).geojson;
49133       var data = entities.map(function(midpoint) {
49134         return {
49135           type: "Feature",
49136           id: midpoint.id,
49137           properties: {
49138             target: true,
49139             entity: midpoint
49140           },
49141           geometry: {
49142             type: "Point",
49143             coordinates: midpoint.loc
49144           }
49145         };
49146       });
49147       var targets = selection2.selectAll(".midpoint.target").filter(function(d) {
49148         return filter2(d.properties.entity);
49149       }).data(data, function key(d) {
49150         return d.id;
49151       });
49152       targets.exit().remove();
49153       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d) {
49154         return "node midpoint target " + fillClass + d.id;
49155       }).attr("transform", getTransform);
49156     }
49157     function drawMidpoints(selection2, graph, entities, filter2, extent) {
49158       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
49159       var touchLayer = selection2.selectAll(".layer-touch.points");
49160       var mode = context.mode();
49161       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
49162         drawLayer.selectAll(".midpoint").remove();
49163         touchLayer.selectAll(".midpoint.target").remove();
49164         return;
49165       }
49166       var poly = extent.polygon();
49167       var midpoints = {};
49168       for (var i2 = 0; i2 < entities.length; i2++) {
49169         var entity = entities[i2];
49170         if (entity.type !== "way")
49171           continue;
49172         if (!filter2(entity))
49173           continue;
49174         if (context.selectedIDs().indexOf(entity.id) < 0)
49175           continue;
49176         var nodes = graph.childNodes(entity);
49177         for (var j2 = 0; j2 < nodes.length - 1; j2++) {
49178           var a = nodes[j2];
49179           var b = nodes[j2 + 1];
49180           var id2 = [a.id, b.id].sort().join("-");
49181           if (midpoints[id2]) {
49182             midpoints[id2].parents.push(entity);
49183           } else if (geoVecLength(projection2(a.loc), projection2(b.loc)) > 40) {
49184             var point = geoVecInterp(a.loc, b.loc, 0.5);
49185             var loc = null;
49186             if (extent.intersects(point)) {
49187               loc = point;
49188             } else {
49189               for (var k = 0; k < 4; k++) {
49190                 point = geoLineIntersection([a.loc, b.loc], [poly[k], poly[k + 1]]);
49191                 if (point && geoVecLength(projection2(a.loc), projection2(point)) > 20 && geoVecLength(projection2(b.loc), projection2(point)) > 20) {
49192                   loc = point;
49193                   break;
49194                 }
49195               }
49196             }
49197             if (loc) {
49198               midpoints[id2] = {
49199                 type: "midpoint",
49200                 id: id2,
49201                 loc,
49202                 edge: [a.id, b.id],
49203                 parents: [entity]
49204               };
49205             }
49206           }
49207         }
49208       }
49209       function midpointFilter(d) {
49210         if (midpoints[d.id])
49211           return true;
49212         for (var i3 = 0; i3 < d.parents.length; i3++) {
49213           if (filter2(d.parents[i3])) {
49214             return true;
49215           }
49216         }
49217         return false;
49218       }
49219       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d) {
49220         return d.id;
49221       });
49222       groups.exit().remove();
49223       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
49224       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
49225       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
49226       groups = groups.merge(enter).attr("transform", function(d) {
49227         var translate = svgPointTransform(projection2);
49228         var a2 = graph.entity(d.edge[0]);
49229         var b2 = graph.entity(d.edge[1]);
49230         var angle2 = geoAngle(a2, b2, projection2) * (180 / Math.PI);
49231         return translate(d) + " rotate(" + angle2 + ")";
49232       }).call(svgTagClasses().tags(
49233         function(d) {
49234           return d.parents[0].tags;
49235         }
49236       ));
49237       groups.select("polygon.shadow");
49238       groups.select("polygon.fill");
49239       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
49240     }
49241     return drawMidpoints;
49242   }
49243
49244   // modules/svg/points.js
49245   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
49246   function svgPoints(projection2, context) {
49247     function markerPath(selection2, klass) {
49248       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");
49249     }
49250     function sortY(a, b) {
49251       return b.loc[1] - a.loc[1];
49252     }
49253     function fastEntityKey(d) {
49254       var mode = context.mode();
49255       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
49256       return isMoving ? d.id : osmEntity.key(d);
49257     }
49258     function drawTargets(selection2, graph, entities, filter2) {
49259       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49260       var getTransform = svgPointTransform(projection2).geojson;
49261       var activeID = context.activeID();
49262       var data = [];
49263       entities.forEach(function(node) {
49264         if (activeID === node.id)
49265           return;
49266         data.push({
49267           type: "Feature",
49268           id: node.id,
49269           properties: {
49270             target: true,
49271             entity: node
49272           },
49273           geometry: node.asGeoJSON()
49274         });
49275       });
49276       var targets = selection2.selectAll(".point.target").filter(function(d) {
49277         return filter2(d.properties.entity);
49278       }).data(data, function key(d) {
49279         return d.id;
49280       });
49281       targets.exit().remove();
49282       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d) {
49283         return "node point target " + fillClass + d.id;
49284       }).attr("transform", getTransform);
49285     }
49286     function drawPoints(selection2, graph, entities, filter2) {
49287       var wireframe = context.surface().classed("fill-wireframe");
49288       var zoom = geoScaleToZoom(projection2.scale());
49289       var base = context.history().base();
49290       function renderAsPoint(entity) {
49291         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
49292       }
49293       var points = wireframe ? [] : entities.filter(renderAsPoint);
49294       points.sort(sortY);
49295       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
49296       var touchLayer = selection2.selectAll(".layer-touch.points");
49297       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
49298       groups.exit().remove();
49299       var enter = groups.enter().append("g").attr("class", function(d) {
49300         return "node point " + d.id;
49301       }).order();
49302       enter.append("path").call(markerPath, "shadow");
49303       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
49304       enter.append("path").call(markerPath, "stroke");
49305       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
49306       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d) {
49307         return !base.entities[d.id];
49308       }).classed("moved", function(d) {
49309         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
49310       }).classed("retagged", function(d) {
49311         return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
49312       }).call(svgTagClasses());
49313       groups.select(".shadow");
49314       groups.select(".stroke");
49315       groups.select(".icon").attr("xlink:href", function(entity) {
49316         var preset = _mainPresetIndex.match(entity, graph);
49317         var picon = preset && preset.icon;
49318         return picon ? "#" + picon : "";
49319       });
49320       touchLayer.call(drawTargets, graph, points, filter2);
49321     }
49322     return drawPoints;
49323   }
49324
49325   // modules/svg/turns.js
49326   function svgTurns(projection2, context) {
49327     function icon2(turn) {
49328       var u = turn.u ? "-u" : "";
49329       if (turn.no)
49330         return "#iD-turn-no" + u;
49331       if (turn.only)
49332         return "#iD-turn-only" + u;
49333       return "#iD-turn-yes" + u;
49334     }
49335     function drawTurns(selection2, graph, turns) {
49336       function turnTransform(d) {
49337         var pxRadius = 50;
49338         var toWay = graph.entity(d.to.way);
49339         var toPoints = graph.childNodes(toWay).map(function(n2) {
49340           return n2.loc;
49341         }).map(projection2);
49342         var toLength = geoPathLength(toPoints);
49343         var mid = toLength / 2;
49344         var toNode = graph.entity(d.to.node);
49345         var toVertex = graph.entity(d.to.vertex);
49346         var a = geoAngle(toVertex, toNode, projection2);
49347         var o = projection2(toVertex.loc);
49348         var r = d.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
49349         return "translate(" + (r * Math.cos(a) + o[0]) + "," + (r * Math.sin(a) + o[1]) + ") rotate(" + a * 180 / Math.PI + ")";
49350       }
49351       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
49352       var touchLayer = selection2.selectAll(".layer-touch.turns");
49353       var groups = drawLayer.selectAll("g.turn").data(turns, function(d) {
49354         return d.key;
49355       });
49356       groups.exit().remove();
49357       var groupsEnter = groups.enter().append("g").attr("class", function(d) {
49358         return "turn " + d.key;
49359       });
49360       var turnsEnter = groupsEnter.filter(function(d) {
49361         return !d.u;
49362       });
49363       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
49364       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
49365       var uEnter = groupsEnter.filter(function(d) {
49366         return d.u;
49367       });
49368       uEnter.append("circle").attr("r", "16");
49369       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
49370       groups = groups.merge(groupsEnter).attr("opacity", function(d) {
49371         return d.direct === false ? "0.7" : null;
49372       }).attr("transform", turnTransform);
49373       groups.select("use").attr("xlink:href", icon2);
49374       groups.select("rect");
49375       groups.select("circle");
49376       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49377       groups = touchLayer.selectAll("g.turn").data(turns, function(d) {
49378         return d.key;
49379       });
49380       groups.exit().remove();
49381       groupsEnter = groups.enter().append("g").attr("class", function(d) {
49382         return "turn " + d.key;
49383       });
49384       turnsEnter = groupsEnter.filter(function(d) {
49385         return !d.u;
49386       });
49387       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
49388       uEnter = groupsEnter.filter(function(d) {
49389         return d.u;
49390       });
49391       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
49392       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
49393       groups.select("rect");
49394       groups.select("circle");
49395       return this;
49396     }
49397     return drawTurns;
49398   }
49399
49400   // modules/svg/vertices.js
49401   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
49402   function svgVertices(projection2, context) {
49403     var radiuses = {
49404       shadow: [6, 7.5, 7.5, 12],
49405       stroke: [2.5, 3.5, 3.5, 8],
49406       fill: [1, 1.5, 1.5, 1.5]
49407     };
49408     var _currHoverTarget;
49409     var _currPersistent = {};
49410     var _currHover = {};
49411     var _prevHover = {};
49412     var _currSelected = {};
49413     var _prevSelected = {};
49414     var _radii = {};
49415     function sortY(a, b) {
49416       return b.loc[1] - a.loc[1];
49417     }
49418     function fastEntityKey(d) {
49419       var mode = context.mode();
49420       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
49421       return isMoving ? d.id : osmEntity.key(d);
49422     }
49423     function draw(selection2, graph, vertices, sets2, filter2) {
49424       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
49425       var icons = {};
49426       var directions = {};
49427       var wireframe = context.surface().classed("fill-wireframe");
49428       var zoom = geoScaleToZoom(projection2.scale());
49429       var z = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
49430       var activeID = context.activeID();
49431       var base = context.history().base();
49432       function getIcon(d) {
49433         var entity = graph.entity(d.id);
49434         if (entity.id in icons)
49435           return icons[entity.id];
49436         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
49437         return icons[entity.id];
49438       }
49439       function getDirections(entity) {
49440         if (entity.id in directions)
49441           return directions[entity.id];
49442         var angles = entity.directions(graph, projection2);
49443         directions[entity.id] = angles.length ? angles : false;
49444         return angles;
49445       }
49446       function updateAttributes(selection3) {
49447         ["shadow", "stroke", "fill"].forEach(function(klass) {
49448           var rads = radiuses[klass];
49449           selection3.selectAll("." + klass).each(function(entity) {
49450             var i2 = z && getIcon(entity);
49451             var r = rads[i2 ? 3 : z];
49452             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
49453               r += 1.5;
49454             }
49455             if (klass === "shadow") {
49456               _radii[entity.id] = r;
49457             }
49458             select_default2(this).attr("r", r).attr("visibility", i2 && klass === "fill" ? "hidden" : null);
49459           });
49460         });
49461       }
49462       vertices.sort(sortY);
49463       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
49464       groups.exit().remove();
49465       var enter = groups.enter().append("g").attr("class", function(d) {
49466         return "node vertex " + d.id;
49467       }).order();
49468       enter.append("circle").attr("class", "shadow");
49469       enter.append("circle").attr("class", "stroke");
49470       enter.filter(function(d) {
49471         return d.hasInterestingTags();
49472       }).append("circle").attr("class", "fill");
49473       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d) {
49474         return d.id in sets2.selected;
49475       }).classed("shared", function(d) {
49476         return graph.isShared(d);
49477       }).classed("endpoint", function(d) {
49478         return d.isEndpoint(graph);
49479       }).classed("added", function(d) {
49480         return !base.entities[d.id];
49481       }).classed("moved", function(d) {
49482         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
49483       }).classed("retagged", function(d) {
49484         return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
49485       }).call(updateAttributes);
49486       var iconUse = groups.selectAll(".icon").data(function data(d) {
49487         return zoom >= 17 && getIcon(d) ? [d] : [];
49488       }, fastEntityKey);
49489       iconUse.exit().remove();
49490       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d) {
49491         var picon = getIcon(d);
49492         return picon ? "#" + picon : "";
49493       });
49494       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d) {
49495         return zoom >= 18 && getDirections(d) ? [d] : [];
49496       }, fastEntityKey);
49497       dgroups.exit().remove();
49498       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
49499       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d) {
49500         return osmEntity.key(d);
49501       });
49502       viewfields.exit().remove();
49503       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(d) {
49504         return "rotate(" + d + ")";
49505       });
49506     }
49507     function drawTargets(selection2, graph, entities, filter2) {
49508       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
49509       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
49510       var getTransform = svgPointTransform(projection2).geojson;
49511       var activeID = context.activeID();
49512       var data = { targets: [], nopes: [] };
49513       entities.forEach(function(node) {
49514         if (activeID === node.id)
49515           return;
49516         var vertexType = svgPassiveVertex(node, graph, activeID);
49517         if (vertexType !== 0) {
49518           data.targets.push({
49519             type: "Feature",
49520             id: node.id,
49521             properties: {
49522               target: true,
49523               entity: node
49524             },
49525             geometry: node.asGeoJSON()
49526           });
49527         } else {
49528           data.nopes.push({
49529             type: "Feature",
49530             id: node.id + "-nope",
49531             properties: {
49532               nope: true,
49533               target: true,
49534               entity: node
49535             },
49536             geometry: node.asGeoJSON()
49537           });
49538         }
49539       });
49540       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d) {
49541         return filter2(d.properties.entity);
49542       }).data(data.targets, function key(d) {
49543         return d.id;
49544       });
49545       targets.exit().remove();
49546       targets.enter().append("circle").attr("r", function(d) {
49547         return _radii[d.id] || radiuses.shadow[3];
49548       }).merge(targets).attr("class", function(d) {
49549         return "node vertex target target-allowed " + targetClass + d.id;
49550       }).attr("transform", getTransform);
49551       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d) {
49552         return filter2(d.properties.entity);
49553       }).data(data.nopes, function key(d) {
49554         return d.id;
49555       });
49556       nopes.exit().remove();
49557       nopes.enter().append("circle").attr("r", function(d) {
49558         return _radii[d.properties.entity.id] || radiuses.shadow[3];
49559       }).merge(nopes).attr("class", function(d) {
49560         return "node vertex target target-nope " + nopeClass + d.id;
49561       }).attr("transform", getTransform);
49562     }
49563     function renderAsVertex(entity, graph, wireframe, zoom) {
49564       var geometry = entity.geometry(graph);
49565       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
49566     }
49567     function isEditedNode(node, base, head) {
49568       var baseNode = base.entities[node.id];
49569       var headNode = head.entities[node.id];
49570       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
49571     }
49572     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
49573       var results = {};
49574       var seenIds = {};
49575       function addChildVertices(entity) {
49576         if (seenIds[entity.id])
49577           return;
49578         seenIds[entity.id] = true;
49579         var geometry = entity.geometry(graph);
49580         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
49581           var i2;
49582           if (entity.type === "way") {
49583             for (i2 = 0; i2 < entity.nodes.length; i2++) {
49584               var child = graph.hasEntity(entity.nodes[i2]);
49585               if (child) {
49586                 addChildVertices(child);
49587               }
49588             }
49589           } else if (entity.type === "relation") {
49590             for (i2 = 0; i2 < entity.members.length; i2++) {
49591               var member = graph.hasEntity(entity.members[i2].id);
49592               if (member) {
49593                 addChildVertices(member);
49594               }
49595             }
49596           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
49597             results[entity.id] = entity;
49598           }
49599         }
49600       }
49601       ids.forEach(function(id2) {
49602         var entity = graph.hasEntity(id2);
49603         if (!entity)
49604           return;
49605         if (entity.type === "node") {
49606           if (renderAsVertex(entity, graph, wireframe, zoom)) {
49607             results[entity.id] = entity;
49608             graph.parentWays(entity).forEach(function(entity2) {
49609               addChildVertices(entity2);
49610             });
49611           }
49612         } else {
49613           addChildVertices(entity);
49614         }
49615       });
49616       return results;
49617     }
49618     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
49619       var wireframe = context.surface().classed("fill-wireframe");
49620       var visualDiff = context.surface().classed("highlight-edited");
49621       var zoom = geoScaleToZoom(projection2.scale());
49622       var mode = context.mode();
49623       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
49624       var base = context.history().base();
49625       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
49626       var touchLayer = selection2.selectAll(".layer-touch.points");
49627       if (fullRedraw) {
49628         _currPersistent = {};
49629         _radii = {};
49630       }
49631       for (var i2 = 0; i2 < entities.length; i2++) {
49632         var entity = entities[i2];
49633         var geometry = entity.geometry(graph);
49634         var keep = false;
49635         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
49636           _currPersistent[entity.id] = entity;
49637           keep = true;
49638         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
49639           _currPersistent[entity.id] = entity;
49640           keep = true;
49641         }
49642         if (!keep && !fullRedraw) {
49643           delete _currPersistent[entity.id];
49644         }
49645       }
49646       var sets2 = {
49647         persistent: _currPersistent,
49648         selected: _currSelected,
49649         hovered: _currHover
49650       };
49651       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
49652       var filterRendered = function(d) {
49653         return d.id in _currPersistent || d.id in _currSelected || d.id in _currHover || filter2(d);
49654       };
49655       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
49656       var filterTouch = function(d) {
49657         return isMoving ? true : filterRendered(d);
49658       };
49659       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
49660       function currentVisible(which) {
49661         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
49662           return entity2 && entity2.intersects(extent, graph);
49663         });
49664       }
49665     }
49666     drawVertices.drawSelected = function(selection2, graph, extent) {
49667       var wireframe = context.surface().classed("fill-wireframe");
49668       var zoom = geoScaleToZoom(projection2.scale());
49669       _prevSelected = _currSelected || {};
49670       if (context.map().isInWideSelection()) {
49671         _currSelected = {};
49672         context.selectedIDs().forEach(function(id2) {
49673           var entity = graph.hasEntity(id2);
49674           if (!entity)
49675             return;
49676           if (entity.type === "node") {
49677             if (renderAsVertex(entity, graph, wireframe, zoom)) {
49678               _currSelected[entity.id] = entity;
49679             }
49680           }
49681         });
49682       } else {
49683         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
49684       }
49685       var filter2 = function(d) {
49686         return d.id in _prevSelected;
49687       };
49688       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
49689     };
49690     drawVertices.drawHover = function(selection2, graph, target, extent) {
49691       if (target === _currHoverTarget)
49692         return;
49693       var wireframe = context.surface().classed("fill-wireframe");
49694       var zoom = geoScaleToZoom(projection2.scale());
49695       _prevHover = _currHover || {};
49696       _currHoverTarget = target;
49697       var entity = target && target.properties && target.properties.entity;
49698       if (entity) {
49699         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
49700       } else {
49701         _currHover = {};
49702       }
49703       var filter2 = function(d) {
49704         return d.id in _prevHover;
49705       };
49706       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
49707     };
49708     return drawVertices;
49709   }
49710
49711   // modules/util/bind_once.js
49712   function utilBindOnce(target, type3, listener, capture) {
49713     var typeOnce = type3 + ".once";
49714     function one2() {
49715       target.on(typeOnce, null);
49716       listener.apply(this, arguments);
49717     }
49718     target.on(typeOnce, one2, capture);
49719     return this;
49720   }
49721
49722   // modules/util/zoom_pan.js
49723   function defaultFilter3(d3_event) {
49724     return !d3_event.ctrlKey && !d3_event.button;
49725   }
49726   function defaultExtent2() {
49727     var e = this;
49728     if (e instanceof SVGElement) {
49729       e = e.ownerSVGElement || e;
49730       if (e.hasAttribute("viewBox")) {
49731         e = e.viewBox.baseVal;
49732         return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
49733       }
49734       return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
49735     }
49736     return [[0, 0], [e.clientWidth, e.clientHeight]];
49737   }
49738   function defaultWheelDelta2(d3_event) {
49739     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
49740   }
49741   function defaultConstrain2(transform2, extent, translateExtent) {
49742     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];
49743     return transform2.translate(
49744       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
49745       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
49746     );
49747   }
49748   function utilZoomPan() {
49749     var filter2 = defaultFilter3, extent = defaultExtent2, constrain = defaultConstrain2, wheelDelta = defaultWheelDelta2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], interpolate = zoom_default, dispatch10 = dispatch_default("start", "zoom", "end"), _wheelDelay = 150, _transform = identity2, _activeGesture;
49750     function zoom(selection2) {
49751       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
49752       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
49753     }
49754     zoom.transform = function(collection, transform2, point) {
49755       var selection2 = collection.selection ? collection.selection() : collection;
49756       if (collection !== selection2) {
49757         schedule(collection, transform2, point);
49758       } else {
49759         selection2.interrupt().each(function() {
49760           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
49761         });
49762       }
49763     };
49764     zoom.scaleBy = function(selection2, k, p) {
49765       zoom.scaleTo(selection2, function() {
49766         var k0 = _transform.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
49767         return k0 * k1;
49768       }, p);
49769     };
49770     zoom.scaleTo = function(selection2, k, p) {
49771       zoom.transform(selection2, function() {
49772         var e = extent.apply(this, arguments), t0 = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p02), k1 = typeof k === "function" ? k.apply(this, arguments) : k;
49773         return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
49774       }, p);
49775     };
49776     zoom.translateBy = function(selection2, x, y) {
49777       zoom.transform(selection2, function() {
49778         return constrain(_transform.translate(
49779           typeof x === "function" ? x.apply(this, arguments) : x,
49780           typeof y === "function" ? y.apply(this, arguments) : y
49781         ), extent.apply(this, arguments), translateExtent);
49782       });
49783     };
49784     zoom.translateTo = function(selection2, x, y, p) {
49785       zoom.transform(selection2, function() {
49786         var e = extent.apply(this, arguments), t = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
49787         return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(
49788           typeof x === "function" ? -x.apply(this, arguments) : -x,
49789           typeof y === "function" ? -y.apply(this, arguments) : -y
49790         ), e, translateExtent);
49791       }, p);
49792     };
49793     function scale(transform2, k) {
49794       k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
49795       return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
49796     }
49797     function translate(transform2, p02, p1) {
49798       var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
49799       return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
49800     }
49801     function centroid(extent2) {
49802       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
49803     }
49804     function schedule(transition2, transform2, point) {
49805       transition2.on("start.zoom", function() {
49806         gesture(this, arguments).start(null);
49807       }).on("interrupt.zoom end.zoom", function() {
49808         gesture(this, arguments).end(null);
49809       }).tween("zoom", function() {
49810         var that = this, args = arguments, g = gesture(that, args), e = extent.apply(that, args), p = !point ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = _transform, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i2 = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
49811         return function(t) {
49812           if (t === 1) {
49813             t = b;
49814           } else {
49815             var l = i2(t);
49816             var k = w / l[2];
49817             t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
49818           }
49819           g.zoom(null, null, t);
49820         };
49821       });
49822     }
49823     function gesture(that, args, clean2) {
49824       return !clean2 && _activeGesture || new Gesture(that, args);
49825     }
49826     function Gesture(that, args) {
49827       this.that = that;
49828       this.args = args;
49829       this.active = 0;
49830       this.extent = extent.apply(that, args);
49831     }
49832     Gesture.prototype = {
49833       start: function(d3_event) {
49834         if (++this.active === 1) {
49835           _activeGesture = this;
49836           dispatch10.call("start", this, d3_event);
49837         }
49838         return this;
49839       },
49840       zoom: function(d3_event, key, transform2) {
49841         if (this.mouse && key !== "mouse")
49842           this.mouse[1] = transform2.invert(this.mouse[0]);
49843         if (this.pointer0 && key !== "touch")
49844           this.pointer0[1] = transform2.invert(this.pointer0[0]);
49845         if (this.pointer1 && key !== "touch")
49846           this.pointer1[1] = transform2.invert(this.pointer1[0]);
49847         _transform = transform2;
49848         dispatch10.call("zoom", this, d3_event, key, transform2);
49849         return this;
49850       },
49851       end: function(d3_event) {
49852         if (--this.active === 0) {
49853           _activeGesture = null;
49854           dispatch10.call("end", this, d3_event);
49855         }
49856         return this;
49857       }
49858     };
49859     function wheeled(d3_event) {
49860       if (!filter2.apply(this, arguments))
49861         return;
49862       var g = gesture(this, arguments), t = _transform, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = utilFastMouse(this)(d3_event);
49863       if (g.wheel) {
49864         if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
49865           g.mouse[1] = t.invert(g.mouse[0] = p);
49866         }
49867         clearTimeout(g.wheel);
49868       } else {
49869         g.mouse = [p, t.invert(p)];
49870         interrupt_default(this);
49871         g.start(d3_event);
49872       }
49873       d3_event.preventDefault();
49874       d3_event.stopImmediatePropagation();
49875       g.wheel = setTimeout(wheelidled, _wheelDelay);
49876       g.zoom(d3_event, "mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
49877       function wheelidled() {
49878         g.wheel = null;
49879         g.end(d3_event);
49880       }
49881     }
49882     var _downPointerIDs = /* @__PURE__ */ new Set();
49883     var _pointerLocGetter;
49884     function pointerdown(d3_event) {
49885       _downPointerIDs.add(d3_event.pointerId);
49886       if (!filter2.apply(this, arguments))
49887         return;
49888       var g = gesture(this, arguments, _downPointerIDs.size === 1);
49889       var started;
49890       d3_event.stopImmediatePropagation();
49891       _pointerLocGetter = utilFastMouse(this);
49892       var loc = _pointerLocGetter(d3_event);
49893       var p = [loc, _transform.invert(loc), d3_event.pointerId];
49894       if (!g.pointer0) {
49895         g.pointer0 = p;
49896         started = true;
49897       } else if (!g.pointer1 && g.pointer0[2] !== p[2]) {
49898         g.pointer1 = p;
49899       }
49900       if (started) {
49901         interrupt_default(this);
49902         g.start(d3_event);
49903       }
49904     }
49905     function pointermove(d3_event) {
49906       if (!_downPointerIDs.has(d3_event.pointerId))
49907         return;
49908       if (!_activeGesture || !_pointerLocGetter)
49909         return;
49910       var g = gesture(this, arguments);
49911       var isPointer0 = g.pointer0 && g.pointer0[2] === d3_event.pointerId;
49912       var isPointer1 = !isPointer0 && g.pointer1 && g.pointer1[2] === d3_event.pointerId;
49913       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
49914         if (g.pointer0)
49915           _downPointerIDs.delete(g.pointer0[2]);
49916         if (g.pointer1)
49917           _downPointerIDs.delete(g.pointer1[2]);
49918         g.end(d3_event);
49919         return;
49920       }
49921       d3_event.preventDefault();
49922       d3_event.stopImmediatePropagation();
49923       var loc = _pointerLocGetter(d3_event);
49924       var t, p, l;
49925       if (isPointer0)
49926         g.pointer0[0] = loc;
49927       else if (isPointer1)
49928         g.pointer1[0] = loc;
49929       t = _transform;
49930       if (g.pointer1) {
49931         var p02 = g.pointer0[0], l0 = g.pointer0[1], p1 = g.pointer1[0], l1 = g.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;
49932         t = scale(t, Math.sqrt(dp / dl));
49933         p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
49934         l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
49935       } else if (g.pointer0) {
49936         p = g.pointer0[0];
49937         l = g.pointer0[1];
49938       } else {
49939         return;
49940       }
49941       g.zoom(d3_event, "touch", constrain(translate(t, p, l), g.extent, translateExtent));
49942     }
49943     function pointerup(d3_event) {
49944       if (!_downPointerIDs.has(d3_event.pointerId))
49945         return;
49946       _downPointerIDs.delete(d3_event.pointerId);
49947       if (!_activeGesture)
49948         return;
49949       var g = gesture(this, arguments);
49950       d3_event.stopImmediatePropagation();
49951       if (g.pointer0 && g.pointer0[2] === d3_event.pointerId)
49952         delete g.pointer0;
49953       else if (g.pointer1 && g.pointer1[2] === d3_event.pointerId)
49954         delete g.pointer1;
49955       if (g.pointer1 && !g.pointer0) {
49956         g.pointer0 = g.pointer1;
49957         delete g.pointer1;
49958       }
49959       if (g.pointer0) {
49960         g.pointer0[1] = _transform.invert(g.pointer0[0]);
49961       } else {
49962         g.end(d3_event);
49963       }
49964     }
49965     zoom.wheelDelta = function(_) {
49966       return arguments.length ? (wheelDelta = utilFunctor(+_), zoom) : wheelDelta;
49967     };
49968     zoom.filter = function(_) {
49969       return arguments.length ? (filter2 = utilFunctor(!!_), zoom) : filter2;
49970     };
49971     zoom.extent = function(_) {
49972       return arguments.length ? (extent = utilFunctor([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
49973     };
49974     zoom.scaleExtent = function(_) {
49975       return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
49976     };
49977     zoom.translateExtent = function(_) {
49978       return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
49979     };
49980     zoom.constrain = function(_) {
49981       return arguments.length ? (constrain = _, zoom) : constrain;
49982     };
49983     zoom.interpolate = function(_) {
49984       return arguments.length ? (interpolate = _, zoom) : interpolate;
49985     };
49986     zoom._transform = function(_) {
49987       return arguments.length ? (_transform = _, zoom) : _transform;
49988     };
49989     return utilRebind(zoom, dispatch10, "on");
49990   }
49991
49992   // modules/util/double_up.js
49993   function utilDoubleUp() {
49994     var dispatch10 = dispatch_default("doubleUp");
49995     var _maxTimespan = 500;
49996     var _maxDistance = 20;
49997     var _pointer;
49998     function pointerIsValidFor(loc) {
49999       return new Date().getTime() - _pointer.startTime <= _maxTimespan && geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
50000     }
50001     function pointerdown(d3_event) {
50002       if (d3_event.ctrlKey || d3_event.button === 2)
50003         return;
50004       var loc = [d3_event.clientX, d3_event.clientY];
50005       if (_pointer && !pointerIsValidFor(loc)) {
50006         _pointer = void 0;
50007       }
50008       if (!_pointer) {
50009         _pointer = {
50010           startLoc: loc,
50011           startTime: new Date().getTime(),
50012           upCount: 0,
50013           pointerId: d3_event.pointerId
50014         };
50015       } else {
50016         _pointer.pointerId = d3_event.pointerId;
50017       }
50018     }
50019     function pointerup(d3_event) {
50020       if (d3_event.ctrlKey || d3_event.button === 2)
50021         return;
50022       if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
50023         return;
50024       _pointer.upCount += 1;
50025       if (_pointer.upCount === 2) {
50026         var loc = [d3_event.clientX, d3_event.clientY];
50027         if (pointerIsValidFor(loc)) {
50028           var locInThis = utilFastMouse(this)(d3_event);
50029           dispatch10.call("doubleUp", this, d3_event, locInThis);
50030         }
50031         _pointer = void 0;
50032       }
50033     }
50034     function doubleUp(selection2) {
50035       if ("PointerEvent" in window) {
50036         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
50037       } else {
50038         selection2.on("dblclick.doubleUp", function(d3_event) {
50039           dispatch10.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
50040         });
50041       }
50042     }
50043     doubleUp.off = function(selection2) {
50044       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
50045     };
50046     return utilRebind(doubleUp, dispatch10, "on");
50047   }
50048
50049   // modules/renderer/map.js
50050   var TILESIZE = 256;
50051   var minZoom2 = 2;
50052   var maxZoom = 24;
50053   var kMin = geoZoomToScale(minZoom2, TILESIZE);
50054   var kMax = geoZoomToScale(maxZoom, TILESIZE);
50055   function clamp(num, min3, max3) {
50056     return Math.max(min3, Math.min(num, max3));
50057   }
50058   function rendererMap(context) {
50059     var dispatch10 = dispatch_default(
50060       "move",
50061       "drawn",
50062       "crossEditableZoom",
50063       "hitMinZoom",
50064       "changeHighlighting",
50065       "changeAreaFill"
50066     );
50067     var projection2 = context.projection;
50068     var curtainProjection = context.curtainProjection;
50069     var drawLayers;
50070     var drawPoints;
50071     var drawVertices;
50072     var drawLines;
50073     var drawAreas;
50074     var drawMidpoints;
50075     var drawLabels;
50076     var _selection = select_default2(null);
50077     var supersurface = select_default2(null);
50078     var wrapper = select_default2(null);
50079     var surface = select_default2(null);
50080     var _dimensions = [1, 1];
50081     var _dblClickZoomEnabled = true;
50082     var _redrawEnabled = true;
50083     var _gestureTransformStart;
50084     var _transformStart = projection2.transform();
50085     var _transformLast;
50086     var _isTransformed = false;
50087     var _minzoom = 0;
50088     var _getMouseCoords;
50089     var _lastPointerEvent;
50090     var _lastWithinEditableZoom;
50091     var _pointerDown = false;
50092     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
50093     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
50094     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan).on("start.map", function(d3_event) {
50095       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
50096     }).on("end.map", function() {
50097       _pointerDown = false;
50098     });
50099     var _doubleUpHandler = utilDoubleUp();
50100     var scheduleRedraw = throttle_default(redraw, 750);
50101     function cancelPendingRedraw() {
50102       scheduleRedraw.cancel();
50103     }
50104     function map2(selection2) {
50105       _selection = selection2;
50106       context.on("change.map", immediateRedraw);
50107       var osm = context.connection();
50108       if (osm) {
50109         osm.on("change.map", immediateRedraw);
50110       }
50111       function didUndoOrRedo(targetTransform) {
50112         var mode = context.mode().id;
50113         if (mode !== "browse" && mode !== "select")
50114           return;
50115         if (targetTransform) {
50116           map2.transformEase(targetTransform);
50117         }
50118       }
50119       context.history().on("merge.map", function() {
50120         scheduleRedraw();
50121       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
50122         didUndoOrRedo(fromStack.transform);
50123       }).on("redone.map", function(stack) {
50124         didUndoOrRedo(stack.transform);
50125       });
50126       context.background().on("change.map", immediateRedraw);
50127       context.features().on("redraw.map", immediateRedraw);
50128       drawLayers.on("change.map", function() {
50129         context.background().updateImagery();
50130         immediateRedraw();
50131       });
50132       selection2.on("wheel.map mousewheel.map", function(d3_event) {
50133         d3_event.preventDefault();
50134       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
50135       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
50136       wrapper = supersurface.append("div").attr("class", "layer layer-data");
50137       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
50138       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
50139         _lastPointerEvent = d3_event;
50140         if (d3_event.button === 2) {
50141           d3_event.stopPropagation();
50142         }
50143       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
50144         _lastPointerEvent = d3_event;
50145         if (resetTransform()) {
50146           immediateRedraw();
50147         }
50148       }).on(_pointerPrefix + "move.map", function(d3_event) {
50149         _lastPointerEvent = d3_event;
50150       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
50151         if (map2.editableDataEnabled() && !_isTransformed) {
50152           var hover = d3_event.target.__data__;
50153           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
50154           dispatch10.call("drawn", this, { full: false });
50155         }
50156       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
50157         if (map2.editableDataEnabled() && !_isTransformed) {
50158           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
50159           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
50160           dispatch10.call("drawn", this, { full: false });
50161         }
50162       });
50163       var detected = utilDetect();
50164       if ("GestureEvent" in window && !detected.isMobileWebKit) {
50165         surface.on("gesturestart.surface", function(d3_event) {
50166           d3_event.preventDefault();
50167           _gestureTransformStart = projection2.transform();
50168         }).on("gesturechange.surface", gestureChange);
50169       }
50170       updateAreaFill();
50171       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
50172         if (!_dblClickZoomEnabled)
50173           return;
50174         if (typeof d3_event.target.__data__ === "object" && !select_default2(d3_event.target).classed("fill"))
50175           return;
50176         var zoomOut2 = d3_event.shiftKey;
50177         var t = projection2.transform();
50178         var p1 = t.invert(p02);
50179         t = t.scale(zoomOut2 ? 0.5 : 2);
50180         t.x = p02[0] - p1[0] * t.k;
50181         t.y = p02[1] - p1[1] * t.k;
50182         map2.transformEase(t);
50183       });
50184       context.on("enter.map", function() {
50185         if (!map2.editableDataEnabled(true))
50186           return;
50187         if (_isTransformed)
50188           return;
50189         var graph = context.graph();
50190         var selectedAndParents = {};
50191         context.selectedIDs().forEach(function(id2) {
50192           var entity = graph.hasEntity(id2);
50193           if (entity) {
50194             selectedAndParents[entity.id] = entity;
50195             if (entity.type === "node") {
50196               graph.parentWays(entity).forEach(function(parent) {
50197                 selectedAndParents[parent.id] = parent;
50198               });
50199             }
50200           }
50201         });
50202         var data = Object.values(selectedAndParents);
50203         var filter2 = function(d) {
50204           return d.id in selectedAndParents;
50205         };
50206         data = context.features().filter(data, graph);
50207         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
50208         dispatch10.call("drawn", this, { full: false });
50209         scheduleRedraw();
50210       });
50211       map2.dimensions(utilGetDimensions(selection2));
50212     }
50213     function zoomEventFilter(d3_event) {
50214       if (d3_event.type === "mousedown") {
50215         var hasOrphan = false;
50216         var listeners = window.__on;
50217         for (var i2 = 0; i2 < listeners.length; i2++) {
50218           var listener = listeners[i2];
50219           if (listener.name === "zoom" && listener.type === "mouseup") {
50220             hasOrphan = true;
50221             break;
50222           }
50223         }
50224         if (hasOrphan) {
50225           var event = window.CustomEvent;
50226           if (event) {
50227             event = new event("mouseup");
50228           } else {
50229             event = window.document.createEvent("Event");
50230             event.initEvent("mouseup", false, false);
50231           }
50232           event.view = window;
50233           window.dispatchEvent(event);
50234         }
50235       }
50236       return d3_event.button !== 2;
50237     }
50238     function pxCenter() {
50239       return [_dimensions[0] / 2, _dimensions[1] / 2];
50240     }
50241     function drawEditable(difference, extent) {
50242       var mode = context.mode();
50243       var graph = context.graph();
50244       var features2 = context.features();
50245       var all = context.history().intersects(map2.extent());
50246       var fullRedraw = false;
50247       var data;
50248       var set3;
50249       var filter2;
50250       var applyFeatureLayerFilters = true;
50251       if (map2.isInWideSelection()) {
50252         data = [];
50253         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
50254           var entity = context.hasEntity(id2);
50255           if (entity)
50256             data.push(entity);
50257         });
50258         fullRedraw = true;
50259         filter2 = utilFunctor(true);
50260         applyFeatureLayerFilters = false;
50261       } else if (difference) {
50262         var complete = difference.complete(map2.extent());
50263         data = Object.values(complete).filter(Boolean);
50264         set3 = new Set(Object.keys(complete));
50265         filter2 = function(d) {
50266           return set3.has(d.id);
50267         };
50268         features2.clear(data);
50269       } else {
50270         if (features2.gatherStats(all, graph, _dimensions)) {
50271           extent = void 0;
50272         }
50273         if (extent) {
50274           data = context.history().intersects(map2.extent().intersection(extent));
50275           set3 = new Set(data.map(function(entity) {
50276             return entity.id;
50277           }));
50278           filter2 = function(d) {
50279             return set3.has(d.id);
50280           };
50281         } else {
50282           data = all;
50283           fullRedraw = true;
50284           filter2 = utilFunctor(true);
50285         }
50286       }
50287       if (applyFeatureLayerFilters) {
50288         data = features2.filter(data, graph);
50289       } else {
50290         context.features().resetStats();
50291       }
50292       if (mode && mode.id === "select") {
50293         surface.call(drawVertices.drawSelected, graph, map2.extent());
50294       }
50295       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);
50296       dispatch10.call("drawn", this, { full: true });
50297     }
50298     map2.init = function() {
50299       drawLayers = svgLayers(projection2, context);
50300       drawPoints = svgPoints(projection2, context);
50301       drawVertices = svgVertices(projection2, context);
50302       drawLines = svgLines(projection2, context);
50303       drawAreas = svgAreas(projection2, context);
50304       drawMidpoints = svgMidpoints(projection2, context);
50305       drawLabels = svgLabels(projection2, context);
50306     };
50307     function editOff() {
50308       context.features().resetStats();
50309       surface.selectAll(".layer-osm *").remove();
50310       surface.selectAll(".layer-touch:not(.markers) *").remove();
50311       var allowed = {
50312         "browse": true,
50313         "save": true,
50314         "select-note": true,
50315         "select-data": true,
50316         "select-error": true
50317       };
50318       var mode = context.mode();
50319       if (mode && !allowed[mode.id]) {
50320         context.enter(modeBrowse(context));
50321       }
50322       dispatch10.call("drawn", this, { full: true });
50323     }
50324     function gestureChange(d3_event) {
50325       var e = d3_event;
50326       e.preventDefault();
50327       var props = {
50328         deltaMode: 0,
50329         deltaY: 1,
50330         clientX: e.clientX,
50331         clientY: e.clientY,
50332         screenX: e.screenX,
50333         screenY: e.screenY,
50334         x: e.x,
50335         y: e.y
50336       };
50337       var e22 = new WheelEvent("wheel", props);
50338       e22._scale = e.scale;
50339       e22._rotation = e.rotation;
50340       _selection.node().dispatchEvent(e22);
50341     }
50342     function zoomPan(event, key, transform2) {
50343       var source = event && event.sourceEvent || event;
50344       var eventTransform = transform2 || event && event.transform;
50345       var x = eventTransform.x;
50346       var y = eventTransform.y;
50347       var k = eventTransform.k;
50348       if (source && source.type === "wheel") {
50349         if (_pointerDown)
50350           return;
50351         var detected = utilDetect();
50352         var dX = source.deltaX;
50353         var dY = source.deltaY;
50354         var x2 = x;
50355         var y2 = y;
50356         var k2 = k;
50357         var t0, p02, p1;
50358         if (source.deltaMode === 1) {
50359           var lines = Math.abs(source.deltaY);
50360           var sign2 = source.deltaY > 0 ? 1 : -1;
50361           dY = sign2 * clamp(
50362             Math.exp((lines - 1) * 0.75) * 4.000244140625,
50363             4.000244140625,
50364             350.000244140625
50365           );
50366           if (detected.os !== "mac") {
50367             dY *= 5;
50368           }
50369           t0 = _isTransformed ? _transformLast : _transformStart;
50370           p02 = _getMouseCoords(source);
50371           p1 = t0.invert(p02);
50372           k2 = t0.k * Math.pow(2, -dY / 500);
50373           k2 = clamp(k2, kMin, kMax);
50374           x2 = p02[0] - p1[0] * k2;
50375           y2 = p02[1] - p1[1] * k2;
50376         } else if (source._scale) {
50377           t0 = _gestureTransformStart;
50378           p02 = _getMouseCoords(source);
50379           p1 = t0.invert(p02);
50380           k2 = t0.k * source._scale;
50381           k2 = clamp(k2, kMin, kMax);
50382           x2 = p02[0] - p1[0] * k2;
50383           y2 = p02[1] - p1[1] * k2;
50384         } else if (source.ctrlKey && !isInteger(dY)) {
50385           dY *= 6;
50386           t0 = _isTransformed ? _transformLast : _transformStart;
50387           p02 = _getMouseCoords(source);
50388           p1 = t0.invert(p02);
50389           k2 = t0.k * Math.pow(2, -dY / 500);
50390           k2 = clamp(k2, kMin, kMax);
50391           x2 = p02[0] - p1[0] * k2;
50392           y2 = p02[1] - p1[1] * k2;
50393         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
50394           t0 = _isTransformed ? _transformLast : _transformStart;
50395           p02 = _getMouseCoords(source);
50396           p1 = t0.invert(p02);
50397           k2 = t0.k * Math.pow(2, -dY / 500);
50398           k2 = clamp(k2, kMin, kMax);
50399           x2 = p02[0] - p1[0] * k2;
50400           y2 = p02[1] - p1[1] * k2;
50401         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
50402           p1 = projection2.translate();
50403           x2 = p1[0] - dX;
50404           y2 = p1[1] - dY;
50405           k2 = projection2.scale();
50406           k2 = clamp(k2, kMin, kMax);
50407         }
50408         if (x2 !== x || y2 !== y || k2 !== k) {
50409           x = x2;
50410           y = y2;
50411           k = k2;
50412           eventTransform = identity2.translate(x2, y2).scale(k2);
50413           if (_zoomerPanner._transform) {
50414             _zoomerPanner._transform(eventTransform);
50415           } else {
50416             _selection.node().__zoom = eventTransform;
50417           }
50418         }
50419       }
50420       if (_transformStart.x === x && _transformStart.y === y && _transformStart.k === k) {
50421         return;
50422       }
50423       if (geoScaleToZoom(k, TILESIZE) < _minzoom) {
50424         surface.interrupt();
50425         dispatch10.call("hitMinZoom", this, map2);
50426         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
50427         scheduleRedraw();
50428         dispatch10.call("move", this, map2);
50429         return;
50430       }
50431       projection2.transform(eventTransform);
50432       var withinEditableZoom = map2.withinEditableZoom();
50433       if (_lastWithinEditableZoom !== withinEditableZoom) {
50434         if (_lastWithinEditableZoom !== void 0) {
50435           dispatch10.call("crossEditableZoom", this, withinEditableZoom);
50436         }
50437         _lastWithinEditableZoom = withinEditableZoom;
50438       }
50439       var scale = k / _transformStart.k;
50440       var tX = (x / scale - _transformStart.x) * scale;
50441       var tY = (y / scale - _transformStart.y) * scale;
50442       if (context.inIntro()) {
50443         curtainProjection.transform({
50444           x: x - tX,
50445           y: y - tY,
50446           k
50447         });
50448       }
50449       if (source) {
50450         _lastPointerEvent = event;
50451       }
50452       _isTransformed = true;
50453       _transformLast = eventTransform;
50454       utilSetTransform(supersurface, tX, tY, scale);
50455       scheduleRedraw();
50456       dispatch10.call("move", this, map2);
50457       function isInteger(val) {
50458         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
50459       }
50460     }
50461     function resetTransform() {
50462       if (!_isTransformed)
50463         return false;
50464       utilSetTransform(supersurface, 0, 0);
50465       _isTransformed = false;
50466       if (context.inIntro()) {
50467         curtainProjection.transform(projection2.transform());
50468       }
50469       return true;
50470     }
50471     function redraw(difference, extent) {
50472       if (surface.empty() || !_redrawEnabled)
50473         return;
50474       if (resetTransform()) {
50475         difference = extent = void 0;
50476       }
50477       var zoom = map2.zoom();
50478       var z = String(~~zoom);
50479       if (surface.attr("data-zoom") !== z) {
50480         surface.attr("data-zoom", z);
50481       }
50482       var lat = map2.center()[1];
50483       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
50484       surface.classed("low-zoom", zoom <= lowzoom(lat));
50485       if (!difference) {
50486         supersurface.call(context.background());
50487         wrapper.call(drawLayers);
50488       }
50489       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
50490         context.loadTiles(projection2);
50491         drawEditable(difference, extent);
50492       } else {
50493         editOff();
50494       }
50495       _transformStart = projection2.transform();
50496       return map2;
50497     }
50498     var immediateRedraw = function(difference, extent) {
50499       if (!difference && !extent)
50500         cancelPendingRedraw();
50501       redraw(difference, extent);
50502     };
50503     map2.lastPointerEvent = function() {
50504       return _lastPointerEvent;
50505     };
50506     map2.mouse = function(d3_event) {
50507       var event = d3_event || _lastPointerEvent;
50508       if (event) {
50509         var s;
50510         while (s = event.sourceEvent) {
50511           event = s;
50512         }
50513         return _getMouseCoords(event);
50514       }
50515       return null;
50516     };
50517     map2.mouseCoordinates = function() {
50518       var coord2 = map2.mouse() || pxCenter();
50519       return projection2.invert(coord2);
50520     };
50521     map2.dblclickZoomEnable = function(val) {
50522       if (!arguments.length)
50523         return _dblClickZoomEnabled;
50524       _dblClickZoomEnabled = val;
50525       return map2;
50526     };
50527     map2.redrawEnable = function(val) {
50528       if (!arguments.length)
50529         return _redrawEnabled;
50530       _redrawEnabled = val;
50531       return map2;
50532     };
50533     map2.isTransformed = function() {
50534       return _isTransformed;
50535     };
50536     function setTransform(t2, duration, force) {
50537       var t = projection2.transform();
50538       if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y)
50539         return false;
50540       if (duration) {
50541         _selection.transition().duration(duration).on("start", function() {
50542           map2.startEase();
50543         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
50544       } else {
50545         projection2.transform(t2);
50546         _transformStart = t2;
50547         _selection.call(_zoomerPanner.transform, _transformStart);
50548       }
50549       return true;
50550     }
50551     function setCenterZoom(loc2, z2, duration, force) {
50552       var c = map2.center();
50553       var z = map2.zoom();
50554       if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force)
50555         return false;
50556       var proj = geoRawMercator().transform(projection2.transform());
50557       var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
50558       proj.scale(k2);
50559       var t = proj.translate();
50560       var point = proj(loc2);
50561       var center = pxCenter();
50562       t[0] += center[0] - point[0];
50563       t[1] += center[1] - point[1];
50564       return setTransform(identity2.translate(t[0], t[1]).scale(k2), duration, force);
50565     }
50566     map2.pan = function(delta, duration) {
50567       var t = projection2.translate();
50568       var k = projection2.scale();
50569       t[0] += delta[0];
50570       t[1] += delta[1];
50571       if (duration) {
50572         _selection.transition().duration(duration).on("start", function() {
50573           map2.startEase();
50574         }).call(_zoomerPanner.transform, identity2.translate(t[0], t[1]).scale(k));
50575       } else {
50576         projection2.translate(t);
50577         _transformStart = projection2.transform();
50578         _selection.call(_zoomerPanner.transform, _transformStart);
50579         dispatch10.call("move", this, map2);
50580         immediateRedraw();
50581       }
50582       return map2;
50583     };
50584     map2.dimensions = function(val) {
50585       if (!arguments.length)
50586         return _dimensions;
50587       _dimensions = val;
50588       drawLayers.dimensions(_dimensions);
50589       context.background().dimensions(_dimensions);
50590       projection2.clipExtent([[0, 0], _dimensions]);
50591       _getMouseCoords = utilFastMouse(supersurface.node());
50592       scheduleRedraw();
50593       return map2;
50594     };
50595     function zoomIn(delta) {
50596       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
50597     }
50598     function zoomOut(delta) {
50599       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
50600     }
50601     map2.zoomIn = function() {
50602       zoomIn(1);
50603     };
50604     map2.zoomInFurther = function() {
50605       zoomIn(4);
50606     };
50607     map2.canZoomIn = function() {
50608       return map2.zoom() < maxZoom;
50609     };
50610     map2.zoomOut = function() {
50611       zoomOut(1);
50612     };
50613     map2.zoomOutFurther = function() {
50614       zoomOut(4);
50615     };
50616     map2.canZoomOut = function() {
50617       return map2.zoom() > minZoom2;
50618     };
50619     map2.center = function(loc2) {
50620       if (!arguments.length) {
50621         return projection2.invert(pxCenter());
50622       }
50623       if (setCenterZoom(loc2, map2.zoom())) {
50624         dispatch10.call("move", this, map2);
50625       }
50626       scheduleRedraw();
50627       return map2;
50628     };
50629     map2.unobscuredCenterZoomEase = function(loc, zoom) {
50630       var offset = map2.unobscuredOffsetPx();
50631       var proj = geoRawMercator().transform(projection2.transform());
50632       proj.scale(geoZoomToScale(zoom, TILESIZE));
50633       var locPx = proj(loc);
50634       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
50635       var offsetLoc = proj.invert(offsetLocPx);
50636       map2.centerZoomEase(offsetLoc, zoom);
50637     };
50638     map2.unobscuredOffsetPx = function() {
50639       var openPane = context.container().select(".map-panes .map-pane.shown");
50640       if (!openPane.empty()) {
50641         return [openPane.node().offsetWidth / 2, 0];
50642       }
50643       return [0, 0];
50644     };
50645     map2.zoom = function(z2) {
50646       if (!arguments.length) {
50647         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
50648       }
50649       if (z2 < _minzoom) {
50650         surface.interrupt();
50651         dispatch10.call("hitMinZoom", this, map2);
50652         z2 = context.minEditableZoom();
50653       }
50654       if (setCenterZoom(map2.center(), z2)) {
50655         dispatch10.call("move", this, map2);
50656       }
50657       scheduleRedraw();
50658       return map2;
50659     };
50660     map2.centerZoom = function(loc2, z2) {
50661       if (setCenterZoom(loc2, z2)) {
50662         dispatch10.call("move", this, map2);
50663       }
50664       scheduleRedraw();
50665       return map2;
50666     };
50667     map2.zoomTo = function(entity) {
50668       var extent = entity.extent(context.graph());
50669       if (!isFinite(extent.area()))
50670         return map2;
50671       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
50672       return map2.centerZoom(extent.center(), z2);
50673     };
50674     map2.centerEase = function(loc2, duration) {
50675       duration = duration || 250;
50676       setCenterZoom(loc2, map2.zoom(), duration);
50677       return map2;
50678     };
50679     map2.zoomEase = function(z2, duration) {
50680       duration = duration || 250;
50681       setCenterZoom(map2.center(), z2, duration, false);
50682       return map2;
50683     };
50684     map2.centerZoomEase = function(loc2, z2, duration) {
50685       duration = duration || 250;
50686       setCenterZoom(loc2, z2, duration, false);
50687       return map2;
50688     };
50689     map2.transformEase = function(t2, duration) {
50690       duration = duration || 250;
50691       setTransform(t2, duration, false);
50692       return map2;
50693     };
50694     map2.zoomToEase = function(obj, duration) {
50695       var extent;
50696       if (Array.isArray(obj)) {
50697         obj.forEach(function(entity) {
50698           var entityExtent = entity.extent(context.graph());
50699           if (!extent) {
50700             extent = entityExtent;
50701           } else {
50702             extent = extent.extend(entityExtent);
50703           }
50704         });
50705       } else {
50706         extent = obj.extent(context.graph());
50707       }
50708       if (!isFinite(extent.area()))
50709         return map2;
50710       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
50711       return map2.centerZoomEase(extent.center(), z2, duration);
50712     };
50713     map2.startEase = function() {
50714       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
50715         map2.cancelEase();
50716       });
50717       return map2;
50718     };
50719     map2.cancelEase = function() {
50720       _selection.interrupt();
50721       return map2;
50722     };
50723     map2.extent = function(val) {
50724       if (!arguments.length) {
50725         return new geoExtent(
50726           projection2.invert([0, _dimensions[1]]),
50727           projection2.invert([_dimensions[0], 0])
50728         );
50729       } else {
50730         var extent = geoExtent(val);
50731         map2.centerZoom(extent.center(), map2.extentZoom(extent));
50732       }
50733     };
50734     map2.trimmedExtent = function(val) {
50735       if (!arguments.length) {
50736         var headerY = 71;
50737         var footerY = 30;
50738         var pad2 = 10;
50739         return new geoExtent(
50740           projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
50741           projection2.invert([_dimensions[0] - pad2, headerY + pad2])
50742         );
50743       } else {
50744         var extent = geoExtent(val);
50745         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
50746       }
50747     };
50748     function calcExtentZoom(extent, dim) {
50749       var tl = projection2([extent[0][0], extent[1][1]]);
50750       var br = projection2([extent[1][0], extent[0][1]]);
50751       var hFactor = (br[0] - tl[0]) / dim[0];
50752       var vFactor = (br[1] - tl[1]) / dim[1];
50753       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
50754       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
50755       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
50756       return newZoom;
50757     }
50758     map2.extentZoom = function(val) {
50759       return calcExtentZoom(geoExtent(val), _dimensions);
50760     };
50761     map2.trimmedExtentZoom = function(val) {
50762       var trimY = 120;
50763       var trimX = 40;
50764       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
50765       return calcExtentZoom(geoExtent(val), trimmed);
50766     };
50767     map2.withinEditableZoom = function() {
50768       return map2.zoom() >= context.minEditableZoom();
50769     };
50770     map2.isInWideSelection = function() {
50771       return !map2.withinEditableZoom() && context.selectedIDs().length;
50772     };
50773     map2.editableDataEnabled = function(skipZoomCheck) {
50774       var layer = context.layers().layer("osm");
50775       if (!layer || !layer.enabled())
50776         return false;
50777       return skipZoomCheck || map2.withinEditableZoom();
50778     };
50779     map2.notesEditable = function() {
50780       var layer = context.layers().layer("notes");
50781       if (!layer || !layer.enabled())
50782         return false;
50783       return map2.withinEditableZoom();
50784     };
50785     map2.minzoom = function(val) {
50786       if (!arguments.length)
50787         return _minzoom;
50788       _minzoom = val;
50789       return map2;
50790     };
50791     map2.toggleHighlightEdited = function() {
50792       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
50793       map2.pan([0, 0]);
50794       dispatch10.call("changeHighlighting", this);
50795     };
50796     map2.areaFillOptions = ["wireframe", "partial", "full"];
50797     map2.activeAreaFill = function(val) {
50798       if (!arguments.length)
50799         return corePreferences("area-fill") || "partial";
50800       corePreferences("area-fill", val);
50801       if (val !== "wireframe") {
50802         corePreferences("area-fill-toggle", val);
50803       }
50804       updateAreaFill();
50805       map2.pan([0, 0]);
50806       dispatch10.call("changeAreaFill", this);
50807       return map2;
50808     };
50809     map2.toggleWireframe = function() {
50810       var activeFill = map2.activeAreaFill();
50811       if (activeFill === "wireframe") {
50812         activeFill = corePreferences("area-fill-toggle") || "partial";
50813       } else {
50814         activeFill = "wireframe";
50815       }
50816       map2.activeAreaFill(activeFill);
50817     };
50818     function updateAreaFill() {
50819       var activeFill = map2.activeAreaFill();
50820       map2.areaFillOptions.forEach(function(opt) {
50821         surface.classed("fill-" + opt, Boolean(opt === activeFill));
50822       });
50823     }
50824     map2.layers = () => drawLayers;
50825     map2.doubleUpHandler = function() {
50826       return _doubleUpHandler;
50827     };
50828     return utilRebind(map2, dispatch10, "on");
50829   }
50830
50831   // modules/renderer/photos.js
50832   function rendererPhotos(context) {
50833     var dispatch10 = dispatch_default("change");
50834     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview"];
50835     var _allPhotoTypes = ["flat", "panoramic"];
50836     var _shownPhotoTypes = _allPhotoTypes.slice();
50837     var _dateFilters = ["fromDate", "toDate"];
50838     var _fromDate;
50839     var _toDate;
50840     var _usernames;
50841     function photos() {
50842     }
50843     function updateStorage() {
50844       if (window.mocha)
50845         return;
50846       var hash = utilStringQs(window.location.hash);
50847       var enabled = context.layers().all().filter(function(d) {
50848         return _layerIDs.indexOf(d.id) !== -1 && d.layer && d.layer.supported() && d.layer.enabled();
50849       }).map(function(d) {
50850         return d.id;
50851       });
50852       if (enabled.length) {
50853         hash.photo_overlay = enabled.join(",");
50854       } else {
50855         delete hash.photo_overlay;
50856       }
50857       window.location.replace("#" + utilQsString(hash, true));
50858     }
50859     photos.overlayLayerIDs = function() {
50860       return _layerIDs;
50861     };
50862     photos.allPhotoTypes = function() {
50863       return _allPhotoTypes;
50864     };
50865     photos.dateFilters = function() {
50866       return _dateFilters;
50867     };
50868     photos.dateFilterValue = function(val) {
50869       return val === _dateFilters[0] ? _fromDate : _toDate;
50870     };
50871     photos.setDateFilter = function(type3, val, updateUrl) {
50872       var date = val && new Date(val);
50873       if (date && !isNaN(date)) {
50874         val = date.toISOString().slice(0, 10);
50875       } else {
50876         val = null;
50877       }
50878       if (type3 === _dateFilters[0]) {
50879         _fromDate = val;
50880         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
50881           _toDate = _fromDate;
50882         }
50883       }
50884       if (type3 === _dateFilters[1]) {
50885         _toDate = val;
50886         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
50887           _fromDate = _toDate;
50888         }
50889       }
50890       dispatch10.call("change", this);
50891       if (updateUrl) {
50892         var rangeString;
50893         if (_fromDate || _toDate) {
50894           rangeString = (_fromDate || "") + "_" + (_toDate || "");
50895         }
50896         setUrlFilterValue("photo_dates", rangeString);
50897       }
50898     };
50899     photos.setUsernameFilter = function(val, updateUrl) {
50900       if (val && typeof val === "string")
50901         val = val.replace(/;/g, ",").split(",");
50902       if (val) {
50903         val = val.map((d) => d.trim()).filter(Boolean);
50904         if (!val.length) {
50905           val = null;
50906         }
50907       }
50908       _usernames = val;
50909       dispatch10.call("change", this);
50910       if (updateUrl) {
50911         var hashString;
50912         if (_usernames) {
50913           hashString = _usernames.join(",");
50914         }
50915         setUrlFilterValue("photo_username", hashString);
50916       }
50917     };
50918     function setUrlFilterValue(property, val) {
50919       if (!window.mocha) {
50920         var hash = utilStringQs(window.location.hash);
50921         if (val) {
50922           if (hash[property] === val)
50923             return;
50924           hash[property] = val;
50925         } else {
50926           if (!(property in hash))
50927             return;
50928           delete hash[property];
50929         }
50930         window.location.replace("#" + utilQsString(hash, true));
50931       }
50932     }
50933     function showsLayer(id2) {
50934       var layer = context.layers().layer(id2);
50935       return layer && layer.supported() && layer.enabled();
50936     }
50937     photos.shouldFilterByDate = function() {
50938       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside");
50939     };
50940     photos.shouldFilterByPhotoType = function() {
50941       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview");
50942     };
50943     photos.shouldFilterByUsername = function() {
50944       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
50945     };
50946     photos.showsPhotoType = function(val) {
50947       if (!photos.shouldFilterByPhotoType())
50948         return true;
50949       return _shownPhotoTypes.indexOf(val) !== -1;
50950     };
50951     photos.showsFlat = function() {
50952       return photos.showsPhotoType("flat");
50953     };
50954     photos.showsPanoramic = function() {
50955       return photos.showsPhotoType("panoramic");
50956     };
50957     photos.fromDate = function() {
50958       return _fromDate;
50959     };
50960     photos.toDate = function() {
50961       return _toDate;
50962     };
50963     photos.togglePhotoType = function(val) {
50964       var index = _shownPhotoTypes.indexOf(val);
50965       if (index !== -1) {
50966         _shownPhotoTypes.splice(index, 1);
50967       } else {
50968         _shownPhotoTypes.push(val);
50969       }
50970       dispatch10.call("change", this);
50971       return photos;
50972     };
50973     photos.usernames = function() {
50974       return _usernames;
50975     };
50976     photos.init = function() {
50977       var hash = utilStringQs(window.location.hash);
50978       if (hash.photo_dates) {
50979         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
50980         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
50981         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
50982       }
50983       if (hash.photo_username) {
50984         this.setUsernameFilter(hash.photo_username, false);
50985       }
50986       if (hash.photo_overlay) {
50987         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
50988         hashOverlayIDs.forEach(function(id2) {
50989           if (id2 === "openstreetcam")
50990             id2 = "kartaview";
50991           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
50992           if (layer2 && !layer2.enabled())
50993             layer2.enabled(true);
50994         });
50995       }
50996       if (hash.photo) {
50997         var photoIds = hash.photo.replace(/;/g, ",").split(",");
50998         var photoId = photoIds.length && photoIds[0].trim();
50999         var results = /(.*)\/(.*)/g.exec(photoId);
51000         if (results && results.length >= 3) {
51001           var serviceId = results[1];
51002           if (serviceId === "openstreetcam")
51003             serviceId = "kartaview";
51004           var photoKey = results[2];
51005           var service = services[serviceId];
51006           if (service && service.ensureViewerLoaded) {
51007             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
51008             if (layer && !layer.enabled())
51009               layer.enabled(true);
51010             var baselineTime = Date.now();
51011             service.on("loadedImages.rendererPhotos", function() {
51012               if (Date.now() - baselineTime > 45e3) {
51013                 service.on("loadedImages.rendererPhotos", null);
51014                 return;
51015               }
51016               if (!service.cachedImage(photoKey))
51017                 return;
51018               service.on("loadedImages.rendererPhotos", null);
51019               service.ensureViewerLoaded(context).then(function() {
51020                 service.selectImage(context, photoKey).showViewer(context);
51021               });
51022             });
51023           }
51024         }
51025       }
51026       context.layers().on("change.rendererPhotos", updateStorage);
51027     };
51028     return utilRebind(photos, dispatch10, "on");
51029   }
51030
51031   // modules/ui/account.js
51032   function uiAccount(context) {
51033     const osm = context.connection();
51034     function updateUserDetails(selection2) {
51035       if (!osm)
51036         return;
51037       if (!osm.authenticated()) {
51038         render(selection2, null);
51039       } else {
51040         osm.userDetails((err, user) => render(selection2, user));
51041       }
51042     }
51043     function render(selection2, user) {
51044       let userInfo = selection2.select(".userInfo");
51045       let loginLogout = selection2.select(".loginLogout");
51046       if (user) {
51047         userInfo.html("").classed("hide", false);
51048         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
51049         if (user.image_url) {
51050           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
51051         } else {
51052           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
51053         }
51054         userLink.append("span").attr("class", "label").html(user.display_name);
51055         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e) => {
51056           e.preventDefault();
51057           osm.logout();
51058           tryLogout();
51059         });
51060       } else {
51061         userInfo.html("").classed("hide", true);
51062         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e) => {
51063           e.preventDefault();
51064           osm.authenticate();
51065         });
51066       }
51067     }
51068     function tryLogout() {
51069       if (!osm)
51070         return;
51071       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
51072       const w = 600;
51073       const h = 550;
51074       const settings = [
51075         ["width", w],
51076         ["height", h],
51077         ["left", window.screen.width / 2 - w / 2],
51078         ["top", window.screen.height / 2 - h / 2]
51079       ].map((x) => x.join("=")).join(",");
51080       window.open(url, "_blank", settings);
51081     }
51082     return function(selection2) {
51083       if (!osm)
51084         return;
51085       selection2.append("li").attr("class", "userInfo").classed("hide", true);
51086       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
51087       osm.on("change.account", () => updateUserDetails(selection2));
51088       updateUserDetails(selection2);
51089     };
51090   }
51091
51092   // modules/ui/attribution.js
51093   function uiAttribution(context) {
51094     let _selection = select_default2(null);
51095     function render(selection2, data, klass) {
51096       let div = selection2.selectAll(`.${klass}`).data([0]);
51097       div = div.enter().append("div").attr("class", klass).merge(div);
51098       let attributions = div.selectAll(".attribution").data(data, (d) => d.id);
51099       attributions.exit().remove();
51100       attributions = attributions.enter().append("span").attr("class", "attribution").each((d, i2, nodes) => {
51101         let attribution = select_default2(nodes[i2]);
51102         if (d.terms_html) {
51103           attribution.html(d.terms_html);
51104           return;
51105         }
51106         if (d.terms_url) {
51107           attribution = attribution.append("a").attr("href", d.terms_url).attr("target", "_blank");
51108         }
51109         const sourceID = d.id.replace(/\./g, "<TX_DOT>");
51110         const terms_text = _t(
51111           `imagery.${sourceID}.attribution.text`,
51112           { default: d.terms_text || d.id || d.name() }
51113         );
51114         if (d.icon && !d.overlay) {
51115           attribution.append("img").attr("class", "source-image").attr("src", d.icon);
51116         }
51117         attribution.append("span").attr("class", "attribution-text").text(terms_text);
51118       }).merge(attributions);
51119       let copyright = attributions.selectAll(".copyright-notice").data((d) => {
51120         let notice = d.copyrightNotices(context.map().zoom(), context.map().extent());
51121         return notice ? [notice] : [];
51122       });
51123       copyright.exit().remove();
51124       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
51125       copyright.text(String);
51126     }
51127     function update() {
51128       let baselayer = context.background().baseLayerSource();
51129       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
51130       const z = context.map().zoom();
51131       let overlays = context.background().overlayLayerSources() || [];
51132       _selection.call(render, overlays.filter((s) => s.validZoom(z)), "overlay-layer-attribution");
51133     }
51134     return function(selection2) {
51135       _selection = selection2;
51136       context.background().on("change.attribution", update);
51137       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
51138       update();
51139     };
51140   }
51141
51142   // modules/ui/contributors.js
51143   function uiContributors(context) {
51144     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
51145       update();
51146     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
51147     function update() {
51148       if (!osm)
51149         return;
51150       var users = {}, entities = context.history().intersects(context.map().extent());
51151       entities.forEach(function(entity) {
51152         if (entity && entity.user)
51153           users[entity.user] = true;
51154       });
51155       var u = Object.keys(users), subset = u.slice(0, u.length > limit ? limit - 1 : limit);
51156       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
51157       var userList = select_default2(document.createElement("span"));
51158       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d) {
51159         return osm.userURL(d);
51160       }).attr("target", "_blank").text(String);
51161       if (u.length > limit) {
51162         var count = select_default2(document.createElement("span"));
51163         var othersNum = u.length - limit + 1;
51164         count.append("a").attr("target", "_blank").attr("href", function() {
51165           return osm.changesetsURL(context.map().center(), context.map().zoom());
51166         }).text(othersNum);
51167         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
51168       } else {
51169         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
51170       }
51171       if (!u.length) {
51172         hidden = true;
51173         wrap2.transition().style("opacity", 0);
51174       } else if (hidden) {
51175         wrap2.transition().style("opacity", 1);
51176       }
51177     }
51178     return function(selection2) {
51179       if (!osm)
51180         return;
51181       wrap2 = selection2;
51182       update();
51183       osm.on("loaded.contributors", debouncedUpdate);
51184       context.map().on("move.contributors", debouncedUpdate);
51185     };
51186   }
51187
51188   // modules/ui/popover.js
51189   var _popoverID = 0;
51190   function uiPopover(klass) {
51191     var _id = _popoverID++;
51192     var _anchorSelection = select_default2(null);
51193     var popover = function(selection2) {
51194       _anchorSelection = selection2;
51195       selection2.each(setup);
51196     };
51197     var _animation = utilFunctor(false);
51198     var _placement = utilFunctor("top");
51199     var _alignment = utilFunctor("center");
51200     var _scrollContainer = utilFunctor(select_default2(null));
51201     var _content;
51202     var _displayType = utilFunctor("");
51203     var _hasArrow = utilFunctor(true);
51204     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
51205     popover.displayType = function(val) {
51206       if (arguments.length) {
51207         _displayType = utilFunctor(val);
51208         return popover;
51209       } else {
51210         return _displayType;
51211       }
51212     };
51213     popover.hasArrow = function(val) {
51214       if (arguments.length) {
51215         _hasArrow = utilFunctor(val);
51216         return popover;
51217       } else {
51218         return _hasArrow;
51219       }
51220     };
51221     popover.placement = function(val) {
51222       if (arguments.length) {
51223         _placement = utilFunctor(val);
51224         return popover;
51225       } else {
51226         return _placement;
51227       }
51228     };
51229     popover.alignment = function(val) {
51230       if (arguments.length) {
51231         _alignment = utilFunctor(val);
51232         return popover;
51233       } else {
51234         return _alignment;
51235       }
51236     };
51237     popover.scrollContainer = function(val) {
51238       if (arguments.length) {
51239         _scrollContainer = utilFunctor(val);
51240         return popover;
51241       } else {
51242         return _scrollContainer;
51243       }
51244     };
51245     popover.content = function(val) {
51246       if (arguments.length) {
51247         _content = val;
51248         return popover;
51249       } else {
51250         return _content;
51251       }
51252     };
51253     popover.isShown = function() {
51254       var popoverSelection = _anchorSelection.select(".popover-" + _id);
51255       return !popoverSelection.empty() && popoverSelection.classed("in");
51256     };
51257     popover.show = function() {
51258       _anchorSelection.each(show);
51259     };
51260     popover.updateContent = function() {
51261       _anchorSelection.each(updateContent);
51262     };
51263     popover.hide = function() {
51264       _anchorSelection.each(hide);
51265     };
51266     popover.toggle = function() {
51267       _anchorSelection.each(toggle);
51268     };
51269     popover.destroy = function(selection2, selector) {
51270       selector = selector || ".popover-" + _id;
51271       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() {
51272         return this.getAttribute("data-original-title") || this.getAttribute("title");
51273       }).attr("data-original-title", null).selectAll(selector).remove();
51274     };
51275     popover.destroyAny = function(selection2) {
51276       selection2.call(popover.destroy, ".popover");
51277     };
51278     function setup() {
51279       var anchor = select_default2(this);
51280       var animate = _animation.apply(this, arguments);
51281       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
51282       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
51283       enter.append("div").attr("class", "popover-arrow");
51284       enter.append("div").attr("class", "popover-inner");
51285       popoverSelection = enter.merge(popoverSelection);
51286       if (animate) {
51287         popoverSelection.classed("fade", true);
51288       }
51289       var display = _displayType.apply(this, arguments);
51290       if (display === "hover") {
51291         var _lastNonMouseEnterTime;
51292         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
51293           if (d3_event.pointerType) {
51294             if (d3_event.pointerType !== "mouse") {
51295               _lastNonMouseEnterTime = d3_event.timeStamp;
51296               return;
51297             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
51298               return;
51299             }
51300           }
51301           if (d3_event.buttons !== 0)
51302             return;
51303           show.apply(this, arguments);
51304         }).on(_pointerPrefix + "leave.popover", function() {
51305           hide.apply(this, arguments);
51306         }).on("focus.popover", function() {
51307           show.apply(this, arguments);
51308         }).on("blur.popover", function() {
51309           hide.apply(this, arguments);
51310         });
51311       } else if (display === "clickFocus") {
51312         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
51313           d3_event.preventDefault();
51314           d3_event.stopPropagation();
51315         }).on(_pointerPrefix + "up.popover", function(d3_event) {
51316           d3_event.preventDefault();
51317           d3_event.stopPropagation();
51318         }).on("click.popover", toggle);
51319         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
51320           anchor.each(function() {
51321             hide.apply(this, arguments);
51322           });
51323         });
51324       }
51325     }
51326     function show() {
51327       var anchor = select_default2(this);
51328       var popoverSelection = anchor.selectAll(".popover-" + _id);
51329       if (popoverSelection.empty()) {
51330         anchor.call(popover.destroy);
51331         anchor.each(setup);
51332         popoverSelection = anchor.selectAll(".popover-" + _id);
51333       }
51334       popoverSelection.classed("in", true);
51335       var displayType = _displayType.apply(this, arguments);
51336       if (displayType === "clickFocus") {
51337         anchor.classed("active", true);
51338         popoverSelection.node().focus();
51339       }
51340       anchor.each(updateContent);
51341     }
51342     function updateContent() {
51343       var anchor = select_default2(this);
51344       if (_content) {
51345         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
51346       }
51347       updatePosition.apply(this, arguments);
51348       updatePosition.apply(this, arguments);
51349       updatePosition.apply(this, arguments);
51350     }
51351     function updatePosition() {
51352       var anchor = select_default2(this);
51353       var popoverSelection = anchor.selectAll(".popover-" + _id);
51354       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
51355       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
51356       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
51357       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
51358       var placement = _placement.apply(this, arguments);
51359       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
51360       var alignment = _alignment.apply(this, arguments);
51361       var alignFactor = 0.5;
51362       if (alignment === "leading") {
51363         alignFactor = 0;
51364       } else if (alignment === "trailing") {
51365         alignFactor = 1;
51366       }
51367       var anchorFrame = getFrame(anchor.node());
51368       var popoverFrame = getFrame(popoverSelection.node());
51369       var position;
51370       switch (placement) {
51371         case "top":
51372           position = {
51373             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
51374             y: anchorFrame.y - popoverFrame.h
51375           };
51376           break;
51377         case "bottom":
51378           position = {
51379             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
51380             y: anchorFrame.y + anchorFrame.h
51381           };
51382           break;
51383         case "left":
51384           position = {
51385             x: anchorFrame.x - popoverFrame.w,
51386             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
51387           };
51388           break;
51389         case "right":
51390           position = {
51391             x: anchorFrame.x + anchorFrame.w,
51392             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
51393           };
51394           break;
51395       }
51396       if (position) {
51397         if (scrollNode && (placement === "top" || placement === "bottom")) {
51398           var initialPosX = position.x;
51399           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
51400             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
51401           } else if (position.x < 10) {
51402             position.x = 10;
51403           }
51404           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
51405           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
51406           arrow.style("left", ~~arrowPosX + "px");
51407         }
51408         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
51409       } else {
51410         popoverSelection.style("left", null).style("top", null);
51411       }
51412       function getFrame(node) {
51413         var positionStyle = select_default2(node).style("position");
51414         if (positionStyle === "absolute" || positionStyle === "static") {
51415           return {
51416             x: node.offsetLeft - scrollLeft,
51417             y: node.offsetTop - scrollTop,
51418             w: node.offsetWidth,
51419             h: node.offsetHeight
51420           };
51421         } else {
51422           return {
51423             x: 0,
51424             y: 0,
51425             w: node.offsetWidth,
51426             h: node.offsetHeight
51427           };
51428         }
51429       }
51430     }
51431     function hide() {
51432       var anchor = select_default2(this);
51433       if (_displayType.apply(this, arguments) === "clickFocus") {
51434         anchor.classed("active", false);
51435       }
51436       anchor.selectAll(".popover-" + _id).classed("in", false);
51437     }
51438     function toggle() {
51439       if (select_default2(this).select(".popover-" + _id).classed("in")) {
51440         hide.apply(this, arguments);
51441       } else {
51442         show.apply(this, arguments);
51443       }
51444     }
51445     return popover;
51446   }
51447
51448   // modules/ui/tooltip.js
51449   function uiTooltip(klass) {
51450     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
51451     var _title = function() {
51452       var title = this.getAttribute("data-original-title");
51453       if (title) {
51454         return title;
51455       } else {
51456         title = this.getAttribute("title");
51457         this.removeAttribute("title");
51458         this.setAttribute("data-original-title", title);
51459       }
51460       return title;
51461     };
51462     var _heading = utilFunctor(null);
51463     var _keys = utilFunctor(null);
51464     tooltip.title = function(val) {
51465       if (!arguments.length)
51466         return _title;
51467       _title = utilFunctor(val);
51468       return tooltip;
51469     };
51470     tooltip.heading = function(val) {
51471       if (!arguments.length)
51472         return _heading;
51473       _heading = utilFunctor(val);
51474       return tooltip;
51475     };
51476     tooltip.keys = function(val) {
51477       if (!arguments.length)
51478         return _keys;
51479       _keys = utilFunctor(val);
51480       return tooltip;
51481     };
51482     tooltip.content(function() {
51483       var heading = _heading.apply(this, arguments);
51484       var text2 = _title.apply(this, arguments);
51485       var keys = _keys.apply(this, arguments);
51486       var headingCallback = typeof heading === "function" ? heading : (s) => s.text(heading);
51487       var textCallback = typeof text2 === "function" ? text2 : (s) => s.text(text2);
51488       return function(selection2) {
51489         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
51490         headingSelect.exit().remove();
51491         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
51492         var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
51493         textSelect.exit().remove();
51494         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
51495         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys && keys.length ? [0] : []);
51496         keyhintWrap.exit().remove();
51497         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
51498         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
51499         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
51500         keyhintWrap.selectAll("kbd.shortcut").data(keys && keys.length ? keys : []).enter().append("kbd").attr("class", "shortcut").text(function(d) {
51501           return d;
51502         });
51503       };
51504     });
51505     return tooltip;
51506   }
51507
51508   // modules/ui/edit_menu.js
51509   function uiEditMenu(context) {
51510     var dispatch10 = dispatch_default("toggled");
51511     var _menu = select_default2(null);
51512     var _operations = [];
51513     var _anchorLoc = [0, 0];
51514     var _anchorLocLonLat = [0, 0];
51515     var _triggerType = "";
51516     var _vpTopMargin = 85;
51517     var _vpBottomMargin = 45;
51518     var _vpSideMargin = 35;
51519     var _menuTop = false;
51520     var _menuHeight;
51521     var _menuWidth;
51522     var _verticalPadding = 4;
51523     var _tooltipWidth = 210;
51524     var _menuSideMargin = 10;
51525     var _tooltips = [];
51526     var editMenu = function(selection2) {
51527       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
51528       var ops = _operations.filter(function(op) {
51529         return !isTouchMenu || !op.mouseOnly;
51530       });
51531       if (!ops.length)
51532         return;
51533       _tooltips = [];
51534       _menuTop = isTouchMenu;
51535       var showLabels = isTouchMenu;
51536       var buttonHeight = showLabels ? 32 : 34;
51537       if (showLabels) {
51538         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
51539           return op.title.length;
51540         })));
51541       } else {
51542         _menuWidth = 44;
51543       }
51544       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
51545       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
51546       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
51547       var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
51548         return "edit-menu-item edit-menu-item-" + d.id;
51549       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
51550         d3_event.stopPropagation();
51551       }).on("mouseenter.highlight", function(d3_event, d) {
51552         if (!d.relatedEntityIds || select_default2(this).classed("disabled"))
51553           return;
51554         utilHighlightEntities(d.relatedEntityIds(), true, context);
51555       }).on("mouseleave.highlight", function(d3_event, d) {
51556         if (!d.relatedEntityIds)
51557           return;
51558         utilHighlightEntities(d.relatedEntityIds(), false, context);
51559       });
51560       buttonsEnter.each(function(d) {
51561         var tooltip = uiTooltip().heading(() => d.title).title(d.tooltip).keys([d.keys[0]]);
51562         _tooltips.push(tooltip);
51563         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d.icon && d.icon() || "#iD-operation-" + d.id, "operation"));
51564       });
51565       if (showLabels) {
51566         buttonsEnter.append("span").attr("class", "label").html(function(d) {
51567           return d.title;
51568         });
51569       }
51570       buttonsEnter.merge(buttons).classed("disabled", function(d) {
51571         return d.disabled();
51572       });
51573       updatePosition();
51574       var initialScale = context.projection.scale();
51575       context.map().on("move.edit-menu", function() {
51576         if (initialScale !== context.projection.scale()) {
51577           editMenu.close();
51578         }
51579       }).on("drawn.edit-menu", function(info) {
51580         if (info.full)
51581           updatePosition();
51582       });
51583       var lastPointerUpType;
51584       function pointerup(d3_event) {
51585         lastPointerUpType = d3_event.pointerType;
51586       }
51587       function click(d3_event, operation) {
51588         d3_event.stopPropagation();
51589         if (operation.relatedEntityIds) {
51590           utilHighlightEntities(operation.relatedEntityIds(), false, context);
51591         }
51592         if (operation.disabled()) {
51593           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
51594             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip())();
51595           }
51596         } else {
51597           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
51598             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
51599           }
51600           operation();
51601           editMenu.close();
51602         }
51603         lastPointerUpType = null;
51604       }
51605       dispatch10.call("toggled", this, true);
51606     };
51607     function updatePosition() {
51608       if (!_menu || _menu.empty())
51609         return;
51610       var anchorLoc = context.projection(_anchorLocLonLat);
51611       var viewport = context.surfaceRect();
51612       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
51613         editMenu.close();
51614         return;
51615       }
51616       var menuLeft = displayOnLeft(viewport);
51617       var offset = [0, 0];
51618       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
51619       if (_menuTop) {
51620         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
51621           offset[1] = -anchorLoc[1] + _vpTopMargin;
51622         } else {
51623           offset[1] = -_menuHeight;
51624         }
51625       } else {
51626         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
51627           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
51628         } else {
51629           offset[1] = 0;
51630         }
51631       }
51632       var origin = geoVecAdd(anchorLoc, offset);
51633       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
51634       var tooltipSide = tooltipPosition(viewport, menuLeft);
51635       _tooltips.forEach(function(tooltip) {
51636         tooltip.placement(tooltipSide);
51637       });
51638       function displayOnLeft(viewport2) {
51639         if (_mainLocalizer.textDirection() === "ltr") {
51640           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
51641             return true;
51642           }
51643           return false;
51644         } else {
51645           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
51646             return false;
51647           }
51648           return true;
51649         }
51650       }
51651       function tooltipPosition(viewport2, menuLeft2) {
51652         if (_mainLocalizer.textDirection() === "ltr") {
51653           if (menuLeft2) {
51654             return "left";
51655           }
51656           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
51657             return "left";
51658           }
51659           return "right";
51660         } else {
51661           if (!menuLeft2) {
51662             return "right";
51663           }
51664           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
51665             return "right";
51666           }
51667           return "left";
51668         }
51669       }
51670     }
51671     editMenu.close = function() {
51672       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
51673       _menu.remove();
51674       _tooltips = [];
51675       dispatch10.call("toggled", this, false);
51676     };
51677     editMenu.anchorLoc = function(val) {
51678       if (!arguments.length)
51679         return _anchorLoc;
51680       _anchorLoc = val;
51681       _anchorLocLonLat = context.projection.invert(_anchorLoc);
51682       return editMenu;
51683     };
51684     editMenu.triggerType = function(val) {
51685       if (!arguments.length)
51686         return _triggerType;
51687       _triggerType = val;
51688       return editMenu;
51689     };
51690     editMenu.operations = function(val) {
51691       if (!arguments.length)
51692         return _operations;
51693       _operations = val;
51694       return editMenu;
51695     };
51696     return utilRebind(editMenu, dispatch10, "on");
51697   }
51698
51699   // modules/ui/feature_info.js
51700   function uiFeatureInfo(context) {
51701     function update(selection2) {
51702       var features2 = context.features();
51703       var stats = features2.stats();
51704       var count = 0;
51705       var hiddenList = features2.hidden().map(function(k) {
51706         if (stats[k]) {
51707           count += stats[k];
51708           return _t.append("inspector.title_count", {
51709             title: _t("feature." + k + ".description"),
51710             count: stats[k]
51711           });
51712         }
51713         return null;
51714       }).filter(Boolean);
51715       selection2.text("");
51716       if (hiddenList.length) {
51717         var tooltipBehavior = uiTooltip().placement("top").title(function() {
51718           return (selection3) => {
51719             hiddenList.forEach((hiddenFeature) => {
51720               selection3.append("div").call(hiddenFeature);
51721             });
51722           };
51723         });
51724         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
51725           tooltipBehavior.hide();
51726           d3_event.preventDefault();
51727           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
51728         });
51729       }
51730       selection2.classed("hide", !hiddenList.length);
51731     }
51732     return function(selection2) {
51733       update(selection2);
51734       context.features().on("change.feature_info", function() {
51735         update(selection2);
51736       });
51737     };
51738   }
51739
51740   // modules/ui/flash.js
51741   function uiFlash(context) {
51742     var _flashTimer;
51743     var _duration = 2e3;
51744     var _iconName = "#iD-icon-no";
51745     var _iconClass = "disabled";
51746     var _label = (s) => s.text("");
51747     function flash() {
51748       if (_flashTimer) {
51749         _flashTimer.stop();
51750       }
51751       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
51752       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
51753       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
51754       var contentEnter = content.enter().append("div").attr("class", "flash-content");
51755       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
51756       iconEnter.append("circle").attr("r", 9);
51757       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
51758       contentEnter.append("div").attr("class", "flash-text");
51759       content = content.merge(contentEnter);
51760       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
51761       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
51762       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
51763       _flashTimer = timeout_default(function() {
51764         _flashTimer = null;
51765         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
51766         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
51767       }, _duration);
51768       return content;
51769     }
51770     flash.duration = function(_) {
51771       if (!arguments.length)
51772         return _duration;
51773       _duration = _;
51774       return flash;
51775     };
51776     flash.label = function(_) {
51777       if (!arguments.length)
51778         return _label;
51779       if (typeof _ !== "function") {
51780         _label = (selection2) => selection2.text(_);
51781       } else {
51782         _label = (selection2) => selection2.text("").call(_);
51783       }
51784       return flash;
51785     };
51786     flash.iconName = function(_) {
51787       if (!arguments.length)
51788         return _iconName;
51789       _iconName = _;
51790       return flash;
51791     };
51792     flash.iconClass = function(_) {
51793       if (!arguments.length)
51794         return _iconClass;
51795       _iconClass = _;
51796       return flash;
51797     };
51798     return flash;
51799   }
51800
51801   // modules/ui/full_screen.js
51802   function uiFullScreen(context) {
51803     var element = context.container().node();
51804     function getFullScreenFn() {
51805       if (element.requestFullscreen) {
51806         return element.requestFullscreen;
51807       } else if (element.msRequestFullscreen) {
51808         return element.msRequestFullscreen;
51809       } else if (element.mozRequestFullScreen) {
51810         return element.mozRequestFullScreen;
51811       } else if (element.webkitRequestFullscreen) {
51812         return element.webkitRequestFullscreen;
51813       }
51814     }
51815     function getExitFullScreenFn() {
51816       if (document.exitFullscreen) {
51817         return document.exitFullscreen;
51818       } else if (document.msExitFullscreen) {
51819         return document.msExitFullscreen;
51820       } else if (document.mozCancelFullScreen) {
51821         return document.mozCancelFullScreen;
51822       } else if (document.webkitExitFullscreen) {
51823         return document.webkitExitFullscreen;
51824       }
51825     }
51826     function isFullScreen() {
51827       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
51828     }
51829     function isSupported() {
51830       return !!getFullScreenFn();
51831     }
51832     function fullScreen(d3_event) {
51833       d3_event.preventDefault();
51834       if (!isFullScreen()) {
51835         getFullScreenFn().apply(element);
51836       } else {
51837         getExitFullScreenFn().apply(document);
51838       }
51839     }
51840     return function() {
51841       if (!isSupported())
51842         return;
51843       var detected = utilDetect();
51844       var keys = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
51845       context.keybinding().on(keys, fullScreen);
51846     };
51847   }
51848
51849   // modules/ui/geolocate.js
51850   function uiGeolocate(context) {
51851     var _geolocationOptions = {
51852       enableHighAccuracy: false,
51853       timeout: 6e3
51854     };
51855     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
51856     var _layer = context.layers().layer("geolocate");
51857     var _position;
51858     var _extent;
51859     var _timeoutID;
51860     var _button = select_default2(null);
51861     function click() {
51862       if (context.inIntro())
51863         return;
51864       if (!_layer.enabled() && !_locating.isShown()) {
51865         _timeoutID = setTimeout(error, 1e4);
51866         context.container().call(_locating);
51867         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
51868       } else {
51869         _locating.close();
51870         _layer.enabled(null, false);
51871         updateButtonState();
51872       }
51873     }
51874     function zoomTo() {
51875       context.enter(modeBrowse(context));
51876       var map2 = context.map();
51877       _layer.enabled(_position, true);
51878       updateButtonState();
51879       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
51880     }
51881     function success(geolocation) {
51882       _position = geolocation;
51883       var coords = _position.coords;
51884       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
51885       zoomTo();
51886       finish();
51887     }
51888     function error() {
51889       if (_position) {
51890         zoomTo();
51891       } else {
51892         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
51893       }
51894       finish();
51895     }
51896     function finish() {
51897       _locating.close();
51898       if (_timeoutID) {
51899         clearTimeout(_timeoutID);
51900       }
51901       _timeoutID = void 0;
51902     }
51903     function updateButtonState() {
51904       _button.classed("active", _layer.enabled());
51905       _button.attr("aria-pressed", _layer.enabled());
51906     }
51907     return function(selection2) {
51908       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
51909         return;
51910       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
51911         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
51912       );
51913       context.keybinding().on(_t("geolocate.key"), click);
51914     };
51915   }
51916
51917   // modules/ui/panels/background.js
51918   function uiPanelBackground(context) {
51919     var background = context.background();
51920     var _currSourceName = null;
51921     var _metadata = {};
51922     var _metadataKeys = [
51923       "zoom",
51924       "vintage",
51925       "source",
51926       "description",
51927       "resolution",
51928       "accuracy"
51929     ];
51930     var debouncedRedraw = debounce_default(redraw, 250);
51931     function redraw(selection2) {
51932       var source = background.baseLayerSource();
51933       if (!source)
51934         return;
51935       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
51936       var sourceLabel = source.label();
51937       if (_currSourceName !== sourceLabel) {
51938         _currSourceName = sourceLabel;
51939         _metadata = {};
51940       }
51941       selection2.text("");
51942       var list = selection2.append("ul").attr("class", "background-info");
51943       list.append("li").call(_currSourceName);
51944       _metadataKeys.forEach(function(k) {
51945         if (isDG && k === "vintage")
51946           return;
51947         list.append("li").attr("class", "background-info-list-" + k).classed("hide", !_metadata[k]).call(_t.append("info_panels.background." + k, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k).text(_metadata[k]);
51948       });
51949       debouncedGetMetadata(selection2);
51950       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
51951       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
51952         d3_event.preventDefault();
51953         context.setDebug("tile", !context.getDebug("tile"));
51954         selection2.call(redraw);
51955       });
51956       if (isDG) {
51957         var key = source.id + "-vintage";
51958         var sourceVintage = context.background().findSource(key);
51959         var showsVintage = context.background().showsLayer(sourceVintage);
51960         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
51961         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
51962           d3_event.preventDefault();
51963           context.background().toggleOverlayLayer(sourceVintage);
51964           selection2.call(redraw);
51965         });
51966       }
51967       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
51968         if (source.id !== layerId) {
51969           var key2 = layerId + "-vintage";
51970           var sourceVintage2 = context.background().findSource(key2);
51971           if (context.background().showsLayer(sourceVintage2)) {
51972             context.background().toggleOverlayLayer(sourceVintage2);
51973           }
51974         }
51975       });
51976     }
51977     var debouncedGetMetadata = debounce_default(getMetadata, 250);
51978     function getMetadata(selection2) {
51979       var tile = context.container().select(".layer-background img.tile-center");
51980       if (tile.empty())
51981         return;
51982       var sourceName = _currSourceName;
51983       var d = tile.datum();
51984       var zoom = d && d.length >= 3 && d[2] || Math.floor(context.map().zoom());
51985       var center = context.map().center();
51986       _metadata.zoom = String(zoom);
51987       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
51988       if (!d || !d.length >= 3)
51989         return;
51990       background.baseLayerSource().getMetadata(center, d, function(err, result) {
51991         if (err || _currSourceName !== sourceName)
51992           return;
51993         var vintage = result.vintage;
51994         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
51995         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
51996         _metadataKeys.forEach(function(k) {
51997           if (k === "zoom" || k === "vintage")
51998             return;
51999           var val = result[k];
52000           _metadata[k] = val;
52001           selection2.selectAll(".background-info-list-" + k).classed("hide", !val).selectAll(".background-info-span-" + k).text(val);
52002         });
52003       });
52004     }
52005     var panel = function(selection2) {
52006       selection2.call(redraw);
52007       context.map().on("drawn.info-background", function() {
52008         selection2.call(debouncedRedraw);
52009       }).on("move.info-background", function() {
52010         selection2.call(debouncedGetMetadata);
52011       });
52012     };
52013     panel.off = function() {
52014       context.map().on("drawn.info-background", null).on("move.info-background", null);
52015     };
52016     panel.id = "background";
52017     panel.label = _t.append("info_panels.background.title");
52018     panel.key = _t("info_panels.background.key");
52019     return panel;
52020   }
52021
52022   // modules/ui/panels/history.js
52023   function uiPanelHistory(context) {
52024     var osm;
52025     function displayTimestamp(timestamp) {
52026       if (!timestamp)
52027         return _t("info_panels.history.unknown");
52028       var options2 = {
52029         day: "numeric",
52030         month: "short",
52031         year: "numeric",
52032         hour: "numeric",
52033         minute: "numeric",
52034         second: "numeric"
52035       };
52036       var d = new Date(timestamp);
52037       if (isNaN(d.getTime()))
52038         return _t("info_panels.history.unknown");
52039       return d.toLocaleString(_mainLocalizer.localeCode(), options2);
52040     }
52041     function displayUser(selection2, userName) {
52042       if (!userName) {
52043         selection2.append("span").call(_t.append("info_panels.history.unknown"));
52044         return;
52045       }
52046       selection2.append("span").attr("class", "user-name").text(userName);
52047       var links = selection2.append("div").attr("class", "links");
52048       if (osm) {
52049         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
52050       }
52051       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
52052     }
52053     function displayChangeset(selection2, changeset) {
52054       if (!changeset) {
52055         selection2.append("span").call(_t.append("info_panels.history.unknown"));
52056         return;
52057       }
52058       selection2.append("span").attr("class", "changeset-id").text(changeset);
52059       var links = selection2.append("div").attr("class", "links");
52060       if (osm) {
52061         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
52062       }
52063       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
52064       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
52065     }
52066     function redraw(selection2) {
52067       var selectedNoteID = context.selectedNoteID();
52068       osm = context.connection();
52069       var selected, note, entity;
52070       if (selectedNoteID && osm) {
52071         selected = [_t.html("note.note") + " " + selectedNoteID];
52072         note = osm.getNote(selectedNoteID);
52073       } else {
52074         selected = context.selectedIDs().filter(function(e) {
52075           return context.hasEntity(e);
52076         });
52077         if (selected.length) {
52078           entity = context.entity(selected[0]);
52079         }
52080       }
52081       var singular = selected.length === 1 ? selected[0] : null;
52082       selection2.html("");
52083       if (singular) {
52084         selection2.append("h4").attr("class", "history-heading").html(singular);
52085       } else {
52086         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
52087       }
52088       if (!singular)
52089         return;
52090       if (entity) {
52091         selection2.call(redrawEntity, entity);
52092       } else if (note) {
52093         selection2.call(redrawNote, note);
52094       }
52095     }
52096     function redrawNote(selection2, note) {
52097       if (!note || note.isNew()) {
52098         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
52099         return;
52100       }
52101       var list = selection2.append("ul");
52102       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
52103       if (note.comments.length) {
52104         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
52105         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
52106       }
52107       if (osm) {
52108         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"));
52109       }
52110     }
52111     function redrawEntity(selection2, entity) {
52112       if (!entity || entity.isNew()) {
52113         selection2.append("div").call(_t.append("info_panels.history.no_history"));
52114         return;
52115       }
52116       var links = selection2.append("div").attr("class", "links");
52117       if (osm) {
52118         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"));
52119       }
52120       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");
52121       var list = selection2.append("ul");
52122       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
52123       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
52124       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
52125       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
52126     }
52127     var panel = function(selection2) {
52128       selection2.call(redraw);
52129       context.map().on("drawn.info-history", function() {
52130         selection2.call(redraw);
52131       });
52132       context.on("enter.info-history", function() {
52133         selection2.call(redraw);
52134       });
52135     };
52136     panel.off = function() {
52137       context.map().on("drawn.info-history", null);
52138       context.on("enter.info-history", null);
52139     };
52140     panel.id = "history";
52141     panel.label = _t.append("info_panels.history.title");
52142     panel.key = _t("info_panels.history.key");
52143     return panel;
52144   }
52145
52146   // modules/util/units.js
52147   var OSM_PRECISION = 7;
52148   function displayLength(m, isImperial) {
52149     var d = m * (isImperial ? 3.28084 : 1);
52150     var unit2;
52151     if (isImperial) {
52152       if (d >= 5280) {
52153         d /= 5280;
52154         unit2 = "miles";
52155       } else {
52156         unit2 = "feet";
52157       }
52158     } else {
52159       if (d >= 1e3) {
52160         d /= 1e3;
52161         unit2 = "kilometers";
52162       } else {
52163         unit2 = "meters";
52164       }
52165     }
52166     return _t("units." + unit2, {
52167       quantity: d.toLocaleString(_mainLocalizer.localeCode(), {
52168         maximumSignificantDigits: 4
52169       })
52170     });
52171   }
52172   function displayArea(m2, isImperial) {
52173     var locale2 = _mainLocalizer.localeCode();
52174     var d = m2 * (isImperial ? 10.7639111056 : 1);
52175     var d1, d2, area;
52176     var unit1 = "";
52177     var unit2 = "";
52178     if (isImperial) {
52179       if (d >= 6969600) {
52180         d1 = d / 27878400;
52181         unit1 = "square_miles";
52182       } else {
52183         d1 = d;
52184         unit1 = "square_feet";
52185       }
52186       if (d > 4356 && d < 4356e4) {
52187         d2 = d / 43560;
52188         unit2 = "acres";
52189       }
52190     } else {
52191       if (d >= 25e4) {
52192         d1 = d / 1e6;
52193         unit1 = "square_kilometers";
52194       } else {
52195         d1 = d;
52196         unit1 = "square_meters";
52197       }
52198       if (d > 1e3 && d < 1e7) {
52199         d2 = d / 1e4;
52200         unit2 = "hectares";
52201       }
52202     }
52203     area = _t("units." + unit1, {
52204       quantity: d1.toLocaleString(locale2, {
52205         maximumSignificantDigits: 4
52206       })
52207     });
52208     if (d2) {
52209       return _t("units.area_pair", {
52210         area1: area,
52211         area2: _t("units." + unit2, {
52212           quantity: d2.toLocaleString(locale2, {
52213             maximumSignificantDigits: 2
52214           })
52215         })
52216       });
52217     } else {
52218       return area;
52219     }
52220   }
52221   function wrap(x, min3, max3) {
52222     var d = max3 - min3;
52223     return ((x - min3) % d + d) % d + min3;
52224   }
52225   function clamp2(x, min3, max3) {
52226     return Math.max(min3, Math.min(x, max3));
52227   }
52228   function displayCoordinate(deg, pos, neg) {
52229     var locale2 = _mainLocalizer.localeCode();
52230     var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
52231     var sec = (min3 - Math.floor(min3)) * 60;
52232     var displayDegrees = _t("units.arcdegrees", {
52233       quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
52234     });
52235     var displayCoordinate2;
52236     if (Math.floor(sec) > 0) {
52237       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
52238         quantity: Math.floor(min3).toLocaleString(locale2)
52239       }) + _t("units.arcseconds", {
52240         quantity: Math.round(sec).toLocaleString(locale2)
52241       });
52242     } else if (Math.floor(min3) > 0) {
52243       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
52244         quantity: Math.round(min3).toLocaleString(locale2)
52245       });
52246     } else {
52247       displayCoordinate2 = _t("units.arcdegrees", {
52248         quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
52249       });
52250     }
52251     if (deg === 0) {
52252       return displayCoordinate2;
52253     } else {
52254       return _t("units.coordinate", {
52255         coordinate: displayCoordinate2,
52256         direction: _t("units." + (deg > 0 ? pos : neg))
52257       });
52258     }
52259   }
52260   function dmsCoordinatePair(coord2) {
52261     return _t("units.coordinate_pair", {
52262       latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
52263       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
52264     });
52265   }
52266   function decimalCoordinatePair(coord2) {
52267     return _t("units.coordinate_pair", {
52268       latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
52269       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
52270     });
52271   }
52272
52273   // modules/ui/panels/location.js
52274   function uiPanelLocation(context) {
52275     var currLocation = "";
52276     function redraw(selection2) {
52277       selection2.html("");
52278       var list = selection2.append("ul");
52279       var coord2 = context.map().mouseCoordinates();
52280       if (coord2.some(isNaN)) {
52281         coord2 = context.map().center();
52282       }
52283       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
52284       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
52285       debouncedGetLocation(selection2, coord2);
52286     }
52287     var debouncedGetLocation = debounce_default(getLocation, 250);
52288     function getLocation(selection2, coord2) {
52289       if (!services.geocoder) {
52290         currLocation = _t("info_panels.location.unknown_location");
52291         selection2.selectAll(".location-info").text(currLocation);
52292       } else {
52293         services.geocoder.reverse(coord2, function(err, result) {
52294           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
52295           selection2.selectAll(".location-info").text(currLocation);
52296         });
52297       }
52298     }
52299     var panel = function(selection2) {
52300       selection2.call(redraw);
52301       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
52302         selection2.call(redraw);
52303       });
52304     };
52305     panel.off = function() {
52306       context.surface().on(".info-location", null);
52307     };
52308     panel.id = "location";
52309     panel.label = _t.append("info_panels.location.title");
52310     panel.key = _t("info_panels.location.key");
52311     return panel;
52312   }
52313
52314   // modules/ui/panels/measurement.js
52315   function uiPanelMeasurement(context) {
52316     function radiansToMeters(r) {
52317       return r * 63710071809e-4;
52318     }
52319     function steradiansToSqmeters(r) {
52320       return r / (4 * Math.PI) * 510065621724e3;
52321     }
52322     function toLineString(feature3) {
52323       if (feature3.type === "LineString")
52324         return feature3;
52325       var result = { type: "LineString", coordinates: [] };
52326       if (feature3.type === "Polygon") {
52327         result.coordinates = feature3.coordinates[0];
52328       } else if (feature3.type === "MultiPolygon") {
52329         result.coordinates = feature3.coordinates[0][0];
52330       }
52331       return result;
52332     }
52333     var _isImperial = !_mainLocalizer.usesMetric();
52334     function redraw(selection2) {
52335       var graph = context.graph();
52336       var selectedNoteID = context.selectedNoteID();
52337       var osm = services.osm;
52338       var localeCode = _mainLocalizer.localeCode();
52339       var heading;
52340       var center, location, centroid;
52341       var closed, geometry;
52342       var totalNodeCount, length = 0, area = 0, distance;
52343       if (selectedNoteID && osm) {
52344         var note = osm.getNote(selectedNoteID);
52345         heading = _t.html("note.note") + " " + selectedNoteID;
52346         location = note.loc;
52347         geometry = "note";
52348       } else {
52349         var selectedIDs = context.selectedIDs().filter(function(id2) {
52350           return context.hasEntity(id2);
52351         });
52352         var selected = selectedIDs.map(function(id2) {
52353           return context.entity(id2);
52354         });
52355         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
52356         if (selected.length) {
52357           var extent = geoExtent();
52358           for (var i2 in selected) {
52359             var entity = selected[i2];
52360             extent._extend(entity.extent(graph));
52361             geometry = entity.geometry(graph);
52362             if (geometry === "line" || geometry === "area") {
52363               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
52364               var feature3 = entity.asGeoJSON(graph);
52365               length += radiansToMeters(length_default(toLineString(feature3)));
52366               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
52367               centroid = centroid && context.projection.invert(centroid);
52368               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
52369                 centroid = entity.extent(graph).center();
52370               }
52371               if (closed) {
52372                 area += steradiansToSqmeters(entity.area(graph));
52373               }
52374             }
52375           }
52376           if (selected.length > 1) {
52377             geometry = null;
52378             closed = null;
52379             centroid = null;
52380           }
52381           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
52382             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
52383           }
52384           if (selected.length === 1 && selected[0].type === "node") {
52385             location = selected[0].loc;
52386           } else {
52387             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
52388           }
52389           if (!location && !centroid) {
52390             center = extent.center();
52391           }
52392         }
52393       }
52394       selection2.html("");
52395       if (heading) {
52396         selection2.append("h4").attr("class", "measurement-heading").html(heading);
52397       }
52398       var list = selection2.append("ul");
52399       var coordItem;
52400       if (geometry) {
52401         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
52402           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
52403         );
52404       }
52405       if (totalNodeCount) {
52406         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
52407       }
52408       if (area) {
52409         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
52410       }
52411       if (length) {
52412         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
52413       }
52414       if (typeof distance === "number") {
52415         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
52416       }
52417       if (location) {
52418         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
52419         coordItem.append("span").text(dmsCoordinatePair(location));
52420         coordItem.append("span").text(decimalCoordinatePair(location));
52421       }
52422       if (centroid) {
52423         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
52424         coordItem.append("span").text(dmsCoordinatePair(centroid));
52425         coordItem.append("span").text(decimalCoordinatePair(centroid));
52426       }
52427       if (center) {
52428         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
52429         coordItem.append("span").text(dmsCoordinatePair(center));
52430         coordItem.append("span").text(decimalCoordinatePair(center));
52431       }
52432       if (length || area || typeof distance === "number") {
52433         var toggle = _isImperial ? "imperial" : "metric";
52434         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
52435           d3_event.preventDefault();
52436           _isImperial = !_isImperial;
52437           selection2.call(redraw);
52438         });
52439       }
52440     }
52441     var panel = function(selection2) {
52442       selection2.call(redraw);
52443       context.map().on("drawn.info-measurement", function() {
52444         selection2.call(redraw);
52445       });
52446       context.on("enter.info-measurement", function() {
52447         selection2.call(redraw);
52448       });
52449     };
52450     panel.off = function() {
52451       context.map().on("drawn.info-measurement", null);
52452       context.on("enter.info-measurement", null);
52453     };
52454     panel.id = "measurement";
52455     panel.label = _t.append("info_panels.measurement.title");
52456     panel.key = _t("info_panels.measurement.key");
52457     return panel;
52458   }
52459
52460   // modules/ui/panels/index.js
52461   var uiInfoPanels = {
52462     background: uiPanelBackground,
52463     history: uiPanelHistory,
52464     location: uiPanelLocation,
52465     measurement: uiPanelMeasurement
52466   };
52467
52468   // modules/ui/info.js
52469   function uiInfo(context) {
52470     var ids = Object.keys(uiInfoPanels);
52471     var wasActive = ["measurement"];
52472     var panels = {};
52473     var active = {};
52474     ids.forEach(function(k) {
52475       if (!panels[k]) {
52476         panels[k] = uiInfoPanels[k](context);
52477         active[k] = false;
52478       }
52479     });
52480     function info(selection2) {
52481       function redraw() {
52482         var activeids = ids.filter(function(k) {
52483           return active[k];
52484         }).sort();
52485         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k) {
52486           return k;
52487         });
52488         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d) {
52489           select_default2(this).call(panels[d].off).remove();
52490         });
52491         var enter = containers.enter().append("div").attr("class", function(d) {
52492           return "fillD2 panel-container panel-container-" + d;
52493         });
52494         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
52495         var title = enter.append("div").attr("class", "panel-title fillD2");
52496         title.append("h3").each(function(d) {
52497           return panels[d].label(select_default2(this));
52498         });
52499         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d) {
52500           d3_event.stopImmediatePropagation();
52501           d3_event.preventDefault();
52502           info.toggle(d);
52503         }).call(svgIcon("#iD-icon-close"));
52504         enter.append("div").attr("class", function(d) {
52505           return "panel-content panel-content-" + d;
52506         });
52507         infoPanels.selectAll(".panel-content").each(function(d) {
52508           select_default2(this).call(panels[d]);
52509         });
52510       }
52511       info.toggle = function(which) {
52512         var activeids = ids.filter(function(k) {
52513           return active[k];
52514         });
52515         if (which) {
52516           active[which] = !active[which];
52517           if (activeids.length === 1 && activeids[0] === which) {
52518             wasActive = [which];
52519           }
52520           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
52521         } else {
52522           if (activeids.length) {
52523             wasActive = activeids;
52524             activeids.forEach(function(k) {
52525               active[k] = false;
52526             });
52527           } else {
52528             wasActive.forEach(function(k) {
52529               active[k] = true;
52530             });
52531           }
52532         }
52533         redraw();
52534       };
52535       var infoPanels = selection2.selectAll(".info-panels").data([0]);
52536       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
52537       redraw();
52538       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
52539         d3_event.stopImmediatePropagation();
52540         d3_event.preventDefault();
52541         info.toggle();
52542       });
52543       ids.forEach(function(k) {
52544         var key = _t("info_panels." + k + ".key", { default: null });
52545         if (!key)
52546           return;
52547         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
52548           d3_event.stopImmediatePropagation();
52549           d3_event.preventDefault();
52550           info.toggle(k);
52551         });
52552       });
52553     }
52554     return info;
52555   }
52556
52557   // modules/ui/intro/helper.js
52558   function pointBox(loc, context) {
52559     var rect = context.surfaceRect();
52560     var point = context.curtainProjection(loc);
52561     return {
52562       left: point[0] + rect.left - 40,
52563       top: point[1] + rect.top - 60,
52564       width: 80,
52565       height: 90
52566     };
52567   }
52568   function pad(locOrBox, padding, context) {
52569     var box;
52570     if (locOrBox instanceof Array) {
52571       var rect = context.surfaceRect();
52572       var point = context.curtainProjection(locOrBox);
52573       box = {
52574         left: point[0] + rect.left,
52575         top: point[1] + rect.top
52576       };
52577     } else {
52578       box = locOrBox;
52579     }
52580     return {
52581       left: box.left - padding,
52582       top: box.top - padding,
52583       width: (box.width || 0) + 2 * padding,
52584       height: (box.width || 0) + 2 * padding
52585     };
52586   }
52587   function icon(name, svgklass, useklass) {
52588     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
52589   }
52590   var helpStringReplacements;
52591   function helpHtml(id2, replacements) {
52592     if (!helpStringReplacements) {
52593       helpStringReplacements = {
52594         point_icon: icon("#iD-icon-point", "inline"),
52595         line_icon: icon("#iD-icon-line", "inline"),
52596         area_icon: icon("#iD-icon-area", "inline"),
52597         note_icon: icon("#iD-icon-note", "inline add-note"),
52598         plus: icon("#iD-icon-plus", "inline"),
52599         minus: icon("#iD-icon-minus", "inline"),
52600         layers_icon: icon("#iD-icon-layers", "inline"),
52601         data_icon: icon("#iD-icon-data", "inline"),
52602         inspect: icon("#iD-icon-inspect", "inline"),
52603         help_icon: icon("#iD-icon-help", "inline"),
52604         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
52605         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
52606         save_icon: icon("#iD-icon-save", "inline"),
52607         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
52608         continue_icon: icon("#iD-operation-continue", "inline operation"),
52609         copy_icon: icon("#iD-operation-copy", "inline operation"),
52610         delete_icon: icon("#iD-operation-delete", "inline operation"),
52611         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
52612         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
52613         extract_icon: icon("#iD-operation-extract", "inline operation"),
52614         merge_icon: icon("#iD-operation-merge", "inline operation"),
52615         move_icon: icon("#iD-operation-move", "inline operation"),
52616         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
52617         paste_icon: icon("#iD-operation-paste", "inline operation"),
52618         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
52619         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
52620         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
52621         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
52622         split_icon: icon("#iD-operation-split", "inline operation"),
52623         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
52624         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
52625         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
52626         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
52627         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
52628         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
52629         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
52630         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
52631         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
52632         shift: uiCmd.display("\u21E7"),
52633         alt: uiCmd.display("\u2325"),
52634         return: uiCmd.display("\u21B5"),
52635         esc: _t.html("shortcuts.key.esc"),
52636         space: _t.html("shortcuts.key.space"),
52637         add_note_key: _t.html("modes.add_note.key"),
52638         help_key: _t.html("help.key"),
52639         shortcuts_key: _t.html("shortcuts.toggle.key"),
52640         save: _t.html("save.title"),
52641         undo: _t.html("undo.title"),
52642         redo: _t.html("redo.title"),
52643         upload: _t.html("commit.save"),
52644         point: _t.html("modes.add_point.title"),
52645         line: _t.html("modes.add_line.title"),
52646         area: _t.html("modes.add_area.title"),
52647         note: _t.html("modes.add_note.label"),
52648         circularize: _t.html("operations.circularize.title"),
52649         continue: _t.html("operations.continue.title"),
52650         copy: _t.html("operations.copy.title"),
52651         delete: _t.html("operations.delete.title"),
52652         disconnect: _t.html("operations.disconnect.title"),
52653         downgrade: _t.html("operations.downgrade.title"),
52654         extract: _t.html("operations.extract.title"),
52655         merge: _t.html("operations.merge.title"),
52656         move: _t.html("operations.move.title"),
52657         orthogonalize: _t.html("operations.orthogonalize.title"),
52658         paste: _t.html("operations.paste.title"),
52659         reflect_long: _t.html("operations.reflect.title.long"),
52660         reflect_short: _t.html("operations.reflect.title.short"),
52661         reverse: _t.html("operations.reverse.title"),
52662         rotate: _t.html("operations.rotate.title"),
52663         split: _t.html("operations.split.title"),
52664         straighten: _t.html("operations.straighten.title"),
52665         map_data: _t.html("map_data.title"),
52666         osm_notes: _t.html("map_data.layers.notes.title"),
52667         fields: _t.html("inspector.fields"),
52668         tags: _t.html("inspector.tags"),
52669         relations: _t.html("inspector.relations"),
52670         new_relation: _t.html("inspector.new_relation"),
52671         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
52672         background_settings: _t.html("background.description"),
52673         imagery_offset: _t.html("background.fix_misalignment"),
52674         start_the_walkthrough: _t.html("splash.walkthrough"),
52675         help: _t.html("help.title"),
52676         ok: _t.html("intro.ok")
52677       };
52678       for (var key in helpStringReplacements) {
52679         helpStringReplacements[key] = { html: helpStringReplacements[key] };
52680       }
52681     }
52682     var reps;
52683     if (replacements) {
52684       reps = Object.assign(replacements, helpStringReplacements);
52685     } else {
52686       reps = helpStringReplacements;
52687     }
52688     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
52689   }
52690   function slugify(text2) {
52691     return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
52692   }
52693   var missingStrings = {};
52694   function checkKey(key, text2) {
52695     if (_t(key, { default: void 0 }) === void 0) {
52696       if (missingStrings.hasOwnProperty(key))
52697         return;
52698       missingStrings[key] = text2;
52699       var missing = key + ": " + text2;
52700       if (typeof console !== "undefined")
52701         console.log(missing);
52702     }
52703   }
52704   function localize(obj) {
52705     var key;
52706     var name = obj.tags && obj.tags.name;
52707     if (name) {
52708       key = "intro.graph.name." + slugify(name);
52709       obj.tags.name = _t(key, { default: name });
52710       checkKey(key, name);
52711     }
52712     var street = obj.tags && obj.tags["addr:street"];
52713     if (street) {
52714       key = "intro.graph.name." + slugify(street);
52715       obj.tags["addr:street"] = _t(key, { default: street });
52716       checkKey(key, street);
52717       var addrTags = [
52718         "block_number",
52719         "city",
52720         "county",
52721         "district",
52722         "hamlet",
52723         "neighbourhood",
52724         "postcode",
52725         "province",
52726         "quarter",
52727         "state",
52728         "subdistrict",
52729         "suburb"
52730       ];
52731       addrTags.forEach(function(k) {
52732         var key2 = "intro.graph." + k;
52733         var tag = "addr:" + k;
52734         var val = obj.tags && obj.tags[tag];
52735         var str2 = _t(key2, { default: val });
52736         if (str2) {
52737           if (str2.match(/^<.*>$/) !== null) {
52738             delete obj.tags[tag];
52739           } else {
52740             obj.tags[tag] = str2;
52741           }
52742         }
52743       });
52744     }
52745     return obj;
52746   }
52747   function isMostlySquare(points) {
52748     var threshold = 15;
52749     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
52750     var upperBound = Math.cos(threshold * Math.PI / 180);
52751     for (var i2 = 0; i2 < points.length; i2++) {
52752       var a = points[(i2 - 1 + points.length) % points.length];
52753       var origin = points[i2];
52754       var b = points[(i2 + 1) % points.length];
52755       var dotp = geoVecNormalizedDot(a, b, origin);
52756       var mag = Math.abs(dotp);
52757       if (mag > lowerBound && mag < upperBound) {
52758         return false;
52759       }
52760     }
52761     return true;
52762   }
52763   function selectMenuItem(context, operation) {
52764     return context.container().select(".edit-menu .edit-menu-item-" + operation);
52765   }
52766   function transitionTime(point1, point2) {
52767     var distance = geoSphericalDistance(point1, point2);
52768     if (distance === 0) {
52769       return 0;
52770     } else if (distance < 80) {
52771       return 500;
52772     } else {
52773       return 1e3;
52774     }
52775   }
52776
52777   // modules/ui/toggle.js
52778   function uiToggle(show, callback) {
52779     return function(selection2) {
52780       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
52781         select_default2(this).classed("hide", !show).style("opacity", null);
52782         if (callback)
52783           callback.apply(this);
52784       });
52785     };
52786   }
52787
52788   // modules/ui/curtain.js
52789   function uiCurtain(containerNode) {
52790     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
52791     function curtain(selection2) {
52792       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
52793       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
52794       select_default2(window).on("resize.curtain", resize);
52795       tooltip = selection2.append("div").attr("class", "tooltip");
52796       tooltip.append("div").attr("class", "popover-arrow");
52797       tooltip.append("div").attr("class", "popover-inner");
52798       resize();
52799       function resize() {
52800         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
52801         curtain.cut(darkness.datum());
52802       }
52803     }
52804     curtain.reveal = function(box, html2, options2) {
52805       options2 = options2 || {};
52806       if (typeof box === "string") {
52807         box = select_default2(box).node();
52808       }
52809       if (box && box.getBoundingClientRect) {
52810         box = copyBox(box.getBoundingClientRect());
52811         var containerRect = containerNode.getBoundingClientRect();
52812         box.top -= containerRect.top;
52813         box.left -= containerRect.left;
52814       }
52815       if (box && options2.padding) {
52816         box.top -= options2.padding;
52817         box.left -= options2.padding;
52818         box.bottom += options2.padding;
52819         box.right += options2.padding;
52820         box.height += options2.padding * 2;
52821         box.width += options2.padding * 2;
52822       }
52823       var tooltipBox;
52824       if (options2.tooltipBox) {
52825         tooltipBox = options2.tooltipBox;
52826         if (typeof tooltipBox === "string") {
52827           tooltipBox = select_default2(tooltipBox).node();
52828         }
52829         if (tooltipBox && tooltipBox.getBoundingClientRect) {
52830           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
52831         }
52832       } else {
52833         tooltipBox = box;
52834       }
52835       if (tooltipBox && html2) {
52836         if (html2.indexOf("**") !== -1) {
52837           if (html2.indexOf("<span") === 0) {
52838             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
52839           } else {
52840             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
52841           }
52842           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
52843         }
52844         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
52845         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
52846         if (options2.buttonText && options2.buttonCallback) {
52847           html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
52848         }
52849         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
52850         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
52851         if (options2.buttonText && options2.buttonCallback) {
52852           var button = tooltip.selectAll(".button-section .button.action");
52853           button.on("click", function(d3_event) {
52854             d3_event.preventDefault();
52855             options2.buttonCallback();
52856           });
52857         }
52858         var tip = copyBox(tooltip.node().getBoundingClientRect()), w = containerNode.clientWidth, h = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
52859         if (options2.tooltipClass === "intro-mouse") {
52860           tip.height += 80;
52861         }
52862         if (tooltipBox.top + tooltipBox.height > h) {
52863           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h;
52864         }
52865         if (tooltipBox.left + tooltipBox.width > w) {
52866           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w;
52867         }
52868         if (tooltipBox.top + tooltipBox.height < 100) {
52869           side = "bottom";
52870           pos = [
52871             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
52872             tooltipBox.top + tooltipBox.height
52873           ];
52874         } else if (tooltipBox.top > h - 140) {
52875           side = "top";
52876           pos = [
52877             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
52878             tooltipBox.top - tip.height
52879           ];
52880         } else {
52881           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
52882           if (_mainLocalizer.textDirection() === "rtl") {
52883             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
52884               side = "right";
52885               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
52886             } else {
52887               side = "left";
52888               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
52889             }
52890           } else {
52891             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w - 70) {
52892               side = "left";
52893               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
52894             } else {
52895               side = "right";
52896               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
52897             }
52898           }
52899         }
52900         if (options2.duration !== 0 || !tooltip.classed(side)) {
52901           tooltip.call(uiToggle(true));
52902         }
52903         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
52904         var shiftY = 0;
52905         if (side === "left" || side === "right") {
52906           if (pos[1] < 60) {
52907             shiftY = 60 - pos[1];
52908           } else if (pos[1] + tip.height > h - 100) {
52909             shiftY = h - pos[1] - tip.height - 100;
52910           }
52911         }
52912         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
52913       } else {
52914         tooltip.classed("in", false).call(uiToggle(false));
52915       }
52916       curtain.cut(box, options2.duration);
52917       return tooltip;
52918     };
52919     curtain.cut = function(datum2, duration) {
52920       darkness.datum(datum2).interrupt();
52921       var selection2;
52922       if (duration === 0) {
52923         selection2 = darkness;
52924       } else {
52925         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
52926       }
52927       selection2.attr("d", function(d) {
52928         var containerWidth = containerNode.clientWidth;
52929         var containerHeight = containerNode.clientHeight;
52930         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
52931         if (!d)
52932           return string;
52933         return string + "M" + d.left + "," + d.top + "L" + d.left + "," + (d.top + d.height) + "L" + (d.left + d.width) + "," + (d.top + d.height) + "L" + (d.left + d.width) + "," + d.top + "Z";
52934       });
52935     };
52936     curtain.remove = function() {
52937       surface.remove();
52938       tooltip.remove();
52939       select_default2(window).on("resize.curtain", null);
52940     };
52941     function copyBox(src) {
52942       return {
52943         top: src.top,
52944         right: src.right,
52945         bottom: src.bottom,
52946         left: src.left,
52947         width: src.width,
52948         height: src.height
52949       };
52950     }
52951     return curtain;
52952   }
52953
52954   // modules/ui/intro/welcome.js
52955   function uiIntroWelcome(context, reveal) {
52956     var dispatch10 = dispatch_default("done");
52957     var chapter = {
52958       title: "intro.welcome.title"
52959     };
52960     function welcome() {
52961       context.map().centerZoom([-85.63591, 41.94285], 19);
52962       reveal(
52963         ".intro-nav-wrap .chapter-welcome",
52964         helpHtml("intro.welcome.welcome"),
52965         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
52966       );
52967     }
52968     function practice() {
52969       reveal(
52970         ".intro-nav-wrap .chapter-welcome",
52971         helpHtml("intro.welcome.practice"),
52972         { buttonText: _t.html("intro.ok"), buttonCallback: words }
52973       );
52974     }
52975     function words() {
52976       reveal(
52977         ".intro-nav-wrap .chapter-welcome",
52978         helpHtml("intro.welcome.words"),
52979         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
52980       );
52981     }
52982     function chapters() {
52983       dispatch10.call("done");
52984       reveal(
52985         ".intro-nav-wrap .chapter-navigation",
52986         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
52987       );
52988     }
52989     chapter.enter = function() {
52990       welcome();
52991     };
52992     chapter.exit = function() {
52993       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
52994     };
52995     chapter.restart = function() {
52996       chapter.exit();
52997       chapter.enter();
52998     };
52999     return utilRebind(chapter, dispatch10, "on");
53000   }
53001
53002   // modules/ui/intro/navigation.js
53003   function uiIntroNavigation(context, reveal) {
53004     var dispatch10 = dispatch_default("done");
53005     var timeouts = [];
53006     var hallId = "n2061";
53007     var townHall = [-85.63591, 41.94285];
53008     var springStreetId = "w397";
53009     var springStreetEndId = "n1834";
53010     var springStreet = [-85.63582, 41.94255];
53011     var onewayField = _mainPresetIndex.field("oneway");
53012     var maxspeedField = _mainPresetIndex.field("maxspeed");
53013     var chapter = {
53014       title: "intro.navigation.title"
53015     };
53016     function timeout2(f2, t) {
53017       timeouts.push(window.setTimeout(f2, t));
53018     }
53019     function eventCancel(d3_event) {
53020       d3_event.stopPropagation();
53021       d3_event.preventDefault();
53022     }
53023     function isTownHallSelected() {
53024       var ids = context.selectedIDs();
53025       return ids.length === 1 && ids[0] === hallId;
53026     }
53027     function dragMap() {
53028       context.enter(modeBrowse(context));
53029       context.history().reset("initial");
53030       var msec = transitionTime(townHall, context.map().center());
53031       if (msec) {
53032         reveal(null, null, { duration: 0 });
53033       }
53034       context.map().centerZoomEase(townHall, 19, msec);
53035       timeout2(function() {
53036         var centerStart = context.map().center();
53037         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
53038         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
53039         reveal(".surface", dragString);
53040         context.map().on("drawn.intro", function() {
53041           reveal(".surface", dragString, { duration: 0 });
53042         });
53043         context.map().on("move.intro", function() {
53044           var centerNow = context.map().center();
53045           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
53046             context.map().on("move.intro", null);
53047             timeout2(function() {
53048               continueTo(zoomMap);
53049             }, 3e3);
53050           }
53051         });
53052       }, msec + 100);
53053       function continueTo(nextStep) {
53054         context.map().on("move.intro drawn.intro", null);
53055         nextStep();
53056       }
53057     }
53058     function zoomMap() {
53059       var zoomStart = context.map().zoom();
53060       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
53061       var zoomString = helpHtml("intro.navigation." + textId);
53062       reveal(".surface", zoomString);
53063       context.map().on("drawn.intro", function() {
53064         reveal(".surface", zoomString, { duration: 0 });
53065       });
53066       context.map().on("move.intro", function() {
53067         if (context.map().zoom() !== zoomStart) {
53068           context.map().on("move.intro", null);
53069           timeout2(function() {
53070             continueTo(features2);
53071           }, 3e3);
53072         }
53073       });
53074       function continueTo(nextStep) {
53075         context.map().on("move.intro drawn.intro", null);
53076         nextStep();
53077       }
53078     }
53079     function features2() {
53080       var onClick = function() {
53081         continueTo(pointsLinesAreas);
53082       };
53083       reveal(
53084         ".surface",
53085         helpHtml("intro.navigation.features"),
53086         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53087       );
53088       context.map().on("drawn.intro", function() {
53089         reveal(
53090           ".surface",
53091           helpHtml("intro.navigation.features"),
53092           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53093         );
53094       });
53095       function continueTo(nextStep) {
53096         context.map().on("drawn.intro", null);
53097         nextStep();
53098       }
53099     }
53100     function pointsLinesAreas() {
53101       var onClick = function() {
53102         continueTo(nodesWays);
53103       };
53104       reveal(
53105         ".surface",
53106         helpHtml("intro.navigation.points_lines_areas"),
53107         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53108       );
53109       context.map().on("drawn.intro", function() {
53110         reveal(
53111           ".surface",
53112           helpHtml("intro.navigation.points_lines_areas"),
53113           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53114         );
53115       });
53116       function continueTo(nextStep) {
53117         context.map().on("drawn.intro", null);
53118         nextStep();
53119       }
53120     }
53121     function nodesWays() {
53122       var onClick = function() {
53123         continueTo(clickTownHall);
53124       };
53125       reveal(
53126         ".surface",
53127         helpHtml("intro.navigation.nodes_ways"),
53128         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53129       );
53130       context.map().on("drawn.intro", function() {
53131         reveal(
53132           ".surface",
53133           helpHtml("intro.navigation.nodes_ways"),
53134           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53135         );
53136       });
53137       function continueTo(nextStep) {
53138         context.map().on("drawn.intro", null);
53139         nextStep();
53140       }
53141     }
53142     function clickTownHall() {
53143       context.enter(modeBrowse(context));
53144       context.history().reset("initial");
53145       var entity = context.hasEntity(hallId);
53146       if (!entity)
53147         return;
53148       reveal(null, null, { duration: 0 });
53149       context.map().centerZoomEase(entity.loc, 19, 500);
53150       timeout2(function() {
53151         var entity2 = context.hasEntity(hallId);
53152         if (!entity2)
53153           return;
53154         var box = pointBox(entity2.loc, context);
53155         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
53156         reveal(box, helpHtml("intro.navigation." + textId));
53157         context.map().on("move.intro drawn.intro", function() {
53158           var entity3 = context.hasEntity(hallId);
53159           if (!entity3)
53160             return;
53161           var box2 = pointBox(entity3.loc, context);
53162           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
53163         });
53164         context.on("enter.intro", function() {
53165           if (isTownHallSelected())
53166             continueTo(selectedTownHall);
53167         });
53168       }, 550);
53169       context.history().on("change.intro", function() {
53170         if (!context.hasEntity(hallId)) {
53171           continueTo(clickTownHall);
53172         }
53173       });
53174       function continueTo(nextStep) {
53175         context.on("enter.intro", null);
53176         context.map().on("move.intro drawn.intro", null);
53177         context.history().on("change.intro", null);
53178         nextStep();
53179       }
53180     }
53181     function selectedTownHall() {
53182       if (!isTownHallSelected())
53183         return clickTownHall();
53184       var entity = context.hasEntity(hallId);
53185       if (!entity)
53186         return clickTownHall();
53187       var box = pointBox(entity.loc, context);
53188       var onClick = function() {
53189         continueTo(editorTownHall);
53190       };
53191       reveal(
53192         box,
53193         helpHtml("intro.navigation.selected_townhall"),
53194         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53195       );
53196       context.map().on("move.intro drawn.intro", function() {
53197         var entity2 = context.hasEntity(hallId);
53198         if (!entity2)
53199           return;
53200         var box2 = pointBox(entity2.loc, context);
53201         reveal(
53202           box2,
53203           helpHtml("intro.navigation.selected_townhall"),
53204           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53205         );
53206       });
53207       context.history().on("change.intro", function() {
53208         if (!context.hasEntity(hallId)) {
53209           continueTo(clickTownHall);
53210         }
53211       });
53212       function continueTo(nextStep) {
53213         context.map().on("move.intro drawn.intro", null);
53214         context.history().on("change.intro", null);
53215         nextStep();
53216       }
53217     }
53218     function editorTownHall() {
53219       if (!isTownHallSelected())
53220         return clickTownHall();
53221       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53222       var onClick = function() {
53223         continueTo(presetTownHall);
53224       };
53225       reveal(
53226         ".entity-editor-pane",
53227         helpHtml("intro.navigation.editor_townhall"),
53228         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53229       );
53230       context.on("exit.intro", function() {
53231         continueTo(clickTownHall);
53232       });
53233       context.history().on("change.intro", function() {
53234         if (!context.hasEntity(hallId)) {
53235           continueTo(clickTownHall);
53236         }
53237       });
53238       function continueTo(nextStep) {
53239         context.on("exit.intro", null);
53240         context.history().on("change.intro", null);
53241         context.container().select(".inspector-wrap").on("wheel.intro", null);
53242         nextStep();
53243       }
53244     }
53245     function presetTownHall() {
53246       if (!isTownHallSelected())
53247         return clickTownHall();
53248       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53249       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53250       var entity = context.entity(context.selectedIDs()[0]);
53251       var preset = _mainPresetIndex.match(entity, context.graph());
53252       var onClick = function() {
53253         continueTo(fieldsTownHall);
53254       };
53255       reveal(
53256         ".entity-editor-pane .section-feature-type",
53257         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
53258         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53259       );
53260       context.on("exit.intro", function() {
53261         continueTo(clickTownHall);
53262       });
53263       context.history().on("change.intro", function() {
53264         if (!context.hasEntity(hallId)) {
53265           continueTo(clickTownHall);
53266         }
53267       });
53268       function continueTo(nextStep) {
53269         context.on("exit.intro", null);
53270         context.history().on("change.intro", null);
53271         context.container().select(".inspector-wrap").on("wheel.intro", null);
53272         nextStep();
53273       }
53274     }
53275     function fieldsTownHall() {
53276       if (!isTownHallSelected())
53277         return clickTownHall();
53278       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53279       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53280       var onClick = function() {
53281         continueTo(closeTownHall);
53282       };
53283       reveal(
53284         ".entity-editor-pane .section-preset-fields",
53285         helpHtml("intro.navigation.fields_townhall"),
53286         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53287       );
53288       context.on("exit.intro", function() {
53289         continueTo(clickTownHall);
53290       });
53291       context.history().on("change.intro", function() {
53292         if (!context.hasEntity(hallId)) {
53293           continueTo(clickTownHall);
53294         }
53295       });
53296       function continueTo(nextStep) {
53297         context.on("exit.intro", null);
53298         context.history().on("change.intro", null);
53299         context.container().select(".inspector-wrap").on("wheel.intro", null);
53300         nextStep();
53301       }
53302     }
53303     function closeTownHall() {
53304       if (!isTownHallSelected())
53305         return clickTownHall();
53306       var selector = ".entity-editor-pane button.close svg use";
53307       var href = select_default2(selector).attr("href") || "#iD-icon-close";
53308       reveal(
53309         ".entity-editor-pane",
53310         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
53311       );
53312       context.on("exit.intro", function() {
53313         continueTo(searchStreet);
53314       });
53315       context.history().on("change.intro", function() {
53316         var selector2 = ".entity-editor-pane button.close svg use";
53317         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
53318         reveal(
53319           ".entity-editor-pane",
53320           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
53321           { duration: 0 }
53322         );
53323       });
53324       function continueTo(nextStep) {
53325         context.on("exit.intro", null);
53326         context.history().on("change.intro", null);
53327         nextStep();
53328       }
53329     }
53330     function searchStreet() {
53331       context.enter(modeBrowse(context));
53332       context.history().reset("initial");
53333       var msec = transitionTime(springStreet, context.map().center());
53334       if (msec) {
53335         reveal(null, null, { duration: 0 });
53336       }
53337       context.map().centerZoomEase(springStreet, 19, msec);
53338       timeout2(function() {
53339         reveal(
53340           ".search-header input",
53341           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
53342         );
53343         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
53344       }, msec + 100);
53345     }
53346     function checkSearchResult() {
53347       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
53348       var firstName = first.select(".entity-name");
53349       var name = _t("intro.graph.name.spring-street");
53350       if (!firstName.empty() && firstName.html() === name) {
53351         reveal(
53352           first.node(),
53353           helpHtml("intro.navigation.choose_street", { name }),
53354           { duration: 300 }
53355         );
53356         context.on("exit.intro", function() {
53357           continueTo(selectedStreet);
53358         });
53359         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
53360       }
53361       function continueTo(nextStep) {
53362         context.on("exit.intro", null);
53363         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
53364         nextStep();
53365       }
53366     }
53367     function selectedStreet() {
53368       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
53369         return searchStreet();
53370       }
53371       var onClick = function() {
53372         continueTo(editorStreet);
53373       };
53374       var entity = context.entity(springStreetEndId);
53375       var box = pointBox(entity.loc, context);
53376       box.height = 500;
53377       reveal(
53378         box,
53379         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
53380         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53381       );
53382       timeout2(function() {
53383         context.map().on("move.intro drawn.intro", function() {
53384           var entity2 = context.hasEntity(springStreetEndId);
53385           if (!entity2)
53386             return;
53387           var box2 = pointBox(entity2.loc, context);
53388           box2.height = 500;
53389           reveal(
53390             box2,
53391             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
53392             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
53393           );
53394         });
53395       }, 600);
53396       context.on("enter.intro", function(mode) {
53397         if (!context.hasEntity(springStreetId)) {
53398           return continueTo(searchStreet);
53399         }
53400         var ids = context.selectedIDs();
53401         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
53402           context.enter(modeSelect(context, [springStreetId]));
53403         }
53404       });
53405       context.history().on("change.intro", function() {
53406         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
53407           timeout2(function() {
53408             continueTo(searchStreet);
53409           }, 300);
53410         }
53411       });
53412       function continueTo(nextStep) {
53413         context.map().on("move.intro drawn.intro", null);
53414         context.on("enter.intro", null);
53415         context.history().on("change.intro", null);
53416         nextStep();
53417       }
53418     }
53419     function editorStreet() {
53420       var selector = ".entity-editor-pane button.close svg use";
53421       var href = select_default2(selector).attr("href") || "#iD-icon-close";
53422       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
53423         button: { html: icon(href, "inline") },
53424         field1: onewayField.title(),
53425         field2: maxspeedField.title()
53426       }));
53427       context.on("exit.intro", function() {
53428         continueTo(play);
53429       });
53430       context.history().on("change.intro", function() {
53431         var selector2 = ".entity-editor-pane button.close svg use";
53432         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
53433         reveal(
53434           ".entity-editor-pane",
53435           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
53436             button: { html: icon(href2, "inline") },
53437             field1: onewayField.title(),
53438             field2: maxspeedField.title()
53439           }),
53440           { duration: 0 }
53441         );
53442       });
53443       function continueTo(nextStep) {
53444         context.on("exit.intro", null);
53445         context.history().on("change.intro", null);
53446         nextStep();
53447       }
53448     }
53449     function play() {
53450       dispatch10.call("done");
53451       reveal(
53452         ".ideditor",
53453         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
53454         {
53455           tooltipBox: ".intro-nav-wrap .chapter-point",
53456           buttonText: _t.html("intro.ok"),
53457           buttonCallback: function() {
53458             reveal(".ideditor");
53459           }
53460         }
53461       );
53462     }
53463     chapter.enter = function() {
53464       dragMap();
53465     };
53466     chapter.exit = function() {
53467       timeouts.forEach(window.clearTimeout);
53468       context.on("enter.intro exit.intro", null);
53469       context.map().on("move.intro drawn.intro", null);
53470       context.history().on("change.intro", null);
53471       context.container().select(".inspector-wrap").on("wheel.intro", null);
53472       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
53473     };
53474     chapter.restart = function() {
53475       chapter.exit();
53476       chapter.enter();
53477     };
53478     return utilRebind(chapter, dispatch10, "on");
53479   }
53480
53481   // modules/ui/intro/point.js
53482   function uiIntroPoint(context, reveal) {
53483     var dispatch10 = dispatch_default("done");
53484     var timeouts = [];
53485     var intersection = [-85.63279, 41.94394];
53486     var building = [-85.632422, 41.944045];
53487     var cafePreset = _mainPresetIndex.item("amenity/cafe");
53488     var _pointID = null;
53489     var chapter = {
53490       title: "intro.points.title"
53491     };
53492     function timeout2(f2, t) {
53493       timeouts.push(window.setTimeout(f2, t));
53494     }
53495     function eventCancel(d3_event) {
53496       d3_event.stopPropagation();
53497       d3_event.preventDefault();
53498     }
53499     function addPoint() {
53500       context.enter(modeBrowse(context));
53501       context.history().reset("initial");
53502       var msec = transitionTime(intersection, context.map().center());
53503       if (msec) {
53504         reveal(null, null, { duration: 0 });
53505       }
53506       context.map().centerZoomEase(intersection, 19, msec);
53507       timeout2(function() {
53508         var tooltip = reveal(
53509           "button.add-point",
53510           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
53511         );
53512         _pointID = null;
53513         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
53514         context.on("enter.intro", function(mode) {
53515           if (mode.id !== "add-point")
53516             return;
53517           continueTo(placePoint);
53518         });
53519       }, msec + 100);
53520       function continueTo(nextStep) {
53521         context.on("enter.intro", null);
53522         nextStep();
53523       }
53524     }
53525     function placePoint() {
53526       if (context.mode().id !== "add-point") {
53527         return chapter.restart();
53528       }
53529       var pointBox2 = pad(building, 150, context);
53530       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
53531       reveal(pointBox2, helpHtml("intro.points." + textId));
53532       context.map().on("move.intro drawn.intro", function() {
53533         pointBox2 = pad(building, 150, context);
53534         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
53535       });
53536       context.on("enter.intro", function(mode) {
53537         if (mode.id !== "select")
53538           return chapter.restart();
53539         _pointID = context.mode().selectedIDs()[0];
53540         continueTo(searchPreset);
53541       });
53542       function continueTo(nextStep) {
53543         context.map().on("move.intro drawn.intro", null);
53544         context.on("enter.intro", null);
53545         nextStep();
53546       }
53547     }
53548     function searchPreset() {
53549       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53550         return addPoint();
53551       }
53552       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53553       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
53554       reveal(
53555         ".preset-search-input",
53556         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
53557       );
53558       context.on("enter.intro", function(mode) {
53559         if (!_pointID || !context.hasEntity(_pointID)) {
53560           return continueTo(addPoint);
53561         }
53562         var ids = context.selectedIDs();
53563         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
53564           context.enter(modeSelect(context, [_pointID]));
53565           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53566           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
53567           reveal(
53568             ".preset-search-input",
53569             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
53570           );
53571           context.history().on("change.intro", null);
53572         }
53573       });
53574       function checkPresetSearch() {
53575         var first = context.container().select(".preset-list-item:first-child");
53576         if (first.classed("preset-amenity-cafe")) {
53577           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
53578           reveal(
53579             first.select(".preset-list-button").node(),
53580             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
53581             { duration: 300 }
53582           );
53583           context.history().on("change.intro", function() {
53584             continueTo(aboutFeatureEditor);
53585           });
53586         }
53587       }
53588       function continueTo(nextStep) {
53589         context.on("enter.intro", null);
53590         context.history().on("change.intro", null);
53591         context.container().select(".inspector-wrap").on("wheel.intro", null);
53592         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53593         nextStep();
53594       }
53595     }
53596     function aboutFeatureEditor() {
53597       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53598         return addPoint();
53599       }
53600       timeout2(function() {
53601         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
53602           tooltipClass: "intro-points-describe",
53603           buttonText: _t.html("intro.ok"),
53604           buttonCallback: function() {
53605             continueTo(addName);
53606           }
53607         });
53608       }, 400);
53609       context.on("exit.intro", function() {
53610         continueTo(reselectPoint);
53611       });
53612       function continueTo(nextStep) {
53613         context.on("exit.intro", null);
53614         nextStep();
53615       }
53616     }
53617     function addName() {
53618       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53619         return addPoint();
53620       }
53621       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53622       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
53623       timeout2(function() {
53624         var entity = context.entity(_pointID);
53625         if (entity.tags.name) {
53626           var tooltip = reveal(".entity-editor-pane", addNameString, {
53627             tooltipClass: "intro-points-describe",
53628             buttonText: _t.html("intro.ok"),
53629             buttonCallback: function() {
53630               continueTo(addCloseEditor);
53631             }
53632           });
53633           tooltip.select(".instruction").style("display", "none");
53634         } else {
53635           reveal(
53636             ".entity-editor-pane",
53637             addNameString,
53638             { tooltipClass: "intro-points-describe" }
53639           );
53640         }
53641       }, 400);
53642       context.history().on("change.intro", function() {
53643         continueTo(addCloseEditor);
53644       });
53645       context.on("exit.intro", function() {
53646         continueTo(reselectPoint);
53647       });
53648       function continueTo(nextStep) {
53649         context.on("exit.intro", null);
53650         context.history().on("change.intro", null);
53651         nextStep();
53652       }
53653     }
53654     function addCloseEditor() {
53655       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53656       var selector = ".entity-editor-pane button.close svg use";
53657       var href = select_default2(selector).attr("href") || "#iD-icon-close";
53658       context.on("exit.intro", function() {
53659         continueTo(reselectPoint);
53660       });
53661       reveal(
53662         ".entity-editor-pane",
53663         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
53664       );
53665       function continueTo(nextStep) {
53666         context.on("exit.intro", null);
53667         nextStep();
53668       }
53669     }
53670     function reselectPoint() {
53671       if (!_pointID)
53672         return chapter.restart();
53673       var entity = context.hasEntity(_pointID);
53674       if (!entity)
53675         return chapter.restart();
53676       var oldPreset = _mainPresetIndex.match(entity, context.graph());
53677       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
53678       context.enter(modeBrowse(context));
53679       var msec = transitionTime(entity.loc, context.map().center());
53680       if (msec) {
53681         reveal(null, null, { duration: 0 });
53682       }
53683       context.map().centerEase(entity.loc, msec);
53684       timeout2(function() {
53685         var box = pointBox(entity.loc, context);
53686         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
53687         timeout2(function() {
53688           context.map().on("move.intro drawn.intro", function() {
53689             var entity2 = context.hasEntity(_pointID);
53690             if (!entity2)
53691               return chapter.restart();
53692             var box2 = pointBox(entity2.loc, context);
53693             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
53694           });
53695         }, 600);
53696         context.on("enter.intro", function(mode) {
53697           if (mode.id !== "select")
53698             return;
53699           continueTo(updatePoint);
53700         });
53701       }, msec + 100);
53702       function continueTo(nextStep) {
53703         context.map().on("move.intro drawn.intro", null);
53704         context.on("enter.intro", null);
53705         nextStep();
53706       }
53707     }
53708     function updatePoint() {
53709       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53710         return continueTo(reselectPoint);
53711       }
53712       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53713       context.on("exit.intro", function() {
53714         continueTo(reselectPoint);
53715       });
53716       context.history().on("change.intro", function() {
53717         continueTo(updateCloseEditor);
53718       });
53719       timeout2(function() {
53720         reveal(
53721           ".entity-editor-pane",
53722           helpHtml("intro.points.update"),
53723           { tooltipClass: "intro-points-describe" }
53724         );
53725       }, 400);
53726       function continueTo(nextStep) {
53727         context.on("exit.intro", null);
53728         context.history().on("change.intro", null);
53729         nextStep();
53730       }
53731     }
53732     function updateCloseEditor() {
53733       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
53734         return continueTo(reselectPoint);
53735       }
53736       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
53737       context.on("exit.intro", function() {
53738         continueTo(rightClickPoint);
53739       });
53740       timeout2(function() {
53741         reveal(
53742           ".entity-editor-pane",
53743           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
53744         );
53745       }, 500);
53746       function continueTo(nextStep) {
53747         context.on("exit.intro", null);
53748         nextStep();
53749       }
53750     }
53751     function rightClickPoint() {
53752       if (!_pointID)
53753         return chapter.restart();
53754       var entity = context.hasEntity(_pointID);
53755       if (!entity)
53756         return chapter.restart();
53757       context.enter(modeBrowse(context));
53758       var box = pointBox(entity.loc, context);
53759       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
53760       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
53761       timeout2(function() {
53762         context.map().on("move.intro", function() {
53763           var entity2 = context.hasEntity(_pointID);
53764           if (!entity2)
53765             return chapter.restart();
53766           var box2 = pointBox(entity2.loc, context);
53767           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
53768         });
53769       }, 600);
53770       context.on("enter.intro", function(mode) {
53771         if (mode.id !== "select")
53772           return;
53773         var ids = context.selectedIDs();
53774         if (ids.length !== 1 || ids[0] !== _pointID)
53775           return;
53776         timeout2(function() {
53777           var node = selectMenuItem(context, "delete").node();
53778           if (!node)
53779             return;
53780           continueTo(enterDelete);
53781         }, 50);
53782       });
53783       function continueTo(nextStep) {
53784         context.on("enter.intro", null);
53785         context.map().on("move.intro", null);
53786         nextStep();
53787       }
53788     }
53789     function enterDelete() {
53790       if (!_pointID)
53791         return chapter.restart();
53792       var entity = context.hasEntity(_pointID);
53793       if (!entity)
53794         return chapter.restart();
53795       var node = selectMenuItem(context, "delete").node();
53796       if (!node) {
53797         return continueTo(rightClickPoint);
53798       }
53799       reveal(
53800         ".edit-menu",
53801         helpHtml("intro.points.delete"),
53802         { padding: 50 }
53803       );
53804       timeout2(function() {
53805         context.map().on("move.intro", function() {
53806           reveal(
53807             ".edit-menu",
53808             helpHtml("intro.points.delete"),
53809             { duration: 0, padding: 50 }
53810           );
53811         });
53812       }, 300);
53813       context.on("exit.intro", function() {
53814         if (!_pointID)
53815           return chapter.restart();
53816         var entity2 = context.hasEntity(_pointID);
53817         if (entity2)
53818           return continueTo(rightClickPoint);
53819       });
53820       context.history().on("change.intro", function(changed) {
53821         if (changed.deleted().length) {
53822           continueTo(undo);
53823         }
53824       });
53825       function continueTo(nextStep) {
53826         context.map().on("move.intro", null);
53827         context.history().on("change.intro", null);
53828         context.on("exit.intro", null);
53829         nextStep();
53830       }
53831     }
53832     function undo() {
53833       context.history().on("change.intro", function() {
53834         continueTo(play);
53835       });
53836       reveal(
53837         ".top-toolbar button.undo-button",
53838         helpHtml("intro.points.undo")
53839       );
53840       function continueTo(nextStep) {
53841         context.history().on("change.intro", null);
53842         nextStep();
53843       }
53844     }
53845     function play() {
53846       dispatch10.call("done");
53847       reveal(
53848         ".ideditor",
53849         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
53850         {
53851           tooltipBox: ".intro-nav-wrap .chapter-area",
53852           buttonText: _t.html("intro.ok"),
53853           buttonCallback: function() {
53854             reveal(".ideditor");
53855           }
53856         }
53857       );
53858     }
53859     chapter.enter = function() {
53860       addPoint();
53861     };
53862     chapter.exit = function() {
53863       timeouts.forEach(window.clearTimeout);
53864       context.on("enter.intro exit.intro", null);
53865       context.map().on("move.intro drawn.intro", null);
53866       context.history().on("change.intro", null);
53867       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
53868       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
53869     };
53870     chapter.restart = function() {
53871       chapter.exit();
53872       chapter.enter();
53873     };
53874     return utilRebind(chapter, dispatch10, "on");
53875   }
53876
53877   // modules/ui/intro/area.js
53878   function uiIntroArea(context, reveal) {
53879     var dispatch10 = dispatch_default("done");
53880     var playground = [-85.63552, 41.94159];
53881     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
53882     var nameField = _mainPresetIndex.field("name");
53883     var descriptionField = _mainPresetIndex.field("description");
53884     var timeouts = [];
53885     var _areaID;
53886     var chapter = {
53887       title: "intro.areas.title"
53888     };
53889     function timeout2(f2, t) {
53890       timeouts.push(window.setTimeout(f2, t));
53891     }
53892     function eventCancel(d3_event) {
53893       d3_event.stopPropagation();
53894       d3_event.preventDefault();
53895     }
53896     function revealPlayground(center, text2, options2) {
53897       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
53898       var box = pad(center, padding, context);
53899       reveal(box, text2, options2);
53900     }
53901     function addArea() {
53902       context.enter(modeBrowse(context));
53903       context.history().reset("initial");
53904       _areaID = null;
53905       var msec = transitionTime(playground, context.map().center());
53906       if (msec) {
53907         reveal(null, null, { duration: 0 });
53908       }
53909       context.map().centerZoomEase(playground, 19, msec);
53910       timeout2(function() {
53911         var tooltip = reveal(
53912           "button.add-area",
53913           helpHtml("intro.areas.add_playground")
53914         );
53915         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
53916         context.on("enter.intro", function(mode) {
53917           if (mode.id !== "add-area")
53918             return;
53919           continueTo(startPlayground);
53920         });
53921       }, msec + 100);
53922       function continueTo(nextStep) {
53923         context.on("enter.intro", null);
53924         nextStep();
53925       }
53926     }
53927     function startPlayground() {
53928       if (context.mode().id !== "add-area") {
53929         return chapter.restart();
53930       }
53931       _areaID = null;
53932       context.map().zoomEase(19.5, 500);
53933       timeout2(function() {
53934         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
53935         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
53936         revealPlayground(
53937           playground,
53938           startDrawString,
53939           { duration: 250 }
53940         );
53941         timeout2(function() {
53942           context.map().on("move.intro drawn.intro", function() {
53943             revealPlayground(
53944               playground,
53945               startDrawString,
53946               { duration: 0 }
53947             );
53948           });
53949           context.on("enter.intro", function(mode) {
53950             if (mode.id !== "draw-area")
53951               return chapter.restart();
53952             continueTo(continuePlayground);
53953           });
53954         }, 250);
53955       }, 550);
53956       function continueTo(nextStep) {
53957         context.map().on("move.intro drawn.intro", null);
53958         context.on("enter.intro", null);
53959         nextStep();
53960       }
53961     }
53962     function continuePlayground() {
53963       if (context.mode().id !== "draw-area") {
53964         return chapter.restart();
53965       }
53966       _areaID = null;
53967       revealPlayground(
53968         playground,
53969         helpHtml("intro.areas.continue_playground"),
53970         { duration: 250 }
53971       );
53972       timeout2(function() {
53973         context.map().on("move.intro drawn.intro", function() {
53974           revealPlayground(
53975             playground,
53976             helpHtml("intro.areas.continue_playground"),
53977             { duration: 0 }
53978           );
53979         });
53980       }, 250);
53981       context.on("enter.intro", function(mode) {
53982         if (mode.id === "draw-area") {
53983           var entity = context.hasEntity(context.selectedIDs()[0]);
53984           if (entity && entity.nodes.length >= 6) {
53985             return continueTo(finishPlayground);
53986           } else {
53987             return;
53988           }
53989         } else if (mode.id === "select") {
53990           _areaID = context.selectedIDs()[0];
53991           return continueTo(searchPresets);
53992         } else {
53993           return chapter.restart();
53994         }
53995       });
53996       function continueTo(nextStep) {
53997         context.map().on("move.intro drawn.intro", null);
53998         context.on("enter.intro", null);
53999         nextStep();
54000       }
54001     }
54002     function finishPlayground() {
54003       if (context.mode().id !== "draw-area") {
54004         return chapter.restart();
54005       }
54006       _areaID = null;
54007       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
54008       revealPlayground(
54009         playground,
54010         finishString,
54011         { duration: 250 }
54012       );
54013       timeout2(function() {
54014         context.map().on("move.intro drawn.intro", function() {
54015           revealPlayground(
54016             playground,
54017             finishString,
54018             { duration: 0 }
54019           );
54020         });
54021       }, 250);
54022       context.on("enter.intro", function(mode) {
54023         if (mode.id === "draw-area") {
54024           return;
54025         } else if (mode.id === "select") {
54026           _areaID = context.selectedIDs()[0];
54027           return continueTo(searchPresets);
54028         } else {
54029           return chapter.restart();
54030         }
54031       });
54032       function continueTo(nextStep) {
54033         context.map().on("move.intro drawn.intro", null);
54034         context.on("enter.intro", null);
54035         nextStep();
54036       }
54037     }
54038     function searchPresets() {
54039       if (!_areaID || !context.hasEntity(_areaID)) {
54040         return addArea();
54041       }
54042       var ids = context.selectedIDs();
54043       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54044         context.enter(modeSelect(context, [_areaID]));
54045       }
54046       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54047       timeout2(function() {
54048         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54049         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54050         reveal(
54051           ".preset-search-input",
54052           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
54053         );
54054       }, 400);
54055       context.on("enter.intro", function(mode) {
54056         if (!_areaID || !context.hasEntity(_areaID)) {
54057           return continueTo(addArea);
54058         }
54059         var ids2 = context.selectedIDs();
54060         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
54061           context.enter(modeSelect(context, [_areaID]));
54062           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54063           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54064           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
54065           reveal(
54066             ".preset-search-input",
54067             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
54068           );
54069           context.history().on("change.intro", null);
54070         }
54071       });
54072       function checkPresetSearch() {
54073         var first = context.container().select(".preset-list-item:first-child");
54074         if (first.classed("preset-leisure-playground")) {
54075           reveal(
54076             first.select(".preset-list-button").node(),
54077             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
54078             { duration: 300 }
54079           );
54080           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
54081           context.history().on("change.intro", function() {
54082             continueTo(clickAddField);
54083           });
54084         }
54085       }
54086       function continueTo(nextStep) {
54087         context.container().select(".inspector-wrap").on("wheel.intro", null);
54088         context.on("enter.intro", null);
54089         context.history().on("change.intro", null);
54090         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54091         nextStep();
54092       }
54093     }
54094     function clickAddField() {
54095       if (!_areaID || !context.hasEntity(_areaID)) {
54096         return addArea();
54097       }
54098       var ids = context.selectedIDs();
54099       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54100         return searchPresets();
54101       }
54102       if (!context.container().select(".form-field-description").empty()) {
54103         return continueTo(describePlayground);
54104       }
54105       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54106       timeout2(function() {
54107         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54108         var entity = context.entity(_areaID);
54109         if (entity.tags.description) {
54110           return continueTo(play);
54111         }
54112         var box = context.container().select(".more-fields").node().getBoundingClientRect();
54113         if (box.top > 300) {
54114           var pane = context.container().select(".entity-editor-pane .inspector-body");
54115           var start2 = pane.node().scrollTop;
54116           var end = start2 + (box.top - 300);
54117           pane.transition().duration(250).tween("scroll.inspector", function() {
54118             var node = this;
54119             var i2 = number_default(start2, end);
54120             return function(t) {
54121               node.scrollTop = i2(t);
54122             };
54123           });
54124         }
54125         timeout2(function() {
54126           reveal(
54127             ".more-fields .combobox-input",
54128             helpHtml("intro.areas.add_field", {
54129               name: nameField.title(),
54130               description: descriptionField.title()
54131             }),
54132             { duration: 300 }
54133           );
54134           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
54135             var watcher;
54136             watcher = window.setInterval(function() {
54137               if (!context.container().select("div.combobox").empty()) {
54138                 window.clearInterval(watcher);
54139                 continueTo(chooseDescriptionField);
54140               }
54141             }, 300);
54142           });
54143         }, 300);
54144       }, 400);
54145       context.on("exit.intro", function() {
54146         return continueTo(searchPresets);
54147       });
54148       function continueTo(nextStep) {
54149         context.container().select(".inspector-wrap").on("wheel.intro", null);
54150         context.container().select(".more-fields .combobox-input").on("click.intro", null);
54151         context.on("exit.intro", null);
54152         nextStep();
54153       }
54154     }
54155     function chooseDescriptionField() {
54156       if (!_areaID || !context.hasEntity(_areaID)) {
54157         return addArea();
54158       }
54159       var ids = context.selectedIDs();
54160       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54161         return searchPresets();
54162       }
54163       if (!context.container().select(".form-field-description").empty()) {
54164         return continueTo(describePlayground);
54165       }
54166       if (context.container().select("div.combobox").empty()) {
54167         return continueTo(clickAddField);
54168       }
54169       var watcher;
54170       watcher = window.setInterval(function() {
54171         if (context.container().select("div.combobox").empty()) {
54172           window.clearInterval(watcher);
54173           timeout2(function() {
54174             if (context.container().select(".form-field-description").empty()) {
54175               continueTo(retryChooseDescription);
54176             } else {
54177               continueTo(describePlayground);
54178             }
54179           }, 300);
54180         }
54181       }, 300);
54182       reveal(
54183         "div.combobox",
54184         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
54185         { duration: 300 }
54186       );
54187       context.on("exit.intro", function() {
54188         return continueTo(searchPresets);
54189       });
54190       function continueTo(nextStep) {
54191         if (watcher)
54192           window.clearInterval(watcher);
54193         context.on("exit.intro", null);
54194         nextStep();
54195       }
54196     }
54197     function describePlayground() {
54198       if (!_areaID || !context.hasEntity(_areaID)) {
54199         return addArea();
54200       }
54201       var ids = context.selectedIDs();
54202       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54203         return searchPresets();
54204       }
54205       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54206       if (context.container().select(".form-field-description").empty()) {
54207         return continueTo(retryChooseDescription);
54208       }
54209       context.on("exit.intro", function() {
54210         continueTo(play);
54211       });
54212       reveal(
54213         ".entity-editor-pane",
54214         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
54215         { duration: 300 }
54216       );
54217       function continueTo(nextStep) {
54218         context.on("exit.intro", null);
54219         nextStep();
54220       }
54221     }
54222     function retryChooseDescription() {
54223       if (!_areaID || !context.hasEntity(_areaID)) {
54224         return addArea();
54225       }
54226       var ids = context.selectedIDs();
54227       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
54228         return searchPresets();
54229       }
54230       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
54231       reveal(
54232         ".entity-editor-pane",
54233         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
54234         {
54235           buttonText: _t.html("intro.ok"),
54236           buttonCallback: function() {
54237             continueTo(clickAddField);
54238           }
54239         }
54240       );
54241       context.on("exit.intro", function() {
54242         return continueTo(searchPresets);
54243       });
54244       function continueTo(nextStep) {
54245         context.on("exit.intro", null);
54246         nextStep();
54247       }
54248     }
54249     function play() {
54250       dispatch10.call("done");
54251       reveal(
54252         ".ideditor",
54253         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
54254         {
54255           tooltipBox: ".intro-nav-wrap .chapter-line",
54256           buttonText: _t.html("intro.ok"),
54257           buttonCallback: function() {
54258             reveal(".ideditor");
54259           }
54260         }
54261       );
54262     }
54263     chapter.enter = function() {
54264       addArea();
54265     };
54266     chapter.exit = function() {
54267       timeouts.forEach(window.clearTimeout);
54268       context.on("enter.intro exit.intro", null);
54269       context.map().on("move.intro drawn.intro", null);
54270       context.history().on("change.intro", null);
54271       context.container().select(".inspector-wrap").on("wheel.intro", null);
54272       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
54273       context.container().select(".more-fields .combobox-input").on("click.intro", null);
54274     };
54275     chapter.restart = function() {
54276       chapter.exit();
54277       chapter.enter();
54278     };
54279     return utilRebind(chapter, dispatch10, "on");
54280   }
54281
54282   // modules/ui/intro/line.js
54283   function uiIntroLine(context, reveal) {
54284     var dispatch10 = dispatch_default("done");
54285     var timeouts = [];
54286     var _tulipRoadID = null;
54287     var flowerRoadID = "w646";
54288     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
54289     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
54290     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
54291     var roadCategory = _mainPresetIndex.item("category-road_minor");
54292     var residentialPreset = _mainPresetIndex.item("highway/residential");
54293     var woodRoadID = "w525";
54294     var woodRoadEndID = "n2862";
54295     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
54296     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
54297     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
54298     var washingtonStreetID = "w522";
54299     var twelfthAvenueID = "w1";
54300     var eleventhAvenueEndID = "n3550";
54301     var twelfthAvenueEndID = "n5";
54302     var _washingtonSegmentID = null;
54303     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
54304     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
54305     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
54306     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
54307     var chapter = {
54308       title: "intro.lines.title"
54309     };
54310     function timeout2(f2, t) {
54311       timeouts.push(window.setTimeout(f2, t));
54312     }
54313     function eventCancel(d3_event) {
54314       d3_event.stopPropagation();
54315       d3_event.preventDefault();
54316     }
54317     function addLine() {
54318       context.enter(modeBrowse(context));
54319       context.history().reset("initial");
54320       var msec = transitionTime(tulipRoadStart, context.map().center());
54321       if (msec) {
54322         reveal(null, null, { duration: 0 });
54323       }
54324       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
54325       timeout2(function() {
54326         var tooltip = reveal(
54327           "button.add-line",
54328           helpHtml("intro.lines.add_line")
54329         );
54330         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
54331         context.on("enter.intro", function(mode) {
54332           if (mode.id !== "add-line")
54333             return;
54334           continueTo(startLine);
54335         });
54336       }, msec + 100);
54337       function continueTo(nextStep) {
54338         context.on("enter.intro", null);
54339         nextStep();
54340       }
54341     }
54342     function startLine() {
54343       if (context.mode().id !== "add-line")
54344         return chapter.restart();
54345       _tulipRoadID = null;
54346       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
54347       var box = pad(tulipRoadStart, padding, context);
54348       box.height = box.height + 100;
54349       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
54350       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
54351       reveal(box, startLineString);
54352       context.map().on("move.intro drawn.intro", function() {
54353         padding = 70 * Math.pow(2, context.map().zoom() - 18);
54354         box = pad(tulipRoadStart, padding, context);
54355         box.height = box.height + 100;
54356         reveal(box, startLineString, { duration: 0 });
54357       });
54358       context.on("enter.intro", function(mode) {
54359         if (mode.id !== "draw-line")
54360           return chapter.restart();
54361         continueTo(drawLine);
54362       });
54363       function continueTo(nextStep) {
54364         context.map().on("move.intro drawn.intro", null);
54365         context.on("enter.intro", null);
54366         nextStep();
54367       }
54368     }
54369     function drawLine() {
54370       if (context.mode().id !== "draw-line")
54371         return chapter.restart();
54372       _tulipRoadID = context.mode().selectedIDs()[0];
54373       context.map().centerEase(tulipRoadMidpoint, 500);
54374       timeout2(function() {
54375         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
54376         var box = pad(tulipRoadMidpoint, padding, context);
54377         box.height = box.height * 2;
54378         reveal(
54379           box,
54380           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
54381         );
54382         context.map().on("move.intro drawn.intro", function() {
54383           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
54384           box = pad(tulipRoadMidpoint, padding, context);
54385           box.height = box.height * 2;
54386           reveal(
54387             box,
54388             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
54389             { duration: 0 }
54390           );
54391         });
54392       }, 550);
54393       context.history().on("change.intro", function() {
54394         if (isLineConnected()) {
54395           continueTo(continueLine);
54396         }
54397       });
54398       context.on("enter.intro", function(mode) {
54399         if (mode.id === "draw-line") {
54400           return;
54401         } else if (mode.id === "select") {
54402           continueTo(retryIntersect);
54403           return;
54404         } else {
54405           return chapter.restart();
54406         }
54407       });
54408       function continueTo(nextStep) {
54409         context.map().on("move.intro drawn.intro", null);
54410         context.history().on("change.intro", null);
54411         context.on("enter.intro", null);
54412         nextStep();
54413       }
54414     }
54415     function isLineConnected() {
54416       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
54417       if (!entity)
54418         return false;
54419       var drawNodes = context.graph().childNodes(entity);
54420       return drawNodes.some(function(node) {
54421         return context.graph().parentWays(node).some(function(parent) {
54422           return parent.id === flowerRoadID;
54423         });
54424       });
54425     }
54426     function retryIntersect() {
54427       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
54428       var box = pad(tulipRoadIntersection, 80, context);
54429       reveal(
54430         box,
54431         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
54432       );
54433       timeout2(chapter.restart, 3e3);
54434     }
54435     function continueLine() {
54436       if (context.mode().id !== "draw-line")
54437         return chapter.restart();
54438       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
54439       if (!entity)
54440         return chapter.restart();
54441       context.map().centerEase(tulipRoadIntersection, 500);
54442       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
54443       reveal(".surface", continueLineText);
54444       context.on("enter.intro", function(mode) {
54445         if (mode.id === "draw-line") {
54446           return;
54447         } else if (mode.id === "select") {
54448           return continueTo(chooseCategoryRoad);
54449         } else {
54450           return chapter.restart();
54451         }
54452       });
54453       function continueTo(nextStep) {
54454         context.on("enter.intro", null);
54455         nextStep();
54456       }
54457     }
54458     function chooseCategoryRoad() {
54459       if (context.mode().id !== "select")
54460         return chapter.restart();
54461       context.on("exit.intro", function() {
54462         return chapter.restart();
54463       });
54464       var button = context.container().select(".preset-category-road_minor .preset-list-button");
54465       if (button.empty())
54466         return chapter.restart();
54467       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54468       timeout2(function() {
54469         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
54470         reveal(
54471           button.node(),
54472           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
54473         );
54474         button.on("click.intro", function() {
54475           continueTo(choosePresetResidential);
54476         });
54477       }, 400);
54478       function continueTo(nextStep) {
54479         context.container().select(".inspector-wrap").on("wheel.intro", null);
54480         context.container().select(".preset-list-button").on("click.intro", null);
54481         context.on("exit.intro", null);
54482         nextStep();
54483       }
54484     }
54485     function choosePresetResidential() {
54486       if (context.mode().id !== "select")
54487         return chapter.restart();
54488       context.on("exit.intro", function() {
54489         return chapter.restart();
54490       });
54491       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
54492       if (subgrid.empty())
54493         return chapter.restart();
54494       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
54495         continueTo(retryPresetResidential);
54496       });
54497       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
54498         continueTo(nameRoad);
54499       });
54500       timeout2(function() {
54501         reveal(
54502           subgrid.node(),
54503           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
54504           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
54505         );
54506       }, 300);
54507       function continueTo(nextStep) {
54508         context.container().select(".preset-list-button").on("click.intro", null);
54509         context.on("exit.intro", null);
54510         nextStep();
54511       }
54512     }
54513     function retryPresetResidential() {
54514       if (context.mode().id !== "select")
54515         return chapter.restart();
54516       context.on("exit.intro", function() {
54517         return chapter.restart();
54518       });
54519       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
54520       timeout2(function() {
54521         var button = context.container().select(".entity-editor-pane .preset-list-button");
54522         reveal(
54523           button.node(),
54524           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
54525         );
54526         button.on("click.intro", function() {
54527           continueTo(chooseCategoryRoad);
54528         });
54529       }, 500);
54530       function continueTo(nextStep) {
54531         context.container().select(".inspector-wrap").on("wheel.intro", null);
54532         context.container().select(".preset-list-button").on("click.intro", null);
54533         context.on("exit.intro", null);
54534         nextStep();
54535       }
54536     }
54537     function nameRoad() {
54538       context.on("exit.intro", function() {
54539         continueTo(didNameRoad);
54540       });
54541       timeout2(function() {
54542         reveal(
54543           ".entity-editor-pane",
54544           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
54545           { tooltipClass: "intro-lines-name_road" }
54546         );
54547       }, 500);
54548       function continueTo(nextStep) {
54549         context.on("exit.intro", null);
54550         nextStep();
54551       }
54552     }
54553     function didNameRoad() {
54554       context.history().checkpoint("doneAddLine");
54555       timeout2(function() {
54556         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
54557           buttonText: _t.html("intro.ok"),
54558           buttonCallback: function() {
54559             continueTo(updateLine);
54560           }
54561         });
54562       }, 500);
54563       function continueTo(nextStep) {
54564         nextStep();
54565       }
54566     }
54567     function updateLine() {
54568       context.history().reset("doneAddLine");
54569       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54570         return chapter.restart();
54571       }
54572       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
54573       if (msec) {
54574         reveal(null, null, { duration: 0 });
54575       }
54576       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
54577       timeout2(function() {
54578         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
54579         var box = pad(woodRoadDragMidpoint, padding, context);
54580         var advance = function() {
54581           continueTo(addNode);
54582         };
54583         reveal(
54584           box,
54585           helpHtml("intro.lines.update_line"),
54586           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
54587         );
54588         context.map().on("move.intro drawn.intro", function() {
54589           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
54590           var box2 = pad(woodRoadDragMidpoint, padding2, context);
54591           reveal(
54592             box2,
54593             helpHtml("intro.lines.update_line"),
54594             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
54595           );
54596         });
54597       }, msec + 100);
54598       function continueTo(nextStep) {
54599         context.map().on("move.intro drawn.intro", null);
54600         nextStep();
54601       }
54602     }
54603     function addNode() {
54604       context.history().reset("doneAddLine");
54605       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54606         return chapter.restart();
54607       }
54608       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
54609       var box = pad(woodRoadAddNode, padding, context);
54610       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
54611       reveal(box, addNodeString);
54612       context.map().on("move.intro drawn.intro", function() {
54613         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
54614         var box2 = pad(woodRoadAddNode, padding2, context);
54615         reveal(box2, addNodeString, { duration: 0 });
54616       });
54617       context.history().on("change.intro", function(changed) {
54618         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54619           return continueTo(updateLine);
54620         }
54621         if (changed.created().length === 1) {
54622           timeout2(function() {
54623             continueTo(startDragEndpoint);
54624           }, 500);
54625         }
54626       });
54627       context.on("enter.intro", function(mode) {
54628         if (mode.id !== "select") {
54629           continueTo(updateLine);
54630         }
54631       });
54632       function continueTo(nextStep) {
54633         context.map().on("move.intro drawn.intro", null);
54634         context.history().on("change.intro", null);
54635         context.on("enter.intro", null);
54636         nextStep();
54637       }
54638     }
54639     function startDragEndpoint() {
54640       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54641         return continueTo(updateLine);
54642       }
54643       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
54644       var box = pad(woodRoadDragEndpoint, padding, context);
54645       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
54646       reveal(box, startDragString);
54647       context.map().on("move.intro drawn.intro", function() {
54648         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54649           return continueTo(updateLine);
54650         }
54651         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
54652         var box2 = pad(woodRoadDragEndpoint, padding2, context);
54653         reveal(box2, startDragString, { duration: 0 });
54654         var entity = context.entity(woodRoadEndID);
54655         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
54656           continueTo(finishDragEndpoint);
54657         }
54658       });
54659       function continueTo(nextStep) {
54660         context.map().on("move.intro drawn.intro", null);
54661         nextStep();
54662       }
54663     }
54664     function finishDragEndpoint() {
54665       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54666         return continueTo(updateLine);
54667       }
54668       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
54669       var box = pad(woodRoadDragEndpoint, padding, context);
54670       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
54671       reveal(box, finishDragString);
54672       context.map().on("move.intro drawn.intro", function() {
54673         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54674           return continueTo(updateLine);
54675         }
54676         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
54677         var box2 = pad(woodRoadDragEndpoint, padding2, context);
54678         reveal(box2, finishDragString, { duration: 0 });
54679         var entity = context.entity(woodRoadEndID);
54680         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
54681           continueTo(startDragEndpoint);
54682         }
54683       });
54684       context.on("enter.intro", function() {
54685         continueTo(startDragMidpoint);
54686       });
54687       function continueTo(nextStep) {
54688         context.map().on("move.intro drawn.intro", null);
54689         context.on("enter.intro", null);
54690         nextStep();
54691       }
54692     }
54693     function startDragMidpoint() {
54694       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54695         return continueTo(updateLine);
54696       }
54697       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
54698         context.enter(modeSelect(context, [woodRoadID]));
54699       }
54700       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
54701       var box = pad(woodRoadDragMidpoint, padding, context);
54702       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
54703       context.map().on("move.intro drawn.intro", function() {
54704         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54705           return continueTo(updateLine);
54706         }
54707         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
54708         var box2 = pad(woodRoadDragMidpoint, padding2, context);
54709         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
54710       });
54711       context.history().on("change.intro", function(changed) {
54712         if (changed.created().length === 1) {
54713           continueTo(continueDragMidpoint);
54714         }
54715       });
54716       context.on("enter.intro", function(mode) {
54717         if (mode.id !== "select") {
54718           context.enter(modeSelect(context, [woodRoadID]));
54719         }
54720       });
54721       function continueTo(nextStep) {
54722         context.map().on("move.intro drawn.intro", null);
54723         context.history().on("change.intro", null);
54724         context.on("enter.intro", null);
54725         nextStep();
54726       }
54727     }
54728     function continueDragMidpoint() {
54729       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54730         return continueTo(updateLine);
54731       }
54732       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
54733       var box = pad(woodRoadDragEndpoint, padding, context);
54734       box.height += 400;
54735       var advance = function() {
54736         context.history().checkpoint("doneUpdateLine");
54737         continueTo(deleteLines);
54738       };
54739       reveal(
54740         box,
54741         helpHtml("intro.lines.continue_drag_midpoint"),
54742         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
54743       );
54744       context.map().on("move.intro drawn.intro", function() {
54745         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
54746           return continueTo(updateLine);
54747         }
54748         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
54749         var box2 = pad(woodRoadDragEndpoint, padding2, context);
54750         box2.height += 400;
54751         reveal(
54752           box2,
54753           helpHtml("intro.lines.continue_drag_midpoint"),
54754           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
54755         );
54756       });
54757       function continueTo(nextStep) {
54758         context.map().on("move.intro drawn.intro", null);
54759         nextStep();
54760       }
54761     }
54762     function deleteLines() {
54763       context.history().reset("doneUpdateLine");
54764       context.enter(modeBrowse(context));
54765       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54766         return chapter.restart();
54767       }
54768       var msec = transitionTime(deleteLinesLoc, context.map().center());
54769       if (msec) {
54770         reveal(null, null, { duration: 0 });
54771       }
54772       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
54773       timeout2(function() {
54774         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54775         var box = pad(deleteLinesLoc, padding, context);
54776         box.top -= 200;
54777         box.height += 400;
54778         var advance = function() {
54779           continueTo(rightClickIntersection);
54780         };
54781         reveal(
54782           box,
54783           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
54784           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
54785         );
54786         context.map().on("move.intro drawn.intro", function() {
54787           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54788           var box2 = pad(deleteLinesLoc, padding2, context);
54789           box2.top -= 200;
54790           box2.height += 400;
54791           reveal(
54792             box2,
54793             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
54794             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
54795           );
54796         });
54797         context.history().on("change.intro", function() {
54798           timeout2(function() {
54799             continueTo(deleteLines);
54800           }, 500);
54801         });
54802       }, msec + 100);
54803       function continueTo(nextStep) {
54804         context.map().on("move.intro drawn.intro", null);
54805         context.history().on("change.intro", null);
54806         nextStep();
54807       }
54808     }
54809     function rightClickIntersection() {
54810       context.history().reset("doneUpdateLine");
54811       context.enter(modeBrowse(context));
54812       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
54813       var rightClickString = helpHtml("intro.lines.split_street", {
54814         street1: _t("intro.graph.name.11th-avenue"),
54815         street2: _t("intro.graph.name.washington-street")
54816       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
54817       timeout2(function() {
54818         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
54819         var box = pad(eleventhAvenueEnd, padding, context);
54820         reveal(box, rightClickString);
54821         context.map().on("move.intro drawn.intro", function() {
54822           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
54823           var box2 = pad(eleventhAvenueEnd, padding2, context);
54824           reveal(
54825             box2,
54826             rightClickString,
54827             { duration: 0 }
54828           );
54829         });
54830         context.on("enter.intro", function(mode) {
54831           if (mode.id !== "select")
54832             return;
54833           var ids = context.selectedIDs();
54834           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
54835             return;
54836           timeout2(function() {
54837             var node = selectMenuItem(context, "split").node();
54838             if (!node)
54839               return;
54840             continueTo(splitIntersection);
54841           }, 50);
54842         });
54843         context.history().on("change.intro", function() {
54844           timeout2(function() {
54845             continueTo(deleteLines);
54846           }, 300);
54847         });
54848       }, 600);
54849       function continueTo(nextStep) {
54850         context.map().on("move.intro drawn.intro", null);
54851         context.on("enter.intro", null);
54852         context.history().on("change.intro", null);
54853         nextStep();
54854       }
54855     }
54856     function splitIntersection() {
54857       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54858         return continueTo(deleteLines);
54859       }
54860       var node = selectMenuItem(context, "split").node();
54861       if (!node) {
54862         return continueTo(rightClickIntersection);
54863       }
54864       var wasChanged = false;
54865       _washingtonSegmentID = null;
54866       reveal(
54867         ".edit-menu",
54868         helpHtml(
54869           "intro.lines.split_intersection",
54870           { street: _t("intro.graph.name.washington-street") }
54871         ),
54872         { padding: 50 }
54873       );
54874       context.map().on("move.intro drawn.intro", function() {
54875         var node2 = selectMenuItem(context, "split").node();
54876         if (!wasChanged && !node2) {
54877           return continueTo(rightClickIntersection);
54878         }
54879         reveal(
54880           ".edit-menu",
54881           helpHtml(
54882             "intro.lines.split_intersection",
54883             { street: _t("intro.graph.name.washington-street") }
54884           ),
54885           { duration: 0, padding: 50 }
54886         );
54887       });
54888       context.history().on("change.intro", function(changed) {
54889         wasChanged = true;
54890         timeout2(function() {
54891           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
54892             _washingtonSegmentID = changed.created()[0].id;
54893             continueTo(didSplit);
54894           } else {
54895             _washingtonSegmentID = null;
54896             continueTo(retrySplit);
54897           }
54898         }, 300);
54899       });
54900       function continueTo(nextStep) {
54901         context.map().on("move.intro drawn.intro", null);
54902         context.history().on("change.intro", null);
54903         nextStep();
54904       }
54905     }
54906     function retrySplit() {
54907       context.enter(modeBrowse(context));
54908       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
54909       var advance = function() {
54910         continueTo(rightClickIntersection);
54911       };
54912       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
54913       var box = pad(eleventhAvenueEnd, padding, context);
54914       reveal(
54915         box,
54916         helpHtml("intro.lines.retry_split"),
54917         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
54918       );
54919       context.map().on("move.intro drawn.intro", function() {
54920         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
54921         var box2 = pad(eleventhAvenueEnd, padding2, context);
54922         reveal(
54923           box2,
54924           helpHtml("intro.lines.retry_split"),
54925           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
54926         );
54927       });
54928       function continueTo(nextStep) {
54929         context.map().on("move.intro drawn.intro", null);
54930         nextStep();
54931       }
54932     }
54933     function didSplit() {
54934       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54935         return continueTo(rightClickIntersection);
54936       }
54937       var ids = context.selectedIDs();
54938       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
54939       var street = _t("intro.graph.name.washington-street");
54940       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
54941       var box = pad(twelfthAvenue, padding, context);
54942       box.width = box.width / 2;
54943       reveal(
54944         box,
54945         helpHtml(string, { street1: street, street2: street }),
54946         { duration: 500 }
54947       );
54948       timeout2(function() {
54949         context.map().centerZoomEase(twelfthAvenue, 18, 500);
54950         context.map().on("move.intro drawn.intro", function() {
54951           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
54952           var box2 = pad(twelfthAvenue, padding2, context);
54953           box2.width = box2.width / 2;
54954           reveal(
54955             box2,
54956             helpHtml(string, { street1: street, street2: street }),
54957             { duration: 0 }
54958           );
54959         });
54960       }, 600);
54961       context.on("enter.intro", function() {
54962         var ids2 = context.selectedIDs();
54963         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
54964           continueTo(multiSelect);
54965         }
54966       });
54967       context.history().on("change.intro", function() {
54968         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54969           return continueTo(rightClickIntersection);
54970         }
54971       });
54972       function continueTo(nextStep) {
54973         context.map().on("move.intro drawn.intro", null);
54974         context.on("enter.intro", null);
54975         context.history().on("change.intro", null);
54976         nextStep();
54977       }
54978     }
54979     function multiSelect() {
54980       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
54981         return continueTo(rightClickIntersection);
54982       }
54983       var ids = context.selectedIDs();
54984       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
54985       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
54986       if (hasWashington && hasTwelfth) {
54987         return continueTo(multiRightClick);
54988       } else if (!hasWashington && !hasTwelfth) {
54989         return continueTo(didSplit);
54990       }
54991       context.map().centerZoomEase(twelfthAvenue, 18, 500);
54992       timeout2(function() {
54993         var selected, other, padding, box;
54994         if (hasWashington) {
54995           selected = _t("intro.graph.name.washington-street");
54996           other = _t("intro.graph.name.12th-avenue");
54997           padding = 60 * Math.pow(2, context.map().zoom() - 18);
54998           box = pad(twelfthAvenueEnd, padding, context);
54999           box.width *= 3;
55000         } else {
55001           selected = _t("intro.graph.name.12th-avenue");
55002           other = _t("intro.graph.name.washington-street");
55003           padding = 200 * Math.pow(2, context.map().zoom() - 18);
55004           box = pad(twelfthAvenue, padding, context);
55005           box.width /= 2;
55006         }
55007         reveal(
55008           box,
55009           helpHtml(
55010             "intro.lines.multi_select",
55011             { selected, other1: other }
55012           ) + " " + helpHtml(
55013             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
55014             { selected, other2: other }
55015           )
55016         );
55017         context.map().on("move.intro drawn.intro", function() {
55018           if (hasWashington) {
55019             selected = _t("intro.graph.name.washington-street");
55020             other = _t("intro.graph.name.12th-avenue");
55021             padding = 60 * Math.pow(2, context.map().zoom() - 18);
55022             box = pad(twelfthAvenueEnd, padding, context);
55023             box.width *= 3;
55024           } else {
55025             selected = _t("intro.graph.name.12th-avenue");
55026             other = _t("intro.graph.name.washington-street");
55027             padding = 200 * Math.pow(2, context.map().zoom() - 18);
55028             box = pad(twelfthAvenue, padding, context);
55029             box.width /= 2;
55030           }
55031           reveal(
55032             box,
55033             helpHtml(
55034               "intro.lines.multi_select",
55035               { selected, other1: other }
55036             ) + " " + helpHtml(
55037               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
55038               { selected, other2: other }
55039             ),
55040             { duration: 0 }
55041           );
55042         });
55043         context.on("enter.intro", function() {
55044           continueTo(multiSelect);
55045         });
55046         context.history().on("change.intro", function() {
55047           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55048             return continueTo(rightClickIntersection);
55049           }
55050         });
55051       }, 600);
55052       function continueTo(nextStep) {
55053         context.map().on("move.intro drawn.intro", null);
55054         context.on("enter.intro", null);
55055         context.history().on("change.intro", null);
55056         nextStep();
55057       }
55058     }
55059     function multiRightClick() {
55060       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55061         return continueTo(rightClickIntersection);
55062       }
55063       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
55064       var box = pad(twelfthAvenue, padding, context);
55065       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
55066       reveal(box, rightClickString);
55067       context.map().on("move.intro drawn.intro", function() {
55068         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
55069         var box2 = pad(twelfthAvenue, padding2, context);
55070         reveal(box2, rightClickString, { duration: 0 });
55071       });
55072       context.ui().editMenu().on("toggled.intro", function(open) {
55073         if (!open)
55074           return;
55075         timeout2(function() {
55076           var ids = context.selectedIDs();
55077           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
55078             var node = selectMenuItem(context, "delete").node();
55079             if (!node)
55080               return;
55081             continueTo(multiDelete);
55082           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
55083             return continueTo(multiSelect);
55084           } else {
55085             return continueTo(didSplit);
55086           }
55087         }, 300);
55088       });
55089       context.history().on("change.intro", function() {
55090         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55091           return continueTo(rightClickIntersection);
55092         }
55093       });
55094       function continueTo(nextStep) {
55095         context.map().on("move.intro drawn.intro", null);
55096         context.ui().editMenu().on("toggled.intro", null);
55097         context.history().on("change.intro", null);
55098         nextStep();
55099       }
55100     }
55101     function multiDelete() {
55102       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
55103         return continueTo(rightClickIntersection);
55104       }
55105       var node = selectMenuItem(context, "delete").node();
55106       if (!node)
55107         return continueTo(multiRightClick);
55108       reveal(
55109         ".edit-menu",
55110         helpHtml("intro.lines.multi_delete"),
55111         { padding: 50 }
55112       );
55113       context.map().on("move.intro drawn.intro", function() {
55114         reveal(
55115           ".edit-menu",
55116           helpHtml("intro.lines.multi_delete"),
55117           { duration: 0, padding: 50 }
55118         );
55119       });
55120       context.on("exit.intro", function() {
55121         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
55122           return continueTo(multiSelect);
55123         }
55124       });
55125       context.history().on("change.intro", function() {
55126         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
55127           continueTo(retryDelete);
55128         } else {
55129           continueTo(play);
55130         }
55131       });
55132       function continueTo(nextStep) {
55133         context.map().on("move.intro drawn.intro", null);
55134         context.on("exit.intro", null);
55135         context.history().on("change.intro", null);
55136         nextStep();
55137       }
55138     }
55139     function retryDelete() {
55140       context.enter(modeBrowse(context));
55141       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
55142       var box = pad(twelfthAvenue, padding, context);
55143       reveal(box, helpHtml("intro.lines.retry_delete"), {
55144         buttonText: _t.html("intro.ok"),
55145         buttonCallback: function() {
55146           continueTo(multiSelect);
55147         }
55148       });
55149       function continueTo(nextStep) {
55150         nextStep();
55151       }
55152     }
55153     function play() {
55154       dispatch10.call("done");
55155       reveal(
55156         ".ideditor",
55157         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
55158         {
55159           tooltipBox: ".intro-nav-wrap .chapter-building",
55160           buttonText: _t.html("intro.ok"),
55161           buttonCallback: function() {
55162             reveal(".ideditor");
55163           }
55164         }
55165       );
55166     }
55167     chapter.enter = function() {
55168       addLine();
55169     };
55170     chapter.exit = function() {
55171       timeouts.forEach(window.clearTimeout);
55172       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
55173       context.on("enter.intro exit.intro", null);
55174       context.map().on("move.intro drawn.intro", null);
55175       context.history().on("change.intro", null);
55176       context.container().select(".inspector-wrap").on("wheel.intro", null);
55177       context.container().select(".preset-list-button").on("click.intro", null);
55178     };
55179     chapter.restart = function() {
55180       chapter.exit();
55181       chapter.enter();
55182     };
55183     return utilRebind(chapter, dispatch10, "on");
55184   }
55185
55186   // modules/ui/intro/building.js
55187   function uiIntroBuilding(context, reveal) {
55188     var dispatch10 = dispatch_default("done");
55189     var house = [-85.62815, 41.95638];
55190     var tank = [-85.62732, 41.95347];
55191     var buildingCatetory = _mainPresetIndex.item("category-building");
55192     var housePreset = _mainPresetIndex.item("building/house");
55193     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
55194     var timeouts = [];
55195     var _houseID = null;
55196     var _tankID = null;
55197     var chapter = {
55198       title: "intro.buildings.title"
55199     };
55200     function timeout2(f2, t) {
55201       timeouts.push(window.setTimeout(f2, t));
55202     }
55203     function eventCancel(d3_event) {
55204       d3_event.stopPropagation();
55205       d3_event.preventDefault();
55206     }
55207     function revealHouse(center, text2, options2) {
55208       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
55209       var box = pad(center, padding, context);
55210       reveal(box, text2, options2);
55211     }
55212     function revealTank(center, text2, options2) {
55213       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
55214       var box = pad(center, padding, context);
55215       reveal(box, text2, options2);
55216     }
55217     function addHouse() {
55218       context.enter(modeBrowse(context));
55219       context.history().reset("initial");
55220       _houseID = null;
55221       var msec = transitionTime(house, context.map().center());
55222       if (msec) {
55223         reveal(null, null, { duration: 0 });
55224       }
55225       context.map().centerZoomEase(house, 19, msec);
55226       timeout2(function() {
55227         var tooltip = reveal(
55228           "button.add-area",
55229           helpHtml("intro.buildings.add_building")
55230         );
55231         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
55232         context.on("enter.intro", function(mode) {
55233           if (mode.id !== "add-area")
55234             return;
55235           continueTo(startHouse);
55236         });
55237       }, msec + 100);
55238       function continueTo(nextStep) {
55239         context.on("enter.intro", null);
55240         nextStep();
55241       }
55242     }
55243     function startHouse() {
55244       if (context.mode().id !== "add-area") {
55245         return continueTo(addHouse);
55246       }
55247       _houseID = null;
55248       context.map().zoomEase(20, 500);
55249       timeout2(function() {
55250         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
55251         revealHouse(house, startString);
55252         context.map().on("move.intro drawn.intro", function() {
55253           revealHouse(house, startString, { duration: 0 });
55254         });
55255         context.on("enter.intro", function(mode) {
55256           if (mode.id !== "draw-area")
55257             return chapter.restart();
55258           continueTo(continueHouse);
55259         });
55260       }, 550);
55261       function continueTo(nextStep) {
55262         context.map().on("move.intro drawn.intro", null);
55263         context.on("enter.intro", null);
55264         nextStep();
55265       }
55266     }
55267     function continueHouse() {
55268       if (context.mode().id !== "draw-area") {
55269         return continueTo(addHouse);
55270       }
55271       _houseID = null;
55272       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
55273       revealHouse(house, continueString);
55274       context.map().on("move.intro drawn.intro", function() {
55275         revealHouse(house, continueString, { duration: 0 });
55276       });
55277       context.on("enter.intro", function(mode) {
55278         if (mode.id === "draw-area") {
55279           return;
55280         } else if (mode.id === "select") {
55281           var graph = context.graph();
55282           var way = context.entity(context.selectedIDs()[0]);
55283           var nodes = graph.childNodes(way);
55284           var points = utilArrayUniq(nodes).map(function(n2) {
55285             return context.projection(n2.loc);
55286           });
55287           if (isMostlySquare(points)) {
55288             _houseID = way.id;
55289             return continueTo(chooseCategoryBuilding);
55290           } else {
55291             return continueTo(retryHouse);
55292           }
55293         } else {
55294           return chapter.restart();
55295         }
55296       });
55297       function continueTo(nextStep) {
55298         context.map().on("move.intro drawn.intro", null);
55299         context.on("enter.intro", null);
55300         nextStep();
55301       }
55302     }
55303     function retryHouse() {
55304       var onClick = function() {
55305         continueTo(addHouse);
55306       };
55307       revealHouse(
55308         house,
55309         helpHtml("intro.buildings.retry_building"),
55310         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55311       );
55312       context.map().on("move.intro drawn.intro", function() {
55313         revealHouse(
55314           house,
55315           helpHtml("intro.buildings.retry_building"),
55316           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
55317         );
55318       });
55319       function continueTo(nextStep) {
55320         context.map().on("move.intro drawn.intro", null);
55321         nextStep();
55322       }
55323     }
55324     function chooseCategoryBuilding() {
55325       if (!_houseID || !context.hasEntity(_houseID)) {
55326         return addHouse();
55327       }
55328       var ids = context.selectedIDs();
55329       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
55330         context.enter(modeSelect(context, [_houseID]));
55331       }
55332       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55333       timeout2(function() {
55334         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
55335         var button = context.container().select(".preset-category-building .preset-list-button");
55336         reveal(
55337           button.node(),
55338           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
55339         );
55340         button.on("click.intro", function() {
55341           button.on("click.intro", null);
55342           continueTo(choosePresetHouse);
55343         });
55344       }, 400);
55345       context.on("enter.intro", function(mode) {
55346         if (!_houseID || !context.hasEntity(_houseID)) {
55347           return continueTo(addHouse);
55348         }
55349         var ids2 = context.selectedIDs();
55350         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
55351           return continueTo(chooseCategoryBuilding);
55352         }
55353       });
55354       function continueTo(nextStep) {
55355         context.container().select(".inspector-wrap").on("wheel.intro", null);
55356         context.container().select(".preset-list-button").on("click.intro", null);
55357         context.on("enter.intro", null);
55358         nextStep();
55359       }
55360     }
55361     function choosePresetHouse() {
55362       if (!_houseID || !context.hasEntity(_houseID)) {
55363         return addHouse();
55364       }
55365       var ids = context.selectedIDs();
55366       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
55367         context.enter(modeSelect(context, [_houseID]));
55368       }
55369       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55370       timeout2(function() {
55371         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
55372         var button = context.container().select(".preset-building-house .preset-list-button");
55373         reveal(
55374           button.node(),
55375           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
55376           { duration: 300 }
55377         );
55378         button.on("click.intro", function() {
55379           button.on("click.intro", null);
55380           continueTo(closeEditorHouse);
55381         });
55382       }, 400);
55383       context.on("enter.intro", function(mode) {
55384         if (!_houseID || !context.hasEntity(_houseID)) {
55385           return continueTo(addHouse);
55386         }
55387         var ids2 = context.selectedIDs();
55388         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
55389           return continueTo(chooseCategoryBuilding);
55390         }
55391       });
55392       function continueTo(nextStep) {
55393         context.container().select(".inspector-wrap").on("wheel.intro", null);
55394         context.container().select(".preset-list-button").on("click.intro", null);
55395         context.on("enter.intro", null);
55396         nextStep();
55397       }
55398     }
55399     function closeEditorHouse() {
55400       if (!_houseID || !context.hasEntity(_houseID)) {
55401         return addHouse();
55402       }
55403       var ids = context.selectedIDs();
55404       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
55405         context.enter(modeSelect(context, [_houseID]));
55406       }
55407       context.history().checkpoint("hasHouse");
55408       context.on("exit.intro", function() {
55409         continueTo(rightClickHouse);
55410       });
55411       timeout2(function() {
55412         reveal(
55413           ".entity-editor-pane",
55414           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
55415         );
55416       }, 500);
55417       function continueTo(nextStep) {
55418         context.on("exit.intro", null);
55419         nextStep();
55420       }
55421     }
55422     function rightClickHouse() {
55423       if (!_houseID)
55424         return chapter.restart();
55425       context.enter(modeBrowse(context));
55426       context.history().reset("hasHouse");
55427       var zoom = context.map().zoom();
55428       if (zoom < 20) {
55429         zoom = 20;
55430       }
55431       context.map().centerZoomEase(house, zoom, 500);
55432       context.on("enter.intro", function(mode) {
55433         if (mode.id !== "select")
55434           return;
55435         var ids = context.selectedIDs();
55436         if (ids.length !== 1 || ids[0] !== _houseID)
55437           return;
55438         timeout2(function() {
55439           var node = selectMenuItem(context, "orthogonalize").node();
55440           if (!node)
55441             return;
55442           continueTo(clickSquare);
55443         }, 50);
55444       });
55445       context.map().on("move.intro drawn.intro", function() {
55446         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
55447         revealHouse(house, rightclickString, { duration: 0 });
55448       });
55449       context.history().on("change.intro", function() {
55450         continueTo(rightClickHouse);
55451       });
55452       function continueTo(nextStep) {
55453         context.on("enter.intro", null);
55454         context.map().on("move.intro drawn.intro", null);
55455         context.history().on("change.intro", null);
55456         nextStep();
55457       }
55458     }
55459     function clickSquare() {
55460       if (!_houseID)
55461         return chapter.restart();
55462       var entity = context.hasEntity(_houseID);
55463       if (!entity)
55464         return continueTo(rightClickHouse);
55465       var node = selectMenuItem(context, "orthogonalize").node();
55466       if (!node) {
55467         return continueTo(rightClickHouse);
55468       }
55469       var wasChanged = false;
55470       reveal(
55471         ".edit-menu",
55472         helpHtml("intro.buildings.square_building"),
55473         { padding: 50 }
55474       );
55475       context.on("enter.intro", function(mode) {
55476         if (mode.id === "browse") {
55477           continueTo(rightClickHouse);
55478         } else if (mode.id === "move" || mode.id === "rotate") {
55479           continueTo(retryClickSquare);
55480         }
55481       });
55482       context.map().on("move.intro", function() {
55483         var node2 = selectMenuItem(context, "orthogonalize").node();
55484         if (!wasChanged && !node2) {
55485           return continueTo(rightClickHouse);
55486         }
55487         reveal(
55488           ".edit-menu",
55489           helpHtml("intro.buildings.square_building"),
55490           { duration: 0, padding: 50 }
55491         );
55492       });
55493       context.history().on("change.intro", function() {
55494         wasChanged = true;
55495         context.history().on("change.intro", null);
55496         timeout2(function() {
55497           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
55498             continueTo(doneSquare);
55499           } else {
55500             continueTo(retryClickSquare);
55501           }
55502         }, 500);
55503       });
55504       function continueTo(nextStep) {
55505         context.on("enter.intro", null);
55506         context.map().on("move.intro", null);
55507         context.history().on("change.intro", null);
55508         nextStep();
55509       }
55510     }
55511     function retryClickSquare() {
55512       context.enter(modeBrowse(context));
55513       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
55514         buttonText: _t.html("intro.ok"),
55515         buttonCallback: function() {
55516           continueTo(rightClickHouse);
55517         }
55518       });
55519       function continueTo(nextStep) {
55520         nextStep();
55521       }
55522     }
55523     function doneSquare() {
55524       context.history().checkpoint("doneSquare");
55525       revealHouse(house, helpHtml("intro.buildings.done_square"), {
55526         buttonText: _t.html("intro.ok"),
55527         buttonCallback: function() {
55528           continueTo(addTank);
55529         }
55530       });
55531       function continueTo(nextStep) {
55532         nextStep();
55533       }
55534     }
55535     function addTank() {
55536       context.enter(modeBrowse(context));
55537       context.history().reset("doneSquare");
55538       _tankID = null;
55539       var msec = transitionTime(tank, context.map().center());
55540       if (msec) {
55541         reveal(null, null, { duration: 0 });
55542       }
55543       context.map().centerZoomEase(tank, 19.5, msec);
55544       timeout2(function() {
55545         reveal(
55546           "button.add-area",
55547           helpHtml("intro.buildings.add_tank")
55548         );
55549         context.on("enter.intro", function(mode) {
55550           if (mode.id !== "add-area")
55551             return;
55552           continueTo(startTank);
55553         });
55554       }, msec + 100);
55555       function continueTo(nextStep) {
55556         context.on("enter.intro", null);
55557         nextStep();
55558       }
55559     }
55560     function startTank() {
55561       if (context.mode().id !== "add-area") {
55562         return continueTo(addTank);
55563       }
55564       _tankID = null;
55565       timeout2(function() {
55566         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
55567         revealTank(tank, startString);
55568         context.map().on("move.intro drawn.intro", function() {
55569           revealTank(tank, startString, { duration: 0 });
55570         });
55571         context.on("enter.intro", function(mode) {
55572           if (mode.id !== "draw-area")
55573             return chapter.restart();
55574           continueTo(continueTank);
55575         });
55576       }, 550);
55577       function continueTo(nextStep) {
55578         context.map().on("move.intro drawn.intro", null);
55579         context.on("enter.intro", null);
55580         nextStep();
55581       }
55582     }
55583     function continueTank() {
55584       if (context.mode().id !== "draw-area") {
55585         return continueTo(addTank);
55586       }
55587       _tankID = null;
55588       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
55589       revealTank(tank, continueString);
55590       context.map().on("move.intro drawn.intro", function() {
55591         revealTank(tank, continueString, { duration: 0 });
55592       });
55593       context.on("enter.intro", function(mode) {
55594         if (mode.id === "draw-area") {
55595           return;
55596         } else if (mode.id === "select") {
55597           _tankID = context.selectedIDs()[0];
55598           return continueTo(searchPresetTank);
55599         } else {
55600           return continueTo(addTank);
55601         }
55602       });
55603       function continueTo(nextStep) {
55604         context.map().on("move.intro drawn.intro", null);
55605         context.on("enter.intro", null);
55606         nextStep();
55607       }
55608     }
55609     function searchPresetTank() {
55610       if (!_tankID || !context.hasEntity(_tankID)) {
55611         return addTank();
55612       }
55613       var ids = context.selectedIDs();
55614       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
55615         context.enter(modeSelect(context, [_tankID]));
55616       }
55617       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55618       timeout2(function() {
55619         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
55620         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
55621         reveal(
55622           ".preset-search-input",
55623           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
55624         );
55625       }, 400);
55626       context.on("enter.intro", function(mode) {
55627         if (!_tankID || !context.hasEntity(_tankID)) {
55628           return continueTo(addTank);
55629         }
55630         var ids2 = context.selectedIDs();
55631         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
55632           context.enter(modeSelect(context, [_tankID]));
55633           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
55634           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
55635           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
55636           reveal(
55637             ".preset-search-input",
55638             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
55639           );
55640           context.history().on("change.intro", null);
55641         }
55642       });
55643       function checkPresetSearch() {
55644         var first = context.container().select(".preset-list-item:first-child");
55645         if (first.classed("preset-man_made-storage_tank")) {
55646           reveal(
55647             first.select(".preset-list-button").node(),
55648             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
55649             { duration: 300 }
55650           );
55651           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
55652           context.history().on("change.intro", function() {
55653             continueTo(closeEditorTank);
55654           });
55655         }
55656       }
55657       function continueTo(nextStep) {
55658         context.container().select(".inspector-wrap").on("wheel.intro", null);
55659         context.on("enter.intro", null);
55660         context.history().on("change.intro", null);
55661         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
55662         nextStep();
55663       }
55664     }
55665     function closeEditorTank() {
55666       if (!_tankID || !context.hasEntity(_tankID)) {
55667         return addTank();
55668       }
55669       var ids = context.selectedIDs();
55670       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
55671         context.enter(modeSelect(context, [_tankID]));
55672       }
55673       context.history().checkpoint("hasTank");
55674       context.on("exit.intro", function() {
55675         continueTo(rightClickTank);
55676       });
55677       timeout2(function() {
55678         reveal(
55679           ".entity-editor-pane",
55680           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
55681         );
55682       }, 500);
55683       function continueTo(nextStep) {
55684         context.on("exit.intro", null);
55685         nextStep();
55686       }
55687     }
55688     function rightClickTank() {
55689       if (!_tankID)
55690         return continueTo(addTank);
55691       context.enter(modeBrowse(context));
55692       context.history().reset("hasTank");
55693       context.map().centerEase(tank, 500);
55694       timeout2(function() {
55695         context.on("enter.intro", function(mode) {
55696           if (mode.id !== "select")
55697             return;
55698           var ids = context.selectedIDs();
55699           if (ids.length !== 1 || ids[0] !== _tankID)
55700             return;
55701           timeout2(function() {
55702             var node = selectMenuItem(context, "circularize").node();
55703             if (!node)
55704               return;
55705             continueTo(clickCircle);
55706           }, 50);
55707         });
55708         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
55709         revealTank(tank, rightclickString);
55710         context.map().on("move.intro drawn.intro", function() {
55711           revealTank(tank, rightclickString, { duration: 0 });
55712         });
55713         context.history().on("change.intro", function() {
55714           continueTo(rightClickTank);
55715         });
55716       }, 600);
55717       function continueTo(nextStep) {
55718         context.on("enter.intro", null);
55719         context.map().on("move.intro drawn.intro", null);
55720         context.history().on("change.intro", null);
55721         nextStep();
55722       }
55723     }
55724     function clickCircle() {
55725       if (!_tankID)
55726         return chapter.restart();
55727       var entity = context.hasEntity(_tankID);
55728       if (!entity)
55729         return continueTo(rightClickTank);
55730       var node = selectMenuItem(context, "circularize").node();
55731       if (!node) {
55732         return continueTo(rightClickTank);
55733       }
55734       var wasChanged = false;
55735       reveal(
55736         ".edit-menu",
55737         helpHtml("intro.buildings.circle_tank"),
55738         { padding: 50 }
55739       );
55740       context.on("enter.intro", function(mode) {
55741         if (mode.id === "browse") {
55742           continueTo(rightClickTank);
55743         } else if (mode.id === "move" || mode.id === "rotate") {
55744           continueTo(retryClickCircle);
55745         }
55746       });
55747       context.map().on("move.intro", function() {
55748         var node2 = selectMenuItem(context, "circularize").node();
55749         if (!wasChanged && !node2) {
55750           return continueTo(rightClickTank);
55751         }
55752         reveal(
55753           ".edit-menu",
55754           helpHtml("intro.buildings.circle_tank"),
55755           { duration: 0, padding: 50 }
55756         );
55757       });
55758       context.history().on("change.intro", function() {
55759         wasChanged = true;
55760         context.history().on("change.intro", null);
55761         timeout2(function() {
55762           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
55763             continueTo(play);
55764           } else {
55765             continueTo(retryClickCircle);
55766           }
55767         }, 500);
55768       });
55769       function continueTo(nextStep) {
55770         context.on("enter.intro", null);
55771         context.map().on("move.intro", null);
55772         context.history().on("change.intro", null);
55773         nextStep();
55774       }
55775     }
55776     function retryClickCircle() {
55777       context.enter(modeBrowse(context));
55778       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
55779         buttonText: _t.html("intro.ok"),
55780         buttonCallback: function() {
55781           continueTo(rightClickTank);
55782         }
55783       });
55784       function continueTo(nextStep) {
55785         nextStep();
55786       }
55787     }
55788     function play() {
55789       dispatch10.call("done");
55790       reveal(
55791         ".ideditor",
55792         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
55793         {
55794           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
55795           buttonText: _t.html("intro.ok"),
55796           buttonCallback: function() {
55797             reveal(".ideditor");
55798           }
55799         }
55800       );
55801     }
55802     chapter.enter = function() {
55803       addHouse();
55804     };
55805     chapter.exit = function() {
55806       timeouts.forEach(window.clearTimeout);
55807       context.on("enter.intro exit.intro", null);
55808       context.map().on("move.intro drawn.intro", null);
55809       context.history().on("change.intro", null);
55810       context.container().select(".inspector-wrap").on("wheel.intro", null);
55811       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
55812       context.container().select(".more-fields .combobox-input").on("click.intro", null);
55813     };
55814     chapter.restart = function() {
55815       chapter.exit();
55816       chapter.enter();
55817     };
55818     return utilRebind(chapter, dispatch10, "on");
55819   }
55820
55821   // modules/ui/intro/start_editing.js
55822   function uiIntroStartEditing(context, reveal) {
55823     var dispatch10 = dispatch_default("done", "startEditing");
55824     var modalSelection = select_default2(null);
55825     var chapter = {
55826       title: "intro.startediting.title"
55827     };
55828     function showHelp() {
55829       reveal(
55830         ".map-control.help-control",
55831         helpHtml("intro.startediting.help"),
55832         {
55833           buttonText: _t.html("intro.ok"),
55834           buttonCallback: function() {
55835             shortcuts();
55836           }
55837         }
55838       );
55839     }
55840     function shortcuts() {
55841       reveal(
55842         ".map-control.help-control",
55843         helpHtml("intro.startediting.shortcuts"),
55844         {
55845           buttonText: _t.html("intro.ok"),
55846           buttonCallback: function() {
55847             showSave();
55848           }
55849         }
55850       );
55851     }
55852     function showSave() {
55853       context.container().selectAll(".shaded").remove();
55854       reveal(
55855         ".top-toolbar button.save",
55856         helpHtml("intro.startediting.save"),
55857         {
55858           buttonText: _t.html("intro.ok"),
55859           buttonCallback: function() {
55860             showStart();
55861           }
55862         }
55863       );
55864     }
55865     function showStart() {
55866       context.container().selectAll(".shaded").remove();
55867       modalSelection = uiModal(context.container());
55868       modalSelection.select(".modal").attr("class", "modal-splash modal");
55869       modalSelection.selectAll(".close").remove();
55870       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
55871         modalSelection.remove();
55872       });
55873       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
55874       startbutton.append("h2").call(_t.append("intro.startediting.start"));
55875       dispatch10.call("startEditing");
55876     }
55877     chapter.enter = function() {
55878       showHelp();
55879     };
55880     chapter.exit = function() {
55881       modalSelection.remove();
55882       context.container().selectAll(".shaded").remove();
55883     };
55884     return utilRebind(chapter, dispatch10, "on");
55885   }
55886
55887   // modules/ui/intro/intro.js
55888   var chapterUi = {
55889     welcome: uiIntroWelcome,
55890     navigation: uiIntroNavigation,
55891     point: uiIntroPoint,
55892     area: uiIntroArea,
55893     line: uiIntroLine,
55894     building: uiIntroBuilding,
55895     startEditing: uiIntroStartEditing
55896   };
55897   var chapterFlow = [
55898     "welcome",
55899     "navigation",
55900     "point",
55901     "area",
55902     "line",
55903     "building",
55904     "startEditing"
55905   ];
55906   function uiIntro(context) {
55907     const INTRO_IMAGERY = "EsriWorldImageryClarity";
55908     let _introGraph = {};
55909     let _currChapter;
55910     function intro(selection2) {
55911       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
55912         for (let id2 in dataIntroGraph) {
55913           if (!_introGraph[id2]) {
55914             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
55915           }
55916         }
55917         selection2.call(startIntro);
55918       }).catch(function() {
55919       });
55920     }
55921     function startIntro(selection2) {
55922       context.enter(modeBrowse(context));
55923       let osm = context.connection();
55924       let history = context.history().toJSON();
55925       let hash = window.location.hash;
55926       let center = context.map().center();
55927       let zoom = context.map().zoom();
55928       let background = context.background().baseLayerSource();
55929       let overlays = context.background().overlayLayerSources();
55930       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
55931       let caches = osm && osm.caches();
55932       let baseEntities = context.history().graph().base().entities;
55933       context.ui().sidebar.expand();
55934       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
55935       context.inIntro(true);
55936       if (osm) {
55937         osm.toggle(false).reset();
55938       }
55939       context.history().reset();
55940       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
55941       context.history().checkpoint("initial");
55942       let imagery = context.background().findSource(INTRO_IMAGERY);
55943       if (imagery) {
55944         context.background().baseLayerSource(imagery);
55945       } else {
55946         context.background().bing();
55947       }
55948       overlays.forEach((d) => context.background().toggleOverlayLayer(d));
55949       let layers = context.layers();
55950       layers.all().forEach((item) => {
55951         if (typeof item.layer.enabled === "function") {
55952           item.layer.enabled(item.id === "osm");
55953         }
55954       });
55955       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
55956       let curtain = uiCurtain(context.container().node());
55957       selection2.call(curtain);
55958       corePreferences("walkthrough_started", "yes");
55959       let storedProgress = corePreferences("walkthrough_progress") || "";
55960       let progress = storedProgress.split(";").filter(Boolean);
55961       let chapters = chapterFlow.map((chapter, i2) => {
55962         let s = chapterUi[chapter](context, curtain.reveal).on("done", () => {
55963           buttons.filter((d) => d.title === s.title).classed("finished", true);
55964           if (i2 < chapterFlow.length - 1) {
55965             const next = chapterFlow[i2 + 1];
55966             context.container().select(`button.chapter-${next}`).classed("next", true);
55967           }
55968           progress.push(chapter);
55969           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
55970         });
55971         return s;
55972       });
55973       chapters[chapters.length - 1].on("startEditing", () => {
55974         progress.push("startEditing");
55975         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
55976         let incomplete = utilArrayDifference(chapterFlow, progress);
55977         if (!incomplete.length) {
55978           corePreferences("walkthrough_completed", "yes");
55979         }
55980         curtain.remove();
55981         navwrap.remove();
55982         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
55983         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
55984         if (osm) {
55985           osm.toggle(true).reset().caches(caches);
55986         }
55987         context.history().reset().merge(Object.values(baseEntities));
55988         context.background().baseLayerSource(background);
55989         overlays.forEach((d) => context.background().toggleOverlayLayer(d));
55990         if (history) {
55991           context.history().fromJSON(history, false);
55992         }
55993         context.map().centerZoom(center, zoom);
55994         window.location.replace(hash);
55995         context.inIntro(false);
55996       });
55997       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
55998       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
55999       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
56000       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d, i2) => `chapter chapter-${chapterFlow[i2]}`).on("click", enterChapter);
56001       buttons.append("span").html((d) => _t.html(d.title));
56002       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
56003       enterChapter(null, chapters[0]);
56004       function enterChapter(d3_event, newChapter) {
56005         if (_currChapter) {
56006           _currChapter.exit();
56007         }
56008         context.enter(modeBrowse(context));
56009         _currChapter = newChapter;
56010         _currChapter.enter();
56011         buttons.classed("next", false).classed("active", (d) => d.title === _currChapter.title);
56012       }
56013     }
56014     return intro;
56015   }
56016
56017   // modules/ui/issues_info.js
56018   function uiIssuesInfo(context) {
56019     var warningsItem = {
56020       id: "warnings",
56021       count: 0,
56022       iconID: "iD-icon-alert",
56023       descriptionID: "issues.warnings_and_errors"
56024     };
56025     var resolvedItem = {
56026       id: "resolved",
56027       count: 0,
56028       iconID: "iD-icon-apply",
56029       descriptionID: "issues.user_resolved_issues"
56030     };
56031     function update(selection2) {
56032       var shownItems = [];
56033       var liveIssues = context.validator().getIssues({
56034         what: corePreferences("validate-what") || "edited",
56035         where: corePreferences("validate-where") || "all"
56036       });
56037       if (liveIssues.length) {
56038         warningsItem.count = liveIssues.length;
56039         shownItems.push(warningsItem);
56040       }
56041       if (corePreferences("validate-what") === "all") {
56042         var resolvedIssues = context.validator().getResolvedIssues();
56043         if (resolvedIssues.length) {
56044           resolvedItem.count = resolvedIssues.length;
56045           shownItems.push(resolvedItem);
56046         }
56047       }
56048       var chips = selection2.selectAll(".chip").data(shownItems, function(d) {
56049         return d.id;
56050       });
56051       chips.exit().remove();
56052       var enter = chips.enter().append("a").attr("class", function(d) {
56053         return "chip " + d.id + "-count";
56054       }).attr("href", "#").each(function(d) {
56055         var chipSelection = select_default2(this);
56056         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d.descriptionID));
56057         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
56058           d3_event.preventDefault();
56059           tooltipBehavior.hide(select_default2(this));
56060           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
56061         });
56062         chipSelection.call(svgIcon("#" + d.iconID));
56063       });
56064       enter.append("span").attr("class", "count");
56065       enter.merge(chips).selectAll("span.count").text(function(d) {
56066         return d.count.toString();
56067       });
56068     }
56069     return function(selection2) {
56070       update(selection2);
56071       context.validator().on("validated.infobox", function() {
56072         update(selection2);
56073       });
56074     };
56075   }
56076
56077   // modules/ui/map_in_map.js
56078   function uiMapInMap(context) {
56079     function mapInMap(selection2) {
56080       var backgroundLayer = rendererTileLayer(context);
56081       var overlayLayers = {};
56082       var projection2 = geoRawMercator();
56083       var dataLayer = svgData(projection2, context).showLabels(false);
56084       var debugLayer = svgDebug(projection2, context);
56085       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
56086       var wrap2 = select_default2(null);
56087       var tiles = select_default2(null);
56088       var viewport = select_default2(null);
56089       var _isTransformed = false;
56090       var _isHidden = true;
56091       var _skipEvents = false;
56092       var _gesture = null;
56093       var _zDiff = 6;
56094       var _dMini;
56095       var _cMini;
56096       var _tStart;
56097       var _tCurr;
56098       var _timeoutID;
56099       function zoomStarted() {
56100         if (_skipEvents)
56101           return;
56102         _tStart = _tCurr = projection2.transform();
56103         _gesture = null;
56104       }
56105       function zoomed(d3_event) {
56106         if (_skipEvents)
56107           return;
56108         var x = d3_event.transform.x;
56109         var y = d3_event.transform.y;
56110         var k = d3_event.transform.k;
56111         var isZooming = k !== _tStart.k;
56112         var isPanning = x !== _tStart.x || y !== _tStart.y;
56113         if (!isZooming && !isPanning) {
56114           return;
56115         }
56116         if (!_gesture) {
56117           _gesture = isZooming ? "zoom" : "pan";
56118         }
56119         var tMini = projection2.transform();
56120         var tX, tY, scale;
56121         if (_gesture === "zoom") {
56122           scale = k / tMini.k;
56123           tX = (_cMini[0] / scale - _cMini[0]) * scale;
56124           tY = (_cMini[1] / scale - _cMini[1]) * scale;
56125         } else {
56126           k = tMini.k;
56127           scale = 1;
56128           tX = x - tMini.x;
56129           tY = y - tMini.y;
56130         }
56131         utilSetTransform(tiles, tX, tY, scale);
56132         utilSetTransform(viewport, 0, 0, scale);
56133         _isTransformed = true;
56134         _tCurr = identity2.translate(x, y).scale(k);
56135         var zMain = geoScaleToZoom(context.projection.scale());
56136         var zMini = geoScaleToZoom(k);
56137         _zDiff = zMain - zMini;
56138         queueRedraw();
56139       }
56140       function zoomEnded() {
56141         if (_skipEvents)
56142           return;
56143         if (_gesture !== "pan")
56144           return;
56145         updateProjection();
56146         _gesture = null;
56147         context.map().center(projection2.invert(_cMini));
56148       }
56149       function updateProjection() {
56150         var loc = context.map().center();
56151         var tMain = context.projection.transform();
56152         var zMain = geoScaleToZoom(tMain.k);
56153         var zMini = Math.max(zMain - _zDiff, 0.5);
56154         var kMini = geoZoomToScale(zMini);
56155         projection2.translate([tMain.x, tMain.y]).scale(kMini);
56156         var point = projection2(loc);
56157         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
56158         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
56159         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
56160         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
56161         _tCurr = projection2.transform();
56162         if (_isTransformed) {
56163           utilSetTransform(tiles, 0, 0);
56164           utilSetTransform(viewport, 0, 0);
56165           _isTransformed = false;
56166         }
56167         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
56168         _skipEvents = true;
56169         wrap2.call(zoom.transform, _tCurr);
56170         _skipEvents = false;
56171       }
56172       function redraw() {
56173         clearTimeout(_timeoutID);
56174         if (_isHidden)
56175           return;
56176         updateProjection();
56177         var zMini = geoScaleToZoom(projection2.scale());
56178         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
56179         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
56180         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
56181         var background = tiles.selectAll(".map-in-map-background").data([0]);
56182         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
56183         var overlaySources = context.background().overlayLayerSources();
56184         var activeOverlayLayers = [];
56185         for (var i2 = 0; i2 < overlaySources.length; i2++) {
56186           if (overlaySources[i2].validZoom(zMini)) {
56187             if (!overlayLayers[i2])
56188               overlayLayers[i2] = rendererTileLayer(context);
56189             activeOverlayLayers.push(overlayLayers[i2].source(overlaySources[i2]).projection(projection2).dimensions(_dMini));
56190           }
56191         }
56192         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
56193         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
56194         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d) {
56195           return d.source().name();
56196         });
56197         overlays.exit().remove();
56198         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
56199           select_default2(this).call(layer);
56200         });
56201         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
56202         dataLayers.exit().remove();
56203         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
56204         if (_gesture !== "pan") {
56205           var getPath = path_default(projection2);
56206           var bbox = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
56207           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
56208           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
56209           var path = viewport.selectAll(".map-in-map-bbox").data([bbox]);
56210           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d) {
56211             return getPath.area(d) < 30;
56212           });
56213         }
56214       }
56215       function queueRedraw() {
56216         clearTimeout(_timeoutID);
56217         _timeoutID = setTimeout(function() {
56218           redraw();
56219         }, 750);
56220       }
56221       function toggle(d3_event) {
56222         if (d3_event)
56223           d3_event.preventDefault();
56224         _isHidden = !_isHidden;
56225         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
56226         if (_isHidden) {
56227           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
56228             selection2.selectAll(".map-in-map").style("display", "none");
56229           });
56230         } else {
56231           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
56232             redraw();
56233           });
56234         }
56235       }
56236       uiMapInMap.toggle = toggle;
56237       wrap2 = selection2.selectAll(".map-in-map").data([0]);
56238       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
56239       _dMini = [200, 150];
56240       _cMini = geoVecScale(_dMini, 0.5);
56241       context.map().on("drawn.map-in-map", function(drawn) {
56242         if (drawn.full === true) {
56243           redraw();
56244         }
56245       });
56246       redraw();
56247       context.keybinding().on(_t("background.minimap.key"), toggle);
56248     }
56249     return mapInMap;
56250   }
56251
56252   // modules/ui/notice.js
56253   function uiNotice(context) {
56254     return function(selection2) {
56255       var div = selection2.append("div").attr("class", "notice");
56256       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
56257         context.map().zoomEase(context.minEditableZoom());
56258       }).on("wheel", function(d3_event) {
56259         var e22 = new WheelEvent(d3_event.type, d3_event);
56260         context.surface().node().dispatchEvent(e22);
56261       });
56262       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
56263       function disableTooHigh() {
56264         var canEdit = context.map().zoom() >= context.minEditableZoom();
56265         div.style("display", canEdit ? "none" : "block");
56266       }
56267       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
56268       disableTooHigh();
56269     };
56270   }
56271
56272   // modules/ui/photoviewer.js
56273   function uiPhotoviewer(context) {
56274     var dispatch10 = dispatch_default("resize");
56275     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
56276     function photoviewer(selection2) {
56277       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
56278         if (services.streetside) {
56279           services.streetside.hideViewer(context);
56280         }
56281         if (services.mapillary) {
56282           services.mapillary.hideViewer(context);
56283         }
56284         if (services.kartaview) {
56285           services.kartaview.hideViewer(context);
56286         }
56287       }).append("div").call(svgIcon("#iD-icon-close"));
56288       function preventDefault(d3_event) {
56289         d3_event.preventDefault();
56290       }
56291       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
56292         _pointerPrefix + "down",
56293         buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true, resizeOnY: true })
56294       );
56295       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
56296         _pointerPrefix + "down",
56297         buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true })
56298       );
56299       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
56300         _pointerPrefix + "down",
56301         buildResizeListener(selection2, "resize", dispatch10, { resizeOnY: true })
56302       );
56303       function buildResizeListener(target, eventName, dispatch11, options2) {
56304         var resizeOnX = !!options2.resizeOnX;
56305         var resizeOnY = !!options2.resizeOnY;
56306         var minHeight = options2.minHeight || 240;
56307         var minWidth = options2.minWidth || 320;
56308         var pointerId;
56309         var startX;
56310         var startY;
56311         var startWidth;
56312         var startHeight;
56313         function startResize(d3_event) {
56314           if (pointerId !== (d3_event.pointerId || "mouse"))
56315             return;
56316           d3_event.preventDefault();
56317           d3_event.stopPropagation();
56318           var mapSize = context.map().dimensions();
56319           if (resizeOnX) {
56320             var maxWidth = mapSize[0];
56321             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
56322             target.style("width", newWidth + "px");
56323           }
56324           if (resizeOnY) {
56325             var maxHeight = mapSize[1] - 90;
56326             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
56327             target.style("height", newHeight + "px");
56328           }
56329           dispatch11.call(eventName, target, utilGetDimensions(target, true));
56330         }
56331         function clamp3(num, min3, max3) {
56332           return Math.max(min3, Math.min(num, max3));
56333         }
56334         function stopResize(d3_event) {
56335           if (pointerId !== (d3_event.pointerId || "mouse"))
56336             return;
56337           d3_event.preventDefault();
56338           d3_event.stopPropagation();
56339           select_default2(window).on("." + eventName, null);
56340         }
56341         return function initResize(d3_event) {
56342           d3_event.preventDefault();
56343           d3_event.stopPropagation();
56344           pointerId = d3_event.pointerId || "mouse";
56345           startX = d3_event.clientX;
56346           startY = d3_event.clientY;
56347           var targetRect = target.node().getBoundingClientRect();
56348           startWidth = targetRect.width;
56349           startHeight = targetRect.height;
56350           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
56351           if (_pointerPrefix === "pointer") {
56352             select_default2(window).on("pointercancel." + eventName, stopResize, false);
56353           }
56354         };
56355       }
56356     }
56357     photoviewer.onMapResize = function() {
56358       var photoviewer2 = context.container().select(".photoviewer");
56359       var content = context.container().select(".main-content");
56360       var mapDimensions = utilGetDimensions(content, true);
56361       var photoDimensions = utilGetDimensions(photoviewer2, true);
56362       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
56363         var setPhotoDimensions = [
56364           Math.min(photoDimensions[0], mapDimensions[0]),
56365           Math.min(photoDimensions[1], mapDimensions[1] - 90)
56366         ];
56367         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
56368         dispatch10.call("resize", photoviewer2, setPhotoDimensions);
56369       }
56370     };
56371     return utilRebind(photoviewer, dispatch10, "on");
56372   }
56373
56374   // modules/ui/restore.js
56375   function uiRestore(context) {
56376     return function(selection2) {
56377       if (!context.history().hasRestorableChanges())
56378         return;
56379       let modalSelection = uiModal(selection2, true);
56380       modalSelection.select(".modal").attr("class", "modal fillL");
56381       let introModal = modalSelection.select(".content");
56382       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
56383       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
56384       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
56385       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
56386         context.history().restore();
56387         modalSelection.remove();
56388       });
56389       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
56390       restore.append("div").call(_t.append("restore.restore"));
56391       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
56392         context.history().clearSaved();
56393         modalSelection.remove();
56394       });
56395       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
56396       reset.append("div").call(_t.append("restore.reset"));
56397       restore.node().focus();
56398     };
56399   }
56400
56401   // modules/ui/scale.js
56402   function uiScale(context) {
56403     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
56404     function scaleDefs(loc1, loc2) {
56405       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, i2, val, dLon;
56406       if (isImperial) {
56407         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
56408       } else {
56409         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
56410       }
56411       for (i2 = 0; i2 < buckets.length; i2++) {
56412         val = buckets[i2];
56413         if (dist >= val) {
56414           scale.dist = Math.floor(dist / val) * val;
56415           break;
56416         } else {
56417           scale.dist = +dist.toFixed(2);
56418         }
56419       }
56420       dLon = geoMetersToLon(scale.dist / conversion, lat);
56421       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
56422       scale.text = displayLength(scale.dist / conversion, isImperial);
56423       return scale;
56424     }
56425     function update(selection2) {
56426       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
56427       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
56428       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
56429     }
56430     return function(selection2) {
56431       function switchUnits() {
56432         isImperial = !isImperial;
56433         selection2.call(update);
56434       }
56435       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
56436       scalegroup.append("path").attr("class", "scale-path");
56437       selection2.append("div").attr("class", "scale-text");
56438       selection2.call(update);
56439       context.map().on("move.scale", function() {
56440         update(selection2);
56441       });
56442     };
56443   }
56444
56445   // modules/ui/shortcuts.js
56446   function uiShortcuts(context) {
56447     var detected = utilDetect();
56448     var _activeTab = 0;
56449     var _modalSelection;
56450     var _selection = select_default2(null);
56451     var _dataShortcuts;
56452     function shortcutsModal(_modalSelection2) {
56453       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
56454       var content = _modalSelection2.select(".content");
56455       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
56456       _mainFileFetcher.get("shortcuts").then(function(data) {
56457         _dataShortcuts = data;
56458         content.call(render);
56459       }).catch(function() {
56460       });
56461     }
56462     function render(selection2) {
56463       if (!_dataShortcuts)
56464         return;
56465       var wrapper = selection2.selectAll(".wrapper").data([0]);
56466       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
56467       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
56468       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
56469       wrapper = wrapper.merge(wrapperEnter);
56470       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
56471       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d) {
56472         d3_event.preventDefault();
56473         var i2 = _dataShortcuts.indexOf(d);
56474         _activeTab = i2;
56475         render(selection2);
56476       });
56477       tabsEnter.append("span").html(function(d) {
56478         return _t.html(d.text);
56479       });
56480       wrapper.selectAll(".tab").classed("active", function(d, i2) {
56481         return i2 === _activeTab;
56482       });
56483       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
56484       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d) {
56485         return "shortcut-tab shortcut-tab-" + d.tab;
56486       });
56487       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d) {
56488         return d.columns;
56489       }).enter().append("table").attr("class", "shortcut-column");
56490       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d) {
56491         return d.rows;
56492       }).enter().append("tr").attr("class", "shortcut-row");
56493       var sectionRows = rowsEnter.filter(function(d) {
56494         return !d.shortcuts;
56495       });
56496       sectionRows.append("td");
56497       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d) {
56498         return _t.html(d.text);
56499       });
56500       var shortcutRows = rowsEnter.filter(function(d) {
56501         return d.shortcuts;
56502       });
56503       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
56504       var modifierKeys = shortcutKeys.filter(function(d) {
56505         return d.modifiers;
56506       });
56507       modifierKeys.selectAll("kbd.modifier").data(function(d) {
56508         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
56509           return ["\u2318"];
56510         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
56511           return [];
56512         } else {
56513           return d.modifiers;
56514         }
56515       }).enter().each(function() {
56516         var selection3 = select_default2(this);
56517         selection3.append("kbd").attr("class", "modifier").text(function(d) {
56518           return uiCmd.display(d);
56519         });
56520         selection3.append("span").text("+");
56521       });
56522       shortcutKeys.selectAll("kbd.shortcut").data(function(d) {
56523         var arr = d.shortcuts;
56524         if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
56525           arr = ["Y"];
56526         } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
56527           arr = ["F11"];
56528         }
56529         arr = arr.map(function(s) {
56530           return uiCmd.display(s.indexOf(".") !== -1 ? _t(s) : s);
56531         });
56532         return utilArrayUniq(arr).map(function(s) {
56533           return {
56534             shortcut: s,
56535             separator: d.separator,
56536             suffix: d.suffix
56537           };
56538         });
56539       }).enter().each(function(d, i2, nodes) {
56540         var selection3 = select_default2(this);
56541         var click = d.shortcut.toLowerCase().match(/(.*).click/);
56542         if (click && click[1]) {
56543           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
56544         } else if (d.shortcut.toLowerCase() === "long-press") {
56545           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
56546         } else if (d.shortcut.toLowerCase() === "tap") {
56547           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
56548         } else {
56549           selection3.append("kbd").attr("class", "shortcut").text(function(d2) {
56550             return d2.shortcut;
56551           });
56552         }
56553         if (i2 < nodes.length - 1) {
56554           selection3.append("span").html(d.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
56555         } else if (i2 === nodes.length - 1 && d.suffix) {
56556           selection3.append("span").text(d.suffix);
56557         }
56558       });
56559       shortcutKeys.filter(function(d) {
56560         return d.gesture;
56561       }).each(function() {
56562         var selection3 = select_default2(this);
56563         selection3.append("span").text("+");
56564         selection3.append("span").attr("class", "gesture").html(function(d) {
56565           return _t.html(d.gesture);
56566         });
56567       });
56568       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d) {
56569         return d.text ? _t.html(d.text) : "\xA0";
56570       });
56571       wrapper.selectAll(".shortcut-tab").style("display", function(d, i2) {
56572         return i2 === _activeTab ? "flex" : "none";
56573       });
56574     }
56575     return function(selection2, show) {
56576       _selection = selection2;
56577       if (show) {
56578         _modalSelection = uiModal(selection2);
56579         _modalSelection.call(shortcutsModal);
56580       } else {
56581         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
56582           if (context.container().selectAll(".modal-shortcuts").size()) {
56583             if (_modalSelection) {
56584               _modalSelection.close();
56585               _modalSelection = null;
56586             }
56587           } else {
56588             _modalSelection = uiModal(_selection);
56589             _modalSelection.call(shortcutsModal);
56590           }
56591         });
56592       }
56593     };
56594   }
56595
56596   // modules/ui/data_header.js
56597   function uiDataHeader() {
56598     var _datum;
56599     function dataHeader(selection2) {
56600       var header = selection2.selectAll(".data-header").data(
56601         _datum ? [_datum] : [],
56602         function(d) {
56603           return d.__featurehash__;
56604         }
56605       );
56606       header.exit().remove();
56607       var headerEnter = header.enter().append("div").attr("class", "data-header");
56608       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
56609       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
56610       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
56611     }
56612     dataHeader.datum = function(val) {
56613       if (!arguments.length)
56614         return _datum;
56615       _datum = val;
56616       return this;
56617     };
56618     return dataHeader;
56619   }
56620
56621   // modules/ui/combobox.js
56622   var _comboHideTimerID;
56623   function uiCombobox(context, klass) {
56624     var dispatch10 = dispatch_default("accept", "cancel");
56625     var container = context.container();
56626     var _suggestions = [];
56627     var _data = [];
56628     var _fetched = {};
56629     var _selected = null;
56630     var _canAutocomplete = true;
56631     var _caseSensitive = false;
56632     var _cancelFetch = false;
56633     var _minItems = 2;
56634     var _tDown = 0;
56635     var _mouseEnterHandler, _mouseLeaveHandler;
56636     var _fetcher = function(val, cb) {
56637       cb(_data.filter(function(d) {
56638         var terms = d.terms || [];
56639         terms.push(d.value);
56640         return terms.some(function(term) {
56641           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
56642         });
56643       }));
56644     };
56645     var combobox = function(input, attachTo) {
56646       if (!input || input.empty())
56647         return;
56648       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() {
56649         var parent = this.parentNode;
56650         var sibling = this.nextSibling;
56651         select_default2(parent).selectAll(".combobox-caret").filter(function(d) {
56652           return d === input.node();
56653         }).data([input.node()]).enter().insert("div", function() {
56654           return sibling;
56655         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
56656           d3_event.preventDefault();
56657           input.node().focus();
56658           mousedown(d3_event);
56659         }).on("mouseup.combo-caret", function(d3_event) {
56660           d3_event.preventDefault();
56661           mouseup(d3_event);
56662         });
56663       });
56664       function mousedown(d3_event) {
56665         if (d3_event.button !== 0)
56666           return;
56667         if (input.classed("disabled"))
56668           return;
56669         _tDown = +new Date();
56670         var start2 = input.property("selectionStart");
56671         var end = input.property("selectionEnd");
56672         if (start2 !== end) {
56673           var val = utilGetSetValue(input);
56674           input.node().setSelectionRange(val.length, val.length);
56675           return;
56676         }
56677         input.on("mouseup.combo-input", mouseup);
56678       }
56679       function mouseup(d3_event) {
56680         input.on("mouseup.combo-input", null);
56681         if (d3_event.button !== 0)
56682           return;
56683         if (input.classed("disabled"))
56684           return;
56685         if (input.node() !== document.activeElement)
56686           return;
56687         var start2 = input.property("selectionStart");
56688         var end = input.property("selectionEnd");
56689         if (start2 !== end)
56690           return;
56691         var combo = container.selectAll(".combobox");
56692         if (combo.empty() || combo.datum() !== input.node()) {
56693           var tOrig = _tDown;
56694           window.setTimeout(function() {
56695             if (tOrig !== _tDown)
56696               return;
56697             fetchComboData("", function() {
56698               show();
56699               render();
56700             });
56701           }, 250);
56702         } else {
56703           hide();
56704         }
56705       }
56706       function focus() {
56707         fetchComboData("");
56708       }
56709       function blur() {
56710         _comboHideTimerID = window.setTimeout(hide, 75);
56711       }
56712       function show() {
56713         hide();
56714         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) {
56715           d3_event.preventDefault();
56716         });
56717         container.on("scroll.combo-scroll", render, true);
56718       }
56719       function hide() {
56720         if (_comboHideTimerID) {
56721           window.clearTimeout(_comboHideTimerID);
56722           _comboHideTimerID = void 0;
56723         }
56724         container.selectAll(".combobox").remove();
56725         container.on("scroll.combo-scroll", null);
56726       }
56727       function keydown(d3_event) {
56728         var shown = !container.selectAll(".combobox").empty();
56729         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
56730         switch (d3_event.keyCode) {
56731           case 8:
56732           case 46:
56733             d3_event.stopPropagation();
56734             _selected = null;
56735             render();
56736             input.on("input.combo-input", function() {
56737               var start2 = input.property("selectionStart");
56738               input.node().setSelectionRange(start2, start2);
56739               input.on("input.combo-input", change);
56740             });
56741             break;
56742           case 9:
56743             accept(d3_event);
56744             break;
56745           case 13:
56746             d3_event.preventDefault();
56747             d3_event.stopPropagation();
56748             break;
56749           case 38:
56750             if (tagName === "textarea" && !shown)
56751               return;
56752             d3_event.preventDefault();
56753             if (tagName === "input" && !shown) {
56754               show();
56755             }
56756             nav(-1);
56757             break;
56758           case 40:
56759             if (tagName === "textarea" && !shown)
56760               return;
56761             d3_event.preventDefault();
56762             if (tagName === "input" && !shown) {
56763               show();
56764             }
56765             nav(1);
56766             break;
56767         }
56768       }
56769       function keyup(d3_event) {
56770         switch (d3_event.keyCode) {
56771           case 27:
56772             cancel();
56773             break;
56774           case 13:
56775             accept(d3_event);
56776             break;
56777         }
56778       }
56779       function change() {
56780         fetchComboData(value(), function() {
56781           _selected = null;
56782           var val = input.property("value");
56783           if (_suggestions.length) {
56784             if (input.property("selectionEnd") === val.length) {
56785               _selected = tryAutocomplete();
56786             }
56787             if (!_selected) {
56788               _selected = val;
56789             }
56790           }
56791           if (val.length) {
56792             var combo = container.selectAll(".combobox");
56793             if (combo.empty()) {
56794               show();
56795             }
56796           } else {
56797             hide();
56798           }
56799           render();
56800         });
56801       }
56802       function nav(dir) {
56803         if (_suggestions.length) {
56804           var index = -1;
56805           for (var i2 = 0; i2 < _suggestions.length; i2++) {
56806             if (_selected && _suggestions[i2].value === _selected) {
56807               index = i2;
56808               break;
56809             }
56810           }
56811           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
56812           _selected = _suggestions[index].value;
56813           input.property("value", _selected);
56814         }
56815         render();
56816         ensureVisible();
56817       }
56818       function ensureVisible() {
56819         var combo = container.selectAll(".combobox");
56820         if (combo.empty())
56821           return;
56822         var containerRect = container.node().getBoundingClientRect();
56823         var comboRect = combo.node().getBoundingClientRect();
56824         if (comboRect.bottom > containerRect.bottom) {
56825           var node = attachTo ? attachTo.node() : input.node();
56826           node.scrollIntoView({ behavior: "instant", block: "center" });
56827           render();
56828         }
56829         var selected = combo.selectAll(".combobox-option.selected").node();
56830         if (selected) {
56831           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
56832         }
56833       }
56834       function value() {
56835         var value2 = input.property("value");
56836         var start2 = input.property("selectionStart");
56837         var end = input.property("selectionEnd");
56838         if (start2 && end) {
56839           value2 = value2.substring(0, start2);
56840         }
56841         return value2;
56842       }
56843       function fetchComboData(v, cb) {
56844         _cancelFetch = false;
56845         _fetcher.call(input, v, function(results) {
56846           if (_cancelFetch)
56847             return;
56848           _suggestions = results;
56849           results.forEach(function(d) {
56850             _fetched[d.value] = d;
56851           });
56852           if (cb) {
56853             cb();
56854           }
56855         });
56856       }
56857       function tryAutocomplete() {
56858         if (!_canAutocomplete)
56859           return;
56860         var val = _caseSensitive ? value() : value().toLowerCase();
56861         if (!val)
56862           return;
56863         if (!isNaN(parseFloat(val)) && isFinite(val))
56864           return;
56865         var bestIndex = -1;
56866         for (var i2 = 0; i2 < _suggestions.length; i2++) {
56867           var suggestion = _suggestions[i2].value;
56868           var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
56869           if (compare === val) {
56870             bestIndex = i2;
56871             break;
56872           } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
56873             bestIndex = i2;
56874           }
56875         }
56876         if (bestIndex !== -1) {
56877           var bestVal = _suggestions[bestIndex].value;
56878           input.property("value", bestVal);
56879           input.node().setSelectionRange(val.length, bestVal.length);
56880           return bestVal;
56881         }
56882       }
56883       function render() {
56884         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
56885           hide();
56886           return;
56887         }
56888         var shown = !container.selectAll(".combobox").empty();
56889         if (!shown)
56890           return;
56891         var combo = container.selectAll(".combobox");
56892         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d) {
56893           return d.value;
56894         });
56895         options2.exit().remove();
56896         options2.enter().append("a").attr("class", function(d) {
56897           return "combobox-option " + (d.klass || "");
56898         }).attr("title", function(d) {
56899           return d.title;
56900         }).each(function(d) {
56901           if (d.display) {
56902             d.display(select_default2(this));
56903           } else {
56904             select_default2(this).text(d.value);
56905           }
56906         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d) {
56907           return d.value === _selected;
56908         }).on("click.combo-option", accept).order();
56909         var node = attachTo ? attachTo.node() : input.node();
56910         var containerRect = container.node().getBoundingClientRect();
56911         var rect = node.getBoundingClientRect();
56912         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
56913       }
56914       function accept(d3_event, d) {
56915         _cancelFetch = true;
56916         var thiz = input.node();
56917         if (d) {
56918           utilGetSetValue(input, d.value);
56919           utilTriggerEvent(input, "change");
56920         }
56921         var val = utilGetSetValue(input);
56922         thiz.setSelectionRange(val.length, val.length);
56923         d = _fetched[val];
56924         dispatch10.call("accept", thiz, d, val);
56925         hide();
56926       }
56927       function cancel() {
56928         _cancelFetch = true;
56929         var thiz = input.node();
56930         var val = utilGetSetValue(input);
56931         var start2 = input.property("selectionStart");
56932         var end = input.property("selectionEnd");
56933         val = val.slice(0, start2) + val.slice(end);
56934         utilGetSetValue(input, val);
56935         thiz.setSelectionRange(val.length, val.length);
56936         dispatch10.call("cancel", thiz);
56937         hide();
56938       }
56939     };
56940     combobox.canAutocomplete = function(val) {
56941       if (!arguments.length)
56942         return _canAutocomplete;
56943       _canAutocomplete = val;
56944       return combobox;
56945     };
56946     combobox.caseSensitive = function(val) {
56947       if (!arguments.length)
56948         return _caseSensitive;
56949       _caseSensitive = val;
56950       return combobox;
56951     };
56952     combobox.data = function(val) {
56953       if (!arguments.length)
56954         return _data;
56955       _data = val;
56956       return combobox;
56957     };
56958     combobox.fetcher = function(val) {
56959       if (!arguments.length)
56960         return _fetcher;
56961       _fetcher = val;
56962       return combobox;
56963     };
56964     combobox.minItems = function(val) {
56965       if (!arguments.length)
56966         return _minItems;
56967       _minItems = val;
56968       return combobox;
56969     };
56970     combobox.itemsMouseEnter = function(val) {
56971       if (!arguments.length)
56972         return _mouseEnterHandler;
56973       _mouseEnterHandler = val;
56974       return combobox;
56975     };
56976     combobox.itemsMouseLeave = function(val) {
56977       if (!arguments.length)
56978         return _mouseLeaveHandler;
56979       _mouseLeaveHandler = val;
56980       return combobox;
56981     };
56982     return utilRebind(combobox, dispatch10, "on");
56983   }
56984   uiCombobox.off = function(input, context) {
56985     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);
56986     context.container().on("scroll.combo-scroll", null);
56987   };
56988
56989   // modules/ui/disclosure.js
56990   function uiDisclosure(context, key, expandedDefault) {
56991     var dispatch10 = dispatch_default("toggled");
56992     var _expanded;
56993     var _label = utilFunctor("");
56994     var _updatePreference = true;
56995     var _content = function() {
56996     };
56997     var disclosure = function(selection2) {
56998       if (_expanded === void 0 || _expanded === null) {
56999         var preference = corePreferences("disclosure." + key + ".expanded");
57000         _expanded = preference === null ? !!expandedDefault : preference === "true";
57001       }
57002       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
57003       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"));
57004       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
57005       hideToggle = hideToggleEnter.merge(hideToggle);
57006       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
57007       const label = _label();
57008       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
57009       if (typeof label !== "function") {
57010         labelSelection.text(_label());
57011       } else {
57012         labelSelection.text("").call(label);
57013       }
57014       hideToggle.selectAll(".hide-toggle-icon").attr(
57015         "xlink:href",
57016         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
57017       );
57018       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
57019       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
57020       if (_expanded) {
57021         wrap2.call(_content);
57022       }
57023       function toggle(d3_event) {
57024         d3_event.preventDefault();
57025         _expanded = !_expanded;
57026         if (_updatePreference) {
57027           corePreferences("disclosure." + key + ".expanded", _expanded);
57028         }
57029         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
57030         hideToggle.selectAll(".hide-toggle-icon").attr(
57031           "xlink:href",
57032           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
57033         );
57034         wrap2.call(uiToggle(_expanded));
57035         if (_expanded) {
57036           wrap2.call(_content);
57037         }
57038         dispatch10.call("toggled", this, _expanded);
57039       }
57040     };
57041     disclosure.label = function(val) {
57042       if (!arguments.length)
57043         return _label;
57044       _label = utilFunctor(val);
57045       return disclosure;
57046     };
57047     disclosure.expanded = function(val) {
57048       if (!arguments.length)
57049         return _expanded;
57050       _expanded = val;
57051       return disclosure;
57052     };
57053     disclosure.updatePreference = function(val) {
57054       if (!arguments.length)
57055         return _updatePreference;
57056       _updatePreference = val;
57057       return disclosure;
57058     };
57059     disclosure.content = function(val) {
57060       if (!arguments.length)
57061         return _content;
57062       _content = val;
57063       return disclosure;
57064     };
57065     return utilRebind(disclosure, dispatch10, "on");
57066   }
57067
57068   // modules/ui/section.js
57069   function uiSection(id2, context) {
57070     var _classes = utilFunctor("");
57071     var _shouldDisplay;
57072     var _content;
57073     var _disclosure;
57074     var _label;
57075     var _expandedByDefault = utilFunctor(true);
57076     var _disclosureContent;
57077     var _disclosureExpanded;
57078     var _containerSelection = select_default2(null);
57079     var section = {
57080       id: id2
57081     };
57082     section.classes = function(val) {
57083       if (!arguments.length)
57084         return _classes;
57085       _classes = utilFunctor(val);
57086       return section;
57087     };
57088     section.label = function(val) {
57089       if (!arguments.length)
57090         return _label;
57091       _label = utilFunctor(val);
57092       return section;
57093     };
57094     section.expandedByDefault = function(val) {
57095       if (!arguments.length)
57096         return _expandedByDefault;
57097       _expandedByDefault = utilFunctor(val);
57098       return section;
57099     };
57100     section.shouldDisplay = function(val) {
57101       if (!arguments.length)
57102         return _shouldDisplay;
57103       _shouldDisplay = utilFunctor(val);
57104       return section;
57105     };
57106     section.content = function(val) {
57107       if (!arguments.length)
57108         return _content;
57109       _content = val;
57110       return section;
57111     };
57112     section.disclosureContent = function(val) {
57113       if (!arguments.length)
57114         return _disclosureContent;
57115       _disclosureContent = val;
57116       return section;
57117     };
57118     section.disclosureExpanded = function(val) {
57119       if (!arguments.length)
57120         return _disclosureExpanded;
57121       _disclosureExpanded = val;
57122       return section;
57123     };
57124     section.render = function(selection2) {
57125       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
57126       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
57127       _containerSelection = sectionEnter.merge(_containerSelection);
57128       _containerSelection.call(renderContent);
57129     };
57130     section.reRender = function() {
57131       _containerSelection.call(renderContent);
57132     };
57133     section.selection = function() {
57134       return _containerSelection;
57135     };
57136     section.disclosure = function() {
57137       return _disclosure;
57138     };
57139     function renderContent(selection2) {
57140       if (_shouldDisplay) {
57141         var shouldDisplay = _shouldDisplay();
57142         selection2.classed("hide", !shouldDisplay);
57143         if (!shouldDisplay) {
57144           selection2.html("");
57145           return;
57146         }
57147       }
57148       if (_disclosureContent) {
57149         if (!_disclosure) {
57150           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
57151         }
57152         if (_disclosureExpanded !== void 0) {
57153           _disclosure.expanded(_disclosureExpanded);
57154           _disclosureExpanded = void 0;
57155         }
57156         selection2.call(_disclosure);
57157         return;
57158       }
57159       if (_content) {
57160         selection2.call(_content);
57161       }
57162     }
57163     return section;
57164   }
57165
57166   // modules/ui/tag_reference.js
57167   function uiTagReference(what) {
57168     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
57169     var tagReference = {};
57170     var _button = select_default2(null);
57171     var _body = select_default2(null);
57172     var _loaded;
57173     var _showing;
57174     function load() {
57175       if (!wikibase)
57176         return;
57177       _button.classed("tag-reference-loading", true);
57178       wikibase.getDocs(what, gotDocs);
57179     }
57180     function gotDocs(err, docs) {
57181       _body.html("");
57182       if (!docs || !docs.title) {
57183         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
57184         done();
57185         return;
57186       }
57187       if (docs.imageURL) {
57188         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
57189           done();
57190         }).on("error", function() {
57191           select_default2(this).remove();
57192           done();
57193         });
57194       } else {
57195         done();
57196       }
57197       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
57198       if (docs.description) {
57199         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
57200       } else {
57201         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
57202       }
57203       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"));
57204       if (docs.wiki) {
57205         _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));
57206       }
57207       if (what.key === "comment") {
57208         _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"));
57209       }
57210     }
57211     function done() {
57212       _loaded = true;
57213       _button.classed("tag-reference-loading", false);
57214       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
57215       _showing = true;
57216       _button.selectAll("svg.icon use").each(function() {
57217         var iconUse = select_default2(this);
57218         if (iconUse.attr("href") === "#iD-icon-info") {
57219           iconUse.attr("href", "#iD-icon-info-filled");
57220         }
57221       });
57222     }
57223     function hide() {
57224       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
57225         _body.classed("expanded", false);
57226       });
57227       _showing = false;
57228       _button.selectAll("svg.icon use").each(function() {
57229         var iconUse = select_default2(this);
57230         if (iconUse.attr("href") === "#iD-icon-info-filled") {
57231           iconUse.attr("href", "#iD-icon-info");
57232         }
57233       });
57234     }
57235     tagReference.button = function(selection2, klass, iconName) {
57236       _button = selection2.selectAll(".tag-reference-button").data([0]);
57237       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
57238       _button.on("click", function(d3_event) {
57239         d3_event.stopPropagation();
57240         d3_event.preventDefault();
57241         this.blur();
57242         if (_showing) {
57243           hide();
57244         } else if (_loaded) {
57245           done();
57246         } else {
57247           load();
57248         }
57249       });
57250     };
57251     tagReference.body = function(selection2) {
57252       var itemID = what.qid || what.key + "-" + (what.value || "");
57253       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d) {
57254         return d;
57255       });
57256       _body.exit().remove();
57257       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
57258       if (_showing === false) {
57259         hide();
57260       }
57261     };
57262     tagReference.showing = function(val) {
57263       if (!arguments.length)
57264         return _showing;
57265       _showing = val;
57266       return tagReference;
57267     };
57268     return tagReference;
57269   }
57270
57271   // modules/ui/field_help.js
57272   function uiFieldHelp(context, fieldName) {
57273     var fieldHelp = {};
57274     var _inspector = select_default2(null);
57275     var _wrap = select_default2(null);
57276     var _body = select_default2(null);
57277     var fieldHelpKeys = {
57278       restrictions: [
57279         ["about", [
57280           "about",
57281           "from_via_to",
57282           "maxdist",
57283           "maxvia"
57284         ]],
57285         ["inspecting", [
57286           "about",
57287           "from_shadow",
57288           "allow_shadow",
57289           "restrict_shadow",
57290           "only_shadow",
57291           "restricted",
57292           "only"
57293         ]],
57294         ["modifying", [
57295           "about",
57296           "indicators",
57297           "allow_turn",
57298           "restrict_turn",
57299           "only_turn"
57300         ]],
57301         ["tips", [
57302           "simple",
57303           "simple_example",
57304           "indirect",
57305           "indirect_example",
57306           "indirect_noedit"
57307         ]]
57308       ]
57309     };
57310     var fieldHelpHeadings = {};
57311     var replacements = {
57312       distField: { html: _t.html("restriction.controls.distance") },
57313       viaField: { html: _t.html("restriction.controls.via") },
57314       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
57315       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
57316       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
57317       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
57318       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
57319       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
57320       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
57321     };
57322     var docs = fieldHelpKeys[fieldName].map(function(key) {
57323       var helpkey = "help.field." + fieldName + "." + key[0];
57324       var text2 = key[1].reduce(function(all, part) {
57325         var subkey = helpkey + "." + part;
57326         var depth = fieldHelpHeadings[subkey];
57327         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
57328         return all + hhh + _t.html(subkey, replacements) + "\n\n";
57329       }, "");
57330       return {
57331         key: helpkey,
57332         title: _t.html(helpkey + ".title"),
57333         html: marked(text2.trim())
57334       };
57335     });
57336     function show() {
57337       updatePosition();
57338       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
57339     }
57340     function hide() {
57341       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
57342         _body.classed("hide", true);
57343       });
57344     }
57345     function clickHelp(index) {
57346       var d = docs[index];
57347       var tkeys = fieldHelpKeys[fieldName][index][1];
57348       _body.selectAll(".field-help-nav-item").classed("active", function(d2, i2) {
57349         return i2 === index;
57350       });
57351       var content = _body.selectAll(".field-help-content").html(d.html);
57352       content.selectAll("p").attr("class", function(d2, i2) {
57353         return tkeys[i2];
57354       });
57355       if (d.key === "help.field.restrictions.inspecting") {
57356         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
57357       } else if (d.key === "help.field.restrictions.modifying") {
57358         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
57359       }
57360     }
57361     fieldHelp.button = function(selection2) {
57362       if (_body.empty())
57363         return;
57364       var button = selection2.selectAll(".field-help-button").data([0]);
57365       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
57366         d3_event.stopPropagation();
57367         d3_event.preventDefault();
57368         if (_body.classed("hide")) {
57369           show();
57370         } else {
57371           hide();
57372         }
57373       });
57374     };
57375     function updatePosition() {
57376       var wrap2 = _wrap.node();
57377       var inspector = _inspector.node();
57378       var wRect = wrap2.getBoundingClientRect();
57379       var iRect = inspector.getBoundingClientRect();
57380       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
57381     }
57382     fieldHelp.body = function(selection2) {
57383       _wrap = selection2.selectAll(".form-field-input-wrap");
57384       if (_wrap.empty())
57385         return;
57386       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
57387       if (_inspector.empty())
57388         return;
57389       _body = _inspector.selectAll(".field-help-body").data([0]);
57390       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
57391       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
57392       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
57393       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
57394         d3_event.stopPropagation();
57395         d3_event.preventDefault();
57396         hide();
57397       }).call(svgIcon("#iD-icon-close"));
57398       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
57399       var titles = docs.map(function(d) {
57400         return d.title;
57401       });
57402       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d) {
57403         return d;
57404       }).on("click", function(d3_event, d) {
57405         d3_event.stopPropagation();
57406         d3_event.preventDefault();
57407         clickHelp(titles.indexOf(d));
57408       });
57409       enter.append("div").attr("class", "field-help-content");
57410       _body = _body.merge(enter);
57411       clickHelp(0);
57412     };
57413     return fieldHelp;
57414   }
57415
57416   // modules/ui/fields/check.js
57417   function uiFieldCheck(field, context) {
57418     var dispatch10 = dispatch_default("change");
57419     var options2 = field.options;
57420     var values = [];
57421     var texts = [];
57422     var _tags;
57423     var input = select_default2(null);
57424     var text2 = select_default2(null);
57425     var label = select_default2(null);
57426     var reverser = select_default2(null);
57427     var _impliedYes;
57428     var _entityIDs = [];
57429     var _value;
57430     if (options2) {
57431       for (var i2 in options2) {
57432         var v = options2[i2];
57433         values.push(v === "undefined" ? void 0 : v);
57434         texts.push(field.t.html("options." + v, { "default": v }));
57435       }
57436     } else {
57437       values = [void 0, "yes"];
57438       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
57439       if (field.type !== "defaultCheck") {
57440         values.push("no");
57441         texts.push(_t.html("inspector.check.no"));
57442       }
57443     }
57444     function checkImpliedYes() {
57445       _impliedYes = field.id === "oneway_yes";
57446       if (field.id === "oneway") {
57447         var entity = context.entity(_entityIDs[0]);
57448         for (var key in entity.tags) {
57449           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
57450             _impliedYes = true;
57451             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
57452             break;
57453           }
57454         }
57455       }
57456     }
57457     function reverserHidden() {
57458       if (!context.container().select("div.inspector-hover").empty())
57459         return true;
57460       return !(_value === "yes" || _impliedYes && !_value);
57461     }
57462     function reverserSetText(selection2) {
57463       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
57464       if (reverserHidden() || !entity)
57465         return selection2;
57466       var first = entity.first();
57467       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
57468       var pseudoDirection = first < last;
57469       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
57470       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
57471       return selection2;
57472     }
57473     var check = function(selection2) {
57474       checkImpliedYes();
57475       label = selection2.selectAll(".form-field-input-wrap").data([0]);
57476       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
57477       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
57478       enter.append("span").html(texts[0]).attr("class", "value");
57479       if (field.type === "onewayCheck") {
57480         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
57481       }
57482       label = label.merge(enter);
57483       input = label.selectAll("input");
57484       text2 = label.selectAll("span.value");
57485       input.on("click", function(d3_event) {
57486         d3_event.stopPropagation();
57487         var t = {};
57488         if (Array.isArray(_tags[field.key])) {
57489           if (values.indexOf("yes") !== -1) {
57490             t[field.key] = "yes";
57491           } else {
57492             t[field.key] = values[0];
57493           }
57494         } else {
57495           t[field.key] = values[(values.indexOf(_value) + 1) % values.length];
57496         }
57497         if (t[field.key] === "reversible" || t[field.key] === "alternating") {
57498           t[field.key] = values[0];
57499         }
57500         dispatch10.call("change", this, t);
57501       });
57502       if (field.type === "onewayCheck") {
57503         reverser = label.selectAll(".reverser");
57504         reverser.call(reverserSetText).on("click", function(d3_event) {
57505           d3_event.preventDefault();
57506           d3_event.stopPropagation();
57507           context.perform(
57508             function(graph) {
57509               for (var i3 in _entityIDs) {
57510                 graph = actionReverse(_entityIDs[i3])(graph);
57511               }
57512               return graph;
57513             },
57514             _t("operations.reverse.annotation.line", { n: 1 })
57515           );
57516           context.validator().validate();
57517           select_default2(this).call(reverserSetText);
57518         });
57519       }
57520     };
57521     check.entityIDs = function(val) {
57522       if (!arguments.length)
57523         return _entityIDs;
57524       _entityIDs = val;
57525       return check;
57526     };
57527     check.tags = function(tags) {
57528       _tags = tags;
57529       function isChecked(val) {
57530         return val !== "no" && val !== "" && val !== void 0 && val !== null;
57531       }
57532       function textFor(val) {
57533         if (val === "")
57534           val = void 0;
57535         var index = values.indexOf(val);
57536         return index !== -1 ? texts[index] : '"' + val + '"';
57537       }
57538       checkImpliedYes();
57539       var isMixed = Array.isArray(tags[field.key]);
57540       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
57541       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
57542         _value = "yes";
57543       }
57544       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
57545       text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
57546       label.classed("set", !!_value);
57547       if (field.type === "onewayCheck") {
57548         reverser.classed("hide", reverserHidden()).call(reverserSetText);
57549       }
57550     };
57551     check.focus = function() {
57552       input.node().focus();
57553     };
57554     return utilRebind(check, dispatch10, "on");
57555   }
57556
57557   // modules/ui/fields/combo.js
57558   function uiFieldCombo(field, context) {
57559     var dispatch10 = dispatch_default("change");
57560     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
57561     var _isNetwork = field.type === "networkCombo";
57562     var _isSemi = field.type === "semiCombo";
57563     var _optarray = field.options;
57564     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
57565     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
57566     var _snake_case = field.snake_case || field.snake_case === void 0;
57567     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(_isMulti || _isSemi ? 1 : 2);
57568     var _container = select_default2(null);
57569     var _inputWrap = select_default2(null);
57570     var _input = select_default2(null);
57571     var _comboData = [];
57572     var _multiData = [];
57573     var _entityIDs = [];
57574     var _tags;
57575     var _countryCode;
57576     var _staticPlaceholder;
57577     var _dataDeprecated = [];
57578     _mainFileFetcher.get("deprecated").then(function(d) {
57579       _dataDeprecated = d;
57580     }).catch(function() {
57581     });
57582     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
57583       field.key += ":";
57584     }
57585     function snake(s) {
57586       return s.replace(/\s+/g, "_").toLowerCase();
57587     }
57588     function clean2(s) {
57589       return s.split(";").map(function(s2) {
57590         return s2.trim();
57591       }).join(";");
57592     }
57593     function tagValue(dval) {
57594       dval = clean2(dval || "");
57595       var found = _comboData.find(function(o) {
57596         return o.key && clean2(o.value) === dval;
57597       });
57598       if (found)
57599         return found.key;
57600       if (field.type === "typeCombo" && !dval) {
57601         return "yes";
57602       }
57603       return (_snake_case ? snake(dval) : dval) || void 0;
57604     }
57605     function displayValue(tval) {
57606       tval = tval || "";
57607       if (field.hasTextForStringId("options." + tval)) {
57608         return field.t("options." + tval, { default: tval });
57609       }
57610       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
57611         return "";
57612       }
57613       return tval;
57614     }
57615     function renderValue(tval) {
57616       tval = tval || "";
57617       if (field.hasTextForStringId("options." + tval)) {
57618         return field.t.append("options." + tval, { default: tval });
57619       }
57620       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
57621         tval = "";
57622       }
57623       return (selection2) => selection2.text(tval);
57624     }
57625     function objectDifference(a, b) {
57626       return a.filter(function(d1) {
57627         return !b.some(function(d2) {
57628           return !d2.isMixed && d1.value === d2.value;
57629         });
57630       });
57631     }
57632     function initCombo(selection2, attachTo) {
57633       if (!_allowCustomValues) {
57634         selection2.attr("readonly", "readonly");
57635       }
57636       if (_showTagInfoSuggestions && services.taginfo) {
57637         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
57638         setTaginfoValues("", setPlaceholder);
57639       } else {
57640         selection2.call(_combobox, attachTo);
57641         setStaticValues(setPlaceholder);
57642       }
57643     }
57644     function setStaticValues(callback) {
57645       if (!_optarray)
57646         return;
57647       _comboData = _optarray.map(function(v) {
57648         return {
57649           key: v,
57650           value: field.t("options." + v, { default: v }),
57651           title: v,
57652           display: field.t.append("options." + v, { default: v }),
57653           klass: field.hasTextForStringId("options." + v) ? "" : "raw-option"
57654         };
57655       });
57656       _combobox.data(objectDifference(_comboData, _multiData));
57657       if (callback)
57658         callback(_comboData);
57659     }
57660     function setTaginfoValues(q, callback) {
57661       var fn = _isMulti ? "multikeys" : "values";
57662       var query = (_isMulti ? field.key : "") + q;
57663       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q.toLowerCase()) === 0;
57664       if (hasCountryPrefix) {
57665         query = _countryCode + ":";
57666       }
57667       var params = {
57668         debounce: q !== "",
57669         key: field.key,
57670         query
57671       };
57672       if (_entityIDs.length) {
57673         params.geometry = context.graph().geometry(_entityIDs[0]);
57674       }
57675       services.taginfo[fn](params, function(err, data) {
57676         if (err)
57677           return;
57678         data = data.filter(function(d) {
57679           return field.type !== "typeCombo" || d.value !== "yes";
57680         });
57681         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
57682         if (deprecatedValues) {
57683           data = data.filter(function(d) {
57684             return deprecatedValues.indexOf(d.value) === -1;
57685           });
57686         }
57687         if (hasCountryPrefix) {
57688           data = data.filter(function(d) {
57689             return d.value.toLowerCase().indexOf(_countryCode + ":") === 0;
57690           });
57691         }
57692         _container.classed("empty-combobox", data.length === 0);
57693         _comboData = data.map(function(d) {
57694           var k = d.value;
57695           if (_isMulti)
57696             k = k.replace(field.key, "");
57697           var label = field.t("options." + k, { default: k });
57698           return {
57699             key: k,
57700             value: _isMulti ? k : label,
57701             display: field.t.append("options." + k, { default: k }),
57702             title: d.title || label,
57703             klass: field.hasTextForStringId("options." + k) ? "" : "raw-option"
57704           };
57705         });
57706         _comboData = objectDifference(_comboData, _multiData);
57707         if (callback)
57708           callback(_comboData);
57709       });
57710     }
57711     function setPlaceholder(values) {
57712       if (_isMulti || _isSemi) {
57713         _staticPlaceholder = field.placeholder() || _t("inspector.add");
57714       } else {
57715         var vals = values.map(function(d) {
57716           return d.value;
57717         }).filter(function(s) {
57718           return s.length < 20;
57719         });
57720         var placeholders = vals.length > 1 ? vals : values.map(function(d) {
57721           return d.key;
57722         });
57723         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
57724       }
57725       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
57726         _staticPlaceholder += "\u2026";
57727       }
57728       var ph;
57729       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
57730         ph = _t("inspector.multiple_values");
57731       } else {
57732         ph = _staticPlaceholder;
57733       }
57734       _container.selectAll("input").attr("placeholder", ph);
57735     }
57736     function change() {
57737       var t = {};
57738       var val;
57739       if (_isMulti || _isSemi) {
57740         val = tagValue(utilGetSetValue(_input).replace(/,/g, ";")) || "";
57741         _container.classed("active", false);
57742         utilGetSetValue(_input, "");
57743         var vals = val.split(";").filter(Boolean);
57744         if (!vals.length)
57745           return;
57746         if (_isMulti) {
57747           utilArrayUniq(vals).forEach(function(v) {
57748             var key = (field.key || "") + v;
57749             if (_tags) {
57750               var old = _tags[key];
57751               if (typeof old === "string" && old.toLowerCase() !== "no")
57752                 return;
57753             }
57754             key = context.cleanTagKey(key);
57755             field.keys.push(key);
57756             t[key] = "yes";
57757           });
57758         } else if (_isSemi) {
57759           var arr = _multiData.map(function(d) {
57760             return d.key;
57761           });
57762           arr = arr.concat(vals);
57763           t[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
57764         }
57765         window.setTimeout(function() {
57766           _input.node().focus();
57767         }, 10);
57768       } else {
57769         var rawValue = utilGetSetValue(_input);
57770         if (!rawValue && Array.isArray(_tags[field.key]))
57771           return;
57772         val = context.cleanTagValue(tagValue(rawValue));
57773         t[field.key] = val || void 0;
57774       }
57775       dispatch10.call("change", this, t);
57776     }
57777     function removeMultikey(d3_event, d) {
57778       d3_event.preventDefault();
57779       d3_event.stopPropagation();
57780       var t = {};
57781       if (_isMulti) {
57782         t[d.key] = void 0;
57783       } else if (_isSemi) {
57784         var arr = _multiData.map(function(md) {
57785           return md.key === d.key ? null : md.key;
57786         }).filter(Boolean);
57787         arr = utilArrayUniq(arr);
57788         t[field.key] = arr.length ? arr.join(";") : void 0;
57789       }
57790       dispatch10.call("change", this, t);
57791     }
57792     function combo(selection2) {
57793       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
57794       var type3 = _isMulti || _isSemi ? "multicombo" : "combo";
57795       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type3).merge(_container);
57796       if (_isMulti || _isSemi) {
57797         _container = _container.selectAll(".chiplist").data([0]);
57798         var listClass = "chiplist";
57799         if (field.key === "destination" || field.key === "via") {
57800           listClass += " full-line-chips";
57801         }
57802         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
57803           window.setTimeout(function() {
57804             _input.node().focus();
57805           }, 10);
57806         }).merge(_container);
57807         _inputWrap = _container.selectAll(".input-wrap").data([0]);
57808         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
57809         _input = _inputWrap.selectAll("input").data([0]);
57810       } else {
57811         _input = _container.selectAll("input").data([0]);
57812       }
57813       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, selection2).merge(_input);
57814       if (_isNetwork) {
57815         var extent = combinedEntityExtent();
57816         var countryCode = extent && iso1A2Code(extent.center());
57817         _countryCode = countryCode && countryCode.toLowerCase();
57818       }
57819       _input.on("change", change).on("blur", change);
57820       _input.on("keydown.field", function(d3_event) {
57821         switch (d3_event.keyCode) {
57822           case 13:
57823             _input.node().blur();
57824             d3_event.stopPropagation();
57825             break;
57826         }
57827       });
57828       if (_isMulti || _isSemi) {
57829         _combobox.on("accept", function() {
57830           _input.node().blur();
57831           _input.node().focus();
57832         });
57833         _input.on("focus", function() {
57834           _container.classed("active", true);
57835         });
57836       }
57837     }
57838     combo.tags = function(tags) {
57839       _tags = tags;
57840       if (_isMulti || _isSemi) {
57841         _multiData = [];
57842         var maxLength;
57843         if (_isMulti) {
57844           for (var k in tags) {
57845             if (field.key && k.indexOf(field.key) !== 0)
57846               continue;
57847             if (!field.key && field.keys.indexOf(k) === -1)
57848               continue;
57849             var v = tags[k];
57850             if (!v || typeof v === "string" && v.toLowerCase() === "no")
57851               continue;
57852             var suffix = field.key ? k.slice(field.key.length) : k;
57853             _multiData.push({
57854               key: k,
57855               value: displayValue(suffix),
57856               display: renderValue(suffix),
57857               isMixed: Array.isArray(v)
57858             });
57859           }
57860           if (field.key) {
57861             field.keys = _multiData.map(function(d) {
57862               return d.key;
57863             });
57864             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
57865           } else {
57866             maxLength = context.maxCharsForTagKey();
57867           }
57868         } else if (_isSemi) {
57869           var allValues = [];
57870           var commonValues;
57871           if (Array.isArray(tags[field.key])) {
57872             tags[field.key].forEach(function(tagVal) {
57873               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
57874               allValues = allValues.concat(thisVals);
57875               if (!commonValues) {
57876                 commonValues = thisVals;
57877               } else {
57878                 commonValues = commonValues.filter((value) => thisVals.includes(value));
57879               }
57880             });
57881             allValues = utilArrayUniq(allValues).filter(Boolean);
57882           } else {
57883             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
57884             commonValues = allValues;
57885           }
57886           _multiData = allValues.map(function(v2) {
57887             return {
57888               key: v2,
57889               value: displayValue(v2),
57890               display: renderValue(v2),
57891               isMixed: !commonValues.includes(v2)
57892             };
57893           });
57894           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
57895           maxLength = context.maxCharsForTagValue() - currLength;
57896           if (currLength > 0) {
57897             maxLength -= 1;
57898           }
57899         }
57900         maxLength = Math.max(0, maxLength);
57901         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
57902         var available = objectDifference(_comboData, _multiData);
57903         _combobox.data(available);
57904         var hideAdd = !_allowCustomValues && !available.length || maxLength <= 0;
57905         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
57906         var chips = _container.selectAll(".chip").data(_multiData);
57907         chips.exit().remove();
57908         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
57909         enter.append("span");
57910         enter.append("a");
57911         chips = chips.merge(enter).order().classed("raw-value", function(d) {
57912           var k2 = d.key;
57913           if (_isMulti)
57914             k2 = k2.replace(field.key, "");
57915           return !field.hasTextForStringId("options." + k2);
57916         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d) {
57917           return d.isMixed;
57918         }).attr("title", function(d) {
57919           return d.isMixed ? _t("inspector.unshared_value_tooltip") : null;
57920         });
57921         if (allowDragAndDrop) {
57922           registerDragAndDrop(chips);
57923         }
57924         chips.select("span").each(function(d) {
57925           const selection2 = select_default2(this);
57926           if (d.display) {
57927             selection2.text("");
57928             d.display(selection2);
57929           } else {
57930             selection2.text(d.value);
57931           }
57932         });
57933         chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
57934       } else {
57935         var isMixed = Array.isArray(tags[field.key]);
57936         var mixedValues = isMixed && tags[field.key].map(function(val) {
57937           return displayValue(val);
57938         }).filter(Boolean);
57939         var showsValue = !isMixed && tags[field.key] && !(field.type === "typeCombo" && tags[field.key] === "yes");
57940         var isRawValue = showsValue && !field.hasTextForStringId("options." + tags[field.key]);
57941         var isKnownValue = showsValue && !isRawValue;
57942         var isReadOnly = !_allowCustomValues || isKnownValue;
57943         utilGetSetValue(_input, !isMixed ? displayValue(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) {
57944           if (isReadOnly && isKnownValue && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
57945             d3_event.preventDefault();
57946             d3_event.stopPropagation();
57947             var t = {};
57948             t[field.key] = void 0;
57949             dispatch10.call("change", this, t);
57950           }
57951         });
57952       }
57953     };
57954     function registerDragAndDrop(selection2) {
57955       var dragOrigin, targetIndex;
57956       selection2.call(
57957         drag_default().on("start", function(d3_event) {
57958           dragOrigin = {
57959             x: d3_event.x,
57960             y: d3_event.y
57961           };
57962           targetIndex = null;
57963         }).on("drag", function(d3_event) {
57964           var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
57965           if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
57966             return;
57967           var index = selection2.nodes().indexOf(this);
57968           select_default2(this).classed("dragging", true);
57969           targetIndex = null;
57970           var targetIndexOffsetTop = null;
57971           var draggedTagWidth = select_default2(this).node().offsetWidth;
57972           if (field.key === "destination" || field.key === "via") {
57973             _container.selectAll(".chip").style("transform", function(d2, index2) {
57974               var node = select_default2(this).node();
57975               if (index === index2) {
57976                 return "translate(" + x + "px, " + y + "px)";
57977               } else if (index2 > index && d3_event.y > node.offsetTop) {
57978                 if (targetIndex === null || index2 > targetIndex) {
57979                   targetIndex = index2;
57980                 }
57981                 return "translateY(-100%)";
57982               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
57983                 if (targetIndex === null || index2 < targetIndex) {
57984                   targetIndex = index2;
57985                 }
57986                 return "translateY(100%)";
57987               }
57988               return null;
57989             });
57990           } else {
57991             _container.selectAll(".chip").each(function(d2, index2) {
57992               var node = select_default2(this).node();
57993               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) {
57994                 targetIndex = index2;
57995                 targetIndexOffsetTop = node.offsetTop;
57996               }
57997             }).style("transform", function(d2, index2) {
57998               var node = select_default2(this).node();
57999               if (index === index2) {
58000                 return "translate(" + x + "px, " + y + "px)";
58001               }
58002               if (node.offsetTop === targetIndexOffsetTop) {
58003                 if (index2 < index && index2 >= targetIndex) {
58004                   return "translateX(" + draggedTagWidth + "px)";
58005                 } else if (index2 > index && index2 <= targetIndex) {
58006                   return "translateX(-" + draggedTagWidth + "px)";
58007                 }
58008               }
58009               return null;
58010             });
58011           }
58012         }).on("end", function() {
58013           if (!select_default2(this).classed("dragging")) {
58014             return;
58015           }
58016           var index = selection2.nodes().indexOf(this);
58017           select_default2(this).classed("dragging", false);
58018           _container.selectAll(".chip").style("transform", null);
58019           if (typeof targetIndex === "number") {
58020             var element = _multiData[index];
58021             _multiData.splice(index, 1);
58022             _multiData.splice(targetIndex, 0, element);
58023             var t = {};
58024             if (_multiData.length) {
58025               t[field.key] = _multiData.map(function(element2) {
58026                 return element2.key;
58027               }).join(";");
58028             } else {
58029               t[field.key] = void 0;
58030             }
58031             dispatch10.call("change", this, t);
58032           }
58033           dragOrigin = void 0;
58034           targetIndex = void 0;
58035         })
58036       );
58037     }
58038     combo.focus = function() {
58039       _input.node().focus();
58040     };
58041     combo.entityIDs = function(val) {
58042       if (!arguments.length)
58043         return _entityIDs;
58044       _entityIDs = val;
58045       return combo;
58046     };
58047     function combinedEntityExtent() {
58048       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58049     }
58050     return utilRebind(combo, dispatch10, "on");
58051   }
58052
58053   // modules/ui/fields/input.js
58054   function uiFieldText(field, context) {
58055     var dispatch10 = dispatch_default("change");
58056     var input = select_default2(null);
58057     var outlinkButton = select_default2(null);
58058     var wrap2 = select_default2(null);
58059     var _entityIDs = [];
58060     var _tags;
58061     var _phoneFormats = {};
58062     if (field.type === "tel") {
58063       _mainFileFetcher.get("phone_formats").then(function(d) {
58064         _phoneFormats = d;
58065         updatePhonePlaceholder();
58066       }).catch(function() {
58067       });
58068     }
58069     function calcLocked() {
58070       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
58071         var entity = context.graph().hasEntity(entityID);
58072         if (!entity)
58073           return false;
58074         if (entity.tags.wikidata)
58075           return true;
58076         var preset = _mainPresetIndex.match(entity, context.graph());
58077         var isSuggestion = preset && preset.suggestion;
58078         var which = field.id;
58079         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
58080       });
58081       field.locked(isLocked);
58082     }
58083     function i2(selection2) {
58084       calcLocked();
58085       var isLocked = field.locked();
58086       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58087       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58088       input = wrap2.selectAll("input").data([0]);
58089       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);
58090       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
58091       if (field.type === "tel") {
58092         updatePhonePlaceholder();
58093       } else if (field.type === "number") {
58094         var rtl = _mainLocalizer.textDirection() === "rtl";
58095         input.attr("type", "text");
58096         var inc = field.increment;
58097         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
58098         buttons.enter().append("button").attr("class", function(d) {
58099           var which = d > 0 ? "increment" : "decrement";
58100           return "form-field-button " + which;
58101         }).attr("title", function(d) {
58102           var which = d > 0 ? "increment" : "decrement";
58103           return _t(`inspector.${which}`);
58104         }).merge(buttons).on("click", function(d3_event, d) {
58105           d3_event.preventDefault();
58106           var raw_vals = input.node().value || "0";
58107           var vals = raw_vals.split(";");
58108           vals = vals.map(function(v) {
58109             var num = parseFloat(v.trim(), 10);
58110             if (isFinite(num))
58111               return clamped(num + d);
58112             const compassDir = cardinal[v.trim().toLowerCase()];
58113             if (compassDir !== void 0)
58114               return clamped(compassDir + d);
58115             return v.trim();
58116           });
58117           input.node().value = vals.join(";");
58118           change()();
58119         });
58120       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
58121         input.attr("type", "text");
58122         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
58123         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
58124           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
58125           if (domainResults.length >= 2 && domainResults[1]) {
58126             var domain2 = domainResults[1];
58127             return _t("icons.view_on", { domain: domain2 });
58128           }
58129           return "";
58130         }).on("click", function(d3_event) {
58131           d3_event.preventDefault();
58132           var value = validIdentifierValueForLink();
58133           if (value) {
58134             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
58135             window.open(url, "_blank");
58136           }
58137         }).merge(outlinkButton);
58138       } else if (field.type === "url") {
58139         input.attr("type", "text");
58140         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
58141         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) {
58142           d3_event.preventDefault();
58143           const value = validIdentifierValueForLink();
58144           if (value)
58145             window.open(value, "_blank");
58146         }).merge(outlinkButton);
58147       } else if (field.key.split(":").includes("colour")) {
58148         input.attr("type", "text");
58149         updateColourPreview();
58150       }
58151     }
58152     function isColourValid(colour) {
58153       if (!colour.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
58154         return false;
58155       } else if (!CSS.supports("color", colour) || ["unset", "inherit", "initial", "revert"].includes(colour)) {
58156         return false;
58157       }
58158       return true;
58159     }
58160     function updateColourPreview() {
58161       wrap2.selectAll(".colour-preview").remove();
58162       const colour = utilGetSetValue(input);
58163       if (!isColourValid(colour) && colour !== "")
58164         return;
58165       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
58166       outlinkButton = wrap2.selectAll(".colour-preview").data([colour]);
58167       colourSelector.enter().append("input").attr("type", "color").attr("class", "form-field-button colour-selector").attr("value", colour).on("input", debounce_default(function(d3_event) {
58168         d3_event.preventDefault();
58169         var colour2 = this.value;
58170         if (!isColourValid(colour2))
58171           return;
58172         utilGetSetValue(input, this.value);
58173         change()();
58174         updateColourPreview();
58175       }, 100));
58176       outlinkButton = outlinkButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box");
58177       if (colour === "") {
58178         outlinkButton = outlinkButton.call(svgIcon("#iD-icon-edit"));
58179       }
58180       outlinkButton.on("click", () => wrap2.select(".colour-selector").node().click()).merge(outlinkButton);
58181     }
58182     function updatePhonePlaceholder() {
58183       if (input.empty() || !Object.keys(_phoneFormats).length)
58184         return;
58185       var extent = combinedEntityExtent();
58186       var countryCode = extent && iso1A2Code(extent.center());
58187       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
58188       if (format2)
58189         input.attr("placeholder", format2);
58190     }
58191     function validIdentifierValueForLink() {
58192       const value = utilGetSetValue(input).trim();
58193       if (field.type === "url" && value) {
58194         try {
58195           return new URL(value).href;
58196         } catch (e) {
58197           return null;
58198         }
58199       }
58200       if (field.type === "identifier" && field.pattern) {
58201         return value && value.match(new RegExp(field.pattern))[0];
58202       }
58203       return null;
58204     }
58205     function clamped(num) {
58206       if (field.minValue !== void 0) {
58207         num = Math.max(num, field.minValue);
58208       }
58209       if (field.maxValue !== void 0) {
58210         num = Math.min(num, field.maxValue);
58211       }
58212       return num;
58213     }
58214     function change(onInput) {
58215       return function() {
58216         var t = {};
58217         var val = utilGetSetValue(input);
58218         if (!onInput)
58219           val = context.cleanTagValue(val);
58220         if (!val && Array.isArray(_tags[field.key]))
58221           return;
58222         if (!onInput) {
58223           if (field.type === "number" && val) {
58224             var vals = val.split(";");
58225             vals = vals.map(function(v) {
58226               var num = parseFloat(v.trim(), 10);
58227               return isFinite(num) ? clamped(num) : v.trim();
58228             });
58229             val = vals.join(";");
58230           }
58231           utilGetSetValue(input, val);
58232         }
58233         t[field.key] = val || void 0;
58234         dispatch10.call("change", this, t, onInput);
58235       };
58236     }
58237     i2.entityIDs = function(val) {
58238       if (!arguments.length)
58239         return _entityIDs;
58240       _entityIDs = val;
58241       return i2;
58242     };
58243     i2.tags = function(tags) {
58244       _tags = tags;
58245       var isMixed = Array.isArray(tags[field.key]);
58246       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);
58247       if (field.key.split(":").includes("colour"))
58248         updateColourPreview();
58249       if (outlinkButton && !outlinkButton.empty()) {
58250         var disabled = !validIdentifierValueForLink();
58251         outlinkButton.classed("disabled", disabled);
58252       }
58253     };
58254     i2.focus = function() {
58255       var node = input.node();
58256       if (node)
58257         node.focus();
58258     };
58259     function combinedEntityExtent() {
58260       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58261     }
58262     return utilRebind(i2, dispatch10, "on");
58263   }
58264
58265   // modules/ui/fields/access.js
58266   function uiFieldAccess(field, context) {
58267     var dispatch10 = dispatch_default("change");
58268     var items = select_default2(null);
58269     var _tags;
58270     function access(selection2) {
58271       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58272       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58273       var list = wrap2.selectAll("ul").data([0]);
58274       list = list.enter().append("ul").attr("class", "rows").merge(list);
58275       items = list.selectAll("li").data(field.keys);
58276       var enter = items.enter().append("li").attr("class", function(d) {
58277         return "labeled-input preset-access-" + d;
58278       });
58279       enter.append("span").attr("class", "label preset-label-access").attr("for", function(d) {
58280         return "preset-input-access-" + d;
58281       }).html(function(d) {
58282         return field.t.html("types." + d);
58283       });
58284       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d) {
58285         return "preset-input-access preset-input-access-" + d;
58286       }).call(utilNoAuto).each(function(d) {
58287         select_default2(this).call(
58288           uiCombobox(context, "access-" + d).data(access.options(d))
58289         );
58290       });
58291       items = items.merge(enter);
58292       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
58293     }
58294     function change(d3_event, d) {
58295       var tag = {};
58296       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
58297       if (!value && typeof _tags[d] !== "string")
58298         return;
58299       tag[d] = value || void 0;
58300       dispatch10.call("change", this, tag);
58301     }
58302     access.options = function(type3) {
58303       var options2 = [
58304         "yes",
58305         "no",
58306         "designated",
58307         "permissive",
58308         "destination",
58309         "customers",
58310         "private",
58311         "permit",
58312         "unknown"
58313       ];
58314       if (type3 === "access") {
58315         options2 = options2.filter((v) => v !== "yes" && v !== "designated");
58316       }
58317       if (type3 === "bicycle") {
58318         options2.splice(options2.length - 4, 0, "dismount");
58319       }
58320       return options2.map(function(option) {
58321         return {
58322           title: field.t("options." + option + ".description"),
58323           value: option
58324         };
58325       });
58326     };
58327     const placeholdersByTag = {
58328       highway: {
58329         footway: {
58330           foot: "designated",
58331           motor_vehicle: "no"
58332         },
58333         steps: {
58334           foot: "yes",
58335           motor_vehicle: "no",
58336           bicycle: "no",
58337           horse: "no"
58338         },
58339         pedestrian: {
58340           foot: "yes",
58341           motor_vehicle: "no"
58342         },
58343         cycleway: {
58344           motor_vehicle: "no",
58345           bicycle: "designated"
58346         },
58347         bridleway: {
58348           motor_vehicle: "no",
58349           horse: "designated"
58350         },
58351         path: {
58352           foot: "yes",
58353           motor_vehicle: "no",
58354           bicycle: "yes",
58355           horse: "yes"
58356         },
58357         motorway: {
58358           foot: "no",
58359           motor_vehicle: "yes",
58360           bicycle: "no",
58361           horse: "no"
58362         },
58363         trunk: {
58364           motor_vehicle: "yes"
58365         },
58366         primary: {
58367           foot: "yes",
58368           motor_vehicle: "yes",
58369           bicycle: "yes",
58370           horse: "yes"
58371         },
58372         secondary: {
58373           foot: "yes",
58374           motor_vehicle: "yes",
58375           bicycle: "yes",
58376           horse: "yes"
58377         },
58378         tertiary: {
58379           foot: "yes",
58380           motor_vehicle: "yes",
58381           bicycle: "yes",
58382           horse: "yes"
58383         },
58384         residential: {
58385           foot: "yes",
58386           motor_vehicle: "yes",
58387           bicycle: "yes",
58388           horse: "yes"
58389         },
58390         unclassified: {
58391           foot: "yes",
58392           motor_vehicle: "yes",
58393           bicycle: "yes",
58394           horse: "yes"
58395         },
58396         service: {
58397           foot: "yes",
58398           motor_vehicle: "yes",
58399           bicycle: "yes",
58400           horse: "yes"
58401         },
58402         motorway_link: {
58403           foot: "no",
58404           motor_vehicle: "yes",
58405           bicycle: "no",
58406           horse: "no"
58407         },
58408         trunk_link: {
58409           motor_vehicle: "yes"
58410         },
58411         primary_link: {
58412           foot: "yes",
58413           motor_vehicle: "yes",
58414           bicycle: "yes",
58415           horse: "yes"
58416         },
58417         secondary_link: {
58418           foot: "yes",
58419           motor_vehicle: "yes",
58420           bicycle: "yes",
58421           horse: "yes"
58422         },
58423         tertiary_link: {
58424           foot: "yes",
58425           motor_vehicle: "yes",
58426           bicycle: "yes",
58427           horse: "yes"
58428         },
58429         construction: {
58430           access: "no"
58431         }
58432       },
58433       barrier: {
58434         bollard: {
58435           access: "no",
58436           bicycle: "yes",
58437           foot: "yes"
58438         },
58439         bus_trap: {
58440           motor_vehicle: "no",
58441           psv: "yes",
58442           foot: "yes",
58443           bicycle: "yes"
58444         },
58445         city_wall: {
58446           access: "no"
58447         },
58448         coupure: {
58449           access: "yes"
58450         },
58451         cycle_barrier: {
58452           motor_vehicle: "no"
58453         },
58454         ditch: {
58455           access: "no"
58456         },
58457         entrance: {
58458           access: "yes"
58459         },
58460         fence: {
58461           access: "no"
58462         },
58463         hedge: {
58464           access: "no"
58465         },
58466         jersey_barrier: {
58467           access: "no"
58468         },
58469         motorcycle_barrier: {
58470           motor_vehicle: "no"
58471         },
58472         rail_guard: {
58473           access: "no"
58474         }
58475       }
58476     };
58477     access.tags = function(tags) {
58478       _tags = tags;
58479       utilGetSetValue(items.selectAll(".preset-input-access"), function(d) {
58480         return typeof tags[d] === "string" ? tags[d] : "";
58481       }).classed("mixed", function(d) {
58482         return tags[d] && Array.isArray(tags[d]);
58483       }).attr("title", function(d) {
58484         return tags[d] && Array.isArray(tags[d]) && tags[d].filter(Boolean).join("\n");
58485       }).attr("placeholder", function(d) {
58486         if (tags[d] && Array.isArray(tags[d])) {
58487           return _t("inspector.multiple_values");
58488         }
58489         if (d === "bicycle" || d === "motor_vehicle") {
58490           if (tags.vehicle && typeof tags.vehicle === "string") {
58491             return tags.vehicle;
58492           }
58493         }
58494         if (tags.access && typeof tags.access === "string") {
58495           return tags.access;
58496         }
58497         function getPlaceholdersByTag(key, placeholdersByKey) {
58498           if (typeof tags[key] === "string") {
58499             if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d]) {
58500               return placeholdersByKey[tags[key]][d];
58501             }
58502           } else {
58503             var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
58504               return placeholdersByKey[val] && placeholdersByKey[val][d];
58505             }).filter(Boolean);
58506             if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
58507               return impliedAccesses[0];
58508             }
58509           }
58510         }
58511         for (const key in placeholdersByTag) {
58512           if (tags[key]) {
58513             const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
58514             if (impliedAccess) {
58515               return impliedAccess;
58516             }
58517           }
58518         }
58519         if (d === "access" && !tags.barrier) {
58520           return "yes";
58521         }
58522         return field.placeholder();
58523       });
58524     };
58525     access.focus = function() {
58526       items.selectAll(".preset-input-access").node().focus();
58527     };
58528     return utilRebind(access, dispatch10, "on");
58529   }
58530
58531   // modules/ui/fields/address.js
58532   function uiFieldAddress(field, context) {
58533     var dispatch10 = dispatch_default("change");
58534     var _selection = select_default2(null);
58535     var _wrap = select_default2(null);
58536     var addrField = _mainPresetIndex.field("address");
58537     var _entityIDs = [];
58538     var _tags;
58539     var _countryCode;
58540     var _addressFormats = [{
58541       format: [
58542         ["housenumber", "street"],
58543         ["city", "postcode"]
58544       ]
58545     }];
58546     _mainFileFetcher.get("address_formats").then(function(d) {
58547       _addressFormats = d;
58548       if (!_selection.empty()) {
58549         _selection.call(address);
58550       }
58551     }).catch(function() {
58552     });
58553     function getNearStreets() {
58554       var extent = combinedEntityExtent();
58555       var l = extent.center();
58556       var box = geoExtent(l).padByMeters(200);
58557       var streets = context.history().intersects(box).filter(isAddressable).map(function(d) {
58558         var loc = context.projection([
58559           (extent[0][0] + extent[1][0]) / 2,
58560           (extent[0][1] + extent[1][1]) / 2
58561         ]);
58562         var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
58563         return {
58564           title: d.tags.name,
58565           value: d.tags.name,
58566           dist: choice.distance
58567         };
58568       }).sort(function(a, b) {
58569         return a.dist - b.dist;
58570       });
58571       return utilArrayUniqBy(streets, "value");
58572       function isAddressable(d) {
58573         return d.tags.highway && d.tags.name && d.type === "way";
58574       }
58575     }
58576     function getNearCities() {
58577       var extent = combinedEntityExtent();
58578       var l = extent.center();
58579       var box = geoExtent(l).padByMeters(200);
58580       var cities = context.history().intersects(box).filter(isAddressable).map(function(d) {
58581         return {
58582           title: d.tags["addr:city"] || d.tags.name,
58583           value: d.tags["addr:city"] || d.tags.name,
58584           dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
58585         };
58586       }).sort(function(a, b) {
58587         return a.dist - b.dist;
58588       });
58589       return utilArrayUniqBy(cities, "value");
58590       function isAddressable(d) {
58591         if (d.tags.name) {
58592           if (d.tags.admin_level === "8" && d.tags.boundary === "administrative")
58593             return true;
58594           if (d.tags.border_type === "city")
58595             return true;
58596           if (d.tags.place === "city" || d.tags.place === "town" || d.tags.place === "village")
58597             return true;
58598         }
58599         if (d.tags["addr:city"])
58600           return true;
58601         return false;
58602       }
58603     }
58604     function getNearValues(key) {
58605       var extent = combinedEntityExtent();
58606       var l = extent.center();
58607       var box = geoExtent(l).padByMeters(200);
58608       var results = context.history().intersects(box).filter(function hasTag(d) {
58609         return _entityIDs.indexOf(d.id) === -1 && d.tags[key];
58610       }).map(function(d) {
58611         return {
58612           title: d.tags[key],
58613           value: d.tags[key],
58614           dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
58615         };
58616       }).sort(function(a, b) {
58617         return a.dist - b.dist;
58618       });
58619       return utilArrayUniqBy(results, "value");
58620     }
58621     function updateForCountryCode() {
58622       if (!_countryCode)
58623         return;
58624       var addressFormat;
58625       for (var i2 = 0; i2 < _addressFormats.length; i2++) {
58626         var format2 = _addressFormats[i2];
58627         if (!format2.countryCodes) {
58628           addressFormat = format2;
58629         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
58630           addressFormat = format2;
58631           break;
58632         }
58633       }
58634       var dropdowns = addressFormat.dropdowns || [
58635         "city",
58636         "county",
58637         "country",
58638         "district",
58639         "hamlet",
58640         "neighbourhood",
58641         "place",
58642         "postcode",
58643         "province",
58644         "quarter",
58645         "state",
58646         "street",
58647         "subdistrict",
58648         "suburb"
58649       ];
58650       var widths = addressFormat.widths || {
58651         housenumber: 1 / 3,
58652         street: 2 / 3,
58653         city: 2 / 3,
58654         state: 1 / 4,
58655         postcode: 1 / 3
58656       };
58657       function row(r) {
58658         var total = r.reduce(function(sum, key) {
58659           return sum + (widths[key] || 0.5);
58660         }, 0);
58661         return r.map(function(key) {
58662           return {
58663             id: key,
58664             width: (widths[key] || 0.5) / total
58665           };
58666         });
58667       }
58668       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d) {
58669         return d.toString();
58670       });
58671       rows.exit().remove();
58672       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d) {
58673         return "addr-" + d.id;
58674       }).call(utilNoAuto).each(addDropdown).style("width", function(d) {
58675         return d.width * 100 + "%";
58676       });
58677       function addDropdown(d) {
58678         if (dropdowns.indexOf(d.id) === -1)
58679           return;
58680         var nearValues = d.id === "street" ? getNearStreets : d.id === "city" ? getNearCities : getNearValues;
58681         select_default2(this).call(
58682           uiCombobox(context, "address-" + d.id).minItems(1).caseSensitive(true).fetcher(function(value, callback) {
58683             callback(nearValues("addr:" + d.id));
58684           })
58685         );
58686       }
58687       _wrap.selectAll("input").on("blur", change()).on("change", change());
58688       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
58689       if (_tags)
58690         updateTags(_tags);
58691     }
58692     function address(selection2) {
58693       _selection = selection2;
58694       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
58695       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
58696       var extent = combinedEntityExtent();
58697       if (extent) {
58698         var countryCode;
58699         if (context.inIntro()) {
58700           countryCode = _t("intro.graph.countrycode");
58701         } else {
58702           var center = extent.center();
58703           countryCode = iso1A2Code(center);
58704         }
58705         if (countryCode) {
58706           _countryCode = countryCode.toLowerCase();
58707           updateForCountryCode();
58708         }
58709       }
58710     }
58711     function change(onInput) {
58712       return function() {
58713         var tags = {};
58714         _wrap.selectAll("input").each(function(subfield) {
58715           var key = field.key + ":" + subfield.id;
58716           var value = this.value;
58717           if (!onInput)
58718             value = context.cleanTagValue(value);
58719           if (Array.isArray(_tags[key]) && !value)
58720             return;
58721           tags[key] = value || void 0;
58722         });
58723         dispatch10.call("change", this, tags, onInput);
58724       };
58725     }
58726     function updatePlaceholder(inputSelection) {
58727       return inputSelection.attr("placeholder", function(subfield) {
58728         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
58729           return _t("inspector.multiple_values");
58730         }
58731         if (_countryCode) {
58732           var localkey = subfield.id + "!" + _countryCode;
58733           var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : subfield.id;
58734           return addrField.t("placeholders." + tkey);
58735         }
58736       });
58737     }
58738     function updateTags(tags) {
58739       utilGetSetValue(_wrap.selectAll("input"), function(subfield) {
58740         var val = tags[field.key + ":" + subfield.id];
58741         return typeof val === "string" ? val : "";
58742       }).attr("title", function(subfield) {
58743         var val = tags[field.key + ":" + subfield.id];
58744         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
58745       }).classed("mixed", function(subfield) {
58746         return Array.isArray(tags[field.key + ":" + subfield.id]);
58747       }).call(updatePlaceholder);
58748     }
58749     function combinedEntityExtent() {
58750       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58751     }
58752     address.entityIDs = function(val) {
58753       if (!arguments.length)
58754         return _entityIDs;
58755       _entityIDs = val;
58756       return address;
58757     };
58758     address.tags = function(tags) {
58759       _tags = tags;
58760       updateTags(tags);
58761     };
58762     address.focus = function() {
58763       var node = _wrap.selectAll("input").node();
58764       if (node)
58765         node.focus();
58766     };
58767     return utilRebind(address, dispatch10, "on");
58768   }
58769
58770   // modules/ui/fields/cycleway.js
58771   function uiFieldCycleway(field, context) {
58772     var dispatch10 = dispatch_default("change");
58773     var items = select_default2(null);
58774     var wrap2 = select_default2(null);
58775     var _tags;
58776     function cycleway(selection2) {
58777       function stripcolon(s) {
58778         return s.replace(":", "");
58779       }
58780       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58781       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58782       var div = wrap2.selectAll("ul").data([0]);
58783       div = div.enter().append("ul").attr("class", "rows").merge(div);
58784       var keys = ["cycleway:left", "cycleway:right"];
58785       items = div.selectAll("li").data(keys);
58786       var enter = items.enter().append("li").attr("class", function(d) {
58787         return "labeled-input preset-cycleway-" + stripcolon(d);
58788       });
58789       enter.append("span").attr("class", "label preset-label-cycleway").attr("for", function(d) {
58790         return "preset-input-cycleway-" + stripcolon(d);
58791       }).html(function(d) {
58792         return field.t.html("types." + d);
58793       });
58794       enter.append("div").attr("class", "preset-input-cycleway-wrap").append("input").attr("type", "text").attr("class", function(d) {
58795         return "preset-input-cycleway preset-input-" + stripcolon(d);
58796       }).call(utilNoAuto).each(function(d) {
58797         select_default2(this).call(
58798           uiCombobox(context, "cycleway-" + stripcolon(d)).data(cycleway.options(d))
58799         );
58800       });
58801       items = items.merge(enter);
58802       wrap2.selectAll(".preset-input-cycleway").on("change", change).on("blur", change);
58803     }
58804     function change(d3_event, key) {
58805       var newValue = context.cleanTagValue(utilGetSetValue(select_default2(this)));
58806       if (!newValue && (Array.isArray(_tags.cycleway) || Array.isArray(_tags[key])))
58807         return;
58808       if (newValue === "none" || newValue === "") {
58809         newValue = void 0;
58810       }
58811       var otherKey = key === "cycleway:left" ? "cycleway:right" : "cycleway:left";
58812       var otherValue = typeof _tags.cycleway === "string" ? _tags.cycleway : _tags[otherKey];
58813       if (otherValue && Array.isArray(otherValue)) {
58814         otherValue = otherValue[0];
58815       }
58816       if (otherValue === "none" || otherValue === "") {
58817         otherValue = void 0;
58818       }
58819       var tag = {};
58820       if (newValue === otherValue) {
58821         tag = {
58822           cycleway: newValue,
58823           "cycleway:left": void 0,
58824           "cycleway:right": void 0
58825         };
58826       } else {
58827         tag = {
58828           cycleway: void 0
58829         };
58830         tag[key] = newValue;
58831         tag[otherKey] = otherValue;
58832       }
58833       dispatch10.call("change", this, tag);
58834     }
58835     cycleway.options = function() {
58836       return field.options.map(function(option) {
58837         return {
58838           title: field.t("options." + option + ".description"),
58839           value: option
58840         };
58841       });
58842     };
58843     cycleway.tags = function(tags) {
58844       _tags = tags;
58845       var commonValue = typeof tags.cycleway === "string" && tags.cycleway;
58846       utilGetSetValue(items.selectAll(".preset-input-cycleway"), function(d) {
58847         if (commonValue)
58848           return commonValue;
58849         return !tags.cycleway && typeof tags[d] === "string" ? tags[d] : "";
58850       }).attr("title", function(d) {
58851         if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
58852           var vals = [];
58853           if (Array.isArray(tags.cycleway)) {
58854             vals = vals.concat(tags.cycleway);
58855           }
58856           if (Array.isArray(tags[d])) {
58857             vals = vals.concat(tags[d]);
58858           }
58859           return vals.filter(Boolean).join("\n");
58860         }
58861         return null;
58862       }).attr("placeholder", function(d) {
58863         if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
58864           return _t("inspector.multiple_values");
58865         }
58866         return field.placeholder();
58867       }).classed("mixed", function(d) {
58868         return Array.isArray(tags.cycleway) || Array.isArray(tags[d]);
58869       });
58870     };
58871     cycleway.focus = function() {
58872       var node = wrap2.selectAll("input").node();
58873       if (node)
58874         node.focus();
58875     };
58876     return utilRebind(cycleway, dispatch10, "on");
58877   }
58878
58879   // modules/ui/fields/lanes.js
58880   function uiFieldLanes(field, context) {
58881     var dispatch10 = dispatch_default("change");
58882     var LANE_WIDTH = 40;
58883     var LANE_HEIGHT = 200;
58884     var _entityIDs = [];
58885     function lanes(selection2) {
58886       var lanesData = context.entity(_entityIDs[0]).lanes();
58887       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
58888         selection2.call(lanes.off);
58889         return;
58890       }
58891       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
58892       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
58893       var surface = wrap2.selectAll(".surface").data([0]);
58894       var d = utilGetDimensions(wrap2);
58895       var freeSpace = d[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
58896       surface = surface.enter().append("svg").attr("width", d[0]).attr("height", 300).attr("class", "surface").merge(surface);
58897       var lanesSelection = surface.selectAll(".lanes").data([0]);
58898       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
58899       lanesSelection.attr("transform", function() {
58900         return "translate(" + freeSpace / 2 + ", 0)";
58901       });
58902       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
58903       lane.exit().remove();
58904       var enter = lane.enter().append("g").attr("class", "lane");
58905       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
58906       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
58907       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
58908       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
58909       lane = lane.merge(enter);
58910       lane.attr("transform", function(d2) {
58911         return "translate(" + LANE_WIDTH * d2.index * 1.5 + ", 0)";
58912       });
58913       lane.select(".forward").style("visibility", function(d2) {
58914         return d2.direction === "forward" ? "visible" : "hidden";
58915       });
58916       lane.select(".bothways").style("visibility", function(d2) {
58917         return d2.direction === "bothways" ? "visible" : "hidden";
58918       });
58919       lane.select(".backward").style("visibility", function(d2) {
58920         return d2.direction === "backward" ? "visible" : "hidden";
58921       });
58922     }
58923     lanes.entityIDs = function(val) {
58924       _entityIDs = val;
58925     };
58926     lanes.tags = function() {
58927     };
58928     lanes.focus = function() {
58929     };
58930     lanes.off = function() {
58931     };
58932     return utilRebind(lanes, dispatch10, "on");
58933   }
58934   uiFieldLanes.supportsMultiselection = false;
58935
58936   // modules/ui/fields/localized.js
58937   var _languagesArray = [];
58938   function uiFieldLocalized(field, context) {
58939     var dispatch10 = dispatch_default("change", "input");
58940     var wikipedia = services.wikipedia;
58941     var input = select_default2(null);
58942     var localizedInputs = select_default2(null);
58943     var _countryCode;
58944     var _tags;
58945     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
58946     });
58947     var _territoryLanguages = {};
58948     _mainFileFetcher.get("territory_languages").then(function(d) {
58949       _territoryLanguages = d;
58950     }).catch(function() {
58951     });
58952     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
58953     var _selection = select_default2(null);
58954     var _multilingual = [];
58955     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
58956     var _wikiTitles;
58957     var _entityIDs = [];
58958     function loadLanguagesArray(dataLanguages) {
58959       if (_languagesArray.length !== 0)
58960         return;
58961       var replacements = {
58962         sr: "sr-Cyrl",
58963         "sr-Cyrl": false
58964       };
58965       for (var code in dataLanguages) {
58966         if (replacements[code] === false)
58967           continue;
58968         var metaCode = code;
58969         if (replacements[code])
58970           metaCode = replacements[code];
58971         _languagesArray.push({
58972           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
58973           nativeName: dataLanguages[metaCode].nativeName,
58974           code,
58975           label: _mainLocalizer.languageName(metaCode)
58976         });
58977       }
58978     }
58979     function calcLocked() {
58980       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
58981         var entity = context.graph().hasEntity(entityID);
58982         if (!entity)
58983           return false;
58984         if (entity.tags.wikidata)
58985           return true;
58986         if (entity.tags["name:etymology:wikidata"])
58987           return true;
58988         var preset = _mainPresetIndex.match(entity, context.graph());
58989         if (preset) {
58990           var isSuggestion = preset.suggestion;
58991           var fields = preset.fields();
58992           var showsBrandField = fields.some(function(d) {
58993             return d.id === "brand";
58994           });
58995           var showsOperatorField = fields.some(function(d) {
58996             return d.id === "operator";
58997           });
58998           var setsName = preset.addTags.name;
58999           var setsBrandWikidata = preset.addTags["brand:wikidata"];
59000           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
59001           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
59002         }
59003         return false;
59004       });
59005       field.locked(isLocked);
59006     }
59007     function calcMultilingual(tags) {
59008       var existingLangsOrdered = _multilingual.map(function(item2) {
59009         return item2.lang;
59010       });
59011       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
59012       for (var k in tags) {
59013         var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
59014         if (m && m[1] === field.key && m[2]) {
59015           var item = { lang: m[2], value: tags[k] };
59016           if (existingLangs.has(item.lang)) {
59017             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
59018             existingLangs.delete(item.lang);
59019           } else {
59020             _multilingual.push(item);
59021           }
59022         }
59023       }
59024       _multilingual.forEach(function(item2) {
59025         if (item2.lang && existingLangs.has(item2.lang)) {
59026           item2.value = "";
59027         }
59028       });
59029     }
59030     function localized(selection2) {
59031       _selection = selection2;
59032       calcLocked();
59033       var isLocked = field.locked();
59034       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59035       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59036       input = wrap2.selectAll(".localized-main").data([0]);
59037       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
59038       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
59039       var translateButton = wrap2.selectAll(".localized-add").data([0]);
59040       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);
59041       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
59042       if (_tags && !_multilingual.length) {
59043         calcMultilingual(_tags);
59044       }
59045       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
59046       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
59047       localizedInputs.call(renderMultilingual);
59048       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
59049       selection2.selectAll(".combobox-caret").classed("nope", true);
59050       function addNew(d3_event) {
59051         d3_event.preventDefault();
59052         if (field.locked())
59053           return;
59054         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
59055         var langExists = _multilingual.find(function(datum2) {
59056           return datum2.lang === defaultLang;
59057         });
59058         var isLangEn = defaultLang.indexOf("en") > -1;
59059         if (isLangEn || langExists) {
59060           defaultLang = "";
59061           langExists = _multilingual.find(function(datum2) {
59062             return datum2.lang === defaultLang;
59063           });
59064         }
59065         if (!langExists) {
59066           _multilingual.unshift({ lang: defaultLang, value: "" });
59067           localizedInputs.call(renderMultilingual);
59068         }
59069       }
59070       function change(onInput) {
59071         return function(d3_event) {
59072           if (field.locked()) {
59073             d3_event.preventDefault();
59074             return;
59075           }
59076           var val = utilGetSetValue(select_default2(this));
59077           if (!onInput)
59078             val = context.cleanTagValue(val);
59079           if (!val && Array.isArray(_tags[field.key]))
59080             return;
59081           var t = {};
59082           t[field.key] = val || void 0;
59083           dispatch10.call("change", this, t, onInput);
59084         };
59085       }
59086     }
59087     function key(lang) {
59088       return field.key + ":" + lang;
59089     }
59090     function changeLang(d3_event, d) {
59091       var tags = {};
59092       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
59093       var language = _languagesArray.find(function(d2) {
59094         return d2.label.toLowerCase() === lang || d2.localName && d2.localName.toLowerCase() === lang || d2.nativeName && d2.nativeName.toLowerCase() === lang;
59095       });
59096       if (language)
59097         lang = language.code;
59098       if (d.lang && d.lang !== lang) {
59099         tags[key(d.lang)] = void 0;
59100       }
59101       var newKey = lang && context.cleanTagKey(key(lang));
59102       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
59103       if (newKey && value) {
59104         tags[newKey] = value;
59105       } else if (newKey && _wikiTitles && _wikiTitles[d.lang]) {
59106         tags[newKey] = _wikiTitles[d.lang];
59107       }
59108       d.lang = lang;
59109       dispatch10.call("change", this, tags);
59110     }
59111     function changeValue(d3_event, d) {
59112       if (!d.lang)
59113         return;
59114       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
59115       if (!value && Array.isArray(d.value))
59116         return;
59117       var t = {};
59118       t[key(d.lang)] = value;
59119       d.value = value;
59120       dispatch10.call("change", this, t);
59121     }
59122     function fetchLanguages(value, cb) {
59123       var v = value.toLowerCase();
59124       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
59125       if (_countryCode && _territoryLanguages[_countryCode]) {
59126         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
59127       }
59128       var langItems = [];
59129       langCodes.forEach(function(code) {
59130         var langItem = _languagesArray.find(function(item) {
59131           return item.code === code;
59132         });
59133         if (langItem)
59134           langItems.push(langItem);
59135       });
59136       langItems = utilArrayUniq(langItems.concat(_languagesArray));
59137       cb(langItems.filter(function(d) {
59138         return d.label.toLowerCase().indexOf(v) >= 0 || d.localName && d.localName.toLowerCase().indexOf(v) >= 0 || d.nativeName && d.nativeName.toLowerCase().indexOf(v) >= 0 || d.code.toLowerCase().indexOf(v) >= 0;
59139       }).map(function(d) {
59140         return { value: d.label };
59141       }));
59142     }
59143     function renderMultilingual(selection2) {
59144       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d) {
59145         return d.lang;
59146       });
59147       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
59148       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_, index) {
59149         var wrap2 = select_default2(this);
59150         var domId = utilUniqueDomId(index);
59151         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
59152         var text2 = label.append("span").attr("class", "label-text");
59153         text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
59154         text2.append("span").attr("class", "label-textannotation");
59155         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d) {
59156           if (field.locked())
59157             return;
59158           d3_event.preventDefault();
59159           _multilingual.splice(_multilingual.indexOf(d), 1);
59160           var langKey = d.lang && key(d.lang);
59161           if (langKey && langKey in _tags) {
59162             delete _tags[langKey];
59163             var t = {};
59164             t[langKey] = void 0;
59165             dispatch10.call("change", this, t);
59166             return;
59167           }
59168           renderMultilingual(selection2);
59169         }).call(svgIcon("#iD-operation-delete"));
59170         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);
59171         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
59172       });
59173       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() {
59174         select_default2(this).style("max-height", "").style("overflow", "visible");
59175       });
59176       entries = entries.merge(entriesEnter);
59177       entries.order();
59178       entries.classed("present", true);
59179       utilGetSetValue(entries.select(".localized-lang"), function(d) {
59180         var langItem = _languagesArray.find(function(item) {
59181           return item.code === d.lang;
59182         });
59183         if (langItem)
59184           return langItem.label;
59185         return d.lang;
59186       });
59187       utilGetSetValue(entries.select(".localized-value"), function(d) {
59188         return typeof d.value === "string" ? d.value : "";
59189       }).attr("title", function(d) {
59190         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : null;
59191       }).attr("placeholder", function(d) {
59192         return Array.isArray(d.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
59193       }).classed("mixed", function(d) {
59194         return Array.isArray(d.value);
59195       });
59196     }
59197     localized.tags = function(tags) {
59198       _tags = tags;
59199       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
59200         _wikiTitles = {};
59201         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
59202         if (wm && wm[0] && wm[1]) {
59203           wikipedia.translations(wm[1], wm[2], function(err, d) {
59204             if (err || !d)
59205               return;
59206             _wikiTitles = d;
59207           });
59208         }
59209       }
59210       var isMixed = Array.isArray(tags[field.key]);
59211       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);
59212       calcMultilingual(tags);
59213       _selection.call(localized);
59214     };
59215     localized.focus = function() {
59216       input.node().focus();
59217     };
59218     localized.entityIDs = function(val) {
59219       if (!arguments.length)
59220         return _entityIDs;
59221       _entityIDs = val;
59222       _multilingual = [];
59223       loadCountryCode();
59224       return localized;
59225     };
59226     function loadCountryCode() {
59227       var extent = combinedEntityExtent();
59228       var countryCode = extent && iso1A2Code(extent.center());
59229       _countryCode = countryCode && countryCode.toLowerCase();
59230     }
59231     function combinedEntityExtent() {
59232       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
59233     }
59234     return utilRebind(localized, dispatch10, "on");
59235   }
59236
59237   // modules/ui/fields/roadheight.js
59238   function uiFieldRoadheight(field, context) {
59239     var dispatch10 = dispatch_default("change");
59240     var primaryUnitInput = select_default2(null);
59241     var primaryInput = select_default2(null);
59242     var secondaryInput = select_default2(null);
59243     var secondaryUnitInput = select_default2(null);
59244     var _entityIDs = [];
59245     var _tags;
59246     var _isImperial;
59247     var primaryUnits = [
59248       {
59249         value: "m",
59250         title: _t("inspector.roadheight.meter")
59251       },
59252       {
59253         value: "ft",
59254         title: _t("inspector.roadheight.foot")
59255       }
59256     ];
59257     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
59258     function roadheight(selection2) {
59259       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59260       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59261       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
59262       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
59263       primaryInput.on("change", change).on("blur", change);
59264       var loc = combinedEntityExtent().center();
59265       _isImperial = roadHeightUnit(loc) === "ft";
59266       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
59267       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
59268       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
59269       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
59270       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
59271       secondaryInput.on("change", change).on("blur", change);
59272       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
59273       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
59274       function changeUnits() {
59275         var primaryUnit = utilGetSetValue(primaryUnitInput);
59276         if (primaryUnit === "m") {
59277           _isImperial = false;
59278         } else if (primaryUnit === "ft") {
59279           _isImperial = true;
59280         }
59281         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
59282         setUnitSuggestions();
59283         change();
59284       }
59285     }
59286     function setUnitSuggestions() {
59287       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
59288     }
59289     function change() {
59290       var tag = {};
59291       var primaryValue = utilGetSetValue(primaryInput).trim();
59292       var secondaryValue = utilGetSetValue(secondaryInput).trim();
59293       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
59294         return;
59295       if (!primaryValue && !secondaryValue) {
59296         tag[field.key] = void 0;
59297       } else if (isNaN(primaryValue) || isNaN(secondaryValue) || !_isImperial) {
59298         tag[field.key] = context.cleanTagValue(primaryValue);
59299       } else {
59300         if (primaryValue !== "") {
59301           primaryValue = context.cleanTagValue(primaryValue + "'");
59302         }
59303         if (secondaryValue !== "") {
59304           secondaryValue = context.cleanTagValue(secondaryValue + '"');
59305         }
59306         tag[field.key] = primaryValue + secondaryValue;
59307       }
59308       dispatch10.call("change", this, tag);
59309     }
59310     roadheight.tags = function(tags) {
59311       _tags = tags;
59312       var primaryValue = tags[field.key];
59313       var secondaryValue;
59314       var isMixed = Array.isArray(primaryValue);
59315       if (!isMixed) {
59316         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
59317           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
59318           if (secondaryValue !== null) {
59319             secondaryValue = secondaryValue[1];
59320           }
59321           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
59322           if (primaryValue !== null) {
59323             primaryValue = primaryValue[1];
59324           }
59325           _isImperial = true;
59326         } else if (primaryValue) {
59327           _isImperial = false;
59328         }
59329       }
59330       setUnitSuggestions();
59331       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);
59332       utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? "0" : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
59333       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
59334     };
59335     roadheight.focus = function() {
59336       primaryInput.node().focus();
59337     };
59338     roadheight.entityIDs = function(val) {
59339       _entityIDs = val;
59340     };
59341     function combinedEntityExtent() {
59342       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
59343     }
59344     return utilRebind(roadheight, dispatch10, "on");
59345   }
59346
59347   // modules/ui/fields/roadspeed.js
59348   function uiFieldRoadspeed(field, context) {
59349     var dispatch10 = dispatch_default("change");
59350     var unitInput = select_default2(null);
59351     var input = select_default2(null);
59352     var _entityIDs = [];
59353     var _tags;
59354     var _isImperial;
59355     var speedCombo = uiCombobox(context, "roadspeed");
59356     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
59357     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
59358     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
59359     function roadspeed(selection2) {
59360       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59361       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59362       input = wrap2.selectAll("input.roadspeed-number").data([0]);
59363       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
59364       input.on("change", change).on("blur", change);
59365       var loc = combinedEntityExtent().center();
59366       _isImperial = roadSpeedUnit(loc) === "mph";
59367       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
59368       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
59369       unitInput.on("blur", changeUnits).on("change", changeUnits);
59370       function changeUnits() {
59371         var unit2 = utilGetSetValue(unitInput);
59372         if (unit2 === "km/h") {
59373           _isImperial = false;
59374         } else if (unit2 === "mph") {
59375           _isImperial = true;
59376         }
59377         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
59378         setUnitSuggestions();
59379         change();
59380       }
59381     }
59382     function setUnitSuggestions() {
59383       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
59384       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
59385     }
59386     function comboValues(d) {
59387       return {
59388         value: d.toString(),
59389         title: d.toString()
59390       };
59391     }
59392     function change() {
59393       var tag = {};
59394       var value = utilGetSetValue(input).trim();
59395       if (!value && Array.isArray(_tags[field.key]))
59396         return;
59397       if (!value) {
59398         tag[field.key] = void 0;
59399       } else if (isNaN(value) || !_isImperial) {
59400         tag[field.key] = context.cleanTagValue(value);
59401       } else {
59402         tag[field.key] = context.cleanTagValue(value + " mph");
59403       }
59404       dispatch10.call("change", this, tag);
59405     }
59406     roadspeed.tags = function(tags) {
59407       _tags = tags;
59408       var value = tags[field.key];
59409       var isMixed = Array.isArray(value);
59410       if (!isMixed) {
59411         if (value && value.indexOf("mph") >= 0) {
59412           value = parseInt(value, 10).toString();
59413           _isImperial = true;
59414         } else if (value) {
59415           _isImperial = false;
59416         }
59417       }
59418       setUnitSuggestions();
59419       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);
59420     };
59421     roadspeed.focus = function() {
59422       input.node().focus();
59423     };
59424     roadspeed.entityIDs = function(val) {
59425       _entityIDs = val;
59426     };
59427     function combinedEntityExtent() {
59428       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
59429     }
59430     return utilRebind(roadspeed, dispatch10, "on");
59431   }
59432
59433   // modules/ui/fields/radio.js
59434   function uiFieldRadio(field, context) {
59435     var dispatch10 = dispatch_default("change");
59436     var placeholder = select_default2(null);
59437     var wrap2 = select_default2(null);
59438     var labels = select_default2(null);
59439     var radios = select_default2(null);
59440     var radioData = (field.options || field.keys).slice();
59441     var typeField;
59442     var layerField;
59443     var _oldType = {};
59444     var _entityIDs = [];
59445     function selectedKey() {
59446       var node = wrap2.selectAll(".form-field-input-radio label.active input");
59447       return !node.empty() && node.datum();
59448     }
59449     function radio(selection2) {
59450       selection2.classed("preset-radio", true);
59451       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59452       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
59453       enter.append("span").attr("class", "placeholder");
59454       wrap2 = wrap2.merge(enter);
59455       placeholder = wrap2.selectAll(".placeholder");
59456       labels = wrap2.selectAll("label").data(radioData);
59457       enter = labels.enter().append("label");
59458       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d) {
59459         return field.t("options." + d, { "default": d });
59460       }).attr("checked", false);
59461       enter.append("span").html(function(d) {
59462         return field.t.html("options." + d, { "default": d });
59463       });
59464       labels = labels.merge(enter);
59465       radios = labels.selectAll("input").on("change", changeRadio);
59466     }
59467     function structureExtras(selection2, tags) {
59468       var selected = selectedKey() || tags.layer !== void 0;
59469       var type3 = _mainPresetIndex.field(selected);
59470       var layer = _mainPresetIndex.field("layer");
59471       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
59472       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
59473       extrasWrap.exit().remove();
59474       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
59475       var list = extrasWrap.selectAll("ul").data([0]);
59476       list = list.enter().append("ul").attr("class", "rows").merge(list);
59477       if (type3) {
59478         if (!typeField || typeField.id !== selected) {
59479           typeField = uiField(context, type3, _entityIDs, { wrap: false }).on("change", changeType);
59480         }
59481         typeField.tags(tags);
59482       } else {
59483         typeField = null;
59484       }
59485       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d) {
59486         return d.id;
59487       });
59488       typeItem.exit().remove();
59489       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
59490       typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
59491       typeEnter.append("div").attr("class", "structure-input-type-wrap");
59492       typeItem = typeItem.merge(typeEnter);
59493       if (typeField) {
59494         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
59495       }
59496       if (layer && showLayer) {
59497         if (!layerField) {
59498           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
59499         }
59500         layerField.tags(tags);
59501         field.keys = utilArrayUnion(field.keys, ["layer"]);
59502       } else {
59503         layerField = null;
59504         field.keys = field.keys.filter(function(k) {
59505           return k !== "layer";
59506         });
59507       }
59508       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
59509       layerItem.exit().remove();
59510       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
59511       layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
59512       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
59513       layerItem = layerItem.merge(layerEnter);
59514       if (layerField) {
59515         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
59516       }
59517     }
59518     function changeType(t, onInput) {
59519       var key = selectedKey();
59520       if (!key)
59521         return;
59522       var val = t[key];
59523       if (val !== "no") {
59524         _oldType[key] = val;
59525       }
59526       if (field.type === "structureRadio") {
59527         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
59528           t.layer = void 0;
59529         }
59530         if (t.layer === void 0) {
59531           if (key === "bridge" && val !== "no") {
59532             t.layer = "1";
59533           }
59534           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
59535             t.layer = "-1";
59536           }
59537         }
59538       }
59539       dispatch10.call("change", this, t, onInput);
59540     }
59541     function changeLayer(t, onInput) {
59542       if (t.layer === "0") {
59543         t.layer = void 0;
59544       }
59545       dispatch10.call("change", this, t, onInput);
59546     }
59547     function changeRadio() {
59548       var t = {};
59549       var activeKey;
59550       if (field.key) {
59551         t[field.key] = void 0;
59552       }
59553       radios.each(function(d) {
59554         var active = select_default2(this).property("checked");
59555         if (active)
59556           activeKey = d;
59557         if (field.key) {
59558           if (active)
59559             t[field.key] = d;
59560         } else {
59561           var val = _oldType[activeKey] || "yes";
59562           t[d] = active ? val : void 0;
59563         }
59564       });
59565       if (field.type === "structureRadio") {
59566         if (activeKey === "bridge") {
59567           t.layer = "1";
59568         } else if (activeKey === "tunnel" && t.tunnel !== "building_passage") {
59569           t.layer = "-1";
59570         } else {
59571           t.layer = void 0;
59572         }
59573       }
59574       dispatch10.call("change", this, t);
59575     }
59576     radio.tags = function(tags) {
59577       function isOptionChecked(d) {
59578         if (field.key) {
59579           return tags[field.key] === d;
59580         }
59581         return !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
59582       }
59583       function isMixed(d) {
59584         if (field.key) {
59585           return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
59586         }
59587         return Array.isArray(tags[d]);
59588       }
59589       radios.property("checked", function(d) {
59590         return isOptionChecked(d) && (field.key || field.options.filter(isOptionChecked).length === 1);
59591       });
59592       labels.classed("active", function(d) {
59593         if (field.key) {
59594           return Array.isArray(tags[field.key]) && tags[field.key].includes(d) || tags[field.key] === d;
59595         }
59596         return Array.isArray(tags[d]) && tags[d].some((v) => typeof v === "string" && v.toLowerCase() !== "no") || !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
59597       }).classed("mixed", isMixed).attr("title", function(d) {
59598         return isMixed(d) ? _t("inspector.unshared_value_tooltip") : null;
59599       });
59600       var selection2 = radios.filter(function() {
59601         return this.checked;
59602       });
59603       if (selection2.empty()) {
59604         placeholder.text("");
59605         placeholder.call(_t.append("inspector.none"));
59606       } else {
59607         placeholder.text(selection2.attr("value"));
59608         _oldType[selection2.datum()] = tags[selection2.datum()];
59609       }
59610       if (field.type === "structureRadio") {
59611         if (!!tags.waterway && !_oldType.tunnel) {
59612           _oldType.tunnel = "culvert";
59613         }
59614         wrap2.call(structureExtras, tags);
59615       }
59616     };
59617     radio.focus = function() {
59618       radios.node().focus();
59619     };
59620     radio.entityIDs = function(val) {
59621       if (!arguments.length)
59622         return _entityIDs;
59623       _entityIDs = val;
59624       _oldType = {};
59625       return radio;
59626     };
59627     radio.isAllowed = function() {
59628       return _entityIDs.length === 1;
59629     };
59630     return utilRebind(radio, dispatch10, "on");
59631   }
59632
59633   // modules/ui/fields/restrictions.js
59634   function uiFieldRestrictions(field, context) {
59635     var dispatch10 = dispatch_default("change");
59636     var breathe = behaviorBreathe(context);
59637     corePreferences("turn-restriction-via-way", null);
59638     var storedViaWay = corePreferences("turn-restriction-via-way0");
59639     var storedDistance = corePreferences("turn-restriction-distance");
59640     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
59641     var _maxDistance = storedDistance ? +storedDistance : 30;
59642     var _initialized2 = false;
59643     var _parent = select_default2(null);
59644     var _container = select_default2(null);
59645     var _oldTurns;
59646     var _graph;
59647     var _vertexID;
59648     var _intersection;
59649     var _fromWayID;
59650     var _lastXPos;
59651     function restrictions(selection2) {
59652       _parent = selection2;
59653       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
59654         _graph = context.graph();
59655         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
59656       }
59657       var isOK = _intersection && _intersection.vertices.length && _intersection.vertices.filter(function(vertex) {
59658         return vertex.id === _vertexID;
59659       }).length && _intersection.ways.length > 2 && _intersection.ways.filter(function(way) {
59660         return way.__to;
59661       }).length > 1;
59662       select_default2(selection2.node().parentNode).classed("hide", !isOK);
59663       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
59664         selection2.call(restrictions.off);
59665         return;
59666       }
59667       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
59668       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
59669       var container = wrap2.selectAll(".restriction-container").data([0]);
59670       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
59671       containerEnter.append("div").attr("class", "restriction-help");
59672       _container = containerEnter.merge(container).call(renderViewer);
59673       var controls = wrap2.selectAll(".restriction-controls").data([0]);
59674       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
59675     }
59676     function renderControls(selection2) {
59677       var distControl = selection2.selectAll(".restriction-distance").data([0]);
59678       distControl.exit().remove();
59679       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
59680       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
59681       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
59682       distControlEnter.append("span").attr("class", "restriction-distance-text");
59683       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
59684         var val = select_default2(this).property("value");
59685         _maxDistance = +val;
59686         _intersection = null;
59687         _container.selectAll(".layer-osm .layer-turns *").remove();
59688         corePreferences("turn-restriction-distance", _maxDistance);
59689         _parent.call(restrictions);
59690       });
59691       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
59692       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
59693       viaControl.exit().remove();
59694       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
59695       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
59696       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
59697       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
59698       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
59699         var val = select_default2(this).property("value");
59700         _maxViaWay = +val;
59701         _container.selectAll(".layer-osm .layer-turns *").remove();
59702         corePreferences("turn-restriction-via-way0", _maxViaWay);
59703         _parent.call(restrictions);
59704       });
59705       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
59706     }
59707     function renderViewer(selection2) {
59708       if (!_intersection)
59709         return;
59710       var vgraph = _intersection.graph;
59711       var filter2 = utilFunctor(true);
59712       var projection2 = geoRawMercator();
59713       var sdims = utilGetDimensions(context.container().select(".sidebar"));
59714       var d = [sdims[0] - 50, 370];
59715       var c = geoVecScale(d, 0.5);
59716       var z = 22;
59717       projection2.scale(geoZoomToScale(z));
59718       var extent = geoExtent();
59719       for (var i2 = 0; i2 < _intersection.vertices.length; i2++) {
59720         extent._extend(_intersection.vertices[i2].extent());
59721       }
59722       var padTop = 35;
59723       if (_intersection.vertices.length > 1) {
59724         var hPadding = Math.min(160, Math.max(110, d[0] * 0.4));
59725         var vPadding = 160;
59726         var tl = projection2([extent[0][0], extent[1][1]]);
59727         var br = projection2([extent[1][0], extent[0][1]]);
59728         var hFactor = (br[0] - tl[0]) / (d[0] - hPadding);
59729         var vFactor = (br[1] - tl[1]) / (d[1] - vPadding - padTop);
59730         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
59731         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
59732         z = z - Math.max(hZoomDiff, vZoomDiff);
59733         projection2.scale(geoZoomToScale(z));
59734       }
59735       var extentCenter = projection2(extent.center());
59736       extentCenter[1] = extentCenter[1] - padTop / 2;
59737       projection2.translate(geoVecSubtract(c, extentCenter)).clipExtent([[0, 0], d]);
59738       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d);
59739       var drawVertices = svgVertices(projection2, context);
59740       var drawLines = svgLines(projection2, context);
59741       var drawTurns = svgTurns(projection2, context);
59742       var firstTime = selection2.selectAll(".surface").empty();
59743       selection2.call(drawLayers);
59744       var surface = selection2.selectAll(".surface").classed("tr", true);
59745       if (firstTime) {
59746         _initialized2 = true;
59747         surface.call(breathe);
59748       }
59749       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
59750         _fromWayID = null;
59751         _oldTurns = null;
59752       }
59753       surface.call(utilSetDimensions, d).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
59754       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
59755       surface.selectAll(".selected").classed("selected", false);
59756       surface.selectAll(".related").classed("related", false);
59757       var way;
59758       if (_fromWayID) {
59759         way = vgraph.entity(_fromWayID);
59760         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
59761       }
59762       document.addEventListener("resizeWindow", function() {
59763         utilSetDimensions(_container, null);
59764         redraw(1);
59765       }, false);
59766       updateHints(null);
59767       function click(d3_event) {
59768         surface.call(breathe.off).call(breathe);
59769         var datum2 = d3_event.target.__data__;
59770         var entity = datum2 && datum2.properties && datum2.properties.entity;
59771         if (entity) {
59772           datum2 = entity;
59773         }
59774         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
59775           _fromWayID = datum2.id;
59776           _oldTurns = null;
59777           redraw();
59778         } else if (datum2 instanceof osmTurn) {
59779           var actions, extraActions, turns, i3;
59780           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
59781           if (datum2.restrictionID && !datum2.direct) {
59782             return;
59783           } else if (datum2.restrictionID && !datum2.only) {
59784             var seen = {};
59785             var datumOnly = JSON.parse(JSON.stringify(datum2));
59786             datumOnly.only = true;
59787             restrictionType = restrictionType.replace(/^no/, "only");
59788             turns = _intersection.turns(_fromWayID, 2);
59789             extraActions = [];
59790             _oldTurns = [];
59791             for (i3 = 0; i3 < turns.length; i3++) {
59792               var turn = turns[i3];
59793               if (seen[turn.restrictionID])
59794                 continue;
59795               if (turn.direct && turn.path[1] === datum2.path[1]) {
59796                 seen[turns[i3].restrictionID] = true;
59797                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
59798                 _oldTurns.push(turn);
59799                 extraActions.push(actionUnrestrictTurn(turn));
59800               }
59801             }
59802             actions = _intersection.actions.concat(extraActions, [
59803               actionRestrictTurn(datumOnly, restrictionType),
59804               _t("operations.restriction.annotation.create")
59805             ]);
59806           } else if (datum2.restrictionID) {
59807             turns = _oldTurns || [];
59808             extraActions = [];
59809             for (i3 = 0; i3 < turns.length; i3++) {
59810               if (turns[i3].key !== datum2.key) {
59811                 extraActions.push(actionRestrictTurn(turns[i3], turns[i3].restrictionType));
59812               }
59813             }
59814             _oldTurns = null;
59815             actions = _intersection.actions.concat(extraActions, [
59816               actionUnrestrictTurn(datum2),
59817               _t("operations.restriction.annotation.delete")
59818             ]);
59819           } else {
59820             actions = _intersection.actions.concat([
59821               actionRestrictTurn(datum2, restrictionType),
59822               _t("operations.restriction.annotation.create")
59823             ]);
59824           }
59825           context.perform.apply(context, actions);
59826           var s = surface.selectAll("." + datum2.key);
59827           datum2 = s.empty() ? null : s.datum();
59828           updateHints(datum2);
59829         } else {
59830           _fromWayID = null;
59831           _oldTurns = null;
59832           redraw();
59833         }
59834       }
59835       function mouseover(d3_event) {
59836         var datum2 = d3_event.target.__data__;
59837         updateHints(datum2);
59838       }
59839       _lastXPos = _lastXPos || sdims[0];
59840       function redraw(minChange) {
59841         var xPos = -1;
59842         if (minChange) {
59843           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
59844         }
59845         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
59846           if (context.hasEntity(_vertexID)) {
59847             _lastXPos = xPos;
59848             _container.call(renderViewer);
59849           }
59850         }
59851       }
59852       function highlightPathsFrom(wayID) {
59853         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
59854         surface.selectAll("." + wayID).classed("related", true);
59855         if (wayID) {
59856           var turns = _intersection.turns(wayID, _maxViaWay);
59857           for (var i3 = 0; i3 < turns.length; i3++) {
59858             var turn = turns[i3];
59859             var ids = [turn.to.way];
59860             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
59861             if (turn.only || turns.length === 1) {
59862               if (turn.via.ways) {
59863                 ids = ids.concat(turn.via.ways);
59864               }
59865             } else if (turn.to.way === wayID) {
59866               continue;
59867             }
59868             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
59869           }
59870         }
59871       }
59872       function updateHints(datum2) {
59873         var help = _container.selectAll(".restriction-help").html("");
59874         var placeholders = {};
59875         ["from", "via", "to"].forEach(function(k) {
59876           placeholders[k] = { html: '<span class="qualifier">' + _t("restriction.help." + k) + "</span>" };
59877         });
59878         var entity = datum2 && datum2.properties && datum2.properties.entity;
59879         if (entity) {
59880           datum2 = entity;
59881         }
59882         if (_fromWayID) {
59883           way = vgraph.entity(_fromWayID);
59884           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
59885         }
59886         if (datum2 instanceof osmWay && datum2.__from) {
59887           way = datum2;
59888           highlightPathsFrom(_fromWayID ? null : way.id);
59889           surface.selectAll("." + way.id).classed("related", true);
59890           var clickSelect = !_fromWayID || _fromWayID !== way.id;
59891           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
59892             from: placeholders.from,
59893             fromName: displayName(way.id, vgraph)
59894           }));
59895         } else if (datum2 instanceof osmTurn) {
59896           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
59897           var turnType = restrictionType.replace(/^(only|no)\_/, "");
59898           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
59899           var klass, turnText, nextText;
59900           if (datum2.no) {
59901             klass = "restrict";
59902             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
59903             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
59904           } else if (datum2.only) {
59905             klass = "only";
59906             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
59907             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
59908           } else {
59909             klass = "allow";
59910             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
59911             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
59912           }
59913           help.append("div").attr("class", "qualifier " + klass).html(turnText);
59914           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
59915             from: placeholders.from,
59916             fromName: displayName(datum2.from.way, vgraph),
59917             to: placeholders.to,
59918             toName: displayName(datum2.to.way, vgraph)
59919           }));
59920           if (datum2.via.ways && datum2.via.ways.length) {
59921             var names = [];
59922             for (var i3 = 0; i3 < datum2.via.ways.length; i3++) {
59923               var prev = names[names.length - 1];
59924               var curr = displayName(datum2.via.ways[i3], vgraph);
59925               if (!prev || curr !== prev) {
59926                 names.push(curr);
59927               }
59928             }
59929             help.append("div").html(_t.html("restriction.help.via_names", {
59930               via: placeholders.via,
59931               viaNames: names.join(", ")
59932             }));
59933           }
59934           if (!indirect) {
59935             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
59936           }
59937           highlightPathsFrom(null);
59938           var alongIDs = datum2.path.slice();
59939           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
59940         } else {
59941           highlightPathsFrom(null);
59942           if (_fromWayID) {
59943             help.append("div").html(_t.html("restriction.help.from_name", {
59944               from: placeholders.from,
59945               fromName: displayName(_fromWayID, vgraph)
59946             }));
59947           } else {
59948             help.append("div").html(_t.html("restriction.help.select_from", {
59949               from: placeholders.from
59950             }));
59951           }
59952         }
59953       }
59954     }
59955     function displayMaxDistance(maxDist) {
59956       return (selection2) => {
59957         var isImperial = !_mainLocalizer.usesMetric();
59958         var opts;
59959         if (isImperial) {
59960           var distToFeet = {
59961             20: 70,
59962             25: 85,
59963             30: 100,
59964             35: 115,
59965             40: 130,
59966             45: 145,
59967             50: 160
59968           }[maxDist];
59969           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
59970         } else {
59971           opts = { distance: _t("units.meters", { quantity: maxDist }) };
59972         }
59973         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
59974       };
59975     }
59976     function displayMaxVia(maxVia) {
59977       return (selection2) => {
59978         selection2 = selection2.html("");
59979         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"));
59980       };
59981     }
59982     function displayName(entityID, graph) {
59983       var entity = graph.entity(entityID);
59984       var name = utilDisplayName(entity) || "";
59985       var matched = _mainPresetIndex.match(entity, graph);
59986       var type3 = matched && matched.name() || utilDisplayType(entity.id);
59987       return name || type3;
59988     }
59989     restrictions.entityIDs = function(val) {
59990       _intersection = null;
59991       _fromWayID = null;
59992       _oldTurns = null;
59993       _vertexID = val[0];
59994     };
59995     restrictions.tags = function() {
59996     };
59997     restrictions.focus = function() {
59998     };
59999     restrictions.off = function(selection2) {
60000       if (!_initialized2)
60001         return;
60002       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
60003       select_default2(window).on("resize.restrictions", null);
60004     };
60005     return utilRebind(restrictions, dispatch10, "on");
60006   }
60007   uiFieldRestrictions.supportsMultiselection = false;
60008
60009   // modules/ui/fields/textarea.js
60010   function uiFieldTextarea(field, context) {
60011     var dispatch10 = dispatch_default("change");
60012     var input = select_default2(null);
60013     var _tags;
60014     function textarea(selection2) {
60015       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60016       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60017       input = wrap2.selectAll("textarea").data([0]);
60018       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
60019     }
60020     function change(onInput) {
60021       return function() {
60022         var val = utilGetSetValue(input);
60023         if (!onInput)
60024           val = context.cleanTagValue(val);
60025         if (!val && Array.isArray(_tags[field.key]))
60026           return;
60027         var t = {};
60028         t[field.key] = val || void 0;
60029         dispatch10.call("change", this, t, onInput);
60030       };
60031     }
60032     textarea.tags = function(tags) {
60033       _tags = tags;
60034       var isMixed = Array.isArray(tags[field.key]);
60035       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);
60036     };
60037     textarea.focus = function() {
60038       input.node().focus();
60039     };
60040     return utilRebind(textarea, dispatch10, "on");
60041   }
60042
60043   // modules/ui/fields/wikidata.js
60044   function uiFieldWikidata(field, context) {
60045     var wikidata = services.wikidata;
60046     var dispatch10 = dispatch_default("change");
60047     var _selection = select_default2(null);
60048     var _searchInput = select_default2(null);
60049     var _qid = null;
60050     var _wikidataEntity = null;
60051     var _wikiURL = "";
60052     var _entityIDs = [];
60053     var _wikipediaKey = field.keys && field.keys.find(function(key) {
60054       return key.includes("wikipedia");
60055     });
60056     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
60057     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
60058     function wiki(selection2) {
60059       _selection = selection2;
60060       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60061       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
60062       var list = wrap2.selectAll("ul").data([0]);
60063       list = list.enter().append("ul").attr("class", "rows").merge(list);
60064       var searchRow = list.selectAll("li.wikidata-search").data([0]);
60065       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
60066       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
60067         var node = select_default2(this).node();
60068         node.setSelectionRange(0, node.value.length);
60069       }).on("blur", function() {
60070         setLabelForEntity();
60071       }).call(combobox.fetcher(fetchWikidataItems));
60072       combobox.on("accept", function(d) {
60073         if (d) {
60074           _qid = d.id;
60075           change();
60076         }
60077       }).on("cancel", function() {
60078         setLabelForEntity();
60079       });
60080       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) {
60081         d3_event.preventDefault();
60082         if (_wikiURL)
60083           window.open(_wikiURL, "_blank");
60084       });
60085       searchRow = searchRow.merge(searchRowEnter);
60086       _searchInput = searchRow.select("input");
60087       var wikidataProperties = ["description", "identifier"];
60088       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
60089       var enter = items.enter().append("li").attr("class", function(d) {
60090         return "labeled-input preset-wikidata-" + d;
60091       });
60092       enter.append("span").attr("class", "label").html(function(d) {
60093         return _t.html("wikidata." + d);
60094       });
60095       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
60096       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
60097         d3_event.preventDefault();
60098         select_default2(this.parentNode).select("input").node().select();
60099         document.execCommand("copy");
60100       });
60101     }
60102     function fetchWikidataItems(q, callback) {
60103       if (!q && _hintKey) {
60104         for (var i2 in _entityIDs) {
60105           var entity = context.hasEntity(_entityIDs[i2]);
60106           if (entity.tags[_hintKey]) {
60107             q = entity.tags[_hintKey];
60108             break;
60109           }
60110         }
60111       }
60112       wikidata.itemsForSearchQuery(q, function(err, data) {
60113         if (err)
60114           return;
60115         var result = data.map(function(item) {
60116           return {
60117             id: item.id,
60118             value: item.display.label.value + " (" + item.id + ")",
60119             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
60120             title: item.display.description && item.display.description.value,
60121             terms: item.aliases
60122           };
60123         });
60124         if (callback)
60125           callback(result);
60126       });
60127     }
60128     function change() {
60129       var syncTags = {};
60130       syncTags[field.key] = _qid;
60131       dispatch10.call("change", this, syncTags);
60132       var initGraph = context.graph();
60133       var initEntityIDs = _entityIDs;
60134       wikidata.entityByQID(_qid, function(err, entity) {
60135         if (err)
60136           return;
60137         if (context.graph() !== initGraph)
60138           return;
60139         if (!entity.sitelinks)
60140           return;
60141         var langs = wikidata.languagesToQuery();
60142         ["labels", "descriptions"].forEach(function(key) {
60143           if (!entity[key])
60144             return;
60145           var valueLangs = Object.keys(entity[key]);
60146           if (valueLangs.length === 0)
60147             return;
60148           var valueLang = valueLangs[0];
60149           if (langs.indexOf(valueLang) === -1) {
60150             langs.push(valueLang);
60151           }
60152         });
60153         var newWikipediaValue;
60154         if (_wikipediaKey) {
60155           var foundPreferred;
60156           for (var i2 in langs) {
60157             var lang = langs[i2];
60158             var siteID = lang.replace("-", "_") + "wiki";
60159             if (entity.sitelinks[siteID]) {
60160               foundPreferred = true;
60161               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
60162               break;
60163             }
60164           }
60165           if (!foundPreferred) {
60166             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
60167               return site.endsWith("wiki");
60168             });
60169             if (wikiSiteKeys.length === 0) {
60170               newWikipediaValue = null;
60171             } else {
60172               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
60173               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
60174               newWikipediaValue = wikiLang + ":" + wikiTitle;
60175             }
60176           }
60177         }
60178         if (newWikipediaValue) {
60179           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
60180         }
60181         if (typeof newWikipediaValue === "undefined")
60182           return;
60183         var actions = initEntityIDs.map(function(entityID) {
60184           var entity2 = context.hasEntity(entityID);
60185           if (!entity2)
60186             return null;
60187           var currTags = Object.assign({}, entity2.tags);
60188           if (newWikipediaValue === null) {
60189             if (!currTags[_wikipediaKey])
60190               return null;
60191             delete currTags[_wikipediaKey];
60192           } else {
60193             currTags[_wikipediaKey] = newWikipediaValue;
60194           }
60195           return actionChangeTags(entityID, currTags);
60196         }).filter(Boolean);
60197         if (!actions.length)
60198           return;
60199         context.overwrite(
60200           function actionUpdateWikipediaTags(graph) {
60201             actions.forEach(function(action) {
60202               graph = action(graph);
60203             });
60204             return graph;
60205           },
60206           context.history().undoAnnotation()
60207         );
60208       });
60209     }
60210     function setLabelForEntity() {
60211       var label = "";
60212       if (_wikidataEntity) {
60213         label = entityPropertyForDisplay(_wikidataEntity, "labels");
60214         if (label.length === 0) {
60215           label = _wikidataEntity.id.toString();
60216         }
60217       }
60218       utilGetSetValue(_searchInput, label);
60219     }
60220     wiki.tags = function(tags) {
60221       var isMixed = Array.isArray(tags[field.key]);
60222       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
60223       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
60224       if (!/^Q[0-9]*$/.test(_qid)) {
60225         unrecognized();
60226         return;
60227       }
60228       _wikiURL = "https://wikidata.org/wiki/" + _qid;
60229       wikidata.entityByQID(_qid, function(err, entity) {
60230         if (err) {
60231           unrecognized();
60232           return;
60233         }
60234         _wikidataEntity = entity;
60235         setLabelForEntity();
60236         var description = entityPropertyForDisplay(entity, "descriptions");
60237         _selection.select("button.wiki-link").classed("disabled", false);
60238         _selection.select(".preset-wikidata-description").style("display", function() {
60239           return description.length > 0 ? "flex" : "none";
60240         }).select("input").attr("value", description);
60241         _selection.select(".preset-wikidata-identifier").style("display", function() {
60242           return entity.id ? "flex" : "none";
60243         }).select("input").attr("value", entity.id);
60244       });
60245       function unrecognized() {
60246         _wikidataEntity = null;
60247         setLabelForEntity();
60248         _selection.select(".preset-wikidata-description").style("display", "none");
60249         _selection.select(".preset-wikidata-identifier").style("display", "none");
60250         _selection.select("button.wiki-link").classed("disabled", true);
60251         if (_qid && _qid !== "") {
60252           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
60253         } else {
60254           _wikiURL = "";
60255         }
60256       }
60257     };
60258     function entityPropertyForDisplay(wikidataEntity, propKey) {
60259       if (!wikidataEntity[propKey])
60260         return "";
60261       var propObj = wikidataEntity[propKey];
60262       var langKeys = Object.keys(propObj);
60263       if (langKeys.length === 0)
60264         return "";
60265       var langs = wikidata.languagesToQuery();
60266       for (var i2 in langs) {
60267         var lang = langs[i2];
60268         var valueObj = propObj[lang];
60269         if (valueObj && valueObj.value && valueObj.value.length > 0)
60270           return valueObj.value;
60271       }
60272       return propObj[langKeys[0]].value;
60273     }
60274     wiki.entityIDs = function(val) {
60275       if (!arguments.length)
60276         return _entityIDs;
60277       _entityIDs = val;
60278       return wiki;
60279     };
60280     wiki.focus = function() {
60281       _searchInput.node().focus();
60282     };
60283     return utilRebind(wiki, dispatch10, "on");
60284   }
60285
60286   // modules/ui/fields/wikipedia.js
60287   function uiFieldWikipedia(field, context) {
60288     const dispatch10 = dispatch_default("change");
60289     const wikipedia = services.wikipedia;
60290     const wikidata = services.wikidata;
60291     let _langInput = select_default2(null);
60292     let _titleInput = select_default2(null);
60293     let _wikiURL = "";
60294     let _entityIDs;
60295     let _tags;
60296     let _dataWikipedia = [];
60297     _mainFileFetcher.get("wmf_sitematrix").then((d) => {
60298       _dataWikipedia = d;
60299       if (_tags)
60300         updateForTags(_tags);
60301     }).catch(() => {
60302     });
60303     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
60304       const v = value.toLowerCase();
60305       callback(
60306         _dataWikipedia.filter((d) => {
60307           return d[0].toLowerCase().indexOf(v) >= 0 || d[1].toLowerCase().indexOf(v) >= 0 || d[2].toLowerCase().indexOf(v) >= 0;
60308         }).map((d) => ({ value: d[1] }))
60309       );
60310     });
60311     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
60312       if (!value) {
60313         value = "";
60314         for (let i2 in _entityIDs) {
60315           let entity = context.hasEntity(_entityIDs[i2]);
60316           if (entity.tags.name) {
60317             value = entity.tags.name;
60318             break;
60319           }
60320         }
60321       }
60322       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
60323       searchfn(language()[2], value, (query, data) => {
60324         callback(data.map((d) => ({ value: d })));
60325       });
60326     });
60327     function wiki(selection2) {
60328       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
60329       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
60330       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
60331       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
60332       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
60333       _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);
60334       _langInput.on("blur", changeLang).on("change", changeLang);
60335       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
60336       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
60337       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
60338       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
60339       _titleInput.on("blur", function() {
60340         change(true);
60341       }).on("change", function() {
60342         change(false);
60343       });
60344       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
60345       link2 = link2.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikipedia.org" })).call(svgIcon("#iD-icon-out-link")).merge(link2);
60346       link2.on("click", (d3_event) => {
60347         d3_event.preventDefault();
60348         if (_wikiURL)
60349           window.open(_wikiURL, "_blank");
60350       });
60351     }
60352     function defaultLanguageInfo(skipEnglishFallback) {
60353       const langCode = _mainLocalizer.languageCode().toLowerCase();
60354       for (let i2 in _dataWikipedia) {
60355         let d = _dataWikipedia[i2];
60356         if (d[2] === langCode)
60357           return d;
60358       }
60359       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
60360     }
60361     function language(skipEnglishFallback) {
60362       const value = utilGetSetValue(_langInput).toLowerCase();
60363       for (let i2 in _dataWikipedia) {
60364         let d = _dataWikipedia[i2];
60365         if (d[0].toLowerCase() === value || d[1].toLowerCase() === value || d[2] === value)
60366           return d;
60367       }
60368       return defaultLanguageInfo(skipEnglishFallback);
60369     }
60370     function changeLang() {
60371       utilGetSetValue(_langInput, language()[1]);
60372       change(true);
60373     }
60374     function change(skipWikidata) {
60375       let value = utilGetSetValue(_titleInput);
60376       const m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
60377       const langInfo = m && _dataWikipedia.find((d) => m[1] === d[2]);
60378       let syncTags = {};
60379       if (langInfo) {
60380         const nativeLangName = langInfo[1];
60381         value = decodeURIComponent(m[2]).replace(/_/g, " ");
60382         if (m[3]) {
60383           let anchor;
60384           anchor = decodeURIComponent(m[3]);
60385           value += "#" + anchor.replace(/_/g, " ");
60386         }
60387         value = value.slice(0, 1).toUpperCase() + value.slice(1);
60388         utilGetSetValue(_langInput, nativeLangName);
60389         utilGetSetValue(_titleInput, value);
60390       }
60391       if (value) {
60392         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
60393       } else {
60394         syncTags.wikipedia = void 0;
60395       }
60396       dispatch10.call("change", this, syncTags);
60397       if (skipWikidata || !value || !language()[2])
60398         return;
60399       const initGraph = context.graph();
60400       const initEntityIDs = _entityIDs;
60401       wikidata.itemsByTitle(language()[2], value, (err, data) => {
60402         if (err || !data || !Object.keys(data).length)
60403           return;
60404         if (context.graph() !== initGraph)
60405           return;
60406         const qids = Object.keys(data);
60407         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
60408         let actions = initEntityIDs.map((entityID) => {
60409           let entity = context.entity(entityID).tags;
60410           let currTags = Object.assign({}, entity);
60411           if (currTags.wikidata !== value2) {
60412             currTags.wikidata = value2;
60413             return actionChangeTags(entityID, currTags);
60414           }
60415           return null;
60416         }).filter(Boolean);
60417         if (!actions.length)
60418           return;
60419         context.overwrite(
60420           function actionUpdateWikidataTags(graph) {
60421             actions.forEach(function(action) {
60422               graph = action(graph);
60423             });
60424             return graph;
60425           },
60426           context.history().undoAnnotation()
60427         );
60428       });
60429     }
60430     wiki.tags = (tags) => {
60431       _tags = tags;
60432       updateForTags(tags);
60433     };
60434     function updateForTags(tags) {
60435       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
60436       const m = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
60437       const tagLang = m && m[1];
60438       const tagArticleTitle = m && m[2];
60439       let anchor = m && m[3];
60440       const tagLangInfo = tagLang && _dataWikipedia.find((d) => tagLang === d[2]);
60441       if (tagLangInfo) {
60442         const nativeLangName = tagLangInfo[1];
60443         utilGetSetValue(_langInput, nativeLangName);
60444         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
60445         if (anchor) {
60446           try {
60447             anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
60448           } catch (e) {
60449             anchor = anchor.replace(/ /g, "_");
60450           }
60451         }
60452         _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
60453       } else {
60454         utilGetSetValue(_titleInput, value);
60455         if (value && value !== "") {
60456           utilGetSetValue(_langInput, "");
60457           const defaultLangInfo = defaultLanguageInfo();
60458           _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
60459         } else {
60460           const shownOrDefaultLangInfo = language(true);
60461           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
60462           _wikiURL = "";
60463         }
60464       }
60465     }
60466     wiki.entityIDs = (val) => {
60467       if (!arguments.length)
60468         return _entityIDs;
60469       _entityIDs = val;
60470       return wiki;
60471     };
60472     wiki.focus = () => {
60473       _titleInput.node().focus();
60474     };
60475     return utilRebind(wiki, dispatch10, "on");
60476   }
60477   uiFieldWikipedia.supportsMultiselection = false;
60478
60479   // modules/ui/fields/index.js
60480   var uiFields = {
60481     access: uiFieldAccess,
60482     address: uiFieldAddress,
60483     check: uiFieldCheck,
60484     combo: uiFieldCombo,
60485     cycleway: uiFieldCycleway,
60486     defaultCheck: uiFieldCheck,
60487     email: uiFieldText,
60488     identifier: uiFieldText,
60489     lanes: uiFieldLanes,
60490     localized: uiFieldLocalized,
60491     roadheight: uiFieldRoadheight,
60492     roadspeed: uiFieldRoadspeed,
60493     manyCombo: uiFieldCombo,
60494     multiCombo: uiFieldCombo,
60495     networkCombo: uiFieldCombo,
60496     number: uiFieldText,
60497     onewayCheck: uiFieldCheck,
60498     radio: uiFieldRadio,
60499     restrictions: uiFieldRestrictions,
60500     semiCombo: uiFieldCombo,
60501     structureRadio: uiFieldRadio,
60502     tel: uiFieldText,
60503     text: uiFieldText,
60504     textarea: uiFieldTextarea,
60505     typeCombo: uiFieldCombo,
60506     url: uiFieldText,
60507     wikidata: uiFieldWikidata,
60508     wikipedia: uiFieldWikipedia
60509   };
60510
60511   // modules/ui/field.js
60512   function uiField(context, presetField2, entityIDs, options2) {
60513     options2 = Object.assign({
60514       show: true,
60515       wrap: true,
60516       remove: true,
60517       revert: true,
60518       info: true
60519     }, options2);
60520     var dispatch10 = dispatch_default("change", "revert");
60521     var field = Object.assign({}, presetField2);
60522     field.domId = utilUniqueDomId("form-field-" + field.safeid);
60523     var _show = options2.show;
60524     var _state = "";
60525     var _tags = {};
60526     var _entityExtent;
60527     if (entityIDs && entityIDs.length) {
60528       _entityExtent = entityIDs.reduce(function(extent, entityID) {
60529         var entity = context.graph().entity(entityID);
60530         return extent.extend(entity.extent(context.graph()));
60531       }, geoExtent());
60532     }
60533     var _locked = false;
60534     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
60535     field.keys = field.keys || [field.key];
60536     if (_show && !field.impl) {
60537       createField();
60538     }
60539     function createField() {
60540       field.impl = uiFields[field.type](field, context).on("change", function(t, onInput) {
60541         dispatch10.call("change", field, t, onInput);
60542       });
60543       if (entityIDs) {
60544         field.entityIDs = entityIDs;
60545         if (field.impl.entityIDs) {
60546           field.impl.entityIDs(entityIDs);
60547         }
60548       }
60549     }
60550     function isModified() {
60551       if (!entityIDs || !entityIDs.length)
60552         return false;
60553       return entityIDs.some(function(entityID) {
60554         var original = context.graph().base().entities[entityID];
60555         var latest = context.graph().entity(entityID);
60556         return field.keys.some(function(key) {
60557           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
60558         });
60559       });
60560     }
60561     function tagsContainFieldKey() {
60562       return field.keys.some(function(key) {
60563         if (field.type === "multiCombo") {
60564           for (var tagKey in _tags) {
60565             if (tagKey.indexOf(key) === 0) {
60566               return true;
60567             }
60568           }
60569           return false;
60570         }
60571         return _tags[key] !== void 0;
60572       });
60573     }
60574     function revert(d3_event, d) {
60575       d3_event.stopPropagation();
60576       d3_event.preventDefault();
60577       if (!entityIDs || _locked)
60578         return;
60579       dispatch10.call("revert", d, d.keys);
60580     }
60581     function remove2(d3_event, d) {
60582       d3_event.stopPropagation();
60583       d3_event.preventDefault();
60584       if (_locked)
60585         return;
60586       var t = {};
60587       d.keys.forEach(function(key) {
60588         t[key] = void 0;
60589       });
60590       dispatch10.call("change", d, t);
60591     }
60592     field.render = function(selection2) {
60593       var container = selection2.selectAll(".form-field").data([field]);
60594       var enter = container.enter().append("div").attr("class", function(d) {
60595         return "form-field form-field-" + d.safeid;
60596       }).classed("nowrap", !options2.wrap);
60597       if (options2.wrap) {
60598         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d) {
60599           return d.domId;
60600         });
60601         var textEnter = labelEnter.append("span").attr("class", "label-text");
60602         textEnter.append("span").attr("class", "label-textvalue").each(function(d) {
60603           d.label()(select_default2(this));
60604         });
60605         textEnter.append("span").attr("class", "label-textannotation");
60606         if (options2.remove) {
60607           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
60608         }
60609         if (options2.revert) {
60610           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
60611         }
60612       }
60613       container = container.merge(enter);
60614       container.select(".field-label > .remove-icon").on("click", remove2);
60615       container.select(".field-label > .modified-icon").on("click", revert);
60616       container.each(function(d) {
60617         var selection3 = select_default2(this);
60618         if (!d.impl) {
60619           createField();
60620         }
60621         var reference, help;
60622         if (options2.wrap && field.type === "restrictions") {
60623           help = uiFieldHelp(context, "restrictions");
60624         }
60625         if (options2.wrap && options2.info) {
60626           var referenceKey = d.key || "";
60627           if (d.type === "multiCombo") {
60628             referenceKey = referenceKey.replace(/:$/, "");
60629           }
60630           reference = uiTagReference(d.reference || { key: referenceKey }, context);
60631           if (_state === "hover") {
60632             reference.showing(false);
60633           }
60634         }
60635         selection3.call(d.impl);
60636         if (help) {
60637           selection3.call(help.body).select(".field-label").call(help.button);
60638         }
60639         if (reference) {
60640           selection3.call(reference.body).select(".field-label").call(reference.button);
60641         }
60642         d.impl.tags(_tags);
60643       });
60644       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
60645       var annotation = container.selectAll(".field-label .label-textannotation");
60646       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
60647       icon2.exit().remove();
60648       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
60649       container.call(_locked ? _lockedTip : _lockedTip.destroy);
60650     };
60651     field.state = function(val) {
60652       if (!arguments.length)
60653         return _state;
60654       _state = val;
60655       return field;
60656     };
60657     field.tags = function(val) {
60658       if (!arguments.length)
60659         return _tags;
60660       _tags = val;
60661       if (tagsContainFieldKey() && !_show) {
60662         _show = true;
60663         if (!field.impl) {
60664           createField();
60665         }
60666       }
60667       return field;
60668     };
60669     field.locked = function(val) {
60670       if (!arguments.length)
60671         return _locked;
60672       _locked = val;
60673       return field;
60674     };
60675     field.show = function() {
60676       _show = true;
60677       if (!field.impl) {
60678         createField();
60679       }
60680       if (field.default && field.key && _tags[field.key] !== field.default) {
60681         var t = {};
60682         t[field.key] = field.default;
60683         dispatch10.call("change", this, t);
60684       }
60685     };
60686     field.isShown = function() {
60687       return _show;
60688     };
60689     field.isAllowed = function() {
60690       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
60691         return false;
60692       if (field.geometry && !entityIDs.every(function(entityID) {
60693         return field.matchGeometry(context.graph().geometry(entityID));
60694       }))
60695         return false;
60696       if (entityIDs && _entityExtent && field.locationSetID) {
60697         var validLocations = _mainLocations.locationsAt(_entityExtent.center());
60698         if (!validLocations[field.locationSetID])
60699           return false;
60700       }
60701       var prerequisiteTag = field.prerequisiteTag;
60702       if (entityIDs && !tagsContainFieldKey() && prerequisiteTag) {
60703         if (!entityIDs.every(function(entityID) {
60704           var entity = context.graph().entity(entityID);
60705           if (prerequisiteTag.key) {
60706             var value = entity.tags[prerequisiteTag.key];
60707             if (!value)
60708               return false;
60709             if (prerequisiteTag.valueNot) {
60710               return prerequisiteTag.valueNot !== value;
60711             }
60712             if (prerequisiteTag.value) {
60713               return prerequisiteTag.value === value;
60714             }
60715           } else if (prerequisiteTag.keyNot) {
60716             if (entity.tags[prerequisiteTag.keyNot])
60717               return false;
60718           }
60719           return true;
60720         }))
60721           return false;
60722       }
60723       return true;
60724     };
60725     field.focus = function() {
60726       if (field.impl) {
60727         field.impl.focus();
60728       }
60729     };
60730     return utilRebind(field, dispatch10, "on");
60731   }
60732
60733   // modules/ui/form_fields.js
60734   function uiFormFields(context) {
60735     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
60736     var _fieldsArr = [];
60737     var _lastPlaceholder = "";
60738     var _state = "";
60739     var _klass = "";
60740     function formFields(selection2) {
60741       var allowedFields = _fieldsArr.filter(function(field) {
60742         return field.isAllowed();
60743       });
60744       var shown = allowedFields.filter(function(field) {
60745         return field.isShown();
60746       });
60747       var notShown = allowedFields.filter(function(field) {
60748         return !field.isShown();
60749       });
60750       var container = selection2.selectAll(".form-fields-container").data([0]);
60751       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
60752       var fields = container.selectAll(".wrap-form-field").data(shown, function(d) {
60753         return d.id + (d.entityIDs ? d.entityIDs.join() : "");
60754       });
60755       fields.exit().remove();
60756       var enter = fields.enter().append("div").attr("class", function(d) {
60757         return "wrap-form-field wrap-form-field-" + d.safeid;
60758       });
60759       fields = fields.merge(enter);
60760       fields.order().each(function(d) {
60761         select_default2(this).call(d.render);
60762       });
60763       var titles = [];
60764       var moreFields = notShown.map(function(field) {
60765         var title = field.title();
60766         titles.push(title);
60767         var terms = field.terms();
60768         if (field.key)
60769           terms.push(field.key);
60770         if (field.keys)
60771           terms = terms.concat(field.keys);
60772         return {
60773           display: field.label(),
60774           value: title,
60775           title,
60776           field,
60777           terms
60778         };
60779       });
60780       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
60781       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
60782       more.exit().remove();
60783       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
60784       moreEnter.append("span").call(_t.append("inspector.add_fields"));
60785       more = moreEnter.merge(more);
60786       var input = more.selectAll(".value").data([0]);
60787       input.exit().remove();
60788       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
60789       input.call(utilGetSetValue, "").call(
60790         moreCombo.data(moreFields).on("accept", function(d) {
60791           if (!d)
60792             return;
60793           var field = d.field;
60794           field.show();
60795           selection2.call(formFields);
60796           field.focus();
60797         })
60798       );
60799       if (_lastPlaceholder !== placeholder) {
60800         input.attr("placeholder", placeholder);
60801         _lastPlaceholder = placeholder;
60802       }
60803     }
60804     formFields.fieldsArr = function(val) {
60805       if (!arguments.length)
60806         return _fieldsArr;
60807       _fieldsArr = val || [];
60808       return formFields;
60809     };
60810     formFields.state = function(val) {
60811       if (!arguments.length)
60812         return _state;
60813       _state = val;
60814       return formFields;
60815     };
60816     formFields.klass = function(val) {
60817       if (!arguments.length)
60818         return _klass;
60819       _klass = val;
60820       return formFields;
60821     };
60822     return formFields;
60823   }
60824
60825   // modules/ui/changeset_editor.js
60826   function uiChangesetEditor(context) {
60827     var dispatch10 = dispatch_default("change");
60828     var formFields = uiFormFields(context);
60829     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
60830     var _fieldsArr;
60831     var _tags;
60832     var _changesetID;
60833     function changesetEditor(selection2) {
60834       render(selection2);
60835     }
60836     function render(selection2) {
60837       var initial = false;
60838       if (!_fieldsArr) {
60839         initial = true;
60840         var presets = _mainPresetIndex;
60841         _fieldsArr = [
60842           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
60843           uiField(context, presets.field("source"), null, { show: false, revert: false }),
60844           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
60845         ];
60846         _fieldsArr.forEach(function(field) {
60847           field.on("change", function(t, onInput) {
60848             dispatch10.call("change", field, void 0, t, onInput);
60849           });
60850         });
60851       }
60852       _fieldsArr.forEach(function(field) {
60853         field.tags(_tags);
60854       });
60855       selection2.call(formFields.fieldsArr(_fieldsArr));
60856       if (initial) {
60857         var commentField = selection2.select(".form-field-comment textarea");
60858         var commentNode = commentField.node();
60859         if (commentNode) {
60860           commentNode.focus();
60861           commentNode.select();
60862         }
60863         utilTriggerEvent(commentField, "blur");
60864         var osm = context.connection();
60865         if (osm) {
60866           osm.userChangesets(function(err, changesets) {
60867             if (err)
60868               return;
60869             var comments = changesets.map(function(changeset) {
60870               var comment = changeset.tags.comment;
60871               return comment ? { title: comment, value: comment } : null;
60872             }).filter(Boolean);
60873             commentField.call(
60874               commentCombo.data(utilArrayUniqBy(comments, "title"))
60875             );
60876           });
60877         }
60878       }
60879       var hasGoogle = _tags.comment.match(/google/i);
60880       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(hasGoogle ? [0] : []);
60881       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
60882       var commentEnter = commentWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning comment-warning").style("opacity", 0);
60883       commentEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-alert", "inline")).attr("href", _t("commit.google_warning_link")).append("span").call(_t.append("commit.google_warning"));
60884       commentEnter.transition().duration(200).style("opacity", 1);
60885     }
60886     changesetEditor.tags = function(_) {
60887       if (!arguments.length)
60888         return _tags;
60889       _tags = _;
60890       return changesetEditor;
60891     };
60892     changesetEditor.changesetID = function(_) {
60893       if (!arguments.length)
60894         return _changesetID;
60895       if (_changesetID === _)
60896         return changesetEditor;
60897       _changesetID = _;
60898       _fieldsArr = null;
60899       return changesetEditor;
60900     };
60901     return utilRebind(changesetEditor, dispatch10, "on");
60902   }
60903
60904   // modules/ui/commit.js
60905   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
60906
60907   // modules/util/jxon.js
60908   var JXON = new function() {
60909     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
60910     function parseText(sValue) {
60911       if (rIsNull.test(sValue)) {
60912         return null;
60913       }
60914       if (rIsBool.test(sValue)) {
60915         return sValue.toLowerCase() === "true";
60916       }
60917       if (isFinite(sValue)) {
60918         return parseFloat(sValue);
60919       }
60920       if (isFinite(Date.parse(sValue))) {
60921         return new Date(sValue);
60922       }
60923       return sValue;
60924     }
60925     function EmptyTree() {
60926     }
60927     EmptyTree.prototype.toString = function() {
60928       return "null";
60929     };
60930     EmptyTree.prototype.valueOf = function() {
60931       return null;
60932     };
60933     function objectify(vValue) {
60934       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
60935     }
60936     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
60937       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
60938       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : true;
60939       if (bChildren) {
60940         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
60941           oNode = oParentNode.childNodes.item(nItem);
60942           if (oNode.nodeType === 4) {
60943             sCollectedTxt += oNode.nodeValue;
60944           } else if (oNode.nodeType === 3) {
60945             sCollectedTxt += oNode.nodeValue.trim();
60946           } else if (oNode.nodeType === 1 && !oNode.prefix) {
60947             aCache.push(oNode);
60948           }
60949         }
60950       }
60951       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
60952       if (!bHighVerb && (bChildren || bAttributes)) {
60953         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
60954       }
60955       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
60956         sProp = aCache[nElId].nodeName.toLowerCase();
60957         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
60958         if (vResult.hasOwnProperty(sProp)) {
60959           if (vResult[sProp].constructor !== Array) {
60960             vResult[sProp] = [vResult[sProp]];
60961           }
60962           vResult[sProp].push(vContent);
60963         } else {
60964           vResult[sProp] = vContent;
60965           nLength++;
60966         }
60967       }
60968       if (bAttributes) {
60969         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
60970         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
60971           oAttrib = oParentNode.attributes.item(nAttrib);
60972           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
60973         }
60974         if (bNesteAttr) {
60975           if (bFreeze) {
60976             Object.freeze(oAttrParent);
60977           }
60978           vResult[sAttributesProp] = oAttrParent;
60979           nLength -= nAttrLen - 1;
60980         }
60981       }
60982       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
60983         vResult[sValueProp] = vBuiltVal;
60984       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
60985         vResult = vBuiltVal;
60986       }
60987       if (bFreeze && (bHighVerb || nLength > 0)) {
60988         Object.freeze(vResult);
60989       }
60990       aCache.length = nLevelStart;
60991       return vResult;
60992     }
60993     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
60994       var vValue, oChild;
60995       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
60996         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
60997       } else if (oParentObj.constructor === Date) {
60998         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
60999       }
61000       for (var sName in oParentObj) {
61001         vValue = oParentObj[sName];
61002         if (isFinite(sName) || vValue instanceof Function) {
61003           continue;
61004         }
61005         if (sName === sValueProp) {
61006           if (vValue !== null && vValue !== true) {
61007             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
61008           }
61009         } else if (sName === sAttributesProp) {
61010           for (var sAttrib in vValue) {
61011             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
61012           }
61013         } else if (sName.charAt(0) === sAttrPref) {
61014           oParentEl.setAttribute(sName.slice(1), vValue);
61015         } else if (vValue.constructor === Array) {
61016           for (var nItem = 0; nItem < vValue.length; nItem++) {
61017             oChild = oXMLDoc.createElement(sName);
61018             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
61019             oParentEl.appendChild(oChild);
61020           }
61021         } else {
61022           oChild = oXMLDoc.createElement(sName);
61023           if (vValue instanceof Object) {
61024             loadObjTree(oXMLDoc, oChild, vValue);
61025           } else if (vValue !== null && vValue !== true) {
61026             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
61027           }
61028           oParentEl.appendChild(oChild);
61029         }
61030       }
61031     }
61032     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
61033       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : 1;
61034       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
61035     };
61036     this.unbuild = function(oObjTree) {
61037       var oNewDoc = document.implementation.createDocument("", "", null);
61038       loadObjTree(oNewDoc, oNewDoc, oObjTree);
61039       return oNewDoc;
61040     };
61041     this.stringify = function(oObjTree) {
61042       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
61043     };
61044   }();
61045
61046   // modules/ui/sections/changes.js
61047   function uiSectionChanges(context) {
61048     var _discardTags = {};
61049     _mainFileFetcher.get("discarded").then(function(d) {
61050       _discardTags = d;
61051     }).catch(function() {
61052     });
61053     var section = uiSection("changes-list", context).label(function() {
61054       var history = context.history();
61055       var summary = history.difference().summary();
61056       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
61057     }).disclosureContent(renderDisclosureContent);
61058     function renderDisclosureContent(selection2) {
61059       var history = context.history();
61060       var summary = history.difference().summary();
61061       var container = selection2.selectAll(".commit-section").data([0]);
61062       var containerEnter = container.enter().append("div").attr("class", "commit-section");
61063       containerEnter.append("ul").attr("class", "changeset-list");
61064       container = containerEnter.merge(container);
61065       var items = container.select("ul").selectAll("li").data(summary);
61066       var itemsEnter = items.enter().append("li").attr("class", "change-item");
61067       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
61068       buttons.each(function(d) {
61069         select_default2(this).call(svgIcon("#iD-icon-" + d.entity.geometry(d.graph), "pre-text " + d.changeType));
61070       });
61071       buttons.append("span").attr("class", "change-type").html(function(d) {
61072         return _t.html("commit." + d.changeType) + " ";
61073       });
61074       buttons.append("strong").attr("class", "entity-type").text(function(d) {
61075         var matched = _mainPresetIndex.match(d.entity, d.graph);
61076         return matched && matched.name() || utilDisplayType(d.entity.id);
61077       });
61078       buttons.append("span").attr("class", "entity-name").text(function(d) {
61079         var name = utilDisplayName(d.entity) || "", string = "";
61080         if (name !== "") {
61081           string += ":";
61082         }
61083         return string += " " + name;
61084       });
61085       items = itemsEnter.merge(items);
61086       var changeset = new osmChangeset().update({ id: void 0 });
61087       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
61088       delete changeset.id;
61089       var data = JXON.stringify(changeset.osmChangeJXON(changes));
61090       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
61091       var fileName = "changes.osc";
61092       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
61093       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
61094       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
61095       function mouseover(d) {
61096         if (d.entity) {
61097           context.surface().selectAll(
61098             utilEntityOrMemberSelector([d.entity.id], context.graph())
61099           ).classed("hover", true);
61100         }
61101       }
61102       function mouseout() {
61103         context.surface().selectAll(".hover").classed("hover", false);
61104       }
61105       function click(d3_event, change) {
61106         if (change.changeType !== "deleted") {
61107           var entity = change.entity;
61108           context.map().zoomToEase(entity);
61109           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
61110         }
61111       }
61112     }
61113     return section;
61114   }
61115
61116   // modules/ui/commit_warnings.js
61117   function uiCommitWarnings(context) {
61118     function commitWarnings(selection2) {
61119       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
61120       for (var severity in issuesBySeverity) {
61121         var issues = issuesBySeverity[severity];
61122         if (severity !== "error") {
61123           issues = issues.filter(function(issue) {
61124             return issue.type !== "help_request";
61125           });
61126         }
61127         var section = severity + "-section";
61128         var issueItem = severity + "-item";
61129         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
61130         container.exit().remove();
61131         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
61132         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
61133         containerEnter.append("ul").attr("class", "changeset-list");
61134         container = containerEnter.merge(container);
61135         var items = container.select("ul").selectAll("li").data(issues, function(d) {
61136           return d.key;
61137         });
61138         items.exit().remove();
61139         var itemsEnter = items.enter().append("li").attr("class", issueItem);
61140         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d) {
61141           if (d.entityIds) {
61142             context.surface().selectAll(
61143               utilEntityOrMemberSelector(
61144                 d.entityIds,
61145                 context.graph()
61146               )
61147             ).classed("hover", true);
61148           }
61149         }).on("mouseout", function() {
61150           context.surface().selectAll(".hover").classed("hover", false);
61151         }).on("click", function(d3_event, d) {
61152           context.validator().focusIssue(d);
61153         });
61154         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
61155         buttons.append("strong").attr("class", "issue-message");
61156         buttons.filter(function(d) {
61157           return d.tooltip;
61158         }).call(
61159           uiTooltip().title(function(d) {
61160             return d.tooltip;
61161           }).placement("top")
61162         );
61163         items = itemsEnter.merge(items);
61164         items.selectAll(".issue-message").text("").each(function(d) {
61165           return d.message(context)(select_default2(this));
61166         });
61167       }
61168     }
61169     return commitWarnings;
61170   }
61171
61172   // modules/ui/commit.js
61173   var readOnlyTags = [
61174     /^changesets_count$/,
61175     /^created_by$/,
61176     /^ideditor:/,
61177     /^imagery_used$/,
61178     /^host$/,
61179     /^locale$/,
61180     /^warnings:/,
61181     /^resolved:/,
61182     /^closed:note$/,
61183     /^closed:keepright$/,
61184     /^closed:improveosm:/,
61185     /^closed:osmose:/
61186   ];
61187   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
61188   function uiCommit(context) {
61189     var dispatch10 = dispatch_default("cancel");
61190     var _userDetails2;
61191     var _selection;
61192     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
61193     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
61194     var commitChanges = uiSectionChanges(context);
61195     var commitWarnings = uiCommitWarnings(context);
61196     function commit(selection2) {
61197       _selection = selection2;
61198       if (!context.changeset)
61199         initChangeset();
61200       loadDerivedChangesetTags();
61201       selection2.call(render);
61202     }
61203     function initChangeset() {
61204       var commentDate = +corePreferences("commentDate") || 0;
61205       var currDate = Date.now();
61206       var cutoff = 2 * 86400 * 1e3;
61207       if (commentDate > currDate || currDate - commentDate > cutoff) {
61208         corePreferences("comment", null);
61209         corePreferences("hashtags", null);
61210         corePreferences("source", null);
61211       }
61212       if (context.defaultChangesetComment()) {
61213         corePreferences("comment", context.defaultChangesetComment());
61214         corePreferences("commentDate", Date.now());
61215       }
61216       if (context.defaultChangesetSource()) {
61217         corePreferences("source", context.defaultChangesetSource());
61218         corePreferences("commentDate", Date.now());
61219       }
61220       if (context.defaultChangesetHashtags()) {
61221         corePreferences("hashtags", context.defaultChangesetHashtags());
61222         corePreferences("commentDate", Date.now());
61223       }
61224       var detected = utilDetect();
61225       var tags = {
61226         comment: corePreferences("comment") || "",
61227         created_by: context.cleanTagValue("iD " + context.version),
61228         host: context.cleanTagValue(detected.host),
61229         locale: context.cleanTagValue(_mainLocalizer.localeCode())
61230       };
61231       findHashtags(tags, true);
61232       var hashtags = corePreferences("hashtags");
61233       if (hashtags) {
61234         tags.hashtags = hashtags;
61235       }
61236       var source = corePreferences("source");
61237       if (source) {
61238         tags.source = source;
61239       }
61240       var photoOverlaysUsed = context.history().photoOverlaysUsed();
61241       if (photoOverlaysUsed.length) {
61242         var sources = (tags.source || "").split(";");
61243         if (sources.indexOf("streetlevel imagery") === -1) {
61244           sources.push("streetlevel imagery");
61245         }
61246         photoOverlaysUsed.forEach(function(photoOverlay) {
61247           if (sources.indexOf(photoOverlay) === -1) {
61248             sources.push(photoOverlay);
61249           }
61250         });
61251         tags.source = context.cleanTagValue(sources.join(";"));
61252       }
61253       context.changeset = new osmChangeset({ tags });
61254     }
61255     function loadDerivedChangesetTags() {
61256       var osm = context.connection();
61257       if (!osm)
61258         return;
61259       var tags = Object.assign({}, context.changeset.tags);
61260       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
61261       tags.imagery_used = imageryUsed || "None";
61262       var osmClosed = osm.getClosedIDs();
61263       var itemType;
61264       if (osmClosed.length) {
61265         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
61266       }
61267       if (services.keepRight) {
61268         var krClosed = services.keepRight.getClosedIDs();
61269         if (krClosed.length) {
61270           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
61271         }
61272       }
61273       if (services.improveOSM) {
61274         var iOsmClosed = services.improveOSM.getClosedCounts();
61275         for (itemType in iOsmClosed) {
61276           tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
61277         }
61278       }
61279       if (services.osmose) {
61280         var osmoseClosed = services.osmose.getClosedCounts();
61281         for (itemType in osmoseClosed) {
61282           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
61283         }
61284       }
61285       for (var key in tags) {
61286         if (key.match(/(^warnings:)|(^resolved:)/)) {
61287           delete tags[key];
61288         }
61289       }
61290       function addIssueCounts(issues, prefix) {
61291         var issuesByType = utilArrayGroupBy(issues, "type");
61292         for (var issueType in issuesByType) {
61293           var issuesOfType = issuesByType[issueType];
61294           if (issuesOfType[0].subtype) {
61295             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
61296             for (var issueSubtype in issuesBySubtype) {
61297               var issuesOfSubtype = issuesBySubtype[issueSubtype];
61298               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
61299             }
61300           } else {
61301             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
61302           }
61303         }
61304       }
61305       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
61306         return issue.type !== "help_request";
61307       });
61308       addIssueCounts(warnings, "warnings");
61309       var resolvedIssues = context.validator().getResolvedIssues();
61310       addIssueCounts(resolvedIssues, "resolved");
61311       context.changeset = context.changeset.update({ tags });
61312     }
61313     function render(selection2) {
61314       var osm = context.connection();
61315       if (!osm)
61316         return;
61317       var header = selection2.selectAll(".header").data([0]);
61318       var headerTitle = header.enter().append("div").attr("class", "header fillL");
61319       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
61320       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
61321         dispatch10.call("cancel", this);
61322       }).call(svgIcon("#iD-icon-close"));
61323       var body = selection2.selectAll(".body").data([0]);
61324       body = body.enter().append("div").attr("class", "body").merge(body);
61325       var changesetSection = body.selectAll(".changeset-editor").data([0]);
61326       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
61327       changesetSection.call(
61328         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
61329       );
61330       body.call(commitWarnings);
61331       var saveSection = body.selectAll(".save-section").data([0]);
61332       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
61333       var prose = saveSection.selectAll(".commit-info").data([0]);
61334       if (prose.enter().size()) {
61335         _userDetails2 = null;
61336       }
61337       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
61338       osm.userDetails(function(err, user) {
61339         if (err)
61340           return;
61341         if (_userDetails2 === user)
61342           return;
61343         _userDetails2 = user;
61344         var userLink = select_default2(document.createElement("div"));
61345         if (user.image_url) {
61346           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
61347         }
61348         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
61349         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
61350       });
61351       var requestReview = saveSection.selectAll(".request-review").data([0]);
61352       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
61353       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
61354       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
61355       if (!labelEnter.empty()) {
61356         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
61357       }
61358       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
61359       labelEnter.append("span").call(_t.append("commit.request_review"));
61360       requestReview = requestReview.merge(requestReviewEnter);
61361       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
61362       var buttonSection = saveSection.selectAll(".buttons").data([0]);
61363       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
61364       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
61365       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
61366       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
61367       var uploadBlockerTooltipText = getUploadBlockerMessage();
61368       buttonSection = buttonSection.merge(buttonEnter);
61369       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
61370         dispatch10.call("cancel", this);
61371       });
61372       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
61373         if (!select_default2(this).classed("disabled")) {
61374           this.blur();
61375           for (var key in context.changeset.tags) {
61376             if (!key)
61377               delete context.changeset.tags[key];
61378           }
61379           context.uploader().save(context.changeset);
61380         }
61381       });
61382       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
61383       if (uploadBlockerTooltipText) {
61384         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
61385       }
61386       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
61387       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
61388       tagSection.call(
61389         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
61390       );
61391       var changesSection = body.selectAll(".commit-changes-section").data([0]);
61392       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
61393       changesSection.call(commitChanges.render);
61394       function toggleRequestReview() {
61395         var rr = requestReviewInput.property("checked");
61396         updateChangeset({ review_requested: rr ? "yes" : void 0 });
61397         tagSection.call(
61398           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
61399         );
61400       }
61401     }
61402     function getUploadBlockerMessage() {
61403       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
61404       if (errors.length) {
61405         return _t.append("commit.outstanding_errors_message", { count: errors.length });
61406       } else {
61407         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
61408         if (!hasChangesetComment) {
61409           return _t.append("commit.comment_needed_message");
61410         }
61411       }
61412       return null;
61413     }
61414     function changeTags(_, changed, onInput) {
61415       if (changed.hasOwnProperty("comment")) {
61416         if (changed.comment === void 0) {
61417           changed.comment = "";
61418         }
61419         if (!onInput) {
61420           corePreferences("comment", changed.comment);
61421           corePreferences("commentDate", Date.now());
61422         }
61423       }
61424       if (changed.hasOwnProperty("source")) {
61425         if (changed.source === void 0) {
61426           corePreferences("source", null);
61427         } else if (!onInput) {
61428           corePreferences("source", changed.source);
61429           corePreferences("commentDate", Date.now());
61430         }
61431       }
61432       updateChangeset(changed, onInput);
61433       if (_selection) {
61434         _selection.call(render);
61435       }
61436     }
61437     function findHashtags(tags, commentOnly) {
61438       var detectedHashtags = commentHashtags();
61439       if (detectedHashtags.length) {
61440         corePreferences("hashtags", null);
61441       }
61442       if (!detectedHashtags.length || !commentOnly) {
61443         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
61444       }
61445       var allLowerCase = /* @__PURE__ */ new Set();
61446       return detectedHashtags.filter(function(hashtag) {
61447         var lowerCase = hashtag.toLowerCase();
61448         if (!allLowerCase.has(lowerCase)) {
61449           allLowerCase.add(lowerCase);
61450           return true;
61451         }
61452         return false;
61453       });
61454       function commentHashtags() {
61455         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
61456         return matches || [];
61457       }
61458       function hashtagHashtags() {
61459         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s) {
61460           if (s[0] !== "#") {
61461             s = "#" + s;
61462           }
61463           var matched = s.match(hashtagRegex);
61464           return matched && matched[0];
61465         }).filter(Boolean);
61466         return matches || [];
61467       }
61468     }
61469     function isReviewRequested(tags) {
61470       var rr = tags.review_requested;
61471       if (rr === void 0)
61472         return false;
61473       rr = rr.trim().toLowerCase();
61474       return !(rr === "" || rr === "no");
61475     }
61476     function updateChangeset(changed, onInput) {
61477       var tags = Object.assign({}, context.changeset.tags);
61478       Object.keys(changed).forEach(function(k) {
61479         var v = changed[k];
61480         k = context.cleanTagKey(k);
61481         if (readOnlyTags.indexOf(k) !== -1)
61482           return;
61483         if (v === void 0) {
61484           delete tags[k];
61485         } else if (onInput) {
61486           tags[k] = v;
61487         } else {
61488           tags[k] = context.cleanTagValue(v);
61489         }
61490       });
61491       if (!onInput) {
61492         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
61493         var arr = findHashtags(tags, commentOnly);
61494         if (arr.length) {
61495           tags.hashtags = context.cleanTagValue(arr.join(";"));
61496           corePreferences("hashtags", tags.hashtags);
61497         } else {
61498           delete tags.hashtags;
61499           corePreferences("hashtags", null);
61500         }
61501       }
61502       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
61503         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
61504         tags.changesets_count = String(changesetsCount);
61505         if (changesetsCount <= 100) {
61506           var s;
61507           s = corePreferences("walkthrough_completed");
61508           if (s) {
61509             tags["ideditor:walkthrough_completed"] = s;
61510           }
61511           s = corePreferences("walkthrough_progress");
61512           if (s) {
61513             tags["ideditor:walkthrough_progress"] = s;
61514           }
61515           s = corePreferences("walkthrough_started");
61516           if (s) {
61517             tags["ideditor:walkthrough_started"] = s;
61518           }
61519         }
61520       } else {
61521         delete tags.changesets_count;
61522       }
61523       if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
61524         context.changeset = context.changeset.update({ tags });
61525       }
61526     }
61527     commit.reset = function() {
61528       context.changeset = null;
61529     };
61530     return utilRebind(commit, dispatch10, "on");
61531   }
61532
61533   // modules/ui/confirm.js
61534   function uiConfirm(selection2) {
61535     var modalSelection = uiModal(selection2);
61536     modalSelection.select(".modal").classed("modal-alert", true);
61537     var section = modalSelection.select(".content");
61538     section.append("div").attr("class", "modal-section header");
61539     section.append("div").attr("class", "modal-section message-text");
61540     var buttons = section.append("div").attr("class", "modal-section buttons cf");
61541     modalSelection.okButton = function() {
61542       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
61543         modalSelection.remove();
61544       }).call(_t.append("confirm.okay")).node().focus();
61545       return modalSelection;
61546     };
61547     return modalSelection;
61548   }
61549
61550   // modules/ui/conflicts.js
61551   function uiConflicts(context) {
61552     var dispatch10 = dispatch_default("cancel", "save");
61553     var keybinding = utilKeybinding("conflicts");
61554     var _origChanges;
61555     var _conflictList;
61556     var _shownConflictIndex;
61557     function keybindingOn() {
61558       select_default2(document).call(keybinding.on("\u238B", cancel, true));
61559     }
61560     function keybindingOff() {
61561       select_default2(document).call(keybinding.unbind);
61562     }
61563     function tryAgain() {
61564       keybindingOff();
61565       dispatch10.call("save");
61566     }
61567     function cancel() {
61568       keybindingOff();
61569       dispatch10.call("cancel");
61570     }
61571     function conflicts(selection2) {
61572       keybindingOn();
61573       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
61574       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
61575       headerEnter.append("h2").call(_t.append("save.conflict.header"));
61576       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
61577       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
61578       var changeset = new osmChangeset();
61579       delete changeset.id;
61580       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
61581       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
61582       var fileName = "changes.osc";
61583       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
61584       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
61585       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
61586       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
61587       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
61588       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
61589       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
61590       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
61591     }
61592     function showConflict(selection2, index) {
61593       index = utilWrap(index, _conflictList.length);
61594       _shownConflictIndex = index;
61595       var parent = select_default2(selection2.node().parentNode);
61596       if (index === _conflictList.length - 1) {
61597         window.setTimeout(function() {
61598           parent.select(".conflicts-button").attr("disabled", null);
61599           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
61600         }, 250);
61601       }
61602       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
61603       conflict.exit().remove();
61604       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
61605       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
61606       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d) {
61607         return d.name;
61608       }).on("click", function(d3_event, d) {
61609         d3_event.preventDefault();
61610         zoomToEntity(d.id);
61611       });
61612       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
61613       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d) {
61614         return d.details || [];
61615       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d) {
61616         return d;
61617       });
61618       details.append("div").attr("class", "conflict-choices").call(addChoices);
61619       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(d, i2) {
61620         return i2 === 0 && index === 0 || i2 === 1 && index === _conflictList.length - 1 || null;
61621       }).on("click", function(d3_event, d) {
61622         d3_event.preventDefault();
61623         var container = parent.selectAll(".conflict-container");
61624         var sign2 = d === "previous" ? -1 : 1;
61625         container.selectAll(".conflict").remove();
61626         container.call(showConflict, index + sign2);
61627       }).call(function(d) {
61628         _t.append("save.conflict." + d)(select_default2(this));
61629       });
61630     }
61631     function addChoices(selection2) {
61632       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d) {
61633         return d.choices || [];
61634       });
61635       var choicesEnter = choices.enter().append("li").attr("class", "layer");
61636       var labelEnter = choicesEnter.append("label");
61637       labelEnter.append("input").attr("type", "radio").attr("name", function(d) {
61638         return d.id;
61639       }).on("change", function(d3_event, d) {
61640         var ul = this.parentNode.parentNode.parentNode;
61641         ul.__data__.chosen = d.id;
61642         choose(d3_event, ul, d);
61643       });
61644       labelEnter.append("span").text(function(d) {
61645         return d.text;
61646       });
61647       choicesEnter.merge(choices).each(function(d) {
61648         var ul = this.parentNode;
61649         if (ul.__data__.chosen === d.id) {
61650           choose(null, ul, d);
61651         }
61652       });
61653     }
61654     function choose(d3_event, ul, datum2) {
61655       if (d3_event)
61656         d3_event.preventDefault();
61657       select_default2(ul).selectAll("li").classed("active", function(d) {
61658         return d === datum2;
61659       }).selectAll("input").property("checked", function(d) {
61660         return d === datum2;
61661       });
61662       var extent = geoExtent();
61663       var entity;
61664       entity = context.graph().hasEntity(datum2.id);
61665       if (entity)
61666         extent._extend(entity.extent(context.graph()));
61667       datum2.action();
61668       entity = context.graph().hasEntity(datum2.id);
61669       if (entity)
61670         extent._extend(entity.extent(context.graph()));
61671       zoomToEntity(datum2.id, extent);
61672     }
61673     function zoomToEntity(id2, extent) {
61674       context.surface().selectAll(".hover").classed("hover", false);
61675       var entity = context.graph().hasEntity(id2);
61676       if (entity) {
61677         if (extent) {
61678           context.map().trimmedExtent(extent);
61679         } else {
61680           context.map().zoomToEase(entity);
61681         }
61682         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
61683       }
61684     }
61685     conflicts.conflictList = function(_) {
61686       if (!arguments.length)
61687         return _conflictList;
61688       _conflictList = _;
61689       return conflicts;
61690     };
61691     conflicts.origChanges = function(_) {
61692       if (!arguments.length)
61693         return _origChanges;
61694       _origChanges = _;
61695       return conflicts;
61696     };
61697     conflicts.shownEntityIds = function() {
61698       if (_conflictList && typeof _shownConflictIndex === "number") {
61699         return [_conflictList[_shownConflictIndex].id];
61700       }
61701       return [];
61702     };
61703     return utilRebind(conflicts, dispatch10, "on");
61704   }
61705
61706   // modules/ui/entity_editor.js
61707   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
61708
61709   // modules/ui/sections/entity_issues.js
61710   function uiSectionEntityIssues(context) {
61711     var preference = corePreferences("entity-issues.reference.expanded");
61712     var _expanded = preference === null ? true : preference === "true";
61713     var _entityIDs = [];
61714     var _issues = [];
61715     var _activeIssueID;
61716     var section = uiSection("entity-issues", context).shouldDisplay(function() {
61717       return _issues.length > 0;
61718     }).label(function() {
61719       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
61720     }).disclosureContent(renderDisclosureContent);
61721     context.validator().on("validated.entity_issues", function() {
61722       reloadIssues();
61723       section.reRender();
61724     }).on("focusedIssue.entity_issues", function(issue) {
61725       makeActiveIssue(issue.id);
61726     });
61727     function reloadIssues() {
61728       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
61729     }
61730     function makeActiveIssue(issueID) {
61731       _activeIssueID = issueID;
61732       section.selection().selectAll(".issue-container").classed("active", function(d) {
61733         return d.id === _activeIssueID;
61734       });
61735     }
61736     function renderDisclosureContent(selection2) {
61737       selection2.classed("grouped-items-area", true);
61738       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
61739       var containers = selection2.selectAll(".issue-container").data(_issues, function(d) {
61740         return d.key;
61741       });
61742       containers.exit().remove();
61743       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
61744       var itemsEnter = containersEnter.append("div").attr("class", function(d) {
61745         return "issue severity-" + d.severity;
61746       }).on("mouseover.highlight", function(d3_event, d) {
61747         var ids = d.entityIds.filter(function(e) {
61748           return _entityIDs.indexOf(e) === -1;
61749         });
61750         utilHighlightEntities(ids, true, context);
61751       }).on("mouseout.highlight", function(d3_event, d) {
61752         var ids = d.entityIds.filter(function(e) {
61753           return _entityIDs.indexOf(e) === -1;
61754         });
61755         utilHighlightEntities(ids, false, context);
61756       });
61757       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
61758       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d) {
61759         makeActiveIssue(d.id);
61760         var extent = d.extent(context.graph());
61761         if (extent) {
61762           var setZoom = Math.max(context.map().zoom(), 19);
61763           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
61764         }
61765       });
61766       textEnter.each(function(d) {
61767         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
61768         select_default2(this).call(svgIcon(iconName, "issue-icon"));
61769       });
61770       textEnter.append("span").attr("class", "issue-message");
61771       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
61772       infoButton.on("click", function(d3_event) {
61773         d3_event.stopPropagation();
61774         d3_event.preventDefault();
61775         this.blur();
61776         var container = select_default2(this.parentNode.parentNode.parentNode);
61777         var info = container.selectAll(".issue-info");
61778         var isExpanded = info.classed("expanded");
61779         _expanded = !isExpanded;
61780         corePreferences("entity-issues.reference.expanded", _expanded);
61781         if (isExpanded) {
61782           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
61783             info.classed("expanded", false);
61784           });
61785         } else {
61786           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
61787             info.style("max-height", null);
61788           });
61789         }
61790       });
61791       itemsEnter.append("ul").attr("class", "issue-fix-list");
61792       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d) {
61793         if (typeof d.reference === "function") {
61794           select_default2(this).call(d.reference);
61795         } else {
61796           select_default2(this).call(_t.append("inspector.no_documentation_key"));
61797         }
61798       });
61799       containers = containers.merge(containersEnter).classed("active", function(d) {
61800         return d.id === _activeIssueID;
61801       });
61802       containers.selectAll(".issue-message").text("").each(function(d) {
61803         return d.message(context)(select_default2(this));
61804       });
61805       var fixLists = containers.selectAll(".issue-fix-list");
61806       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d) {
61807         return d.fixes ? d.fixes(context) : [];
61808       }, function(fix) {
61809         return fix.id;
61810       });
61811       fixes.exit().remove();
61812       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
61813       var buttons = fixesEnter.append("button").on("click", function(d3_event, d) {
61814         if (select_default2(this).attr("disabled") || !d.onClick)
61815           return;
61816         if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1e3)
61817           return;
61818         d.issue.dateLastRanFix = new Date();
61819         utilHighlightEntities(d.issue.entityIds.concat(d.entityIds), false, context);
61820         new Promise(function(resolve, reject) {
61821           d.onClick(context, resolve, reject);
61822           if (d.onClick.length <= 1) {
61823             resolve();
61824           }
61825         }).then(function() {
61826           context.validator().validate();
61827         });
61828       }).on("mouseover.highlight", function(d3_event, d) {
61829         utilHighlightEntities(d.entityIds, true, context);
61830       }).on("mouseout.highlight", function(d3_event, d) {
61831         utilHighlightEntities(d.entityIds, false, context);
61832       });
61833       buttons.each(function(d) {
61834         var iconName = d.icon || "iD-icon-wrench";
61835         if (iconName.startsWith("maki")) {
61836           iconName += "-15";
61837         }
61838         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
61839       });
61840       buttons.append("span").attr("class", "fix-message").each(function(d) {
61841         return d.title(select_default2(this));
61842       });
61843       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d) {
61844         return d.onClick;
61845       }).attr("disabled", function(d) {
61846         return d.onClick ? null : "true";
61847       }).attr("title", function(d) {
61848         if (d.disabledReason) {
61849           return d.disabledReason;
61850         }
61851         return null;
61852       });
61853     }
61854     section.entityIDs = function(val) {
61855       if (!arguments.length)
61856         return _entityIDs;
61857       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
61858         _entityIDs = val;
61859         _activeIssueID = null;
61860         reloadIssues();
61861       }
61862       return section;
61863     };
61864     return section;
61865   }
61866
61867   // modules/ui/preset_icon.js
61868   function uiPresetIcon() {
61869     let _preset;
61870     let _geometry;
61871     function presetIcon(selection2) {
61872       selection2.each(render);
61873     }
61874     function getIcon(p, geom) {
61875       if (p.isFallback && p.isFallback())
61876         return geom === "vertex" ? "" : "iD-icon-" + p.id;
61877       if (p.icon)
61878         return p.icon;
61879       if (geom === "line")
61880         return "iD-other-line";
61881       if (geom === "vertex")
61882         return "temaki-vertex";
61883       return "maki-marker-stroked";
61884     }
61885     function renderPointBorder(container, drawPoint) {
61886       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
61887       pointBorder.exit().remove();
61888       let pointBorderEnter = pointBorder.enter();
61889       const w = 40;
61890       const h = 40;
61891       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`).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");
61892       pointBorder = pointBorderEnter.merge(pointBorder);
61893     }
61894     function renderCategoryBorder(container, category) {
61895       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
61896       categoryBorder.exit().remove();
61897       let categoryBorderEnter = categoryBorder.enter();
61898       const d = 60;
61899       let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d).attr("height", d).attr("viewBox", `0 0 ${d} ${d}`);
61900       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");
61901       categoryBorder = categoryBorderEnter.merge(categoryBorder);
61902       if (category) {
61903         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
61904       }
61905     }
61906     function renderCircleFill(container, drawVertex) {
61907       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
61908       vertexFill.exit().remove();
61909       let vertexFillEnter = vertexFill.enter();
61910       const w = 60;
61911       const h = 60;
61912       const d = 40;
61913       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`).append("circle").attr("cx", w / 2).attr("cy", h / 2).attr("r", d / 2);
61914       vertexFill = vertexFillEnter.merge(vertexFill);
61915     }
61916     function renderSquareFill(container, drawArea, tagClasses) {
61917       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
61918       fill.exit().remove();
61919       let fillEnter = fill.enter();
61920       const d = 60;
61921       const w = d;
61922       const h = d;
61923       const l = d * 2 / 3;
61924       const c1 = (w - l) / 2;
61925       const c2 = c1 + l;
61926       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
61927       ["fill", "stroke"].forEach((klass) => {
61928         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
61929       });
61930       const rVertex = 2.5;
61931       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
61932         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
61933       });
61934       const rMidpoint = 1.25;
61935       [[c1, w / 2], [c2, w / 2], [h / 2, c1], [h / 2, c2]].forEach((point) => {
61936         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
61937       });
61938       fill = fillEnter.merge(fill);
61939       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
61940       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
61941     }
61942     function renderLine(container, drawLine, tagClasses) {
61943       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
61944       line.exit().remove();
61945       let lineEnter = line.enter();
61946       const d = 60;
61947       const w = d;
61948       const h = d;
61949       const y = Math.round(d * 0.72);
61950       const l = Math.round(d * 0.6);
61951       const r = 2.5;
61952       const x12 = (w - l) / 2;
61953       const x2 = x12 + l;
61954       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
61955       ["casing", "stroke"].forEach((klass) => {
61956         lineEnter.append("path").attr("d", `M${x12} ${y} L${x2} ${y}`).attr("class", `line ${klass}`);
61957       });
61958       [[x12 - 1, y], [x2 + 1, y]].forEach((point) => {
61959         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
61960       });
61961       line = lineEnter.merge(line);
61962       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
61963       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
61964     }
61965     function renderRoute(container, drawRoute, p) {
61966       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
61967       route.exit().remove();
61968       let routeEnter = route.enter();
61969       const d = 60;
61970       const w = d;
61971       const h = d;
61972       const y12 = Math.round(d * 0.8);
61973       const y2 = Math.round(d * 0.68);
61974       const l = Math.round(d * 0.6);
61975       const r = 2;
61976       const x12 = (w - l) / 2;
61977       const x2 = x12 + l / 3;
61978       const x3 = x2 + l / 3;
61979       const x4 = x3 + l / 3;
61980       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
61981       ["casing", "stroke"].forEach((klass) => {
61982         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
61983         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
61984         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
61985       });
61986       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
61987         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
61988       });
61989       route = routeEnter.merge(route);
61990       if (drawRoute) {
61991         let routeType = p.tags.type === "waterway" ? "waterway" : p.tags.route;
61992         const segmentPresetIDs = routeSegments[routeType];
61993         for (let i2 in segmentPresetIDs) {
61994           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i2]);
61995           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
61996           route.selectAll(`path.stroke.segment${i2}`).attr("class", `segment${i2} line stroke ${segmentTagClasses}`);
61997           route.selectAll(`path.casing.segment${i2}`).attr("class", `segment${i2} line casing ${segmentTagClasses}`);
61998         }
61999       }
62000     }
62001     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
62002       const isMaki = picon && /^maki-/.test(picon);
62003       const isTemaki = picon && /^temaki-/.test(picon);
62004       const isFa = picon && /^fa[srb]-/.test(picon);
62005       const isiDIcon = picon && !(isMaki || isTemaki || isFa);
62006       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
62007       icon2.exit().remove();
62008       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
62009       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
62010       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
62011       icon2.selectAll("use").attr("href", "#" + picon);
62012     }
62013     function renderImageIcon(container, imageURL) {
62014       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
62015       imageIcon.exit().remove();
62016       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);
62017       imageIcon.attr("src", imageURL);
62018     }
62019     const routeSegments = {
62020       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
62021       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
62022       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
62023       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
62024       ferry: ["route/ferry", "route/ferry", "route/ferry"],
62025       foot: ["highway/footway", "highway/footway", "highway/footway"],
62026       hiking: ["highway/path", "highway/path", "highway/path"],
62027       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
62028       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
62029       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
62030       mtb: ["highway/path", "highway/track", "highway/bridleway"],
62031       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
62032       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
62033       power: ["power/line", "power/line", "power/line"],
62034       road: ["highway/secondary", "highway/primary", "highway/trunk"],
62035       subway: ["railway/subway", "railway/subway", "railway/subway"],
62036       train: ["railway/rail", "railway/rail", "railway/rail"],
62037       tram: ["railway/tram", "railway/tram", "railway/tram"],
62038       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
62039     };
62040     function render() {
62041       let p = _preset.apply(this, arguments);
62042       let geom = _geometry ? _geometry.apply(this, arguments) : null;
62043       if (geom === "relation" && p.tags && (p.tags.type === "route" && p.tags.route && routeSegments[p.tags.route] || p.tags.type === "waterway")) {
62044         geom = "route";
62045       }
62046       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
62047       const isFallback = p.isFallback && p.isFallback();
62048       const imageURL = showThirdPartyIcons === "true" && p.imageURL;
62049       const picon = getIcon(p, geom);
62050       const isCategory = !p.setTags;
62051       const drawPoint = false;
62052       const drawVertex = picon !== null && geom === "vertex";
62053       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
62054       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
62055       const drawRoute = picon && geom === "route";
62056       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
62057       let tags = !isCategory ? p.setTags({}, geom) : {};
62058       for (let k in tags) {
62059         if (tags[k] === "*") {
62060           tags[k] = "yes";
62061         }
62062       }
62063       let tagClasses = svgTagClasses().getClassesString(tags, "");
62064       let selection2 = select_default2(this);
62065       let container = selection2.selectAll(".preset-icon-container").data([0]);
62066       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
62067       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
62068       renderCategoryBorder(container, isCategory && p);
62069       renderPointBorder(container, drawPoint);
62070       renderCircleFill(container, drawVertex);
62071       renderSquareFill(container, drawArea, tagClasses);
62072       renderLine(container, drawLine, tagClasses);
62073       renderRoute(container, drawRoute, p);
62074       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
62075       renderImageIcon(container, imageURL);
62076     }
62077     presetIcon.preset = function(val) {
62078       if (!arguments.length)
62079         return _preset;
62080       _preset = utilFunctor(val);
62081       return presetIcon;
62082     };
62083     presetIcon.geometry = function(val) {
62084       if (!arguments.length)
62085         return _geometry;
62086       _geometry = utilFunctor(val);
62087       return presetIcon;
62088     };
62089     return presetIcon;
62090   }
62091
62092   // modules/ui/sections/feature_type.js
62093   function uiSectionFeatureType(context) {
62094     var dispatch10 = dispatch_default("choose");
62095     var _entityIDs = [];
62096     var _presets = [];
62097     var _tagReference;
62098     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
62099     function renderDisclosureContent(selection2) {
62100       selection2.classed("preset-list-item", true);
62101       selection2.classed("mixed-types", _presets.length > 1);
62102       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
62103       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
62104         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
62105       );
62106       presetButton.append("div").attr("class", "preset-icon-container");
62107       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
62108       presetButtonWrap.append("div").attr("class", "accessory-buttons");
62109       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
62110       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
62111       if (_tagReference) {
62112         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
62113         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
62114       }
62115       selection2.selectAll(".preset-reset").on("click", function() {
62116         dispatch10.call("choose", this, _presets);
62117       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
62118         d3_event.preventDefault();
62119         d3_event.stopPropagation();
62120       });
62121       var geometries = entityGeometries();
62122       selection2.select(".preset-list-item button").call(
62123         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
62124       );
62125       var names = _presets.length === 1 ? [
62126         _presets[0].nameLabel(),
62127         _presets[0].subtitleLabel()
62128       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
62129       var label = selection2.select(".label-inner");
62130       var nameparts = label.selectAll(".namepart").data(names, (d) => d.stringId);
62131       nameparts.exit().remove();
62132       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d) {
62133         d(select_default2(this));
62134       });
62135     }
62136     section.entityIDs = function(val) {
62137       if (!arguments.length)
62138         return _entityIDs;
62139       _entityIDs = val;
62140       return section;
62141     };
62142     section.presets = function(val) {
62143       if (!arguments.length)
62144         return _presets;
62145       if (!utilArrayIdentical(val, _presets)) {
62146         _presets = val;
62147         if (_presets.length === 1) {
62148           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
62149         }
62150       }
62151       return section;
62152     };
62153     function entityGeometries() {
62154       var counts = {};
62155       for (var i2 in _entityIDs) {
62156         var geometry = context.graph().geometry(_entityIDs[i2]);
62157         if (!counts[geometry])
62158           counts[geometry] = 0;
62159         counts[geometry] += 1;
62160       }
62161       return Object.keys(counts).sort(function(geom1, geom2) {
62162         return counts[geom2] - counts[geom1];
62163       });
62164     }
62165     return utilRebind(section, dispatch10, "on");
62166   }
62167
62168   // modules/ui/sections/preset_fields.js
62169   function uiSectionPresetFields(context) {
62170     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
62171     var dispatch10 = dispatch_default("change", "revert");
62172     var formFields = uiFormFields(context);
62173     var _state;
62174     var _fieldsArr;
62175     var _presets = [];
62176     var _tags;
62177     var _entityIDs;
62178     function renderDisclosureContent(selection2) {
62179       if (!_fieldsArr) {
62180         var graph = context.graph();
62181         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
62182           geoms[graph.entity(entityID).geometry(graph)] = true;
62183           return geoms;
62184         }, {}));
62185         var presetsManager = _mainPresetIndex;
62186         var allFields = [];
62187         var allMoreFields = [];
62188         var sharedTotalFields;
62189         _presets.forEach(function(preset) {
62190           var fields = preset.fields();
62191           var moreFields = preset.moreFields();
62192           allFields = utilArrayUnion(allFields, fields);
62193           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
62194           if (!sharedTotalFields) {
62195             sharedTotalFields = utilArrayUnion(fields, moreFields);
62196           } else {
62197             sharedTotalFields = sharedTotalFields.filter(function(field) {
62198               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
62199             });
62200           }
62201         });
62202         var sharedFields = allFields.filter(function(field) {
62203           return sharedTotalFields.indexOf(field) !== -1;
62204         });
62205         var sharedMoreFields = allMoreFields.filter(function(field) {
62206           return sharedTotalFields.indexOf(field) !== -1;
62207         });
62208         _fieldsArr = [];
62209         sharedFields.forEach(function(field) {
62210           if (field.matchAllGeometry(geometries)) {
62211             _fieldsArr.push(
62212               uiField(context, field, _entityIDs)
62213             );
62214           }
62215         });
62216         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
62217         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
62218           _fieldsArr.push(
62219             uiField(context, presetsManager.field("restrictions"), _entityIDs)
62220           );
62221         }
62222         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
62223         additionalFields.sort(function(field1, field2) {
62224           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
62225         });
62226         additionalFields.forEach(function(field) {
62227           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
62228             _fieldsArr.push(
62229               uiField(context, field, _entityIDs, { show: false })
62230             );
62231           }
62232         });
62233         _fieldsArr.forEach(function(field) {
62234           field.on("change", function(t, onInput) {
62235             dispatch10.call("change", field, _entityIDs, t, onInput);
62236           }).on("revert", function(keys) {
62237             dispatch10.call("revert", field, keys);
62238           });
62239         });
62240       }
62241       _fieldsArr.forEach(function(field) {
62242         field.state(_state).tags(_tags);
62243       });
62244       selection2.call(
62245         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
62246       );
62247       selection2.selectAll(".wrap-form-field input").on("keydown", function(d3_event) {
62248         if (d3_event.keyCode === 13 && context.container().select(".combobox").empty()) {
62249           context.enter(modeBrowse(context));
62250         }
62251       });
62252     }
62253     section.presets = function(val) {
62254       if (!arguments.length)
62255         return _presets;
62256       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
62257         _presets = val;
62258         _fieldsArr = null;
62259       }
62260       return section;
62261     };
62262     section.state = function(val) {
62263       if (!arguments.length)
62264         return _state;
62265       _state = val;
62266       return section;
62267     };
62268     section.tags = function(val) {
62269       if (!arguments.length)
62270         return _tags;
62271       _tags = val;
62272       return section;
62273     };
62274     section.entityIDs = function(val) {
62275       if (!arguments.length)
62276         return _entityIDs;
62277       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
62278         _entityIDs = val;
62279         _fieldsArr = null;
62280       }
62281       return section;
62282     };
62283     return utilRebind(section, dispatch10, "on");
62284   }
62285
62286   // modules/ui/sections/raw_member_editor.js
62287   function uiSectionRawMemberEditor(context) {
62288     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
62289       if (!_entityIDs || _entityIDs.length !== 1)
62290         return false;
62291       var entity = context.hasEntity(_entityIDs[0]);
62292       return entity && entity.type === "relation";
62293     }).label(function() {
62294       var entity = context.hasEntity(_entityIDs[0]);
62295       if (!entity)
62296         return "";
62297       var gt = entity.members.length > _maxMembers ? ">" : "";
62298       var count = gt + entity.members.slice(0, _maxMembers).length;
62299       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
62300     }).disclosureContent(renderDisclosureContent);
62301     var taginfo = services.taginfo;
62302     var _entityIDs;
62303     var _maxMembers = 1e3;
62304     function downloadMember(d3_event, d) {
62305       d3_event.preventDefault();
62306       select_default2(this.parentNode).classed("tag-reference-loading", true);
62307       context.loadEntity(d.id, function() {
62308         section.reRender();
62309       });
62310     }
62311     function zoomToMember(d3_event, d) {
62312       d3_event.preventDefault();
62313       var entity = context.entity(d.id);
62314       context.map().zoomToEase(entity);
62315       utilHighlightEntities([d.id], true, context);
62316     }
62317     function selectMember(d3_event, d) {
62318       d3_event.preventDefault();
62319       utilHighlightEntities([d.id], false, context);
62320       var entity = context.entity(d.id);
62321       var mapExtent = context.map().extent();
62322       if (!entity.intersects(mapExtent, context.graph())) {
62323         context.map().zoomToEase(entity);
62324       }
62325       context.enter(modeSelect(context, [d.id]));
62326     }
62327     function changeRole(d3_event, d) {
62328       var oldRole = d.role;
62329       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
62330       if (oldRole !== newRole) {
62331         var member = { id: d.id, type: d.type, role: newRole };
62332         context.perform(
62333           actionChangeMember(d.relation.id, member, d.index),
62334           _t("operations.change_role.annotation", {
62335             n: 1
62336           })
62337         );
62338         context.validator().validate();
62339       }
62340     }
62341     function deleteMember(d3_event, d) {
62342       utilHighlightEntities([d.id], false, context);
62343       context.perform(
62344         actionDeleteMember(d.relation.id, d.index),
62345         _t("operations.delete_member.annotation", {
62346           n: 1
62347         })
62348       );
62349       if (!context.hasEntity(d.relation.id)) {
62350         context.enter(modeBrowse(context));
62351       } else {
62352         context.validator().validate();
62353       }
62354     }
62355     function renderDisclosureContent(selection2) {
62356       var entityID = _entityIDs[0];
62357       var memberships = [];
62358       var entity = context.entity(entityID);
62359       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
62360         memberships.push({
62361           index,
62362           id: member.id,
62363           type: member.type,
62364           role: member.role,
62365           relation: entity,
62366           member: context.hasEntity(member.id),
62367           domId: utilUniqueDomId(entityID + "-member-" + index)
62368         });
62369       });
62370       var list = selection2.selectAll(".member-list").data([0]);
62371       list = list.enter().append("ul").attr("class", "member-list").merge(list);
62372       var items = list.selectAll("li").data(memberships, function(d) {
62373         return osmEntity.key(d.relation) + "," + d.index + "," + (d.member ? osmEntity.key(d.member) : "incomplete");
62374       });
62375       items.exit().each(unbind).remove();
62376       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d) {
62377         return !d.member;
62378       });
62379       itemsEnter.each(function(d) {
62380         var item = select_default2(this);
62381         var label = item.append("label").attr("class", "field-label").attr("for", d.domId);
62382         if (d.member) {
62383           item.on("mouseover", function() {
62384             utilHighlightEntities([d.id], true, context);
62385           }).on("mouseout", function() {
62386             utilHighlightEntities([d.id], false, context);
62387           });
62388           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
62389           labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
62390             var matched = _mainPresetIndex.match(d2.member, context.graph());
62391             return matched && matched.name() || utilDisplayType(d2.member.id);
62392           });
62393           labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
62394             return utilDisplayName(d2.member);
62395           });
62396           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
62397           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
62398         } else {
62399           var labelText = label.append("span").attr("class", "label-text");
62400           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d.type, { id: d.id }));
62401           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d.id }));
62402           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
62403         }
62404       });
62405       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
62406       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
62407         return d.domId;
62408       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
62409       if (taginfo) {
62410         wrapEnter.each(bindTypeahead);
62411       }
62412       items = items.merge(itemsEnter).order();
62413       items.select("input.member-role").property("value", function(d) {
62414         return d.role;
62415       }).on("blur", changeRole).on("change", changeRole);
62416       items.select("button.member-delete").on("click", deleteMember);
62417       var dragOrigin, targetIndex;
62418       items.call(
62419         drag_default().on("start", function(d3_event) {
62420           dragOrigin = {
62421             x: d3_event.x,
62422             y: d3_event.y
62423           };
62424           targetIndex = null;
62425         }).on("drag", function(d3_event) {
62426           var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
62427           if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
62428             return;
62429           var index = items.nodes().indexOf(this);
62430           select_default2(this).classed("dragging", true);
62431           targetIndex = null;
62432           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
62433             var node = select_default2(this).node();
62434             if (index === index2) {
62435               return "translate(" + x + "px, " + y + "px)";
62436             } else if (index2 > index && d3_event.y > node.offsetTop) {
62437               if (targetIndex === null || index2 > targetIndex) {
62438                 targetIndex = index2;
62439               }
62440               return "translateY(-100%)";
62441             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
62442               if (targetIndex === null || index2 < targetIndex) {
62443                 targetIndex = index2;
62444               }
62445               return "translateY(100%)";
62446             }
62447             return null;
62448           });
62449         }).on("end", function(d3_event, d) {
62450           if (!select_default2(this).classed("dragging"))
62451             return;
62452           var index = items.nodes().indexOf(this);
62453           select_default2(this).classed("dragging", false);
62454           selection2.selectAll("li.member-row").style("transform", null);
62455           if (targetIndex !== null) {
62456             context.perform(
62457               actionMoveMember(d.relation.id, index, targetIndex),
62458               _t("operations.reorder_members.annotation")
62459             );
62460             context.validator().validate();
62461           }
62462         })
62463       );
62464       function bindTypeahead(d) {
62465         var row = select_default2(this);
62466         var role = row.selectAll("input.member-role");
62467         var origValue = role.property("value");
62468         function sort(value, data) {
62469           var sameletter = [];
62470           var other = [];
62471           for (var i2 = 0; i2 < data.length; i2++) {
62472             if (data[i2].value.substring(0, value.length) === value) {
62473               sameletter.push(data[i2]);
62474             } else {
62475               other.push(data[i2]);
62476             }
62477           }
62478           return sameletter.concat(other);
62479         }
62480         role.call(
62481           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
62482             var geometry;
62483             if (d.member) {
62484               geometry = context.graph().geometry(d.member.id);
62485             } else if (d.type === "relation") {
62486               geometry = "relation";
62487             } else if (d.type === "way") {
62488               geometry = "line";
62489             } else {
62490               geometry = "point";
62491             }
62492             var rtype = entity.tags.type;
62493             taginfo.roles({
62494               debounce: true,
62495               rtype: rtype || "",
62496               geometry,
62497               query: role2
62498             }, function(err, data) {
62499               if (!err)
62500                 callback(sort(role2, data));
62501             });
62502           }).on("cancel", function() {
62503             role.property("value", origValue);
62504           })
62505         );
62506       }
62507       function unbind() {
62508         var row = select_default2(this);
62509         row.selectAll("input.member-role").call(uiCombobox.off, context);
62510       }
62511     }
62512     section.entityIDs = function(val) {
62513       if (!arguments.length)
62514         return _entityIDs;
62515       _entityIDs = val;
62516       return section;
62517     };
62518     return section;
62519   }
62520
62521   // modules/actions/delete_members.js
62522   function actionDeleteMembers(relationId, memberIndexes) {
62523     return function(graph) {
62524       memberIndexes.sort((a, b) => b - a);
62525       for (var i2 in memberIndexes) {
62526         graph = actionDeleteMember(relationId, memberIndexes[i2])(graph);
62527       }
62528       return graph;
62529     };
62530   }
62531
62532   // modules/ui/sections/raw_membership_editor.js
62533   function uiSectionRawMembershipEditor(context) {
62534     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
62535       return _entityIDs && _entityIDs.length;
62536     }).label(function() {
62537       var parents = getSharedParentRelations();
62538       var gt = parents.length > _maxMemberships ? ">" : "";
62539       var count = gt + parents.slice(0, _maxMemberships).length;
62540       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
62541     }).disclosureContent(renderDisclosureContent);
62542     var taginfo = services.taginfo;
62543     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d) {
62544       if (d.relation)
62545         utilHighlightEntities([d.relation.id], true, context);
62546     }).itemsMouseLeave(function(d3_event, d) {
62547       if (d.relation)
62548         utilHighlightEntities([d.relation.id], false, context);
62549     });
62550     var _inChange = false;
62551     var _entityIDs = [];
62552     var _showBlank;
62553     var _maxMemberships = 1e3;
62554     function getSharedParentRelations() {
62555       var parents = [];
62556       for (var i2 = 0; i2 < _entityIDs.length; i2++) {
62557         var entity = context.graph().hasEntity(_entityIDs[i2]);
62558         if (!entity)
62559           continue;
62560         if (i2 === 0) {
62561           parents = context.graph().parentRelations(entity);
62562         } else {
62563           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
62564         }
62565         if (!parents.length)
62566           break;
62567       }
62568       return parents;
62569     }
62570     function getMemberships() {
62571       var memberships = [];
62572       var relations = getSharedParentRelations().slice(0, _maxMemberships);
62573       var isMultiselect = _entityIDs.length > 1;
62574       var i2, relation, membership, index, member, indexedMember;
62575       for (i2 = 0; i2 < relations.length; i2++) {
62576         relation = relations[i2];
62577         membership = {
62578           relation,
62579           members: [],
62580           hash: osmEntity.key(relation)
62581         };
62582         for (index = 0; index < relation.members.length; index++) {
62583           member = relation.members[index];
62584           if (_entityIDs.indexOf(member.id) !== -1) {
62585             indexedMember = Object.assign({}, member, { index });
62586             membership.members.push(indexedMember);
62587             membership.hash += "," + index.toString();
62588             if (!isMultiselect) {
62589               memberships.push(membership);
62590               membership = {
62591                 relation,
62592                 members: [],
62593                 hash: osmEntity.key(relation)
62594               };
62595             }
62596           }
62597         }
62598         if (membership.members.length)
62599           memberships.push(membership);
62600       }
62601       memberships.forEach(function(membership2) {
62602         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
62603         var roles = [];
62604         membership2.members.forEach(function(member2) {
62605           if (roles.indexOf(member2.role) === -1)
62606             roles.push(member2.role);
62607         });
62608         membership2.role = roles.length === 1 ? roles[0] : roles;
62609       });
62610       return memberships;
62611     }
62612     function selectRelation(d3_event, d) {
62613       d3_event.preventDefault();
62614       utilHighlightEntities([d.relation.id], false, context);
62615       context.enter(modeSelect(context, [d.relation.id]));
62616     }
62617     function zoomToRelation(d3_event, d) {
62618       d3_event.preventDefault();
62619       var entity = context.entity(d.relation.id);
62620       context.map().zoomToEase(entity);
62621       utilHighlightEntities([d.relation.id], true, context);
62622     }
62623     function changeRole(d3_event, d) {
62624       if (d === 0)
62625         return;
62626       if (_inChange)
62627         return;
62628       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
62629       if (!newRole.trim() && typeof d.role !== "string")
62630         return;
62631       var membersToUpdate = d.members.filter(function(member) {
62632         return member.role !== newRole;
62633       });
62634       if (membersToUpdate.length) {
62635         _inChange = true;
62636         context.perform(
62637           function actionChangeMemberRoles(graph) {
62638             membersToUpdate.forEach(function(member) {
62639               var newMember = Object.assign({}, member, { role: newRole });
62640               delete newMember.index;
62641               graph = actionChangeMember(d.relation.id, newMember, member.index)(graph);
62642             });
62643             return graph;
62644           },
62645           _t("operations.change_role.annotation", {
62646             n: membersToUpdate.length
62647           })
62648         );
62649         context.validator().validate();
62650       }
62651       _inChange = false;
62652     }
62653     function addMembership(d, role) {
62654       this.blur();
62655       _showBlank = false;
62656       function actionAddMembers(relationId, ids, role2) {
62657         return function(graph) {
62658           for (var i2 in ids) {
62659             var member = { id: ids[i2], type: graph.entity(ids[i2]).type, role: role2 };
62660             graph = actionAddMember(relationId, member)(graph);
62661           }
62662           return graph;
62663         };
62664       }
62665       if (d.relation) {
62666         context.perform(
62667           actionAddMembers(d.relation.id, _entityIDs, role),
62668           _t("operations.add_member.annotation", {
62669             n: _entityIDs.length
62670           })
62671         );
62672         context.validator().validate();
62673       } else {
62674         var relation = osmRelation();
62675         context.perform(
62676           actionAddEntity(relation),
62677           actionAddMembers(relation.id, _entityIDs, role),
62678           _t("operations.add.annotation.relation")
62679         );
62680         context.enter(modeSelect(context, [relation.id]).newFeature(true));
62681       }
62682     }
62683     function deleteMembership(d3_event, d) {
62684       this.blur();
62685       if (d === 0)
62686         return;
62687       utilHighlightEntities([d.relation.id], false, context);
62688       var indexes = d.members.map(function(member) {
62689         return member.index;
62690       });
62691       context.perform(
62692         actionDeleteMembers(d.relation.id, indexes),
62693         _t("operations.delete_member.annotation", {
62694           n: _entityIDs.length
62695         })
62696       );
62697       context.validator().validate();
62698     }
62699     function fetchNearbyRelations(q, callback) {
62700       var newRelation = {
62701         relation: null,
62702         value: _t("inspector.new_relation"),
62703         display: _t.append("inspector.new_relation")
62704       };
62705       var entityID = _entityIDs[0];
62706       var result = [];
62707       var graph = context.graph();
62708       function baseDisplayLabel(entity) {
62709         var matched = _mainPresetIndex.match(entity, graph);
62710         var presetName = matched && matched.name() || _t("inspector.relation");
62711         var entityName = utilDisplayName(entity) || "";
62712         return presetName + " " + entityName;
62713       }
62714       var explicitRelation = q && context.hasEntity(q.toLowerCase());
62715       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
62716         result.push({
62717           relation: explicitRelation,
62718           value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
62719         });
62720       } else {
62721         context.history().intersects(context.map().extent()).forEach(function(entity) {
62722           if (entity.type !== "relation" || entity.id === entityID)
62723             return;
62724           var value = baseDisplayLabel(entity);
62725           if (q && (value + " " + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1)
62726             return;
62727           result.push({ relation: entity, value });
62728         });
62729         result.sort(function(a, b) {
62730           return osmRelation.creationOrder(a.relation, b.relation);
62731         });
62732         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v) {
62733           return v.length > 1;
62734         });
62735         dupeGroups.forEach(function(group) {
62736           group.forEach(function(obj) {
62737             obj.value += " " + obj.relation.id;
62738           });
62739         });
62740       }
62741       result.forEach(function(obj) {
62742         obj.title = obj.value;
62743       });
62744       result.unshift(newRelation);
62745       callback(result);
62746     }
62747     function renderDisclosureContent(selection2) {
62748       var memberships = getMemberships();
62749       var list = selection2.selectAll(".member-list").data([0]);
62750       list = list.enter().append("ul").attr("class", "member-list").merge(list);
62751       var items = list.selectAll("li.member-row-normal").data(memberships, function(d) {
62752         return d.hash;
62753       });
62754       items.exit().each(unbind).remove();
62755       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
62756       itemsEnter.on("mouseover", function(d3_event, d) {
62757         utilHighlightEntities([d.relation.id], true, context);
62758       }).on("mouseout", function(d3_event, d) {
62759         utilHighlightEntities([d.relation.id], false, context);
62760       });
62761       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d) {
62762         return d.domId;
62763       });
62764       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
62765       labelLink.append("span").attr("class", "member-entity-type").text(function(d) {
62766         var matched = _mainPresetIndex.match(d.relation, context.graph());
62767         return matched && matched.name() || _t.html("inspector.relation");
62768       });
62769       labelLink.append("span").attr("class", "member-entity-name").text(function(d) {
62770         return utilDisplayName(d.relation);
62771       });
62772       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
62773       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
62774       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
62775       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
62776         return d.domId;
62777       }).property("type", "text").property("value", function(d) {
62778         return typeof d.role === "string" ? d.role : "";
62779       }).attr("title", function(d) {
62780         return Array.isArray(d.role) ? d.role.filter(Boolean).join("\n") : d.role;
62781       }).attr("placeholder", function(d) {
62782         return Array.isArray(d.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
62783       }).classed("mixed", function(d) {
62784         return Array.isArray(d.role);
62785       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
62786       if (taginfo) {
62787         wrapEnter.each(bindTypeahead);
62788       }
62789       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
62790       newMembership.exit().remove();
62791       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
62792       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
62793       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
62794       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
62795         list.selectAll(".member-row-new").remove();
62796       });
62797       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
62798       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
62799       newMembership = newMembership.merge(newMembershipEnter);
62800       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
62801         nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
62802       );
62803       var addRow = selection2.selectAll(".add-row").data([0]);
62804       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
62805       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
62806       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
62807       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
62808       addRowEnter.append("div").attr("class", "space-value");
62809       addRowEnter.append("div").attr("class", "space-buttons");
62810       addRow = addRow.merge(addRowEnter);
62811       addRow.select(".add-relation").on("click", function() {
62812         _showBlank = true;
62813         section.reRender();
62814         list.selectAll(".member-entity-input").node().focus();
62815       });
62816       function acceptEntity(d) {
62817         if (!d) {
62818           cancelEntity();
62819           return;
62820         }
62821         if (d.relation)
62822           utilHighlightEntities([d.relation.id], false, context);
62823         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
62824         addMembership(d, role);
62825       }
62826       function cancelEntity() {
62827         var input = newMembership.selectAll(".member-entity-input");
62828         input.property("value", "");
62829         context.surface().selectAll(".highlighted").classed("highlighted", false);
62830       }
62831       function bindTypeahead(d) {
62832         var row = select_default2(this);
62833         var role = row.selectAll("input.member-role");
62834         var origValue = role.property("value");
62835         function sort(value, data) {
62836           var sameletter = [];
62837           var other = [];
62838           for (var i2 = 0; i2 < data.length; i2++) {
62839             if (data[i2].value.substring(0, value.length) === value) {
62840               sameletter.push(data[i2]);
62841             } else {
62842               other.push(data[i2]);
62843             }
62844           }
62845           return sameletter.concat(other);
62846         }
62847         role.call(
62848           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
62849             var rtype = d.relation.tags.type;
62850             taginfo.roles({
62851               debounce: true,
62852               rtype: rtype || "",
62853               geometry: context.graph().geometry(_entityIDs[0]),
62854               query: role2
62855             }, function(err, data) {
62856               if (!err)
62857                 callback(sort(role2, data));
62858             });
62859           }).on("cancel", function() {
62860             role.property("value", origValue);
62861           })
62862         );
62863       }
62864       function unbind() {
62865         var row = select_default2(this);
62866         row.selectAll("input.member-role").call(uiCombobox.off, context);
62867       }
62868     }
62869     section.entityIDs = function(val) {
62870       if (!arguments.length)
62871         return _entityIDs;
62872       _entityIDs = val;
62873       _showBlank = false;
62874       return section;
62875     };
62876     return section;
62877   }
62878
62879   // modules/ui/sections/selection_list.js
62880   function uiSectionSelectionList(context) {
62881     var _selectedIDs = [];
62882     var section = uiSection("selected-features", context).shouldDisplay(function() {
62883       return _selectedIDs.length > 1;
62884     }).label(function() {
62885       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
62886     }).disclosureContent(renderDisclosureContent);
62887     context.history().on("change.selectionList", function(difference) {
62888       if (difference) {
62889         section.reRender();
62890       }
62891     });
62892     section.entityIDs = function(val) {
62893       if (!arguments.length)
62894         return _selectedIDs;
62895       _selectedIDs = val;
62896       return section;
62897     };
62898     function selectEntity(d3_event, entity) {
62899       context.enter(modeSelect(context, [entity.id]));
62900     }
62901     function deselectEntity(d3_event, entity) {
62902       var selectedIDs = _selectedIDs.slice();
62903       var index = selectedIDs.indexOf(entity.id);
62904       if (index > -1) {
62905         selectedIDs.splice(index, 1);
62906         context.enter(modeSelect(context, selectedIDs));
62907       }
62908     }
62909     function renderDisclosureContent(selection2) {
62910       var list = selection2.selectAll(".feature-list").data([0]);
62911       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
62912       var entities = _selectedIDs.map(function(id2) {
62913         return context.hasEntity(id2);
62914       }).filter(Boolean);
62915       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
62916       items.exit().remove();
62917       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d) {
62918         select_default2(this).on("mouseover", function() {
62919           utilHighlightEntities([d.id], true, context);
62920         }).on("mouseout", function() {
62921           utilHighlightEntities([d.id], false, context);
62922         });
62923       });
62924       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
62925       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
62926       label.append("span").attr("class", "entity-type");
62927       label.append("span").attr("class", "entity-name");
62928       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
62929       items = items.merge(enter);
62930       items.selectAll(".entity-geom-icon use").attr("href", function() {
62931         var entity = this.parentNode.parentNode.__data__;
62932         return "#iD-icon-" + entity.geometry(context.graph());
62933       });
62934       items.selectAll(".entity-type").text(function(entity) {
62935         return _mainPresetIndex.match(entity, context.graph()).name();
62936       });
62937       items.selectAll(".entity-name").text(function(d) {
62938         var entity = context.entity(d.id);
62939         return utilDisplayName(entity);
62940       });
62941     }
62942     return section;
62943   }
62944
62945   // modules/ui/entity_editor.js
62946   function uiEntityEditor(context) {
62947     var dispatch10 = dispatch_default("choose");
62948     var _state = "select";
62949     var _coalesceChanges = false;
62950     var _modified = false;
62951     var _base;
62952     var _entityIDs;
62953     var _activePresets = [];
62954     var _newFeature;
62955     var _sections;
62956     function entityEditor(selection2) {
62957       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
62958       var header = selection2.selectAll(".header").data([0]);
62959       var headerEnter = header.enter().append("div").attr("class", "header fillL");
62960       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
62961       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t(`icons.${direction}`)).call(svgIcon(`#iD-icon-${direction}`));
62962       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
62963         context.enter(modeBrowse(context));
62964       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
62965       headerEnter.append("h2");
62966       header = header.merge(headerEnter);
62967       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
62968       header.selectAll(".preset-reset").on("click", function() {
62969         dispatch10.call("choose", this, _activePresets);
62970       });
62971       var body = selection2.selectAll(".inspector-body").data([0]);
62972       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
62973       body = body.merge(bodyEnter);
62974       if (!_sections) {
62975         _sections = [
62976           uiSectionSelectionList(context),
62977           uiSectionFeatureType(context).on("choose", function(presets) {
62978             dispatch10.call("choose", this, presets);
62979           }),
62980           uiSectionEntityIssues(context),
62981           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
62982           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
62983           uiSectionRawMemberEditor(context),
62984           uiSectionRawMembershipEditor(context)
62985         ];
62986       }
62987       _sections.forEach(function(section) {
62988         if (section.entityIDs) {
62989           section.entityIDs(_entityIDs);
62990         }
62991         if (section.presets) {
62992           section.presets(_activePresets);
62993         }
62994         if (section.tags) {
62995           section.tags(combinedTags);
62996         }
62997         if (section.state) {
62998           section.state(_state);
62999         }
63000         body.call(section.render);
63001       });
63002       context.history().on("change.entity-editor", historyChanged);
63003       function historyChanged(difference) {
63004         if (selection2.selectAll(".entity-editor").empty())
63005           return;
63006         if (_state === "hide")
63007           return;
63008         var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
63009         if (!significant)
63010           return;
63011         _entityIDs = _entityIDs.filter(context.hasEntity);
63012         if (!_entityIDs.length)
63013           return;
63014         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
63015         loadActivePresets();
63016         var graph = context.graph();
63017         entityEditor.modified(_base !== graph);
63018         entityEditor(selection2);
63019         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
63020           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
63021         }
63022       }
63023     }
63024     function changeTags(entityIDs, changed, onInput) {
63025       var actions = [];
63026       for (var i2 in entityIDs) {
63027         var entityID = entityIDs[i2];
63028         var entity = context.entity(entityID);
63029         var tags = Object.assign({}, entity.tags);
63030         for (var k in changed) {
63031           if (!k)
63032             continue;
63033           var v = changed[k];
63034           if (typeof v === "object") {
63035             tags[k] = tags[v.oldKey];
63036           } else if (v !== void 0 || tags.hasOwnProperty(k)) {
63037             tags[k] = v;
63038           }
63039         }
63040         if (!onInput) {
63041           tags = utilCleanTags(tags);
63042         }
63043         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
63044           actions.push(actionChangeTags(entityID, tags));
63045         }
63046       }
63047       if (actions.length) {
63048         var combinedAction = function(graph) {
63049           actions.forEach(function(action) {
63050             graph = action(graph);
63051           });
63052           return graph;
63053         };
63054         var annotation = _t("operations.change_tags.annotation");
63055         if (_coalesceChanges) {
63056           context.overwrite(combinedAction, annotation);
63057         } else {
63058           context.perform(combinedAction, annotation);
63059           _coalesceChanges = !!onInput;
63060         }
63061       }
63062       if (!onInput) {
63063         context.validator().validate();
63064       }
63065     }
63066     function revertTags(keys) {
63067       var actions = [];
63068       for (var i2 in _entityIDs) {
63069         var entityID = _entityIDs[i2];
63070         var original = context.graph().base().entities[entityID];
63071         var changed = {};
63072         for (var j2 in keys) {
63073           var key = keys[j2];
63074           changed[key] = original ? original.tags[key] : void 0;
63075         }
63076         var entity = context.entity(entityID);
63077         var tags = Object.assign({}, entity.tags);
63078         for (var k in changed) {
63079           if (!k)
63080             continue;
63081           var v = changed[k];
63082           if (v !== void 0 || tags.hasOwnProperty(k)) {
63083             tags[k] = v;
63084           }
63085         }
63086         tags = utilCleanTags(tags);
63087         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
63088           actions.push(actionChangeTags(entityID, tags));
63089         }
63090       }
63091       if (actions.length) {
63092         var combinedAction = function(graph) {
63093           actions.forEach(function(action) {
63094             graph = action(graph);
63095           });
63096           return graph;
63097         };
63098         var annotation = _t("operations.change_tags.annotation");
63099         if (_coalesceChanges) {
63100           context.overwrite(combinedAction, annotation);
63101         } else {
63102           context.perform(combinedAction, annotation);
63103           _coalesceChanges = false;
63104         }
63105       }
63106       context.validator().validate();
63107     }
63108     entityEditor.modified = function(val) {
63109       if (!arguments.length)
63110         return _modified;
63111       _modified = val;
63112       return entityEditor;
63113     };
63114     entityEditor.state = function(val) {
63115       if (!arguments.length)
63116         return _state;
63117       _state = val;
63118       return entityEditor;
63119     };
63120     entityEditor.entityIDs = function(val) {
63121       if (!arguments.length)
63122         return _entityIDs;
63123       _base = context.graph();
63124       _coalesceChanges = false;
63125       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
63126         return entityEditor;
63127       _entityIDs = val;
63128       loadActivePresets(true);
63129       return entityEditor.modified(false);
63130     };
63131     entityEditor.newFeature = function(val) {
63132       if (!arguments.length)
63133         return _newFeature;
63134       _newFeature = val;
63135       return entityEditor;
63136     };
63137     function loadActivePresets(isForNewSelection) {
63138       var graph = context.graph();
63139       var counts = {};
63140       for (var i2 in _entityIDs) {
63141         var entity = graph.hasEntity(_entityIDs[i2]);
63142         if (!entity)
63143           return;
63144         var match = _mainPresetIndex.match(entity, graph);
63145         if (!counts[match.id])
63146           counts[match.id] = 0;
63147         counts[match.id] += 1;
63148       }
63149       var matches = Object.keys(counts).sort(function(p1, p2) {
63150         return counts[p2] - counts[p1];
63151       }).map(function(pID) {
63152         return _mainPresetIndex.item(pID);
63153       });
63154       if (!isForNewSelection) {
63155         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
63156         if (weakPreset && matches.length === 1 && matches[0].isFallback())
63157           return;
63158       }
63159       entityEditor.presets(matches);
63160     }
63161     entityEditor.presets = function(val) {
63162       if (!arguments.length)
63163         return _activePresets;
63164       if (!utilArrayIdentical(val, _activePresets)) {
63165         _activePresets = val;
63166       }
63167       return entityEditor;
63168     };
63169     return utilRebind(entityEditor, dispatch10, "on");
63170   }
63171
63172   // modules/ui/feature_list.js
63173   var sexagesimal = __toESM(require_sexagesimal());
63174   function uiFeatureList(context) {
63175     var _geocodeResults;
63176     function featureList(selection2) {
63177       var header = selection2.append("div").attr("class", "header fillL");
63178       header.append("h2").call(_t.append("inspector.feature_list"));
63179       var searchWrap = selection2.append("div").attr("class", "search-header");
63180       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
63181       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
63182       var listWrap = selection2.append("div").attr("class", "inspector-body");
63183       var list = listWrap.append("div").attr("class", "feature-list");
63184       context.on("exit.feature-list", clearSearch);
63185       context.map().on("drawn.feature-list", mapDrawn);
63186       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
63187       function focusSearch(d3_event) {
63188         var mode = context.mode() && context.mode().id;
63189         if (mode !== "browse")
63190           return;
63191         d3_event.preventDefault();
63192         search.node().focus();
63193       }
63194       function keydown(d3_event) {
63195         if (d3_event.keyCode === 27) {
63196           search.node().blur();
63197         }
63198       }
63199       function keypress(d3_event) {
63200         var q = search.property("value"), items = list.selectAll(".feature-list-item");
63201         if (d3_event.keyCode === 13 && q.length && items.size()) {
63202           click(d3_event, items.datum());
63203         }
63204       }
63205       function inputevent() {
63206         _geocodeResults = void 0;
63207         drawList();
63208       }
63209       function clearSearch() {
63210         search.property("value", "");
63211         drawList();
63212       }
63213       function mapDrawn(e) {
63214         if (e.full) {
63215           drawList();
63216         }
63217       }
63218       function features2() {
63219         var result = [];
63220         var graph = context.graph();
63221         var visibleCenter = context.map().extent().center();
63222         var q = search.property("value").toLowerCase();
63223         if (!q)
63224           return result;
63225         var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
63226         if (locationMatch) {
63227           var loc = [parseFloat(locationMatch[0]), parseFloat(locationMatch[1])];
63228           result.push({
63229             id: -1,
63230             geometry: "point",
63231             type: _t("inspector.location"),
63232             name: dmsCoordinatePair([loc[1], loc[0]]),
63233             location: loc
63234           });
63235         }
63236         var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i);
63237         if (idMatch) {
63238           var elemType = idMatch[1].charAt(0);
63239           var elemId = idMatch[2];
63240           result.push({
63241             id: elemType + elemId,
63242             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
63243             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
63244             name: elemId
63245           });
63246         }
63247         var allEntities = graph.entities;
63248         var localResults = [];
63249         for (var id2 in allEntities) {
63250           var entity = allEntities[id2];
63251           if (!entity)
63252             continue;
63253           var name = utilDisplayName(entity) || "";
63254           if (name.toLowerCase().indexOf(q) < 0)
63255             continue;
63256           var matched = _mainPresetIndex.match(entity, graph);
63257           var type3 = matched && matched.name() || utilDisplayType(entity.id);
63258           var extent = entity.extent(graph);
63259           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
63260           localResults.push({
63261             id: entity.id,
63262             entity,
63263             geometry: entity.geometry(graph),
63264             type: type3,
63265             name,
63266             distance
63267           });
63268           if (localResults.length > 100)
63269             break;
63270         }
63271         localResults = localResults.sort(function byDistance(a, b) {
63272           return a.distance - b.distance;
63273         });
63274         result = result.concat(localResults);
63275         (_geocodeResults || []).forEach(function(d) {
63276           if (d.osm_type && d.osm_id) {
63277             var id3 = osmEntity.id.fromOSM(d.osm_type, d.osm_id);
63278             var tags = {};
63279             tags[d.class] = d.type;
63280             var attrs = { id: id3, type: d.osm_type, tags };
63281             if (d.osm_type === "way") {
63282               attrs.nodes = ["a", "a"];
63283             }
63284             var tempEntity = osmEntity(attrs);
63285             var tempGraph = coreGraph([tempEntity]);
63286             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
63287             var type4 = matched2 && matched2.name() || utilDisplayType(id3);
63288             result.push({
63289               id: tempEntity.id,
63290               geometry: tempEntity.geometry(tempGraph),
63291               type: type4,
63292               name: d.display_name,
63293               extent: new geoExtent(
63294                 [parseFloat(d.boundingbox[3]), parseFloat(d.boundingbox[0])],
63295                 [parseFloat(d.boundingbox[2]), parseFloat(d.boundingbox[1])]
63296               )
63297             });
63298           }
63299         });
63300         if (q.match(/^[0-9]+$/)) {
63301           result.push({
63302             id: "n" + q,
63303             geometry: "point",
63304             type: _t("inspector.node"),
63305             name: q
63306           });
63307           result.push({
63308             id: "w" + q,
63309             geometry: "line",
63310             type: _t("inspector.way"),
63311             name: q
63312           });
63313           result.push({
63314             id: "r" + q,
63315             geometry: "relation",
63316             type: _t("inspector.relation"),
63317             name: q
63318           });
63319         }
63320         return result;
63321       }
63322       function drawList() {
63323         var value = search.property("value");
63324         var results = features2();
63325         list.classed("filtered", value.length);
63326         var resultsIndicator = list.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
63327         resultsIndicator.append("span").attr("class", "entity-name");
63328         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
63329         if (services.geocoder) {
63330           list.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"));
63331         }
63332         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
63333         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
63334         list.selectAll(".feature-list-item").data([-1]).remove();
63335         var items = list.selectAll(".feature-list-item").data(results, function(d) {
63336           return d.id;
63337         });
63338         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
63339         var label = enter.append("div").attr("class", "label");
63340         label.each(function(d) {
63341           select_default2(this).call(svgIcon("#iD-icon-" + d.geometry, "pre-text"));
63342         });
63343         label.append("span").attr("class", "entity-type").text(function(d) {
63344           return d.type;
63345         });
63346         label.append("span").attr("class", "entity-name").text(function(d) {
63347           return d.name;
63348         });
63349         enter.style("opacity", 0).transition().style("opacity", 1);
63350         items.order();
63351         items.exit().remove();
63352       }
63353       function mouseover(d3_event, d) {
63354         if (d.id === -1)
63355           return;
63356         utilHighlightEntities([d.id], true, context);
63357       }
63358       function mouseout(d3_event, d) {
63359         if (d.id === -1)
63360           return;
63361         utilHighlightEntities([d.id], false, context);
63362       }
63363       function click(d3_event, d) {
63364         d3_event.preventDefault();
63365         if (d.location) {
63366           context.map().centerZoomEase([d.location[1], d.location[0]], 19);
63367         } else if (d.entity) {
63368           utilHighlightEntities([d.id], false, context);
63369           context.enter(modeSelect(context, [d.entity.id]));
63370           context.map().zoomToEase(d.entity);
63371         } else {
63372           context.zoomToEntity(d.id);
63373         }
63374       }
63375       function geocoderSearch() {
63376         services.geocoder.search(search.property("value"), function(err, resp) {
63377           _geocodeResults = resp || [];
63378           drawList();
63379         });
63380       }
63381     }
63382     return featureList;
63383   }
63384
63385   // modules/ui/improveOSM_comments.js
63386   function uiImproveOsmComments() {
63387     let _qaItem;
63388     function issueComments(selection2) {
63389       let comments = selection2.selectAll(".comments-container").data([0]);
63390       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
63391       services.improveOSM.getComments(_qaItem).then((d) => {
63392         if (!d.comments)
63393           return;
63394         const commentEnter = comments.selectAll(".comment").data(d.comments).enter().append("div").attr("class", "comment");
63395         commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
63396         const mainEnter = commentEnter.append("div").attr("class", "comment-main");
63397         const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
63398         metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
63399           const osm = services.osm;
63400           let selection3 = select_default2(this);
63401           if (osm && d2.username) {
63402             selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.username)).attr("target", "_blank");
63403           }
63404           selection3.text((d4) => d4.username);
63405         });
63406         metadataEnter.append("div").attr("class", "comment-date").html((d2) => _t.html("note.status.commented", { when: localeDateString2(d2.timestamp) }));
63407         mainEnter.append("div").attr("class", "comment-text").append("p").text((d2) => d2.text);
63408       }).catch((err) => {
63409         console.log(err);
63410       });
63411     }
63412     function localeDateString2(s) {
63413       if (!s)
63414         return null;
63415       const options2 = { day: "numeric", month: "short", year: "numeric" };
63416       const d = new Date(s * 1e3);
63417       if (isNaN(d.getTime()))
63418         return null;
63419       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
63420     }
63421     issueComments.issue = function(val) {
63422       if (!arguments.length)
63423         return _qaItem;
63424       _qaItem = val;
63425       return issueComments;
63426     };
63427     return issueComments;
63428   }
63429
63430   // modules/ui/improveOSM_details.js
63431   function uiImproveOsmDetails(context) {
63432     let _qaItem;
63433     function issueDetail(d) {
63434       if (d.desc)
63435         return d.desc;
63436       const issueKey = d.issueKey;
63437       d.replacements = d.replacements || {};
63438       d.replacements.default = { html: _t.html("inspector.unknown") };
63439       return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements);
63440     }
63441     function improveOsmDetails(selection2) {
63442       const details = selection2.selectAll(".error-details").data(
63443         _qaItem ? [_qaItem] : [],
63444         (d) => `${d.id}-${d.status || 0}`
63445       );
63446       details.exit().remove();
63447       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
63448       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
63449       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
63450       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
63451       let relatedEntities = [];
63452       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
63453         const link2 = select_default2(this);
63454         const isObjectLink = link2.classed("error_object_link");
63455         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
63456         const entity = context.hasEntity(entityID);
63457         relatedEntities.push(entityID);
63458         link2.on("mouseenter", () => {
63459           utilHighlightEntities([entityID], true, context);
63460         }).on("mouseleave", () => {
63461           utilHighlightEntities([entityID], false, context);
63462         }).on("click", (d3_event) => {
63463           d3_event.preventDefault();
63464           utilHighlightEntities([entityID], false, context);
63465           const osmlayer = context.layers().layer("osm");
63466           if (!osmlayer.enabled()) {
63467             osmlayer.enabled(true);
63468           }
63469           context.map().centerZoom(_qaItem.loc, 20);
63470           if (entity) {
63471             context.enter(modeSelect(context, [entityID]));
63472           } else {
63473             context.loadEntity(entityID, (err, result) => {
63474               if (err)
63475                 return;
63476               const entity2 = result.data.find((e) => e.id === entityID);
63477               if (entity2)
63478                 context.enter(modeSelect(context, [entityID]));
63479             });
63480           }
63481         });
63482         if (entity) {
63483           let name = utilDisplayName(entity);
63484           if (!name && !isObjectLink) {
63485             const preset = _mainPresetIndex.match(entity, context.graph());
63486             name = preset && !preset.isFallback() && preset.name();
63487           }
63488           if (name) {
63489             this.innerText = name;
63490           }
63491         }
63492       });
63493       context.features().forceVisible(relatedEntities);
63494       context.map().pan([0, 0]);
63495     }
63496     improveOsmDetails.issue = function(val) {
63497       if (!arguments.length)
63498         return _qaItem;
63499       _qaItem = val;
63500       return improveOsmDetails;
63501     };
63502     return improveOsmDetails;
63503   }
63504
63505   // modules/ui/improveOSM_header.js
63506   function uiImproveOsmHeader() {
63507     let _qaItem;
63508     function issueTitle(d) {
63509       const issueKey = d.issueKey;
63510       d.replacements = d.replacements || {};
63511       d.replacements.default = { html: _t.html("inspector.unknown") };
63512       return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements);
63513     }
63514     function improveOsmHeader(selection2) {
63515       const header = selection2.selectAll(".qa-header").data(
63516         _qaItem ? [_qaItem] : [],
63517         (d) => `${d.id}-${d.status || 0}`
63518       );
63519       header.exit().remove();
63520       const headerEnter = header.enter().append("div").attr("class", "qa-header");
63521       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
63522       svgEnter.append("polygon").attr("fill", "currentColor").attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
63523       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
63524       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
63525     }
63526     improveOsmHeader.issue = function(val) {
63527       if (!arguments.length)
63528         return _qaItem;
63529       _qaItem = val;
63530       return improveOsmHeader;
63531     };
63532     return improveOsmHeader;
63533   }
63534
63535   // modules/ui/improveOSM_editor.js
63536   function uiImproveOsmEditor(context) {
63537     const dispatch10 = dispatch_default("change");
63538     const qaDetails = uiImproveOsmDetails(context);
63539     const qaComments = uiImproveOsmComments(context);
63540     const qaHeader = uiImproveOsmHeader(context);
63541     let _qaItem;
63542     function improveOsmEditor(selection2) {
63543       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
63544       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
63545       headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
63546       let body = selection2.selectAll(".body").data([0]);
63547       body = body.enter().append("div").attr("class", "body").merge(body);
63548       const editor = body.selectAll(".qa-editor").data([0]);
63549       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(qaComments.issue(_qaItem)).call(improveOsmSaveSection);
63550     }
63551     function improveOsmSaveSection(selection2) {
63552       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
63553       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
63554       let saveSection = selection2.selectAll(".qa-save").data(
63555         isShown ? [_qaItem] : [],
63556         (d) => `${d.id}-${d.status || 0}`
63557       );
63558       saveSection.exit().remove();
63559       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
63560       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
63561       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d) => d.newComment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
63562       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
63563       function changeInput() {
63564         const input = select_default2(this);
63565         let val = input.property("value").trim();
63566         if (val === "") {
63567           val = void 0;
63568         }
63569         _qaItem = _qaItem.update({ newComment: val });
63570         const qaService = services.improveOSM;
63571         if (qaService) {
63572           qaService.replaceItem(_qaItem);
63573         }
63574         saveSection.call(qaSaveButtons);
63575       }
63576     }
63577     function qaSaveButtons(selection2) {
63578       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
63579       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
63580       buttonSection.exit().remove();
63581       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
63582       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
63583       buttonEnter.append("button").attr("class", "button close-button action");
63584       buttonEnter.append("button").attr("class", "button ignore-button action");
63585       buttonSection = buttonSection.merge(buttonEnter);
63586       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
63587         this.blur();
63588         const qaService = services.improveOSM;
63589         if (qaService) {
63590           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63591         }
63592       });
63593       buttonSection.select(".close-button").html((d) => {
63594         const andComment = d.newComment ? "_comment" : "";
63595         return _t.html(`QA.keepRight.close${andComment}`);
63596       }).on("click.close", function(d3_event, d) {
63597         this.blur();
63598         const qaService = services.improveOSM;
63599         if (qaService) {
63600           d.newStatus = "SOLVED";
63601           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63602         }
63603       });
63604       buttonSection.select(".ignore-button").html((d) => {
63605         const andComment = d.newComment ? "_comment" : "";
63606         return _t.html(`QA.keepRight.ignore${andComment}`);
63607       }).on("click.ignore", function(d3_event, d) {
63608         this.blur();
63609         const qaService = services.improveOSM;
63610         if (qaService) {
63611           d.newStatus = "INVALID";
63612           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
63613         }
63614       });
63615     }
63616     improveOsmEditor.error = function(val) {
63617       if (!arguments.length)
63618         return _qaItem;
63619       _qaItem = val;
63620       return improveOsmEditor;
63621     };
63622     return utilRebind(improveOsmEditor, dispatch10, "on");
63623   }
63624
63625   // modules/ui/preset_list.js
63626   function uiPresetList(context) {
63627     var dispatch10 = dispatch_default("cancel", "choose");
63628     var _entityIDs;
63629     var _currLoc;
63630     var _currentPresets;
63631     var _autofocus = false;
63632     function presetList(selection2) {
63633       if (!_entityIDs)
63634         return;
63635       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
63636       selection2.html("");
63637       var messagewrap = selection2.append("div").attr("class", "header fillL");
63638       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
63639       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
63640       messagewrap.append("button").attr("class", "preset-choose").attr("title", direction).on("click", function() {
63641         dispatch10.call("cancel", this);
63642       }).call(svgIcon(`#iD-icon-${direction}`));
63643       function initialKeydown(d3_event) {
63644         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
63645           d3_event.preventDefault();
63646           d3_event.stopPropagation();
63647           operationDelete(context, _entityIDs)();
63648         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
63649           d3_event.preventDefault();
63650           d3_event.stopPropagation();
63651           context.undo();
63652         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
63653           select_default2(this).on("keydown", keydown);
63654           keydown.call(this, d3_event);
63655         }
63656       }
63657       function keydown(d3_event) {
63658         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && search.node().selectionStart === search.property("value").length) {
63659           d3_event.preventDefault();
63660           d3_event.stopPropagation();
63661           var buttons = list.selectAll(".preset-list-button");
63662           if (!buttons.empty())
63663             buttons.nodes()[0].focus();
63664         }
63665       }
63666       function keypress(d3_event) {
63667         var value = search.property("value");
63668         if (d3_event.keyCode === 13 && value.length) {
63669           list.selectAll(".preset-list-item:first-child").each(function(d) {
63670             d.choose.call(this);
63671           });
63672         }
63673       }
63674       function inputevent() {
63675         var value = search.property("value");
63676         list.classed("filtered", value.length);
63677         var results, messageText;
63678         if (value.length) {
63679           results = presets.search(value, entityGeometries()[0], _currLoc);
63680           messageText = _t.html("inspector.results", {
63681             n: results.collection.length,
63682             search: value
63683           });
63684         } else {
63685           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
63686           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
63687           messageText = _t.html("inspector.choose");
63688         }
63689         list.call(drawList, results);
63690         message.html(messageText);
63691       }
63692       var searchWrap = selection2.append("div").attr("class", "search-header");
63693       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
63694       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));
63695       if (_autofocus) {
63696         search.node().focus();
63697         setTimeout(function() {
63698           search.node().focus();
63699         }, 0);
63700       }
63701       var listWrap = selection2.append("div").attr("class", "inspector-body");
63702       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
63703       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
63704       context.features().on("change.preset-list", updateForFeatureHiddenState);
63705     }
63706     function drawList(list, presets) {
63707       presets = presets.matchAllGeometry(entityGeometries());
63708       var collection = presets.collection.reduce(function(collection2, preset) {
63709         if (!preset)
63710           return collection2;
63711         if (preset.members) {
63712           if (preset.members.collection.filter(function(preset2) {
63713             return preset2.addable();
63714           }).length > 1) {
63715             collection2.push(CategoryItem(preset));
63716           }
63717         } else if (preset.addable()) {
63718           collection2.push(PresetItem(preset));
63719         }
63720         return collection2;
63721       }, []);
63722       var items = list.selectAll(".preset-list-item").data(collection, function(d) {
63723         return d.preset.id;
63724       });
63725       items.order();
63726       items.exit().remove();
63727       items.enter().append("div").attr("class", function(item) {
63728         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
63729       }).classed("current", function(item) {
63730         return _currentPresets.indexOf(item.preset) !== -1;
63731       }).each(function(item) {
63732         select_default2(this).call(item);
63733       }).style("opacity", 0).transition().style("opacity", 1);
63734       updateForFeatureHiddenState();
63735     }
63736     function itemKeydown(d3_event) {
63737       var item = select_default2(this.closest(".preset-list-item"));
63738       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
63739       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
63740         d3_event.preventDefault();
63741         d3_event.stopPropagation();
63742         var nextItem = select_default2(item.node().nextElementSibling);
63743         if (nextItem.empty()) {
63744           if (!parentItem.empty()) {
63745             nextItem = select_default2(parentItem.node().nextElementSibling);
63746           }
63747         } else if (select_default2(this).classed("expanded")) {
63748           nextItem = item.select(".subgrid .preset-list-item:first-child");
63749         }
63750         if (!nextItem.empty()) {
63751           nextItem.select(".preset-list-button").node().focus();
63752         }
63753       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
63754         d3_event.preventDefault();
63755         d3_event.stopPropagation();
63756         var previousItem = select_default2(item.node().previousElementSibling);
63757         if (previousItem.empty()) {
63758           if (!parentItem.empty()) {
63759             previousItem = parentItem;
63760           }
63761         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
63762           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
63763         }
63764         if (!previousItem.empty()) {
63765           previousItem.select(".preset-list-button").node().focus();
63766         } else {
63767           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
63768           search.node().focus();
63769         }
63770       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
63771         d3_event.preventDefault();
63772         d3_event.stopPropagation();
63773         if (!parentItem.empty()) {
63774           parentItem.select(".preset-list-button").node().focus();
63775         }
63776       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
63777         d3_event.preventDefault();
63778         d3_event.stopPropagation();
63779         item.datum().choose.call(select_default2(this).node());
63780       }
63781     }
63782     function CategoryItem(preset) {
63783       var box, sublist, shown = false;
63784       function item(selection2) {
63785         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
63786         function click() {
63787           var isExpanded = select_default2(this).classed("expanded");
63788           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
63789           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
63790           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
63791           item.choose();
63792         }
63793         var geometries = entityGeometries();
63794         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) {
63795           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
63796             d3_event.preventDefault();
63797             d3_event.stopPropagation();
63798             if (!select_default2(this).classed("expanded")) {
63799               click.call(this, d3_event);
63800             }
63801           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
63802             d3_event.preventDefault();
63803             d3_event.stopPropagation();
63804             if (select_default2(this).classed("expanded")) {
63805               click.call(this, d3_event);
63806             }
63807           } else {
63808             itemKeydown.call(this, d3_event);
63809           }
63810         });
63811         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
63812         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");
63813         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
63814         box.append("div").attr("class", "arrow");
63815         sublist = box.append("div").attr("class", "preset-list fillL3");
63816       }
63817       item.choose = function() {
63818         if (!box || !sublist)
63819           return;
63820         if (shown) {
63821           shown = false;
63822           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
63823         } else {
63824           shown = true;
63825           var members = preset.members.matchAllGeometry(entityGeometries());
63826           sublist.call(drawList, members);
63827           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
63828         }
63829       };
63830       item.preset = preset;
63831       return item;
63832     }
63833     function PresetItem(preset) {
63834       function item(selection2) {
63835         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
63836         var geometries = entityGeometries();
63837         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);
63838         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
63839         var nameparts = [
63840           preset.nameLabel(),
63841           preset.subtitleLabel()
63842         ].filter(Boolean);
63843         label.selectAll(".namepart").data(nameparts, (d) => d.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d) {
63844           d(select_default2(this));
63845         });
63846         wrap2.call(item.reference.button);
63847         selection2.call(item.reference.body);
63848       }
63849       item.choose = function() {
63850         if (select_default2(this).classed("disabled"))
63851           return;
63852         if (!context.inIntro()) {
63853           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
63854         }
63855         context.perform(
63856           function(graph) {
63857             for (var i2 in _entityIDs) {
63858               var entityID = _entityIDs[i2];
63859               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
63860               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
63861             }
63862             return graph;
63863           },
63864           _t("operations.change_tags.annotation")
63865         );
63866         context.validator().validate();
63867         dispatch10.call("choose", this, preset);
63868       };
63869       item.help = function(d3_event) {
63870         d3_event.stopPropagation();
63871         item.reference.toggle();
63872       };
63873       item.preset = preset;
63874       item.reference = uiTagReference(preset.reference(), context);
63875       return item;
63876     }
63877     function updateForFeatureHiddenState() {
63878       if (!_entityIDs.every(context.hasEntity))
63879         return;
63880       var geometries = entityGeometries();
63881       var button = context.container().selectAll(".preset-list .preset-list-button");
63882       button.call(uiTooltip().destroyAny);
63883       button.each(function(item, index) {
63884         var hiddenPresetFeaturesId;
63885         for (var i2 in geometries) {
63886           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i2]);
63887           if (hiddenPresetFeaturesId)
63888             break;
63889         }
63890         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
63891         select_default2(this).classed("disabled", isHiddenPreset);
63892         if (isHiddenPreset) {
63893           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
63894           select_default2(this).call(
63895             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
63896               features: _t("feature." + hiddenPresetFeaturesId + ".description")
63897             })).placement(index < 2 ? "bottom" : "top")
63898           );
63899         }
63900       });
63901     }
63902     presetList.autofocus = function(val) {
63903       if (!arguments.length)
63904         return _autofocus;
63905       _autofocus = val;
63906       return presetList;
63907     };
63908     presetList.entityIDs = function(val) {
63909       if (!arguments.length)
63910         return _entityIDs;
63911       _entityIDs = val;
63912       _currLoc = null;
63913       if (_entityIDs && _entityIDs.length) {
63914         const extent = _entityIDs.reduce(function(extent2, entityID) {
63915           var entity = context.graph().entity(entityID);
63916           return extent2.extend(entity.extent(context.graph()));
63917         }, geoExtent());
63918         _currLoc = extent.center();
63919         var presets = _entityIDs.map(function(entityID) {
63920           return _mainPresetIndex.match(context.entity(entityID), context.graph());
63921         });
63922         presetList.presets(presets);
63923       }
63924       return presetList;
63925     };
63926     presetList.presets = function(val) {
63927       if (!arguments.length)
63928         return _currentPresets;
63929       _currentPresets = val;
63930       return presetList;
63931     };
63932     function entityGeometries() {
63933       var counts = {};
63934       for (var i2 in _entityIDs) {
63935         var entityID = _entityIDs[i2];
63936         var entity = context.entity(entityID);
63937         var geometry = entity.geometry(context.graph());
63938         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
63939           geometry = "point";
63940         }
63941         if (!counts[geometry])
63942           counts[geometry] = 0;
63943         counts[geometry] += 1;
63944       }
63945       return Object.keys(counts).sort(function(geom1, geom2) {
63946         return counts[geom2] - counts[geom1];
63947       });
63948     }
63949     return utilRebind(presetList, dispatch10, "on");
63950   }
63951
63952   // modules/ui/view_on_osm.js
63953   function uiViewOnOSM(context) {
63954     var _what;
63955     function viewOnOSM(selection2) {
63956       var url;
63957       if (_what instanceof osmEntity) {
63958         url = context.connection().entityURL(_what);
63959       } else if (_what instanceof osmNote) {
63960         url = context.connection().noteURL(_what);
63961       }
63962       var data = !_what || _what.isNew() ? [] : [_what];
63963       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d) {
63964         return d.id;
63965       });
63966       link2.exit().remove();
63967       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
63968       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
63969     }
63970     viewOnOSM.what = function(_) {
63971       if (!arguments.length)
63972         return _what;
63973       _what = _;
63974       return viewOnOSM;
63975     };
63976     return viewOnOSM;
63977   }
63978
63979   // modules/ui/inspector.js
63980   function uiInspector(context) {
63981     var presetList = uiPresetList(context);
63982     var entityEditor = uiEntityEditor(context);
63983     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
63984     var _state = "select";
63985     var _entityIDs;
63986     var _newFeature = false;
63987     function inspector(selection2) {
63988       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
63989         inspector.setPreset();
63990       });
63991       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
63992       wrap2 = selection2.selectAll(".panewrap").data([0]);
63993       var enter = wrap2.enter().append("div").attr("class", "panewrap");
63994       enter.append("div").attr("class", "preset-list-pane pane");
63995       enter.append("div").attr("class", "entity-editor-pane pane");
63996       wrap2 = wrap2.merge(enter);
63997       presetPane = wrap2.selectAll(".preset-list-pane");
63998       editorPane = wrap2.selectAll(".entity-editor-pane");
63999       function shouldDefaultToPresetList() {
64000         if (_state !== "select")
64001           return false;
64002         if (_entityIDs.length !== 1)
64003           return false;
64004         var entityID = _entityIDs[0];
64005         var entity = context.hasEntity(entityID);
64006         if (!entity)
64007           return false;
64008         if (entity.hasNonGeometryTags())
64009           return false;
64010         if (_newFeature)
64011           return true;
64012         if (entity.geometry(context.graph()) !== "vertex")
64013           return false;
64014         if (context.graph().parentRelations(entity).length)
64015           return false;
64016         if (context.validator().getEntityIssues(entityID).length)
64017           return false;
64018         if (entity.isHighwayIntersection(context.graph()))
64019           return false;
64020         return true;
64021       }
64022       if (shouldDefaultToPresetList()) {
64023         wrap2.style("right", "-100%");
64024         editorPane.classed("hide", true);
64025         presetPane.classed("hide", false).call(presetList);
64026       } else {
64027         wrap2.style("right", "0%");
64028         presetPane.classed("hide", true);
64029         editorPane.classed("hide", false).call(entityEditor);
64030       }
64031       var footer = selection2.selectAll(".footer").data([0]);
64032       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
64033       footer.call(
64034         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
64035       );
64036     }
64037     inspector.showList = function(presets) {
64038       presetPane.classed("hide", false);
64039       wrap2.transition().styleTween("right", function() {
64040         return value_default("0%", "-100%");
64041       }).on("end", function() {
64042         editorPane.classed("hide", true);
64043       });
64044       if (presets) {
64045         presetList.presets(presets);
64046       }
64047       presetPane.call(presetList.autofocus(true));
64048     };
64049     inspector.setPreset = function(preset) {
64050       if (preset && preset.id === "type/multipolygon") {
64051         presetPane.call(presetList.autofocus(true));
64052       } else {
64053         editorPane.classed("hide", false);
64054         wrap2.transition().styleTween("right", function() {
64055           return value_default("-100%", "0%");
64056         }).on("end", function() {
64057           presetPane.classed("hide", true);
64058         });
64059         if (preset) {
64060           entityEditor.presets([preset]);
64061         }
64062         editorPane.call(entityEditor);
64063       }
64064     };
64065     inspector.state = function(val) {
64066       if (!arguments.length)
64067         return _state;
64068       _state = val;
64069       entityEditor.state(_state);
64070       context.container().selectAll(".field-help-body").remove();
64071       return inspector;
64072     };
64073     inspector.entityIDs = function(val) {
64074       if (!arguments.length)
64075         return _entityIDs;
64076       _entityIDs = val;
64077       return inspector;
64078     };
64079     inspector.newFeature = function(val) {
64080       if (!arguments.length)
64081         return _newFeature;
64082       _newFeature = val;
64083       return inspector;
64084     };
64085     return inspector;
64086   }
64087
64088   // modules/ui/keepRight_details.js
64089   function uiKeepRightDetails(context) {
64090     let _qaItem;
64091     function issueDetail(d) {
64092       const { itemType, parentIssueType } = d;
64093       const unknown = { html: _t.html("inspector.unknown") };
64094       let replacements = d.replacements || {};
64095       replacements.default = unknown;
64096       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
64097         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
64098       } else {
64099         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
64100       }
64101     }
64102     function keepRightDetails(selection2) {
64103       const details = selection2.selectAll(".error-details").data(
64104         _qaItem ? [_qaItem] : [],
64105         (d) => `${d.id}-${d.status || 0}`
64106       );
64107       details.exit().remove();
64108       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
64109       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
64110       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
64111       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
64112       let relatedEntities = [];
64113       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
64114         const link2 = select_default2(this);
64115         const isObjectLink = link2.classed("error_object_link");
64116         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
64117         const entity = context.hasEntity(entityID);
64118         relatedEntities.push(entityID);
64119         link2.on("mouseenter", () => {
64120           utilHighlightEntities([entityID], true, context);
64121         }).on("mouseleave", () => {
64122           utilHighlightEntities([entityID], false, context);
64123         }).on("click", (d3_event) => {
64124           d3_event.preventDefault();
64125           utilHighlightEntities([entityID], false, context);
64126           const osmlayer = context.layers().layer("osm");
64127           if (!osmlayer.enabled()) {
64128             osmlayer.enabled(true);
64129           }
64130           context.map().centerZoomEase(_qaItem.loc, 20);
64131           if (entity) {
64132             context.enter(modeSelect(context, [entityID]));
64133           } else {
64134             context.loadEntity(entityID, (err, result) => {
64135               if (err)
64136                 return;
64137               const entity2 = result.data.find((e) => e.id === entityID);
64138               if (entity2)
64139                 context.enter(modeSelect(context, [entityID]));
64140             });
64141           }
64142         });
64143         if (entity) {
64144           let name = utilDisplayName(entity);
64145           if (!name && !isObjectLink) {
64146             const preset = _mainPresetIndex.match(entity, context.graph());
64147             name = preset && !preset.isFallback() && preset.name();
64148           }
64149           if (name) {
64150             this.innerText = name;
64151           }
64152         }
64153       });
64154       context.features().forceVisible(relatedEntities);
64155       context.map().pan([0, 0]);
64156     }
64157     keepRightDetails.issue = function(val) {
64158       if (!arguments.length)
64159         return _qaItem;
64160       _qaItem = val;
64161       return keepRightDetails;
64162     };
64163     return keepRightDetails;
64164   }
64165
64166   // modules/ui/keepRight_header.js
64167   function uiKeepRightHeader() {
64168     let _qaItem;
64169     function issueTitle(d) {
64170       const { itemType, parentIssueType } = d;
64171       const unknown = _t.html("inspector.unknown");
64172       let replacements = d.replacements || {};
64173       replacements.default = { html: unknown };
64174       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
64175         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
64176       } else {
64177         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
64178       }
64179     }
64180     function keepRightHeader(selection2) {
64181       const header = selection2.selectAll(".qa-header").data(
64182         _qaItem ? [_qaItem] : [],
64183         (d) => `${d.id}-${d.status || 0}`
64184       );
64185       header.exit().remove();
64186       const headerEnter = header.enter().append("div").attr("class", "qa-header");
64187       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0);
64188       iconEnter.append("div").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
64189       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
64190     }
64191     keepRightHeader.issue = function(val) {
64192       if (!arguments.length)
64193         return _qaItem;
64194       _qaItem = val;
64195       return keepRightHeader;
64196     };
64197     return keepRightHeader;
64198   }
64199
64200   // modules/ui/view_on_keepRight.js
64201   function uiViewOnKeepRight() {
64202     let _qaItem;
64203     function viewOnKeepRight(selection2) {
64204       let url;
64205       if (services.keepRight && _qaItem instanceof QAItem) {
64206         url = services.keepRight.issueURL(_qaItem);
64207       }
64208       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
64209       link2.exit().remove();
64210       const linkEnter = link2.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d) => d).call(svgIcon("#iD-icon-out-link", "inline"));
64211       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
64212     }
64213     viewOnKeepRight.what = function(val) {
64214       if (!arguments.length)
64215         return _qaItem;
64216       _qaItem = val;
64217       return viewOnKeepRight;
64218     };
64219     return viewOnKeepRight;
64220   }
64221
64222   // modules/ui/keepRight_editor.js
64223   function uiKeepRightEditor(context) {
64224     const dispatch10 = dispatch_default("change");
64225     const qaDetails = uiKeepRightDetails(context);
64226     const qaHeader = uiKeepRightHeader(context);
64227     let _qaItem;
64228     function keepRightEditor(selection2) {
64229       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
64230       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
64231       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
64232       let body = selection2.selectAll(".body").data([0]);
64233       body = body.enter().append("div").attr("class", "body").merge(body);
64234       const editor = body.selectAll(".qa-editor").data([0]);
64235       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
64236       const footer = selection2.selectAll(".footer").data([0]);
64237       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
64238     }
64239     function keepRightSaveSection(selection2) {
64240       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64241       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
64242       let saveSection = selection2.selectAll(".qa-save").data(
64243         isShown ? [_qaItem] : [],
64244         (d) => `${d.id}-${d.status || 0}`
64245       );
64246       saveSection.exit().remove();
64247       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
64248       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
64249       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d) => d.newComment || d.comment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
64250       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
64251       function changeInput() {
64252         const input = select_default2(this);
64253         let val = input.property("value").trim();
64254         if (val === _qaItem.comment) {
64255           val = void 0;
64256         }
64257         _qaItem = _qaItem.update({ newComment: val });
64258         const qaService = services.keepRight;
64259         if (qaService) {
64260           qaService.replaceItem(_qaItem);
64261         }
64262         saveSection.call(qaSaveButtons);
64263       }
64264     }
64265     function qaSaveButtons(selection2) {
64266       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
64267       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
64268       buttonSection.exit().remove();
64269       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
64270       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
64271       buttonEnter.append("button").attr("class", "button close-button action");
64272       buttonEnter.append("button").attr("class", "button ignore-button action");
64273       buttonSection = buttonSection.merge(buttonEnter);
64274       buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
64275         this.blur();
64276         const qaService = services.keepRight;
64277         if (qaService) {
64278           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64279         }
64280       });
64281       buttonSection.select(".close-button").html((d) => {
64282         const andComment = d.newComment ? "_comment" : "";
64283         return _t.html(`QA.keepRight.close${andComment}`);
64284       }).on("click.close", function(d3_event, d) {
64285         this.blur();
64286         const qaService = services.keepRight;
64287         if (qaService) {
64288           d.newStatus = "ignore_t";
64289           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64290         }
64291       });
64292       buttonSection.select(".ignore-button").html((d) => {
64293         const andComment = d.newComment ? "_comment" : "";
64294         return _t.html(`QA.keepRight.ignore${andComment}`);
64295       }).on("click.ignore", function(d3_event, d) {
64296         this.blur();
64297         const qaService = services.keepRight;
64298         if (qaService) {
64299           d.newStatus = "ignore";
64300           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
64301         }
64302       });
64303     }
64304     keepRightEditor.error = function(val) {
64305       if (!arguments.length)
64306         return _qaItem;
64307       _qaItem = val;
64308       return keepRightEditor;
64309     };
64310     return utilRebind(keepRightEditor, dispatch10, "on");
64311   }
64312
64313   // modules/ui/lasso.js
64314   function uiLasso(context) {
64315     var group, polygon2;
64316     lasso.coordinates = [];
64317     function lasso(selection2) {
64318       context.container().classed("lasso", true);
64319       group = selection2.append("g").attr("class", "lasso hide");
64320       polygon2 = group.append("path").attr("class", "lasso-path");
64321       group.call(uiToggle(true));
64322     }
64323     function draw() {
64324       if (polygon2) {
64325         polygon2.data([lasso.coordinates]).attr("d", function(d) {
64326           return "M" + d.join(" L") + " Z";
64327         });
64328       }
64329     }
64330     lasso.extent = function() {
64331       return lasso.coordinates.reduce(function(extent, point) {
64332         return extent.extend(geoExtent(point));
64333       }, geoExtent());
64334     };
64335     lasso.p = function(_) {
64336       if (!arguments.length)
64337         return lasso;
64338       lasso.coordinates.push(_);
64339       draw();
64340       return lasso;
64341     };
64342     lasso.close = function() {
64343       if (group) {
64344         group.call(uiToggle(false, function() {
64345           select_default2(this).remove();
64346         }));
64347       }
64348       context.container().classed("lasso", false);
64349     };
64350     return lasso;
64351   }
64352
64353   // modules/ui/note_comments.js
64354   function uiNoteComments() {
64355     var _note;
64356     function noteComments(selection2) {
64357       if (_note.isNew())
64358         return;
64359       var comments = selection2.selectAll(".comments-container").data([0]);
64360       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
64361       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
64362       commentEnter.append("div").attr("class", function(d) {
64363         return "comment-avatar user-" + d.uid;
64364       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
64365       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
64366       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
64367       metadataEnter.append("div").attr("class", "comment-author").each(function(d) {
64368         var selection3 = select_default2(this);
64369         var osm = services.osm;
64370         if (osm && d.user) {
64371           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d.user)).attr("target", "_blank");
64372         }
64373         if (d.user) {
64374           selection3.text(d.user);
64375         } else {
64376           selection3.call(_t.append("note.anonymous"));
64377         }
64378       });
64379       metadataEnter.append("div").attr("class", "comment-date").html(function(d) {
64380         return _t.html("note.status." + d.action, { when: localeDateString2(d.date) });
64381       });
64382       mainEnter.append("div").attr("class", "comment-text").html(function(d) {
64383         return d.html;
64384       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
64385       comments.call(replaceAvatars);
64386     }
64387     function replaceAvatars(selection2) {
64388       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
64389       var osm = services.osm;
64390       if (showThirdPartyIcons !== "true" || !osm)
64391         return;
64392       var uids = {};
64393       _note.comments.forEach(function(d) {
64394         if (d.uid)
64395           uids[d.uid] = true;
64396       });
64397       Object.keys(uids).forEach(function(uid) {
64398         osm.loadUser(uid, function(err, user) {
64399           if (!user || !user.image_url)
64400             return;
64401           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);
64402         });
64403       });
64404     }
64405     function localeDateString2(s) {
64406       if (!s)
64407         return null;
64408       var options2 = { day: "numeric", month: "short", year: "numeric" };
64409       s = s.replace(/-/g, "/");
64410       var d = new Date(s);
64411       if (isNaN(d.getTime()))
64412         return null;
64413       return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
64414     }
64415     noteComments.note = function(val) {
64416       if (!arguments.length)
64417         return _note;
64418       _note = val;
64419       return noteComments;
64420     };
64421     return noteComments;
64422   }
64423
64424   // modules/ui/note_header.js
64425   function uiNoteHeader() {
64426     var _note;
64427     function noteHeader(selection2) {
64428       var header = selection2.selectAll(".note-header").data(
64429         _note ? [_note] : [],
64430         function(d) {
64431           return d.status + d.id;
64432         }
64433       );
64434       header.exit().remove();
64435       var headerEnter = header.enter().append("div").attr("class", "note-header");
64436       var iconEnter = headerEnter.append("div").attr("class", function(d) {
64437         return "note-header-icon " + d.status;
64438       }).classed("new", function(d) {
64439         return d.id < 0;
64440       });
64441       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
64442       iconEnter.each(function(d) {
64443         var statusIcon;
64444         if (d.id < 0) {
64445           statusIcon = "#iD-icon-plus";
64446         } else if (d.status === "open") {
64447           statusIcon = "#iD-icon-close";
64448         } else {
64449           statusIcon = "#iD-icon-apply";
64450         }
64451         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
64452       });
64453       headerEnter.append("div").attr("class", "note-header-label").html(function(d) {
64454         if (_note.isNew()) {
64455           return _t.html("note.new");
64456         }
64457         return _t.html("note.note") + " " + d.id + " " + (d.status === "closed" ? _t.html("note.closed") : "");
64458       });
64459     }
64460     noteHeader.note = function(val) {
64461       if (!arguments.length)
64462         return _note;
64463       _note = val;
64464       return noteHeader;
64465     };
64466     return noteHeader;
64467   }
64468
64469   // modules/ui/note_report.js
64470   function uiNoteReport() {
64471     var _note;
64472     function noteReport(selection2) {
64473       var url;
64474       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
64475         url = services.osm.noteReportURL(_note);
64476       }
64477       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
64478       link2.exit().remove();
64479       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d) {
64480         return d;
64481       }).call(svgIcon("#iD-icon-out-link", "inline"));
64482       linkEnter.append("span").call(_t.append("note.report"));
64483     }
64484     noteReport.note = function(val) {
64485       if (!arguments.length)
64486         return _note;
64487       _note = val;
64488       return noteReport;
64489     };
64490     return noteReport;
64491   }
64492
64493   // modules/ui/note_editor.js
64494   function uiNoteEditor(context) {
64495     var dispatch10 = dispatch_default("change");
64496     var noteComments = uiNoteComments(context);
64497     var noteHeader = uiNoteHeader();
64498     var _note;
64499     var _newNote;
64500     function noteEditor(selection2) {
64501       var header = selection2.selectAll(".header").data([0]);
64502       var headerEnter = header.enter().append("div").attr("class", "header fillL");
64503       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
64504         context.enter(modeBrowse(context));
64505       }).call(svgIcon("#iD-icon-close"));
64506       headerEnter.append("h2").call(_t.append("note.title"));
64507       var body = selection2.selectAll(".body").data([0]);
64508       body = body.enter().append("div").attr("class", "body").merge(body);
64509       var editor = body.selectAll(".note-editor").data([0]);
64510       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
64511       var footer = selection2.selectAll(".footer").data([0]);
64512       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
64513       var osm = services.osm;
64514       if (osm) {
64515         osm.on("change.note-save", function() {
64516           selection2.call(noteEditor);
64517         });
64518       }
64519     }
64520     function noteSaveSection(selection2) {
64521       var isSelected = _note && _note.id === context.selectedNoteID();
64522       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d) {
64523         return d.status + d.id;
64524       });
64525       noteSave.exit().remove();
64526       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
64527       noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
64528         return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
64529       });
64530       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d) {
64531         return d.newComment;
64532       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
64533       if (!commentTextarea.empty() && _newNote) {
64534         commentTextarea.node().focus();
64535       }
64536       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
64537       function keydown(d3_event) {
64538         if (!(d3_event.keyCode === 13 && d3_event.metaKey))
64539           return;
64540         var osm = services.osm;
64541         if (!osm)
64542           return;
64543         var hasAuth = osm.authenticated();
64544         if (!hasAuth)
64545           return;
64546         if (!_note.newComment)
64547           return;
64548         d3_event.preventDefault();
64549         select_default2(this).on("keydown.note-input", null);
64550         window.setTimeout(function() {
64551           if (_note.isNew()) {
64552             noteSave.selectAll(".save-button").node().focus();
64553             clickSave(_note);
64554           } else {
64555             noteSave.selectAll(".comment-button").node().focus();
64556             clickComment(_note);
64557           }
64558         }, 10);
64559       }
64560       function changeInput() {
64561         var input = select_default2(this);
64562         var val = input.property("value").trim() || void 0;
64563         _note = _note.update({ newComment: val });
64564         var osm = services.osm;
64565         if (osm) {
64566           osm.replaceNote(_note);
64567         }
64568         noteSave.call(noteSaveButtons);
64569       }
64570     }
64571     function userDetails(selection2) {
64572       var detailSection = selection2.selectAll(".detail-section").data([0]);
64573       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
64574       var osm = services.osm;
64575       if (!osm)
64576         return;
64577       var hasAuth = osm.authenticated();
64578       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
64579       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
64580       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
64581       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
64582       authEnter.append("span").call(_t.append("note.login"));
64583       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) {
64584         d3_event.preventDefault();
64585         osm.authenticate();
64586       });
64587       authEnter.transition().duration(200).style("opacity", 1);
64588       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
64589       prose.exit().remove();
64590       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
64591       osm.userDetails(function(err, user) {
64592         if (err)
64593           return;
64594         var userLink = select_default2(document.createElement("div"));
64595         if (user.image_url) {
64596           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
64597         }
64598         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
64599         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
64600       });
64601     }
64602     function noteSaveButtons(selection2) {
64603       var osm = services.osm;
64604       var hasAuth = osm && osm.authenticated();
64605       var isSelected = _note && _note.id === context.selectedNoteID();
64606       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d) {
64607         return d.status + d.id;
64608       });
64609       buttonSection.exit().remove();
64610       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
64611       if (_note.isNew()) {
64612         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
64613         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
64614       } else {
64615         buttonEnter.append("button").attr("class", "button status-button action");
64616         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
64617       }
64618       buttonSection = buttonSection.merge(buttonEnter);
64619       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
64620       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
64621       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d) {
64622         var action = d.status === "open" ? "close" : "open";
64623         var andComment = d.newComment ? "_comment" : "";
64624         return _t.html("note." + action + andComment);
64625       }).on("click.status", clickStatus);
64626       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
64627       function isSaveDisabled(d) {
64628         return hasAuth && d.status === "open" && d.newComment ? null : true;
64629       }
64630     }
64631     function clickCancel(d3_event, d) {
64632       this.blur();
64633       var osm = services.osm;
64634       if (osm) {
64635         osm.removeNote(d);
64636       }
64637       context.enter(modeBrowse(context));
64638       dispatch10.call("change");
64639     }
64640     function clickSave(d3_event, d) {
64641       this.blur();
64642       var osm = services.osm;
64643       if (osm) {
64644         osm.postNoteCreate(d, function(err, note) {
64645           dispatch10.call("change", note);
64646         });
64647       }
64648     }
64649     function clickStatus(d3_event, d) {
64650       this.blur();
64651       var osm = services.osm;
64652       if (osm) {
64653         var setStatus = d.status === "open" ? "closed" : "open";
64654         osm.postNoteUpdate(d, setStatus, function(err, note) {
64655           dispatch10.call("change", note);
64656         });
64657       }
64658     }
64659     function clickComment(d3_event, d) {
64660       this.blur();
64661       var osm = services.osm;
64662       if (osm) {
64663         osm.postNoteUpdate(d, d.status, function(err, note) {
64664           dispatch10.call("change", note);
64665         });
64666       }
64667     }
64668     noteEditor.note = function(val) {
64669       if (!arguments.length)
64670         return _note;
64671       _note = val;
64672       return noteEditor;
64673     };
64674     noteEditor.newNote = function(val) {
64675       if (!arguments.length)
64676         return _newNote;
64677       _newNote = val;
64678       return noteEditor;
64679     };
64680     return utilRebind(noteEditor, dispatch10, "on");
64681   }
64682
64683   // modules/ui/source_switch.js
64684   function uiSourceSwitch(context) {
64685     var keys;
64686     function click(d3_event) {
64687       d3_event.preventDefault();
64688       var osm = context.connection();
64689       if (!osm)
64690         return;
64691       if (context.inIntro())
64692         return;
64693       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
64694         return;
64695       var isLive = select_default2(this).classed("live");
64696       isLive = !isLive;
64697       context.enter(modeBrowse(context));
64698       context.history().clearSaved();
64699       context.flush();
64700       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
64701       osm.switch(isLive ? keys[0] : keys[1]);
64702     }
64703     var sourceSwitch = function(selection2) {
64704       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
64705     };
64706     sourceSwitch.keys = function(_) {
64707       if (!arguments.length)
64708         return keys;
64709       keys = _;
64710       return sourceSwitch;
64711     };
64712     return sourceSwitch;
64713   }
64714
64715   // modules/ui/spinner.js
64716   function uiSpinner(context) {
64717     var osm = context.connection();
64718     return function(selection2) {
64719       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
64720       if (osm) {
64721         osm.on("loading.spinner", function() {
64722           img.transition().style("opacity", 1);
64723         }).on("loaded.spinner", function() {
64724           img.transition().style("opacity", 0);
64725         });
64726       }
64727     };
64728   }
64729
64730   // modules/ui/sections/privacy.js
64731   function uiSectionPrivacy(context) {
64732     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
64733     function renderDisclosureContent(selection2) {
64734       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
64735       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(
64736         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
64737       );
64738       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d) => {
64739         d3_event.preventDefault();
64740         corePreferences("preferences.privacy.thirdpartyicons", d === "true" ? "false" : "true");
64741       });
64742       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
64743       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d) => d === "true").select("input").property("checked", (d) => d === "true");
64744       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"));
64745     }
64746     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
64747     return section;
64748   }
64749
64750   // modules/ui/splash.js
64751   function uiSplash(context) {
64752     return (selection2) => {
64753       if (context.history().hasRestorableChanges())
64754         return;
64755       let updateMessage = "";
64756       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
64757       let showSplash = !corePreferences("sawSplash");
64758       if (sawPrivacyVersion !== context.privacyVersion) {
64759         updateMessage = _t("splash.privacy_update");
64760         showSplash = true;
64761       }
64762       if (!showSplash)
64763         return;
64764       corePreferences("sawSplash", true);
64765       corePreferences("sawPrivacyVersion", context.privacyVersion);
64766       _mainFileFetcher.get("intro_graph");
64767       let modalSelection = uiModal(selection2);
64768       modalSelection.select(".modal").attr("class", "modal-splash modal");
64769       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
64770       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
64771       let modalSection = introModal.append("div").attr("class", "modal-section");
64772       modalSection.append("p").html(_t.html("splash.text", {
64773         version: context.version,
64774         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
64775         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
64776       }));
64777       modalSection.append("p").html(_t.html("splash.privacy", {
64778         updateMessage,
64779         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
64780       }));
64781       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
64782       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
64783       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
64784         context.container().call(uiIntro(context));
64785         modalSelection.close();
64786       });
64787       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
64788       walkthrough.append("div").call(_t.append("splash.walkthrough"));
64789       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
64790       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
64791       startEditing.append("div").call(_t.append("splash.start"));
64792       modalSelection.select("button.close").attr("class", "hide");
64793     };
64794   }
64795
64796   // modules/ui/status.js
64797   function uiStatus(context) {
64798     var osm = context.connection();
64799     return function(selection2) {
64800       if (!osm)
64801         return;
64802       function update(err, apiStatus) {
64803         selection2.html("");
64804         if (err) {
64805           if (apiStatus === "connectionSwitched") {
64806             return;
64807           } else if (apiStatus === "rateLimited") {
64808             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) {
64809               d3_event.preventDefault();
64810               osm.authenticate();
64811             });
64812           } else {
64813             var throttledRetry = throttle_default(function() {
64814               context.loadTiles(context.projection);
64815               osm.reloadApiStatus();
64816             }, 2e3);
64817             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) {
64818               d3_event.preventDefault();
64819               throttledRetry();
64820             });
64821           }
64822         } else if (apiStatus === "readonly") {
64823           selection2.call(_t.append("osm_api_status.message.readonly"));
64824         } else if (apiStatus === "offline") {
64825           selection2.call(_t.append("osm_api_status.message.offline"));
64826         }
64827         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
64828       }
64829       osm.on("apiStatusChange.uiStatus", update);
64830       context.history().on("storage_error", () => {
64831         selection2.selectAll("span.local-storage-full").remove();
64832         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
64833         selection2.classed("error", true);
64834       });
64835       window.setInterval(function() {
64836         osm.reloadApiStatus();
64837       }, 9e4);
64838       osm.reloadApiStatus();
64839     };
64840   }
64841
64842   // node_modules/osm-community-index/lib/simplify.js
64843   var import_diacritics3 = __toESM(require_diacritics(), 1);
64844   function simplify2(str2) {
64845     if (typeof str2 !== "string")
64846       return "";
64847     return import_diacritics3.default.remove(
64848       str2.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\u200b-\u200f\u2016\u2017\u2020-\u2027\u2030-\u2038\u203b-\u203e\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205e\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00\u2e01\u2e06-\u2e08\u2e0b\u2e0e-\u2e16\u2e18\u2e19\u2e1b\u2e1e\u2e1f\u2e2a-\u2e2e\u2e30-\u2e39\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()
64849     );
64850   }
64851
64852   // node_modules/osm-community-index/lib/resolve_strings.js
64853   function resolveStrings(item, defaults2, localizerFn) {
64854     let itemStrings = Object.assign({}, item.strings);
64855     let defaultStrings = Object.assign({}, defaults2[item.type]);
64856     const anyToken = new RegExp(/(\{\w+\})/, "gi");
64857     if (localizerFn) {
64858       if (itemStrings.community) {
64859         const communityID = simplify2(itemStrings.community);
64860         itemStrings.community = localizerFn(`_communities.${communityID}`);
64861       }
64862       ["name", "description", "extendedDescription"].forEach((prop) => {
64863         if (defaultStrings[prop])
64864           defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
64865         if (itemStrings[prop])
64866           itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
64867       });
64868     }
64869     let replacements = {
64870       account: item.account,
64871       community: itemStrings.community,
64872       signupUrl: itemStrings.signupUrl,
64873       url: itemStrings.url
64874     };
64875     if (!replacements.signupUrl) {
64876       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
64877     }
64878     if (!replacements.url) {
64879       replacements.url = resolve(itemStrings.url || defaultStrings.url);
64880     }
64881     let resolved = {
64882       name: resolve(itemStrings.name || defaultStrings.name),
64883       url: resolve(itemStrings.url || defaultStrings.url),
64884       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
64885       description: resolve(itemStrings.description || defaultStrings.description),
64886       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
64887     };
64888     resolved.nameHTML = linkify(resolved.url, resolved.name);
64889     resolved.urlHTML = linkify(resolved.url);
64890     resolved.signupUrlHTML = linkify(resolved.signupUrl);
64891     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
64892     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
64893     return resolved;
64894     function resolve(s, addLinks) {
64895       if (!s)
64896         return void 0;
64897       let result = s;
64898       for (let key in replacements) {
64899         const token = `{${key}}`;
64900         const regex = new RegExp(token, "g");
64901         if (regex.test(result)) {
64902           let replacement = replacements[key];
64903           if (!replacement) {
64904             throw new Error(`Cannot resolve token: ${token}`);
64905           } else {
64906             if (addLinks && (key === "signupUrl" || key === "url")) {
64907               replacement = linkify(replacement);
64908             }
64909             result = result.replace(regex, replacement);
64910           }
64911         }
64912       }
64913       const leftovers = result.match(anyToken);
64914       if (leftovers) {
64915         throw new Error(`Cannot resolve tokens: ${leftovers}`);
64916       }
64917       if (addLinks && item.type === "reddit") {
64918         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
64919       }
64920       return result;
64921     }
64922     function linkify(url, text2) {
64923       if (!url)
64924         return void 0;
64925       text2 = text2 || url;
64926       return `<a target="_blank" href="${url}">${text2}</a>`;
64927     }
64928   }
64929
64930   // modules/ui/success.js
64931   var _oci = null;
64932   function uiSuccess(context) {
64933     const MAXEVENTS = 2;
64934     const dispatch10 = dispatch_default("cancel");
64935     let _changeset2;
64936     let _location;
64937     ensureOSMCommunityIndex();
64938     function ensureOSMCommunityIndex() {
64939       const data = _mainFileFetcher;
64940       return Promise.all([
64941         data.get("oci_features"),
64942         data.get("oci_resources"),
64943         data.get("oci_defaults")
64944       ]).then((vals) => {
64945         if (_oci)
64946           return _oci;
64947         if (vals[0] && Array.isArray(vals[0].features)) {
64948           _mainLocations.mergeCustomGeoJSON(vals[0]);
64949         }
64950         let ociResources = Object.values(vals[1].resources);
64951         if (ociResources.length) {
64952           return _mainLocations.mergeLocationSets(ociResources).then(() => {
64953             _oci = {
64954               resources: ociResources,
64955               defaults: vals[2].defaults
64956             };
64957             return _oci;
64958           });
64959         } else {
64960           _oci = {
64961             resources: [],
64962             defaults: vals[2].defaults
64963           };
64964           return _oci;
64965         }
64966       });
64967     }
64968     function parseEventDate(when) {
64969       if (!when)
64970         return;
64971       let raw = when.trim();
64972       if (!raw)
64973         return;
64974       if (!/Z$/.test(raw)) {
64975         raw += "Z";
64976       }
64977       const parsed = new Date(raw);
64978       return new Date(parsed.toUTCString().slice(0, 25));
64979     }
64980     function success(selection2) {
64981       let header = selection2.append("div").attr("class", "header fillL");
64982       header.append("h2").call(_t.append("success.just_edited"));
64983       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch10.call("cancel")).call(svgIcon("#iD-icon-close"));
64984       let body = selection2.append("div").attr("class", "body save-success fillL");
64985       let summary = body.append("div").attr("class", "save-summary");
64986       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
64987       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"));
64988       let osm = context.connection();
64989       if (!osm)
64990         return;
64991       let changesetURL = osm.changesetURL(_changeset2.id);
64992       let table = summary.append("table").attr("class", "summary-table");
64993       let row = table.append("tr").attr("class", "summary-row");
64994       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");
64995       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
64996       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
64997       summaryDetail.append("div").html(_t.html("success.changeset_id", {
64998         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
64999       }));
65000       ensureOSMCommunityIndex().then((oci) => {
65001         const loc = context.map().center();
65002         const validLocations = _mainLocations.locationsAt(loc);
65003         let communities = [];
65004         oci.resources.forEach((resource) => {
65005           let area = validLocations[resource.locationSetID];
65006           if (!area)
65007             return;
65008           const localizer = (stringID) => _t.html(`community.${stringID}`);
65009           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
65010           communities.push({
65011             area,
65012             order: resource.order || 0,
65013             resource
65014           });
65015         });
65016         communities.sort((a, b) => a.area - b.area || b.order - a.order);
65017         body.call(showCommunityLinks, communities.map((c) => c.resource));
65018       });
65019     }
65020     function showCommunityLinks(selection2, resources) {
65021       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
65022       communityLinks.append("h3").call(_t.append("success.like_osm"));
65023       let table = communityLinks.append("table").attr("class", "community-table");
65024       let row = table.selectAll(".community-row").data(resources);
65025       let rowEnter = row.enter().append("tr").attr("class", "community-row");
65026       rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d) => d.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d) => `#community-${d.type}`);
65027       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
65028       communityDetail.each(showCommunityDetails);
65029       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"));
65030     }
65031     function showCommunityDetails(d) {
65032       let selection2 = select_default2(this);
65033       let communityID = d.id;
65034       selection2.append("div").attr("class", "community-name").html(d.resolved.nameHTML);
65035       selection2.append("div").attr("class", "community-description").html(d.resolved.descriptionHTML);
65036       if (d.resolved.extendedDescriptionHTML || d.languageCodes && d.languageCodes.length) {
65037         selection2.append("div").call(
65038           uiDisclosure(context, `community-more-${d.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
65039         );
65040       }
65041       let nextEvents = (d.events || []).map((event) => {
65042         event.date = parseEventDate(event.when);
65043         return event;
65044       }).filter((event) => {
65045         const t = event.date.getTime();
65046         const now3 = new Date().setHours(0, 0, 0, 0);
65047         return !isNaN(t) && t >= now3;
65048       }).sort((a, b) => {
65049         return a.date < b.date ? -1 : a.date > b.date ? 1 : 0;
65050       }).slice(0, MAXEVENTS);
65051       if (nextEvents.length) {
65052         selection2.append("div").call(
65053           uiDisclosure(context, `community-events-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
65054         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
65055       }
65056       function showMore(selection3) {
65057         let more = selection3.selectAll(".community-more").data([0]);
65058         let moreEnter = more.enter().append("div").attr("class", "community-more");
65059         if (d.resolved.extendedDescriptionHTML) {
65060           moreEnter.append("div").attr("class", "community-extended-description").html(d.resolved.extendedDescriptionHTML);
65061         }
65062         if (d.languageCodes && d.languageCodes.length) {
65063           const languageList = d.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
65064           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
65065         }
65066       }
65067       function showNextEvents(selection3) {
65068         let events = selection3.append("div").attr("class", "community-events");
65069         let item = events.selectAll(".community-event").data(nextEvents);
65070         let itemEnter = item.enter().append("div").attr("class", "community-event");
65071         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d2) => d2.url).text((d2) => {
65072           let name = d2.name;
65073           if (d2.i18n && d2.id) {
65074             name = _t(`community.${communityID}.events.${d2.id}.name`, { default: name });
65075           }
65076           return name;
65077         });
65078         itemEnter.append("div").attr("class", "community-event-when").text((d2) => {
65079           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
65080           if (d2.date.getHours() || d2.date.getMinutes()) {
65081             options2.hour = "numeric";
65082             options2.minute = "numeric";
65083           }
65084           return d2.date.toLocaleString(_mainLocalizer.localeCode(), options2);
65085         });
65086         itemEnter.append("div").attr("class", "community-event-where").text((d2) => {
65087           let where = d2.where;
65088           if (d2.i18n && d2.id) {
65089             where = _t(`community.${communityID}.events.${d2.id}.where`, { default: where });
65090           }
65091           return where;
65092         });
65093         itemEnter.append("div").attr("class", "community-event-description").text((d2) => {
65094           let description = d2.description;
65095           if (d2.i18n && d2.id) {
65096             description = _t(`community.${communityID}.events.${d2.id}.description`, { default: description });
65097           }
65098           return description;
65099         });
65100       }
65101     }
65102     success.changeset = function(val) {
65103       if (!arguments.length)
65104         return _changeset2;
65105       _changeset2 = val;
65106       return success;
65107     };
65108     success.location = function(val) {
65109       if (!arguments.length)
65110         return _location;
65111       _location = val;
65112       return success;
65113     };
65114     return utilRebind(success, dispatch10, "on");
65115   }
65116
65117   // modules/ui/version.js
65118   var sawVersion = null;
65119   var isNewVersion = false;
65120   var isNewUser = false;
65121   function uiVersion(context) {
65122     var currVersion = context.version;
65123     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
65124     if (sawVersion === null && matchedVersion !== null) {
65125       if (corePreferences("sawVersion")) {
65126         isNewUser = false;
65127         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
65128       } else {
65129         isNewUser = true;
65130         isNewVersion = true;
65131       }
65132       corePreferences("sawVersion", currVersion);
65133       sawVersion = currVersion;
65134     }
65135     return function(selection2) {
65136       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
65137       if (isNewVersion && !isNewUser) {
65138         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(
65139           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
65140         );
65141       }
65142     };
65143   }
65144
65145   // modules/ui/zoom.js
65146   function uiZoom(context) {
65147     var zooms = [{
65148       id: "zoom-in",
65149       icon: "iD-icon-plus",
65150       title: _t.append("zoom.in"),
65151       action: zoomIn,
65152       disabled: function() {
65153         return !context.map().canZoomIn();
65154       },
65155       disabledTitle: _t.append("zoom.disabled.in"),
65156       key: "+"
65157     }, {
65158       id: "zoom-out",
65159       icon: "iD-icon-minus",
65160       title: _t.append("zoom.out"),
65161       action: zoomOut,
65162       disabled: function() {
65163         return !context.map().canZoomOut();
65164       },
65165       disabledTitle: _t.append("zoom.disabled.out"),
65166       key: "-"
65167     }];
65168     function zoomIn(d3_event) {
65169       if (d3_event.shiftKey)
65170         return;
65171       d3_event.preventDefault();
65172       context.map().zoomIn();
65173     }
65174     function zoomOut(d3_event) {
65175       if (d3_event.shiftKey)
65176         return;
65177       d3_event.preventDefault();
65178       context.map().zoomOut();
65179     }
65180     function zoomInFurther(d3_event) {
65181       if (d3_event.shiftKey)
65182         return;
65183       d3_event.preventDefault();
65184       context.map().zoomInFurther();
65185     }
65186     function zoomOutFurther(d3_event) {
65187       if (d3_event.shiftKey)
65188         return;
65189       d3_event.preventDefault();
65190       context.map().zoomOutFurther();
65191     }
65192     return function(selection2) {
65193       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d) {
65194         if (d.disabled()) {
65195           return d.disabledTitle;
65196         }
65197         return d.title;
65198       }).keys(function(d) {
65199         return [d.key];
65200       });
65201       var lastPointerUpType;
65202       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d) {
65203         return d.id;
65204       }).on("pointerup.editor", function(d3_event) {
65205         lastPointerUpType = d3_event.pointerType;
65206       }).on("click.editor", function(d3_event, d) {
65207         if (!d.disabled()) {
65208           d.action(d3_event);
65209         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
65210           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass("disabled").label(d.disabledTitle)();
65211         }
65212         lastPointerUpType = null;
65213       }).call(tooltipBehavior);
65214       buttons.each(function(d) {
65215         select_default2(this).call(svgIcon("#" + d.icon, "light"));
65216       });
65217       utilKeybinding.plusKeys.forEach(function(key) {
65218         context.keybinding().on([key], zoomIn);
65219         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
65220       });
65221       utilKeybinding.minusKeys.forEach(function(key) {
65222         context.keybinding().on([key], zoomOut);
65223         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
65224       });
65225       function updateButtonStates() {
65226         buttons.classed("disabled", function(d) {
65227           return d.disabled();
65228         }).each(function() {
65229           var selection3 = select_default2(this);
65230           if (!selection3.select(".tooltip.in").empty()) {
65231             selection3.call(tooltipBehavior.updateContent);
65232           }
65233         });
65234       }
65235       updateButtonStates();
65236       context.map().on("move.uiZoom", updateButtonStates);
65237     };
65238   }
65239
65240   // modules/ui/sections/raw_tag_editor.js
65241   function uiSectionRawTagEditor(id2, context) {
65242     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
65243       var count = Object.keys(_tags).filter(function(d) {
65244         return d;
65245       }).length;
65246       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
65247     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
65248     var taginfo = services.taginfo;
65249     var dispatch10 = dispatch_default("change");
65250     var availableViews = [
65251       { id: "list", icon: "#fas-th-list" },
65252       { id: "text", icon: "#fas-i-cursor" }
65253     ];
65254     var _tagView = corePreferences("raw-tag-editor-view") || "list";
65255     var _readOnlyTags = [];
65256     var _orderedKeys = [];
65257     var _showBlank = false;
65258     var _pendingChange = null;
65259     var _state;
65260     var _presets;
65261     var _tags;
65262     var _entityIDs;
65263     var _didInteract = false;
65264     function interacted() {
65265       _didInteract = true;
65266     }
65267     function renderDisclosureContent(wrap2) {
65268       _orderedKeys = _orderedKeys.filter(function(key) {
65269         return _tags[key] !== void 0;
65270       });
65271       var all = Object.keys(_tags).sort();
65272       var missingKeys = utilArrayDifference(all, _orderedKeys);
65273       for (var i2 in missingKeys) {
65274         _orderedKeys.push(missingKeys[i2]);
65275       }
65276       var rowData = _orderedKeys.map(function(key, i3) {
65277         return { index: i3, key, value: _tags[key] };
65278       });
65279       if (!rowData.length || _showBlank) {
65280         _showBlank = false;
65281         rowData.push({ index: rowData.length, key: "", value: "" });
65282       }
65283       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
65284       options2.exit().remove();
65285       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
65286       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d) {
65287         return d.id;
65288       }).enter();
65289       optionEnter.append("button").attr("class", function(d) {
65290         return "raw-tag-option raw-tag-option-" + d.id + (_tagView === d.id ? " selected" : "");
65291       }).attr("aria-selected", function(d) {
65292         return _tagView === d.id;
65293       }).attr("role", "tab").attr("title", function(d) {
65294         return _t("icons." + d.id);
65295       }).on("click", function(d3_event, d) {
65296         _tagView = d.id;
65297         corePreferences("raw-tag-editor-view", d.id);
65298         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
65299           return datum2 === d;
65300         }).attr("aria-selected", function(datum2) {
65301           return datum2 === d;
65302         });
65303         wrap2.selectAll(".tag-text").classed("hide", d.id !== "text").each(setTextareaHeight);
65304         wrap2.selectAll(".tag-list, .add-row").classed("hide", d.id !== "list");
65305       }).each(function(d) {
65306         select_default2(this).call(svgIcon(d.icon));
65307       });
65308       var textData = rowsToText(rowData);
65309       var textarea = wrap2.selectAll(".tag-text").data([0]);
65310       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);
65311       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
65312       var list = wrap2.selectAll(".tag-list").data([0]);
65313       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
65314       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
65315       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);
65316       addRowEnter.append("div").attr("class", "space-value");
65317       addRowEnter.append("div").attr("class", "space-buttons");
65318       var items = list.selectAll(".tag-row").data(rowData, function(d) {
65319         return d.key;
65320       });
65321       items.exit().each(unbind).remove();
65322       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
65323       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
65324       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);
65325       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);
65326       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
65327       items = items.merge(itemsEnter).sort(function(a, b) {
65328         return a.index - b.index;
65329       });
65330       items.each(function(d) {
65331         var row = select_default2(this);
65332         var key = row.select("input.key");
65333         var value = row.select("input.value");
65334         if (_entityIDs && taginfo && _state !== "hover") {
65335           bindTypeahead(key, value);
65336         }
65337         var referenceOptions = { key: d.key };
65338         if (typeof d.value === "string") {
65339           referenceOptions.value = d.value;
65340         }
65341         var reference = uiTagReference(referenceOptions, context);
65342         if (_state === "hover") {
65343           reference.showing(false);
65344         }
65345         row.select(".inner-wrap").call(reference.button);
65346         row.call(reference.body);
65347         row.select("button.remove");
65348       });
65349       items.selectAll("input.key").attr("title", function(d) {
65350         return d.key;
65351       }).call(utilGetSetValue, function(d) {
65352         return d.key;
65353       }).attr("readonly", function(d) {
65354         return isReadOnly(d) || null;
65355       });
65356       items.selectAll("input.value").attr("title", function(d) {
65357         return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : d.value;
65358       }).classed("mixed", function(d) {
65359         return Array.isArray(d.value);
65360       }).attr("placeholder", function(d) {
65361         return typeof d.value === "string" ? null : _t("inspector.multiple_values");
65362       }).call(utilGetSetValue, function(d) {
65363         return typeof d.value === "string" ? d.value : "";
65364       }).attr("readonly", function(d) {
65365         return isReadOnly(d) || null;
65366       });
65367       items.selectAll("button.remove").on(("PointerEvent" in window ? "pointer" : "mouse") + "down", removeTag);
65368     }
65369     function isReadOnly(d) {
65370       for (var i2 = 0; i2 < _readOnlyTags.length; i2++) {
65371         if (d.key.match(_readOnlyTags[i2]) !== null) {
65372           return true;
65373         }
65374       }
65375       return false;
65376     }
65377     function setTextareaHeight() {
65378       if (_tagView !== "text")
65379         return;
65380       var selection2 = select_default2(this);
65381       var matches = selection2.node().value.match(/\n/g);
65382       var lineCount = 2 + Number(matches && matches.length);
65383       var lineHeight = 20;
65384       selection2.style("height", lineCount * lineHeight + "px");
65385     }
65386     function stringify3(s) {
65387       return JSON.stringify(s).slice(1, -1);
65388     }
65389     function unstringify(s) {
65390       var leading = "";
65391       var trailing = "";
65392       if (s.length < 1 || s.charAt(0) !== '"') {
65393         leading = '"';
65394       }
65395       if (s.length < 2 || s.charAt(s.length - 1) !== '"' || s.charAt(s.length - 1) === '"' && s.charAt(s.length - 2) === "\\") {
65396         trailing = '"';
65397       }
65398       return JSON.parse(leading + s + trailing);
65399     }
65400     function rowsToText(rows) {
65401       var str2 = rows.filter(function(row) {
65402         return row.key && row.key.trim() !== "";
65403       }).map(function(row) {
65404         var rawVal = row.value;
65405         if (typeof rawVal !== "string")
65406           rawVal = "*";
65407         var val = rawVal ? stringify3(rawVal) : "";
65408         return stringify3(row.key) + "=" + val;
65409       }).join("\n");
65410       if (_state !== "hover" && str2.length) {
65411         return str2 + "\n";
65412       }
65413       return str2;
65414     }
65415     function textChanged() {
65416       var newText = this.value.trim();
65417       var newTags = {};
65418       newText.split("\n").forEach(function(row) {
65419         var m = row.match(/^\s*([^=]+)=(.*)$/);
65420         if (m !== null) {
65421           var k = context.cleanTagKey(unstringify(m[1].trim()));
65422           var v = context.cleanTagValue(unstringify(m[2].trim()));
65423           newTags[k] = v;
65424         }
65425       });
65426       var tagDiff = utilTagDiff(_tags, newTags);
65427       if (!tagDiff.length)
65428         return;
65429       _pendingChange = _pendingChange || {};
65430       tagDiff.forEach(function(change) {
65431         if (isReadOnly({ key: change.key }))
65432           return;
65433         if (change.newVal === "*" && typeof change.oldVal !== "string")
65434           return;
65435         if (change.type === "-") {
65436           _pendingChange[change.key] = void 0;
65437         } else if (change.type === "+") {
65438           _pendingChange[change.key] = change.newVal || "";
65439         }
65440       });
65441       if (Object.keys(_pendingChange).length === 0) {
65442         _pendingChange = null;
65443         return;
65444       }
65445       scheduleChange();
65446     }
65447     function pushMore(d3_event) {
65448       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
65449         addTag();
65450       }
65451     }
65452     function bindTypeahead(key, value) {
65453       if (isReadOnly(key.datum()))
65454         return;
65455       if (Array.isArray(value.datum().value)) {
65456         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
65457           var keyString = utilGetSetValue(key);
65458           if (!_tags[keyString])
65459             return;
65460           var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
65461             return {
65462               value: tagValue,
65463               title: tagValue
65464             };
65465           });
65466           callback(data);
65467         }));
65468         return;
65469       }
65470       var geometry = context.graph().geometry(_entityIDs[0]);
65471       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
65472         taginfo.keys({
65473           debounce: true,
65474           geometry,
65475           query: value2
65476         }, function(err, data) {
65477           if (!err) {
65478             var filtered = data.filter(function(d) {
65479               return _tags[d.value] === void 0;
65480             });
65481             callback(sort(value2, filtered));
65482           }
65483         });
65484       }));
65485       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
65486         taginfo.values({
65487           debounce: true,
65488           key: utilGetSetValue(key),
65489           geometry,
65490           query: value2
65491         }, function(err, data) {
65492           if (!err)
65493             callback(sort(value2, data));
65494         });
65495       }));
65496       function sort(value2, data) {
65497         var sameletter = [];
65498         var other = [];
65499         for (var i2 = 0; i2 < data.length; i2++) {
65500           if (data[i2].value.substring(0, value2.length) === value2) {
65501             sameletter.push(data[i2]);
65502           } else {
65503             other.push(data[i2]);
65504           }
65505         }
65506         return sameletter.concat(other);
65507       }
65508     }
65509     function unbind() {
65510       var row = select_default2(this);
65511       row.selectAll("input.key").call(uiCombobox.off, context);
65512       row.selectAll("input.value").call(uiCombobox.off, context);
65513     }
65514     function keyChange(d3_event, d) {
65515       if (select_default2(this).attr("readonly"))
65516         return;
65517       var kOld = d.key;
65518       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
65519         return;
65520       var kNew = context.cleanTagKey(this.value.trim());
65521       if (isReadOnly({ key: kNew })) {
65522         this.value = kOld;
65523         return;
65524       }
65525       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
65526         this.value = kOld;
65527         section.selection().selectAll(".tag-list input.value").each(function(d2) {
65528           if (d2.key === kNew) {
65529             var input = select_default2(this).node();
65530             input.focus();
65531             input.select();
65532           }
65533         });
65534         return;
65535       }
65536       _pendingChange = _pendingChange || {};
65537       if (kOld) {
65538         if (kOld === kNew)
65539           return;
65540         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
65541         _pendingChange[kOld] = void 0;
65542       } else {
65543         let row = this.parentNode.parentNode;
65544         let inputVal = select_default2(row).selectAll("input.value");
65545         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
65546         _pendingChange[kNew] = vNew;
65547         utilGetSetValue(inputVal, vNew);
65548       }
65549       var existingKeyIndex = _orderedKeys.indexOf(kOld);
65550       if (existingKeyIndex !== -1)
65551         _orderedKeys[existingKeyIndex] = kNew;
65552       d.key = kNew;
65553       this.value = kNew;
65554       scheduleChange();
65555     }
65556     function valueChange(d3_event, d) {
65557       if (isReadOnly(d))
65558         return;
65559       if (typeof d.value !== "string" && !this.value)
65560         return;
65561       if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === void 0)
65562         return;
65563       _pendingChange = _pendingChange || {};
65564       _pendingChange[d.key] = context.cleanTagValue(this.value);
65565       scheduleChange();
65566     }
65567     function removeTag(d3_event, d) {
65568       if (isReadOnly(d))
65569         return;
65570       if (d.key === "") {
65571         _showBlank = false;
65572         section.reRender();
65573       } else {
65574         _orderedKeys = _orderedKeys.filter(function(key) {
65575           return key !== d.key;
65576         });
65577         _pendingChange = _pendingChange || {};
65578         _pendingChange[d.key] = void 0;
65579         scheduleChange();
65580       }
65581     }
65582     function addTag() {
65583       window.setTimeout(function() {
65584         _showBlank = true;
65585         section.reRender();
65586         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
65587       }, 20);
65588     }
65589     function scheduleChange() {
65590       var entityIDs = _entityIDs;
65591       window.setTimeout(function() {
65592         if (!_pendingChange)
65593           return;
65594         dispatch10.call("change", this, entityIDs, _pendingChange);
65595         _pendingChange = null;
65596       }, 10);
65597     }
65598     section.state = function(val) {
65599       if (!arguments.length)
65600         return _state;
65601       if (_state !== val) {
65602         _orderedKeys = [];
65603         _state = val;
65604       }
65605       return section;
65606     };
65607     section.presets = function(val) {
65608       if (!arguments.length)
65609         return _presets;
65610       _presets = val;
65611       if (_presets && _presets.length && _presets[0].isFallback()) {
65612         section.disclosureExpanded(true);
65613       } else if (!_didInteract) {
65614         section.disclosureExpanded(null);
65615       }
65616       return section;
65617     };
65618     section.tags = function(val) {
65619       if (!arguments.length)
65620         return _tags;
65621       _tags = val;
65622       return section;
65623     };
65624     section.entityIDs = function(val) {
65625       if (!arguments.length)
65626         return _entityIDs;
65627       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
65628         _entityIDs = val;
65629         _orderedKeys = [];
65630       }
65631       return section;
65632     };
65633     section.readOnlyTags = function(val) {
65634       if (!arguments.length)
65635         return _readOnlyTags;
65636       _readOnlyTags = val;
65637       return section;
65638     };
65639     return utilRebind(section, dispatch10, "on");
65640   }
65641
65642   // modules/ui/data_editor.js
65643   function uiDataEditor(context) {
65644     var dataHeader = uiDataHeader();
65645     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
65646     var _datum;
65647     function dataEditor(selection2) {
65648       var header = selection2.selectAll(".header").data([0]);
65649       var headerEnter = header.enter().append("div").attr("class", "header fillL");
65650       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
65651         context.enter(modeBrowse(context));
65652       }).call(svgIcon("#iD-icon-close"));
65653       headerEnter.append("h2").call(_t.append("map_data.title"));
65654       var body = selection2.selectAll(".body").data([0]);
65655       body = body.enter().append("div").attr("class", "body").merge(body);
65656       var editor = body.selectAll(".data-editor").data([0]);
65657       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
65658       var rte = body.selectAll(".raw-tag-editor").data([0]);
65659       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
65660         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
65661       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
65662     }
65663     dataEditor.datum = function(val) {
65664       if (!arguments.length)
65665         return _datum;
65666       _datum = val;
65667       return this;
65668     };
65669     return dataEditor;
65670   }
65671
65672   // modules/ui/osmose_details.js
65673   function uiOsmoseDetails(context) {
65674     let _qaItem;
65675     function issueString(d, type3) {
65676       if (!d)
65677         return "";
65678       const s = services.osmose.getStrings(d.itemType);
65679       return type3 in s ? s[type3] : "";
65680     }
65681     function osmoseDetails(selection2) {
65682       const details = selection2.selectAll(".error-details").data(
65683         _qaItem ? [_qaItem] : [],
65684         (d) => `${d.id}-${d.status || 0}`
65685       );
65686       details.exit().remove();
65687       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
65688       if (issueString(_qaItem, "detail")) {
65689         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
65690         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
65691         div.append("p").attr("class", "qa-details-description-text").html((d) => issueString(d, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
65692       }
65693       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
65694       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
65695       if (issueString(_qaItem, "fix")) {
65696         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
65697         div.append("h4").call(_t.append("QA.osmose.fix_title"));
65698         div.append("p").html((d) => issueString(d, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
65699       }
65700       if (issueString(_qaItem, "trap")) {
65701         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
65702         div.append("h4").call(_t.append("QA.osmose.trap_title"));
65703         div.append("p").html((d) => issueString(d, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
65704       }
65705       const thisItem = _qaItem;
65706       services.osmose.loadIssueDetail(_qaItem).then((d) => {
65707         if (!d.elems || d.elems.length === 0)
65708           return;
65709         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
65710           return;
65711         if (d.detail) {
65712           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
65713           detailsDiv.append("p").html((d2) => d2.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
65714         }
65715         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
65716         elemsDiv.append("ul").selectAll("li").data(d.elems).enter().append("li").append("a").attr("href", "#").attr("class", "error_entity_link").text((d2) => d2).each(function() {
65717           const link2 = select_default2(this);
65718           const entityID = this.textContent;
65719           const entity = context.hasEntity(entityID);
65720           link2.on("mouseenter", () => {
65721             utilHighlightEntities([entityID], true, context);
65722           }).on("mouseleave", () => {
65723             utilHighlightEntities([entityID], false, context);
65724           }).on("click", (d3_event) => {
65725             d3_event.preventDefault();
65726             utilHighlightEntities([entityID], false, context);
65727             const osmlayer = context.layers().layer("osm");
65728             if (!osmlayer.enabled()) {
65729               osmlayer.enabled(true);
65730             }
65731             context.map().centerZoom(d.loc, 20);
65732             if (entity) {
65733               context.enter(modeSelect(context, [entityID]));
65734             } else {
65735               context.loadEntity(entityID, (err, result) => {
65736                 if (err)
65737                   return;
65738                 const entity2 = result.data.find((e) => e.id === entityID);
65739                 if (entity2)
65740                   context.enter(modeSelect(context, [entityID]));
65741               });
65742             }
65743           });
65744           if (entity) {
65745             let name = utilDisplayName(entity);
65746             if (!name) {
65747               const preset = _mainPresetIndex.match(entity, context.graph());
65748               name = preset && !preset.isFallback() && preset.name();
65749             }
65750             if (name) {
65751               this.innerText = name;
65752             }
65753           }
65754         });
65755         context.features().forceVisible(d.elems);
65756         context.map().pan([0, 0]);
65757       }).catch((err) => {
65758         console.log(err);
65759       });
65760     }
65761     osmoseDetails.issue = function(val) {
65762       if (!arguments.length)
65763         return _qaItem;
65764       _qaItem = val;
65765       return osmoseDetails;
65766     };
65767     return osmoseDetails;
65768   }
65769
65770   // modules/ui/osmose_header.js
65771   function uiOsmoseHeader() {
65772     let _qaItem;
65773     function issueTitle(d) {
65774       const unknown = _t("inspector.unknown");
65775       if (!d)
65776         return unknown;
65777       const s = services.osmose.getStrings(d.itemType);
65778       return "title" in s ? s.title : unknown;
65779     }
65780     function osmoseHeader(selection2) {
65781       const header = selection2.selectAll(".qa-header").data(
65782         _qaItem ? [_qaItem] : [],
65783         (d) => `${d.id}-${d.status || 0}`
65784       );
65785       header.exit().remove();
65786       const headerEnter = header.enter().append("div").attr("class", "qa-header");
65787       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
65788       svgEnter.append("polygon").attr("fill", (d) => services.osmose.getColor(d.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");
65789       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
65790       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
65791     }
65792     osmoseHeader.issue = function(val) {
65793       if (!arguments.length)
65794         return _qaItem;
65795       _qaItem = val;
65796       return osmoseHeader;
65797     };
65798     return osmoseHeader;
65799   }
65800
65801   // modules/ui/view_on_osmose.js
65802   function uiViewOnOsmose() {
65803     let _qaItem;
65804     function viewOnOsmose(selection2) {
65805       let url;
65806       if (services.osmose && _qaItem instanceof QAItem) {
65807         url = services.osmose.itemURL(_qaItem);
65808       }
65809       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
65810       link2.exit().remove();
65811       const linkEnter = link2.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d) => d).call(svgIcon("#iD-icon-out-link", "inline"));
65812       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
65813     }
65814     viewOnOsmose.what = function(val) {
65815       if (!arguments.length)
65816         return _qaItem;
65817       _qaItem = val;
65818       return viewOnOsmose;
65819     };
65820     return viewOnOsmose;
65821   }
65822
65823   // modules/ui/osmose_editor.js
65824   function uiOsmoseEditor(context) {
65825     const dispatch10 = dispatch_default("change");
65826     const qaDetails = uiOsmoseDetails(context);
65827     const qaHeader = uiOsmoseHeader(context);
65828     let _qaItem;
65829     function osmoseEditor(selection2) {
65830       const header = selection2.selectAll(".header").data([0]);
65831       const headerEnter = header.enter().append("div").attr("class", "header fillL");
65832       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
65833       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
65834       let body = selection2.selectAll(".body").data([0]);
65835       body = body.enter().append("div").attr("class", "body").merge(body);
65836       let editor = body.selectAll(".qa-editor").data([0]);
65837       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
65838       const footer = selection2.selectAll(".footer").data([0]);
65839       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
65840     }
65841     function osmoseSaveSection(selection2) {
65842       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
65843       const isShown = _qaItem && isSelected;
65844       let saveSection = selection2.selectAll(".qa-save").data(
65845         isShown ? [_qaItem] : [],
65846         (d) => `${d.id}-${d.status || 0}`
65847       );
65848       saveSection.exit().remove();
65849       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
65850       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
65851     }
65852     function qaSaveButtons(selection2) {
65853       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
65854       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
65855       buttonSection.exit().remove();
65856       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
65857       buttonEnter.append("button").attr("class", "button close-button action");
65858       buttonEnter.append("button").attr("class", "button ignore-button action");
65859       buttonSection = buttonSection.merge(buttonEnter);
65860       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d) {
65861         this.blur();
65862         const qaService = services.osmose;
65863         if (qaService) {
65864           d.newStatus = "done";
65865           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
65866         }
65867       });
65868       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d) {
65869         this.blur();
65870         const qaService = services.osmose;
65871         if (qaService) {
65872           d.newStatus = "false";
65873           qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
65874         }
65875       });
65876     }
65877     osmoseEditor.error = function(val) {
65878       if (!arguments.length)
65879         return _qaItem;
65880       _qaItem = val;
65881       return osmoseEditor;
65882     };
65883     return utilRebind(osmoseEditor, dispatch10, "on");
65884   }
65885
65886   // modules/ui/sidebar.js
65887   function uiSidebar(context) {
65888     var inspector = uiInspector(context);
65889     var dataEditor = uiDataEditor(context);
65890     var noteEditor = uiNoteEditor(context);
65891     var improveOsmEditor = uiImproveOsmEditor(context);
65892     var keepRightEditor = uiKeepRightEditor(context);
65893     var osmoseEditor = uiOsmoseEditor(context);
65894     var _current;
65895     var _wasData = false;
65896     var _wasNote = false;
65897     var _wasQaItem = false;
65898     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
65899     function sidebar(selection2) {
65900       var container = context.container();
65901       var minWidth = 240;
65902       var sidebarWidth;
65903       var containerWidth;
65904       var dragOffset;
65905       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
65906       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
65907       var downPointerId, lastClientX, containerLocGetter;
65908       function pointerdown(d3_event) {
65909         if (downPointerId)
65910           return;
65911         if ("button" in d3_event && d3_event.button !== 0)
65912           return;
65913         downPointerId = d3_event.pointerId || "mouse";
65914         lastClientX = d3_event.clientX;
65915         containerLocGetter = utilFastMouse(container.node());
65916         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
65917         sidebarWidth = selection2.node().getBoundingClientRect().width;
65918         containerWidth = container.node().getBoundingClientRect().width;
65919         var widthPct = sidebarWidth / containerWidth * 100;
65920         selection2.style("width", widthPct + "%").style("max-width", "85%");
65921         resizer.classed("dragging", true);
65922         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
65923           d3_event2.preventDefault();
65924         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
65925       }
65926       function pointermove(d3_event) {
65927         if (downPointerId !== (d3_event.pointerId || "mouse"))
65928           return;
65929         d3_event.preventDefault();
65930         var dx = d3_event.clientX - lastClientX;
65931         lastClientX = d3_event.clientX;
65932         var isRTL = _mainLocalizer.textDirection() === "rtl";
65933         var scaleX = isRTL ? 0 : 1;
65934         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
65935         var x = containerLocGetter(d3_event)[0] - dragOffset;
65936         sidebarWidth = isRTL ? containerWidth - x : x;
65937         var isCollapsed = selection2.classed("collapsed");
65938         var shouldCollapse = sidebarWidth < minWidth;
65939         selection2.classed("collapsed", shouldCollapse);
65940         if (shouldCollapse) {
65941           if (!isCollapsed) {
65942             selection2.style(xMarginProperty, "-400px").style("width", "400px");
65943             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
65944           }
65945         } else {
65946           var widthPct = sidebarWidth / containerWidth * 100;
65947           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
65948           if (isCollapsed) {
65949             context.ui().onResize([-sidebarWidth * scaleX, 0]);
65950           } else {
65951             context.ui().onResize([-dx * scaleX, 0]);
65952           }
65953         }
65954       }
65955       function pointerup(d3_event) {
65956         if (downPointerId !== (d3_event.pointerId || "mouse"))
65957           return;
65958         downPointerId = null;
65959         resizer.classed("dragging", false);
65960         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
65961       }
65962       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
65963       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
65964       var hoverModeSelect = function(targets) {
65965         context.container().selectAll(".feature-list-item button").classed("hover", false);
65966         if (context.selectedIDs().length > 1 && targets && targets.length) {
65967           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
65968             return targets.indexOf(node) !== -1;
65969           });
65970           if (!elements.empty()) {
65971             elements.classed("hover", true);
65972           }
65973         }
65974       };
65975       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
65976       function hover(targets) {
65977         var datum2 = targets && targets.length && targets[0];
65978         if (datum2 && datum2.__featurehash__) {
65979           _wasData = true;
65980           sidebar.show(dataEditor.datum(datum2));
65981           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
65982         } else if (datum2 instanceof osmNote) {
65983           if (context.mode().id === "drag-note")
65984             return;
65985           _wasNote = true;
65986           var osm = services.osm;
65987           if (osm) {
65988             datum2 = osm.getNote(datum2.id);
65989           }
65990           sidebar.show(noteEditor.note(datum2));
65991           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
65992         } else if (datum2 instanceof QAItem) {
65993           _wasQaItem = true;
65994           var errService = services[datum2.service];
65995           if (errService) {
65996             datum2 = errService.getError(datum2.id);
65997           }
65998           var errEditor;
65999           if (datum2.service === "keepRight") {
66000             errEditor = keepRightEditor;
66001           } else if (datum2.service === "osmose") {
66002             errEditor = osmoseEditor;
66003           } else {
66004             errEditor = improveOsmEditor;
66005           }
66006           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d) {
66007             return d.id === datum2.id;
66008           });
66009           sidebar.show(errEditor.error(datum2));
66010           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
66011         } else if (!_current && datum2 instanceof osmEntity) {
66012           featureListWrap.classed("inspector-hidden", true);
66013           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
66014           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
66015             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
66016             inspectorWrap.call(inspector);
66017           }
66018         } else if (!_current) {
66019           featureListWrap.classed("inspector-hidden", false);
66020           inspectorWrap.classed("inspector-hidden", true);
66021           inspector.state("hide");
66022         } else if (_wasData || _wasNote || _wasQaItem) {
66023           _wasNote = false;
66024           _wasData = false;
66025           _wasQaItem = false;
66026           context.container().selectAll(".note").classed("hover", false);
66027           context.container().selectAll(".qaItem").classed("hover", false);
66028           sidebar.hide();
66029         }
66030       }
66031       sidebar.hover = throttle_default(hover, 200);
66032       sidebar.intersects = function(extent) {
66033         var rect = selection2.node().getBoundingClientRect();
66034         return extent.intersects([
66035           context.projection.invert([0, rect.height]),
66036           context.projection.invert([rect.width, 0])
66037         ]);
66038       };
66039       sidebar.select = function(ids, newFeature) {
66040         sidebar.hide();
66041         if (ids && ids.length) {
66042           var entity = ids.length === 1 && context.entity(ids[0]);
66043           if (entity && newFeature && selection2.classed("collapsed")) {
66044             var extent = entity.extent(context.graph());
66045             sidebar.expand(sidebar.intersects(extent));
66046           }
66047           featureListWrap.classed("inspector-hidden", true);
66048           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
66049           inspector.state("select").entityIDs(ids).newFeature(newFeature);
66050           inspectorWrap.call(inspector);
66051         } else {
66052           inspector.state("hide");
66053         }
66054       };
66055       sidebar.showPresetList = function() {
66056         inspector.showList();
66057       };
66058       sidebar.show = function(component, element) {
66059         featureListWrap.classed("inspector-hidden", true);
66060         inspectorWrap.classed("inspector-hidden", true);
66061         if (_current)
66062           _current.remove();
66063         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
66064       };
66065       sidebar.hide = function() {
66066         featureListWrap.classed("inspector-hidden", false);
66067         inspectorWrap.classed("inspector-hidden", true);
66068         if (_current)
66069           _current.remove();
66070         _current = null;
66071       };
66072       sidebar.expand = function(moveMap) {
66073         if (selection2.classed("collapsed")) {
66074           sidebar.toggle(moveMap);
66075         }
66076       };
66077       sidebar.collapse = function(moveMap) {
66078         if (!selection2.classed("collapsed")) {
66079           sidebar.toggle(moveMap);
66080         }
66081       };
66082       sidebar.toggle = function(moveMap) {
66083         if (context.inIntro())
66084           return;
66085         var isCollapsed = selection2.classed("collapsed");
66086         var isCollapsing = !isCollapsed;
66087         var isRTL = _mainLocalizer.textDirection() === "rtl";
66088         var scaleX = isRTL ? 0 : 1;
66089         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
66090         sidebarWidth = selection2.node().getBoundingClientRect().width;
66091         selection2.style("width", sidebarWidth + "px");
66092         var startMargin, endMargin, lastMargin;
66093         if (isCollapsing) {
66094           startMargin = lastMargin = 0;
66095           endMargin = -sidebarWidth;
66096         } else {
66097           startMargin = lastMargin = -sidebarWidth;
66098           endMargin = 0;
66099         }
66100         if (!isCollapsing) {
66101           selection2.classed("collapsed", isCollapsing);
66102         }
66103         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
66104           var i2 = number_default(startMargin, endMargin);
66105           return function(t) {
66106             var dx = lastMargin - Math.round(i2(t));
66107             lastMargin = lastMargin - dx;
66108             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
66109           };
66110         }).on("end", function() {
66111           if (isCollapsing) {
66112             selection2.classed("collapsed", isCollapsing);
66113           }
66114           if (!isCollapsing) {
66115             var containerWidth2 = container.node().getBoundingClientRect().width;
66116             var widthPct = sidebarWidth / containerWidth2 * 100;
66117             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
66118           }
66119         });
66120       };
66121       resizer.on("dblclick", function(d3_event) {
66122         d3_event.preventDefault();
66123         if (d3_event.sourceEvent) {
66124           d3_event.sourceEvent.preventDefault();
66125         }
66126         sidebar.toggle();
66127       });
66128       context.map().on("crossEditableZoom.sidebar", function(within) {
66129         if (!within && !selection2.select(".inspector-hover").empty()) {
66130           hover([]);
66131         }
66132       });
66133     }
66134     sidebar.showPresetList = function() {
66135     };
66136     sidebar.hover = function() {
66137     };
66138     sidebar.hover.cancel = function() {
66139     };
66140     sidebar.intersects = function() {
66141     };
66142     sidebar.select = function() {
66143     };
66144     sidebar.show = function() {
66145     };
66146     sidebar.hide = function() {
66147     };
66148     sidebar.expand = function() {
66149     };
66150     sidebar.collapse = function() {
66151     };
66152     sidebar.toggle = function() {
66153     };
66154     return sidebar;
66155   }
66156
66157   // modules/modes/draw_area.js
66158   function modeDrawArea(context, wayID, startGraph, button) {
66159     var mode = {
66160       button,
66161       id: "draw-area"
66162     };
66163     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
66164       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
66165     });
66166     mode.wayID = wayID;
66167     mode.enter = function() {
66168       context.install(behavior);
66169     };
66170     mode.exit = function() {
66171       context.uninstall(behavior);
66172     };
66173     mode.selectedIDs = function() {
66174       return [wayID];
66175     };
66176     mode.activeID = function() {
66177       return behavior && behavior.activeID() || [];
66178     };
66179     return mode;
66180   }
66181
66182   // modules/modes/add_area.js
66183   function modeAddArea(context, mode) {
66184     mode.id = "add-area";
66185     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
66186     var defaultTags = { area: "yes" };
66187     if (mode.preset)
66188       defaultTags = mode.preset.setTags(defaultTags, "area");
66189     function actionClose(wayId) {
66190       return function(graph) {
66191         return graph.replace(graph.entity(wayId).close());
66192       };
66193     }
66194     function start2(loc) {
66195       var startGraph = context.graph();
66196       var node = osmNode({ loc });
66197       var way = osmWay({ tags: defaultTags });
66198       context.perform(
66199         actionAddEntity(node),
66200         actionAddEntity(way),
66201         actionAddVertex(way.id, node.id),
66202         actionClose(way.id)
66203       );
66204       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
66205     }
66206     function startFromWay(loc, edge) {
66207       var startGraph = context.graph();
66208       var node = osmNode({ loc });
66209       var way = osmWay({ tags: defaultTags });
66210       context.perform(
66211         actionAddEntity(node),
66212         actionAddEntity(way),
66213         actionAddVertex(way.id, node.id),
66214         actionClose(way.id),
66215         actionAddMidpoint({ loc, edge }, node)
66216       );
66217       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
66218     }
66219     function startFromNode(node) {
66220       var startGraph = context.graph();
66221       var way = osmWay({ tags: defaultTags });
66222       context.perform(
66223         actionAddEntity(way),
66224         actionAddVertex(way.id, node.id),
66225         actionClose(way.id)
66226       );
66227       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
66228     }
66229     mode.enter = function() {
66230       context.install(behavior);
66231     };
66232     mode.exit = function() {
66233       context.uninstall(behavior);
66234     };
66235     return mode;
66236   }
66237
66238   // modules/modes/add_line.js
66239   function modeAddLine(context, mode) {
66240     mode.id = "add-line";
66241     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
66242     var defaultTags = {};
66243     if (mode.preset)
66244       defaultTags = mode.preset.setTags(defaultTags, "line");
66245     function start2(loc) {
66246       var startGraph = context.graph();
66247       var node = osmNode({ loc });
66248       var way = osmWay({ tags: defaultTags });
66249       context.perform(
66250         actionAddEntity(node),
66251         actionAddEntity(way),
66252         actionAddVertex(way.id, node.id)
66253       );
66254       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
66255     }
66256     function startFromWay(loc, edge) {
66257       var startGraph = context.graph();
66258       var node = osmNode({ loc });
66259       var way = osmWay({ tags: defaultTags });
66260       context.perform(
66261         actionAddEntity(node),
66262         actionAddEntity(way),
66263         actionAddVertex(way.id, node.id),
66264         actionAddMidpoint({ loc, edge }, node)
66265       );
66266       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
66267     }
66268     function startFromNode(node) {
66269       var startGraph = context.graph();
66270       var way = osmWay({ tags: defaultTags });
66271       context.perform(
66272         actionAddEntity(way),
66273         actionAddVertex(way.id, node.id)
66274       );
66275       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
66276     }
66277     mode.enter = function() {
66278       context.install(behavior);
66279     };
66280     mode.exit = function() {
66281       context.uninstall(behavior);
66282     };
66283     return mode;
66284   }
66285
66286   // modules/modes/add_point.js
66287   function modeAddPoint(context, mode) {
66288     mode.id = "add-point";
66289     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
66290     var defaultTags = {};
66291     if (mode.preset)
66292       defaultTags = mode.preset.setTags(defaultTags, "point");
66293     function add(loc) {
66294       var node = osmNode({ loc, tags: defaultTags });
66295       context.perform(
66296         actionAddEntity(node),
66297         _t("operations.add.annotation.point")
66298       );
66299       enterSelectMode(node);
66300     }
66301     function addWay(loc, edge) {
66302       var node = osmNode({ tags: defaultTags });
66303       context.perform(
66304         actionAddMidpoint({ loc, edge }, node),
66305         _t("operations.add.annotation.vertex")
66306       );
66307       enterSelectMode(node);
66308     }
66309     function enterSelectMode(node) {
66310       context.enter(
66311         modeSelect(context, [node.id]).newFeature(true)
66312       );
66313     }
66314     function addNode(node) {
66315       if (Object.keys(defaultTags).length === 0) {
66316         enterSelectMode(node);
66317         return;
66318       }
66319       var tags = Object.assign({}, node.tags);
66320       for (var key in defaultTags) {
66321         tags[key] = defaultTags[key];
66322       }
66323       context.perform(
66324         actionChangeTags(node.id, tags),
66325         _t("operations.add.annotation.point")
66326       );
66327       enterSelectMode(node);
66328     }
66329     function cancel() {
66330       context.enter(modeBrowse(context));
66331     }
66332     mode.enter = function() {
66333       context.install(behavior);
66334     };
66335     mode.exit = function() {
66336       context.uninstall(behavior);
66337     };
66338     return mode;
66339   }
66340
66341   // modules/modes/select_note.js
66342   function modeSelectNote(context, selectedNoteID) {
66343     var mode = {
66344       id: "select-note",
66345       button: "browse"
66346     };
66347     var _keybinding = utilKeybinding("select-note");
66348     var _noteEditor = uiNoteEditor(context).on("change", function() {
66349       context.map().pan([0, 0]);
66350       var note = checkSelectedID();
66351       if (!note)
66352         return;
66353       context.ui().sidebar.show(_noteEditor.note(note));
66354     });
66355     var _behaviors = [
66356       behaviorBreathe(context),
66357       behaviorHover(context),
66358       behaviorSelect(context),
66359       behaviorLasso(context),
66360       modeDragNode(context).behavior,
66361       modeDragNote(context).behavior
66362     ];
66363     var _newFeature = false;
66364     function checkSelectedID() {
66365       if (!services.osm)
66366         return;
66367       var note = services.osm.getNote(selectedNoteID);
66368       if (!note) {
66369         context.enter(modeBrowse(context));
66370       }
66371       return note;
66372     }
66373     function selectNote(d3_event, drawn) {
66374       if (!checkSelectedID())
66375         return;
66376       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
66377       if (selection2.empty()) {
66378         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
66379         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
66380           context.enter(modeBrowse(context));
66381         }
66382       } else {
66383         selection2.classed("selected", true);
66384         context.selectedNoteID(selectedNoteID);
66385       }
66386     }
66387     function esc() {
66388       if (context.container().select(".combobox").size())
66389         return;
66390       context.enter(modeBrowse(context));
66391     }
66392     mode.zoomToSelected = function() {
66393       if (!services.osm)
66394         return;
66395       var note = services.osm.getNote(selectedNoteID);
66396       if (note) {
66397         context.map().centerZoomEase(note.loc, 20);
66398       }
66399     };
66400     mode.newFeature = function(val) {
66401       if (!arguments.length)
66402         return _newFeature;
66403       _newFeature = val;
66404       return mode;
66405     };
66406     mode.enter = function() {
66407       var note = checkSelectedID();
66408       if (!note)
66409         return;
66410       _behaviors.forEach(context.install);
66411       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
66412       select_default2(document).call(_keybinding);
66413       selectNote();
66414       var sidebar = context.ui().sidebar;
66415       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
66416       sidebar.expand(sidebar.intersects(note.extent()));
66417       context.map().on("drawn.select", selectNote);
66418     };
66419     mode.exit = function() {
66420       _behaviors.forEach(context.uninstall);
66421       select_default2(document).call(_keybinding.unbind);
66422       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
66423       context.map().on("drawn.select", null);
66424       context.ui().sidebar.hide();
66425       context.selectedNoteID(null);
66426     };
66427     return mode;
66428   }
66429
66430   // modules/modes/add_note.js
66431   function modeAddNote(context) {
66432     var mode = {
66433       id: "add-note",
66434       button: "note",
66435       description: _t.append("modes.add_note.description"),
66436       key: _t("modes.add_note.key")
66437     };
66438     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
66439     function add(loc) {
66440       var osm = services.osm;
66441       if (!osm)
66442         return;
66443       var note = osmNote({ loc, status: "open", comments: [] });
66444       osm.replaceNote(note);
66445       context.map().pan([0, 0]);
66446       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
66447     }
66448     function cancel() {
66449       context.enter(modeBrowse(context));
66450     }
66451     mode.enter = function() {
66452       context.install(behavior);
66453     };
66454     mode.exit = function() {
66455       context.uninstall(behavior);
66456     };
66457     return mode;
66458   }
66459
66460   // modules/modes/save.js
66461   function modeSave(context) {
66462     var mode = { id: "save" };
66463     var keybinding = utilKeybinding("modeSave");
66464     var commit = uiCommit(context).on("cancel", cancel);
66465     var _conflictsUi;
66466     var _location;
66467     var _success;
66468     var uploader = context.uploader().on("saveStarted.modeSave", function() {
66469       keybindingOff();
66470     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
66471       cancel();
66472     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
66473     function cancel() {
66474       context.enter(modeBrowse(context));
66475     }
66476     function showProgress(num, total) {
66477       var modal = context.container().select(".loading-modal .modal-section");
66478       var progress = modal.selectAll(".progress").data([0]);
66479       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
66480     }
66481     function showConflicts(changeset, conflicts, origChanges) {
66482       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
66483       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
66484       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
66485         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
66486         selection2.remove();
66487         keybindingOn();
66488         uploader.cancelConflictResolution();
66489       }).on("save", function() {
66490         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
66491         selection2.remove();
66492         uploader.processResolvedConflicts(changeset);
66493       });
66494       selection2.call(_conflictsUi);
66495     }
66496     function showErrors(errors) {
66497       keybindingOn();
66498       var selection2 = uiConfirm(context.container());
66499       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
66500       addErrors(selection2, errors);
66501       selection2.okButton();
66502     }
66503     function addErrors(selection2, data) {
66504       var message = selection2.select(".modal-section.message-text");
66505       var items = message.selectAll(".error-container").data(data);
66506       var enter = items.enter().append("div").attr("class", "error-container");
66507       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d) {
66508         return d.msg || _t("save.unknown_error_details");
66509       }).on("click", function(d3_event) {
66510         d3_event.preventDefault();
66511         var error = select_default2(this);
66512         var detail = select_default2(this.nextElementSibling);
66513         var exp2 = error.classed("expanded");
66514         detail.style("display", exp2 ? "none" : "block");
66515         error.classed("expanded", !exp2);
66516       });
66517       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
66518       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d) {
66519         return d.details || [];
66520       }).enter().append("li").attr("class", "error-detail-item").text(function(d) {
66521         return d;
66522       });
66523       items.exit().remove();
66524     }
66525     function showSuccess(changeset) {
66526       commit.reset();
66527       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
66528         context.ui().sidebar.hide();
66529       });
66530       context.enter(modeBrowse(context).sidebar(ui));
66531     }
66532     function keybindingOn() {
66533       select_default2(document).call(keybinding.on("\u238B", cancel, true));
66534     }
66535     function keybindingOff() {
66536       select_default2(document).call(keybinding.unbind);
66537     }
66538     function prepareForSuccess() {
66539       _success = uiSuccess(context);
66540       _location = null;
66541       if (!services.geocoder)
66542         return;
66543       services.geocoder.reverse(context.map().center(), function(err, result) {
66544         if (err || !result || !result.address)
66545           return;
66546         var addr = result.address;
66547         var place = addr && (addr.town || addr.city || addr.county) || "";
66548         var region = addr && (addr.state || addr.country) || "";
66549         var separator = place && region ? _t("success.thank_you_where.separator") : "";
66550         _location = _t(
66551           "success.thank_you_where.format",
66552           { place, separator, region }
66553         );
66554       });
66555     }
66556     mode.selectedIDs = function() {
66557       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
66558     };
66559     mode.enter = function() {
66560       context.ui().sidebar.expand();
66561       function done() {
66562         context.ui().sidebar.show(commit);
66563       }
66564       keybindingOn();
66565       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
66566       var osm = context.connection();
66567       if (!osm) {
66568         cancel();
66569         return;
66570       }
66571       if (osm.authenticated()) {
66572         done();
66573       } else {
66574         osm.authenticate(function(err) {
66575           if (err) {
66576             cancel();
66577           } else {
66578             done();
66579           }
66580         });
66581       }
66582     };
66583     mode.exit = function() {
66584       keybindingOff();
66585       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
66586       context.ui().sidebar.hide();
66587     };
66588     return mode;
66589   }
66590
66591   // modules/modes/select_error.js
66592   function modeSelectError(context, selectedErrorID, selectedErrorService) {
66593     var mode = {
66594       id: "select-error",
66595       button: "browse"
66596     };
66597     var keybinding = utilKeybinding("select-error");
66598     var errorService = services[selectedErrorService];
66599     var errorEditor;
66600     switch (selectedErrorService) {
66601       case "improveOSM":
66602         errorEditor = uiImproveOsmEditor(context).on("change", function() {
66603           context.map().pan([0, 0]);
66604           var error = checkSelectedID();
66605           if (!error)
66606             return;
66607           context.ui().sidebar.show(errorEditor.error(error));
66608         });
66609         break;
66610       case "keepRight":
66611         errorEditor = uiKeepRightEditor(context).on("change", function() {
66612           context.map().pan([0, 0]);
66613           var error = checkSelectedID();
66614           if (!error)
66615             return;
66616           context.ui().sidebar.show(errorEditor.error(error));
66617         });
66618         break;
66619       case "osmose":
66620         errorEditor = uiOsmoseEditor(context).on("change", function() {
66621           context.map().pan([0, 0]);
66622           var error = checkSelectedID();
66623           if (!error)
66624             return;
66625           context.ui().sidebar.show(errorEditor.error(error));
66626         });
66627         break;
66628     }
66629     var behaviors = [
66630       behaviorBreathe(context),
66631       behaviorHover(context),
66632       behaviorSelect(context),
66633       behaviorLasso(context),
66634       modeDragNode(context).behavior,
66635       modeDragNote(context).behavior
66636     ];
66637     function checkSelectedID() {
66638       if (!errorService)
66639         return;
66640       var error = errorService.getError(selectedErrorID);
66641       if (!error) {
66642         context.enter(modeBrowse(context));
66643       }
66644       return error;
66645     }
66646     mode.zoomToSelected = function() {
66647       if (!errorService)
66648         return;
66649       var error = errorService.getError(selectedErrorID);
66650       if (error) {
66651         context.map().centerZoomEase(error.loc, 20);
66652       }
66653     };
66654     mode.enter = function() {
66655       var error = checkSelectedID();
66656       if (!error)
66657         return;
66658       behaviors.forEach(context.install);
66659       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
66660       select_default2(document).call(keybinding);
66661       selectError();
66662       var sidebar = context.ui().sidebar;
66663       sidebar.show(errorEditor.error(error));
66664       context.map().on("drawn.select-error", selectError);
66665       function selectError(d3_event, drawn) {
66666         if (!checkSelectedID())
66667           return;
66668         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
66669         if (selection2.empty()) {
66670           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
66671           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
66672             context.enter(modeBrowse(context));
66673           }
66674         } else {
66675           selection2.classed("selected", true);
66676           context.selectedErrorID(selectedErrorID);
66677         }
66678       }
66679       function esc() {
66680         if (context.container().select(".combobox").size())
66681           return;
66682         context.enter(modeBrowse(context));
66683       }
66684     };
66685     mode.exit = function() {
66686       behaviors.forEach(context.uninstall);
66687       select_default2(document).call(keybinding.unbind);
66688       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
66689       context.map().on("drawn.select-error", null);
66690       context.ui().sidebar.hide();
66691       context.selectedErrorID(null);
66692       context.features().forceVisible([]);
66693     };
66694     return mode;
66695   }
66696
66697   // modules/ui/tools/modes.js
66698   function uiToolDrawModes(context) {
66699     var tool = {
66700       id: "old_modes",
66701       label: _t.append("toolbar.add_feature")
66702     };
66703     var modes = [
66704       modeAddPoint(context, {
66705         title: _t.append("modes.add_point.title"),
66706         button: "point",
66707         description: _t.append("modes.add_point.description"),
66708         preset: _mainPresetIndex.item("point"),
66709         key: "1"
66710       }),
66711       modeAddLine(context, {
66712         title: _t.append("modes.add_line.title"),
66713         button: "line",
66714         description: _t.append("modes.add_line.description"),
66715         preset: _mainPresetIndex.item("line"),
66716         key: "2"
66717       }),
66718       modeAddArea(context, {
66719         title: _t.append("modes.add_area.title"),
66720         button: "area",
66721         description: _t.append("modes.add_area.description"),
66722         preset: _mainPresetIndex.item("area"),
66723         key: "3"
66724       })
66725     ];
66726     function enabled(_mode) {
66727       return osmEditable();
66728     }
66729     function osmEditable() {
66730       return context.editable();
66731     }
66732     modes.forEach(function(mode) {
66733       context.keybinding().on(mode.key, function() {
66734         if (!enabled(mode))
66735           return;
66736         if (mode.id === context.mode().id) {
66737           context.enter(modeBrowse(context));
66738         } else {
66739           context.enter(mode);
66740         }
66741       });
66742     });
66743     tool.render = function(selection2) {
66744       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
66745       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
66746       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
66747       context.on("enter.modes", update);
66748       update();
66749       function update() {
66750         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d) {
66751           return d.id;
66752         });
66753         buttons.exit().remove();
66754         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
66755           return d.id + " add-button bar-button";
66756         }).on("click.mode-buttons", function(d3_event, d) {
66757           if (!enabled(d))
66758             return;
66759           var currMode = context.mode().id;
66760           if (/^draw/.test(currMode))
66761             return;
66762           if (d.id === currMode) {
66763             context.enter(modeBrowse(context));
66764           } else {
66765             context.enter(d);
66766           }
66767         }).call(
66768           uiTooltip().placement("bottom").title(function(d) {
66769             return d.description;
66770           }).keys(function(d) {
66771             return [d.key];
66772           }).scrollContainer(context.container().select(".top-toolbar"))
66773         );
66774         buttonsEnter.each(function(d) {
66775           select_default2(this).call(svgIcon("#iD-icon-" + d.button));
66776         });
66777         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
66778           mode.title(select_default2(this));
66779         });
66780         if (buttons.enter().size() || buttons.exit().size()) {
66781           context.ui().checkOverflow(".top-toolbar", true);
66782         }
66783         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d) {
66784           return !enabled(d);
66785         }).classed("disabled", function(d) {
66786           return !enabled(d);
66787         }).attr("aria-pressed", function(d) {
66788           return context.mode() && context.mode().button === d.button;
66789         }).classed("active", function(d) {
66790           return context.mode() && context.mode().button === d.button;
66791         });
66792       }
66793     };
66794     return tool;
66795   }
66796
66797   // modules/ui/tools/notes.js
66798   function uiToolNotes(context) {
66799     var tool = {
66800       id: "notes",
66801       label: _t.append("modes.add_note.label")
66802     };
66803     var mode = modeAddNote(context);
66804     function enabled() {
66805       return notesEnabled() && notesEditable();
66806     }
66807     function notesEnabled() {
66808       var noteLayer = context.layers().layer("notes");
66809       return noteLayer && noteLayer.enabled();
66810     }
66811     function notesEditable() {
66812       var mode2 = context.mode();
66813       return context.map().notesEditable() && mode2 && mode2.id !== "save";
66814     }
66815     context.keybinding().on(mode.key, function() {
66816       if (!enabled())
66817         return;
66818       if (mode.id === context.mode().id) {
66819         context.enter(modeBrowse(context));
66820       } else {
66821         context.enter(mode);
66822       }
66823     });
66824     tool.render = function(selection2) {
66825       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
66826       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
66827       context.on("enter.notes", update);
66828       update();
66829       function update() {
66830         var showNotes = notesEnabled();
66831         var data = showNotes ? [mode] : [];
66832         var buttons = selection2.selectAll("button.add-button").data(data, function(d) {
66833           return d.id;
66834         });
66835         buttons.exit().remove();
66836         var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
66837           return d.id + " add-button bar-button";
66838         }).on("click.notes", function(d3_event, d) {
66839           if (!enabled())
66840             return;
66841           var currMode = context.mode().id;
66842           if (/^draw/.test(currMode))
66843             return;
66844           if (d.id === currMode) {
66845             context.enter(modeBrowse(context));
66846           } else {
66847             context.enter(d);
66848           }
66849         }).call(
66850           uiTooltip().placement("bottom").title(function(d) {
66851             return d.description;
66852           }).keys(function(d) {
66853             return [d.key];
66854           }).scrollContainer(context.container().select(".top-toolbar"))
66855         );
66856         buttonsEnter.each(function(d) {
66857           select_default2(this).call(svgIcon(d.icon || "#iD-icon-" + d.button));
66858         });
66859         if (buttons.enter().size() || buttons.exit().size()) {
66860           context.ui().checkOverflow(".top-toolbar", true);
66861         }
66862         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
66863           return !enabled();
66864         }).attr("aria-disabled", function() {
66865           return !enabled();
66866         }).classed("active", function(d) {
66867           return context.mode() && context.mode().button === d.button;
66868         }).attr("aria-pressed", function(d) {
66869           return context.mode() && context.mode().button === d.button;
66870         });
66871       }
66872     };
66873     tool.uninstall = function() {
66874       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
66875       context.map().on("move.notes", null).on("drawn.notes", null);
66876     };
66877     return tool;
66878   }
66879
66880   // modules/ui/tools/save.js
66881   function uiToolSave(context) {
66882     var tool = {
66883       id: "save",
66884       label: _t.append("save.title")
66885     };
66886     var button = null;
66887     var tooltipBehavior = null;
66888     var history = context.history();
66889     var key = uiCmd("\u2318S");
66890     var _numChanges = 0;
66891     function isSaving() {
66892       var mode = context.mode();
66893       return mode && mode.id === "save";
66894     }
66895     function isDisabled() {
66896       return _numChanges === 0 || isSaving();
66897     }
66898     function save(d3_event) {
66899       d3_event.preventDefault();
66900       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
66901         context.enter(modeSave(context));
66902       }
66903     }
66904     function bgColor(numChanges) {
66905       var step;
66906       if (numChanges === 0) {
66907         return null;
66908       } else if (numChanges <= 50) {
66909         step = numChanges / 50;
66910         return rgb_default("#fff", "#ff8")(step);
66911       } else {
66912         step = Math.min((numChanges - 50) / 50, 1);
66913         return rgb_default("#ff8", "#f88")(step);
66914       }
66915     }
66916     function updateCount() {
66917       var val = history.difference().summary().length;
66918       if (val === _numChanges)
66919         return;
66920       _numChanges = val;
66921       if (tooltipBehavior) {
66922         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
66923       }
66924       if (button) {
66925         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
66926         button.select("span.count").text(_numChanges);
66927       }
66928     }
66929     tool.render = function(selection2) {
66930       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
66931       var lastPointerUpType;
66932       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
66933         lastPointerUpType = d3_event.pointerType;
66934       }).on("click", function(d3_event) {
66935         save(d3_event);
66936         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
66937           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
66938         }
66939         lastPointerUpType = null;
66940       }).call(tooltipBehavior);
66941       button.call(svgIcon("#iD-icon-save"));
66942       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
66943       updateCount();
66944       context.keybinding().on(key, save, true);
66945       context.history().on("change.save", updateCount);
66946       context.on("enter.save", function() {
66947         if (button) {
66948           button.classed("disabled", isDisabled());
66949           if (isSaving()) {
66950             button.call(tooltipBehavior.hide);
66951           }
66952         }
66953       });
66954     };
66955     tool.uninstall = function() {
66956       context.keybinding().off(key, true);
66957       context.history().on("change.save", null);
66958       context.on("enter.save", null);
66959       button = null;
66960       tooltipBehavior = null;
66961     };
66962     return tool;
66963   }
66964
66965   // modules/ui/tools/sidebar_toggle.js
66966   function uiToolSidebarToggle(context) {
66967     var tool = {
66968       id: "sidebar_toggle",
66969       label: _t.append("toolbar.inspect")
66970     };
66971     tool.render = function(selection2) {
66972       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
66973         context.ui().sidebar.toggle();
66974       }).call(
66975         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
66976       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
66977     };
66978     return tool;
66979   }
66980
66981   // modules/ui/tools/undo_redo.js
66982   function uiToolUndoRedo(context) {
66983     var tool = {
66984       id: "undo_redo",
66985       label: _t.append("toolbar.undo_redo")
66986     };
66987     var commands = [{
66988       id: "undo",
66989       cmd: uiCmd("\u2318Z"),
66990       action: function() {
66991         context.undo();
66992       },
66993       annotation: function() {
66994         return context.history().undoAnnotation();
66995       },
66996       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
66997     }, {
66998       id: "redo",
66999       cmd: uiCmd("\u2318\u21E7Z"),
67000       action: function() {
67001         context.redo();
67002       },
67003       annotation: function() {
67004         return context.history().redoAnnotation();
67005       },
67006       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
67007     }];
67008     function editable() {
67009       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(true);
67010     }
67011     tool.render = function(selection2) {
67012       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d) {
67013         return d.annotation() ? _t.append(d.id + ".tooltip", { action: d.annotation() }) : _t.append(d.id + ".nothing");
67014       }).keys(function(d) {
67015         return [d.cmd];
67016       }).scrollContainer(context.container().select(".top-toolbar"));
67017       var lastPointerUpType;
67018       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d) {
67019         return "disabled " + d.id + "-button bar-button";
67020       }).on("pointerup", function(d3_event) {
67021         lastPointerUpType = d3_event.pointerType;
67022       }).on("click", function(d3_event, d) {
67023         d3_event.preventDefault();
67024         var annotation = d.annotation();
67025         if (editable() && annotation) {
67026           d.action();
67027         }
67028         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
67029           var label = annotation ? _t.append(d.id + ".tooltip", { action: annotation }) : _t.append(d.id + ".nothing");
67030           context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass(annotation ? "" : "disabled").label(label)();
67031         }
67032         lastPointerUpType = null;
67033       }).call(tooltipBehavior);
67034       buttons.each(function(d) {
67035         select_default2(this).call(svgIcon("#" + d.icon));
67036       });
67037       context.keybinding().on(commands[0].cmd, function(d3_event) {
67038         d3_event.preventDefault();
67039         if (editable())
67040           commands[0].action();
67041       }).on(commands[1].cmd, function(d3_event) {
67042         d3_event.preventDefault();
67043         if (editable())
67044           commands[1].action();
67045       });
67046       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67047       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
67048       context.history().on("change.undo_redo", function(difference) {
67049         if (difference)
67050           update();
67051       });
67052       context.on("enter.undo_redo", update);
67053       function update() {
67054         buttons.classed("disabled", function(d) {
67055           return !editable() || !d.annotation();
67056         }).each(function() {
67057           var selection3 = select_default2(this);
67058           if (!selection3.select(".tooltip.in").empty()) {
67059             selection3.call(tooltipBehavior.updateContent);
67060           }
67061         });
67062       }
67063     };
67064     tool.uninstall = function() {
67065       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
67066       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
67067       context.history().on("change.undo_redo", null);
67068       context.on("enter.undo_redo", null);
67069     };
67070     return tool;
67071   }
67072
67073   // modules/ui/top_toolbar.js
67074   function uiTopToolbar(context) {
67075     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
67076     function notesEnabled() {
67077       var noteLayer = context.layers().layer("notes");
67078       return noteLayer && noteLayer.enabled();
67079     }
67080     function topToolbar(bar) {
67081       bar.on("wheel.topToolbar", function(d3_event) {
67082         if (!d3_event.deltaX) {
67083           bar.node().scrollLeft += d3_event.deltaY;
67084         }
67085       });
67086       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67087       context.layers().on("change.topToolbar", debouncedUpdate);
67088       update();
67089       function update() {
67090         var tools = [
67091           sidebarToggle,
67092           "spacer",
67093           modes
67094         ];
67095         tools.push("spacer");
67096         if (notesEnabled()) {
67097           tools = tools.concat([notes, "spacer"]);
67098         }
67099         tools = tools.concat([undoRedo, save]);
67100         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d) {
67101           return d.id || d;
67102         });
67103         toolbarItems.exit().each(function(d) {
67104           if (d.uninstall) {
67105             d.uninstall();
67106           }
67107         }).remove();
67108         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d) {
67109           var classes = "toolbar-item " + (d.id || d).replace("_", "-");
67110           if (d.klass)
67111             classes += " " + d.klass;
67112           return classes;
67113         });
67114         var actionableItems = itemsEnter.filter(function(d) {
67115           return d !== "spacer";
67116         });
67117         actionableItems.append("div").attr("class", "item-content").each(function(d) {
67118           select_default2(this).call(d.render, bar);
67119         });
67120         actionableItems.append("div").attr("class", "item-label").each(function(d) {
67121           d.label(select_default2(this));
67122         });
67123       }
67124     }
67125     return topToolbar;
67126   }
67127
67128   // modules/ui/zoom_to_selection.js
67129   function uiZoomToSelection(context) {
67130     function isDisabled() {
67131       var mode = context.mode();
67132       return !mode || !mode.zoomToSelected;
67133     }
67134     var _lastPointerUpType;
67135     function pointerup(d3_event) {
67136       _lastPointerUpType = d3_event.pointerType;
67137     }
67138     function click(d3_event) {
67139       d3_event.preventDefault();
67140       if (isDisabled()) {
67141         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
67142           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
67143         }
67144       } else {
67145         var mode = context.mode();
67146         if (mode && mode.zoomToSelected) {
67147           mode.zoomToSelected();
67148         }
67149       }
67150       _lastPointerUpType = null;
67151     }
67152     return function(selection2) {
67153       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
67154         if (isDisabled()) {
67155           return _t.append("inspector.zoom_to.no_selection");
67156         }
67157         return _t.append("inspector.zoom_to.title");
67158       }).keys([_t("inspector.zoom_to.key")]);
67159       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
67160       function setEnabledState() {
67161         button.classed("disabled", isDisabled());
67162         if (!button.select(".tooltip.in").empty()) {
67163           button.call(tooltipBehavior.updateContent);
67164         }
67165       }
67166       context.on("enter.uiZoomToSelection", setEnabledState);
67167       setEnabledState();
67168     };
67169   }
67170
67171   // modules/ui/pane.js
67172   function uiPane(id2, context) {
67173     var _key;
67174     var _label = "";
67175     var _description = "";
67176     var _iconName = "";
67177     var _sections;
67178     var _paneSelection = select_default2(null);
67179     var _paneTooltip;
67180     var pane = {
67181       id: id2
67182     };
67183     pane.label = function(val) {
67184       if (!arguments.length)
67185         return _label;
67186       _label = val;
67187       return pane;
67188     };
67189     pane.key = function(val) {
67190       if (!arguments.length)
67191         return _key;
67192       _key = val;
67193       return pane;
67194     };
67195     pane.description = function(val) {
67196       if (!arguments.length)
67197         return _description;
67198       _description = val;
67199       return pane;
67200     };
67201     pane.iconName = function(val) {
67202       if (!arguments.length)
67203         return _iconName;
67204       _iconName = val;
67205       return pane;
67206     };
67207     pane.sections = function(val) {
67208       if (!arguments.length)
67209         return _sections;
67210       _sections = val;
67211       return pane;
67212     };
67213     pane.selection = function() {
67214       return _paneSelection;
67215     };
67216     function hidePane() {
67217       context.ui().togglePanes();
67218     }
67219     pane.togglePane = function(d3_event) {
67220       if (d3_event)
67221         d3_event.preventDefault();
67222       _paneTooltip.hide();
67223       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
67224     };
67225     pane.renderToggleButton = function(selection2) {
67226       if (!_paneTooltip) {
67227         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
67228       }
67229       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
67230     };
67231     pane.renderContent = function(selection2) {
67232       if (_sections) {
67233         _sections.forEach(function(section) {
67234           selection2.call(section.render);
67235         });
67236       }
67237     };
67238     pane.renderPane = function(selection2) {
67239       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
67240       var heading = _paneSelection.append("div").attr("class", "pane-heading");
67241       heading.append("h2").text("").call(_label);
67242       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
67243       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
67244       if (_key) {
67245         context.keybinding().on(_key, pane.togglePane);
67246       }
67247     };
67248     return pane;
67249   }
67250
67251   // modules/ui/sections/background_display_options.js
67252   function uiSectionBackgroundDisplayOptions(context) {
67253     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
67254     var _storedOpacity = corePreferences("background-opacity");
67255     var _minVal = 0;
67256     var _maxVal = 3;
67257     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
67258     var _options = {
67259       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
67260       contrast: 1,
67261       saturation: 1,
67262       sharpness: 1
67263     };
67264     function clamp3(x, min3, max3) {
67265       return Math.max(min3, Math.min(x, max3));
67266     }
67267     function updateValue(d, val) {
67268       val = clamp3(val, _minVal, _maxVal);
67269       _options[d] = val;
67270       context.background()[d](val);
67271       if (d === "brightness") {
67272         corePreferences("background-opacity", val);
67273       }
67274       section.reRender();
67275     }
67276     function renderDisclosureContent(selection2) {
67277       var container = selection2.selectAll(".display-options-container").data([0]);
67278       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
67279       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d) {
67280         return "display-control display-control-" + d;
67281       });
67282       slidersEnter.html(function(d) {
67283         return _t.html("background." + d);
67284       }).append("span").attr("class", function(d) {
67285         return "display-option-value display-option-value-" + d;
67286       });
67287       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
67288       sildersControlEnter.append("input").attr("class", function(d) {
67289         return "display-option-input display-option-input-" + d;
67290       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d) {
67291         var val = select_default2(this).property("value");
67292         if (!val && d3_event && d3_event.target) {
67293           val = d3_event.target.value;
67294         }
67295         updateValue(d, val);
67296       });
67297       sildersControlEnter.append("button").attr("title", function(d) {
67298         return `${_t("background.reset")} ${_t("background." + d)}`;
67299       }).attr("class", function(d) {
67300         return "display-option-reset display-option-reset-" + d;
67301       }).on("click", function(d3_event, d) {
67302         if (d3_event.button !== 0)
67303           return;
67304         updateValue(d, 1);
67305       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
67306       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
67307         d3_event.preventDefault();
67308         for (var i2 = 0; i2 < _sliders.length; i2++) {
67309           updateValue(_sliders[i2], 1);
67310         }
67311       });
67312       container = containerEnter.merge(container);
67313       container.selectAll(".display-option-input").property("value", function(d) {
67314         return _options[d];
67315       });
67316       container.selectAll(".display-option-value").text(function(d) {
67317         return Math.floor(_options[d] * 100) + "%";
67318       });
67319       container.selectAll(".display-option-reset").classed("disabled", function(d) {
67320         return _options[d] === 1;
67321       });
67322       if (containerEnter.size() && _options.brightness !== 1) {
67323         context.background().brightness(_options.brightness);
67324       }
67325     }
67326     return section;
67327   }
67328
67329   // modules/ui/settings/custom_background.js
67330   function uiSettingsCustomBackground() {
67331     var dispatch10 = dispatch_default("change");
67332     function render(selection2) {
67333       var _origSettings = {
67334         template: corePreferences("background-custom-template")
67335       };
67336       var _currSettings = {
67337         template: corePreferences("background-custom-template")
67338       };
67339       var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
67340       var modal = uiConfirm(selection2).okButton();
67341       modal.classed("settings-modal settings-custom-background", true);
67342       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
67343       var textSection = modal.select(".modal-section.message-text");
67344       var instructions = `${_t.html("settings.custom_background.instructions.info")}
67345
67346 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
67347 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
67348 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
67349 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
67350 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
67351
67352 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
67353 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
67354 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
67355 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
67356 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
67357 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
67358
67359 #### ${_t.html("settings.custom_background.instructions.example")}
67360 \`${example}\``;
67361       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
67362       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
67363       var buttonSection = modal.select(".modal-section.buttons");
67364       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
67365       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
67366       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
67367       function isSaveDisabled() {
67368         return null;
67369       }
67370       function clickCancel() {
67371         textSection.select(".field-template").property("value", _origSettings.template);
67372         corePreferences("background-custom-template", _origSettings.template);
67373         this.blur();
67374         modal.close();
67375       }
67376       function clickSave() {
67377         _currSettings.template = textSection.select(".field-template").property("value");
67378         corePreferences("background-custom-template", _currSettings.template);
67379         this.blur();
67380         modal.close();
67381         dispatch10.call("change", this, _currSettings);
67382       }
67383     }
67384     return utilRebind(render, dispatch10, "on");
67385   }
67386
67387   // modules/ui/sections/background_list.js
67388   function uiSectionBackgroundList(context) {
67389     var _backgroundList = select_default2(null);
67390     var _customSource = context.background().findSource("custom");
67391     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
67392     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
67393     function previousBackgroundID() {
67394       return corePreferences("background-last-used-toggle");
67395     }
67396     function renderDisclosureContent(selection2) {
67397       var container = selection2.selectAll(".layer-background-list").data([0]);
67398       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
67399       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
67400       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
67401         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
67402       );
67403       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
67404         d3_event.preventDefault();
67405         uiMapInMap.toggle();
67406       });
67407       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
67408       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
67409         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
67410       );
67411       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
67412         d3_event.preventDefault();
67413         context.ui().info.toggle("background");
67414       });
67415       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
67416       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
67417         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
67418       );
67419       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
67420         d3_event.preventDefault();
67421         context.ui().info.toggle("location");
67422       });
67423       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
67424       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"));
67425       _backgroundList.call(drawListItems, "radio", function(d3_event, d) {
67426         chooseBackground(d);
67427       }, function(d) {
67428         return !d.isHidden() && !d.overlay;
67429       });
67430     }
67431     function setTooltips(selection2) {
67432       selection2.each(function(d, i2, nodes) {
67433         var item = select_default2(this).select("label");
67434         var span = item.select("span");
67435         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
67436         var description = d.description();
67437         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
67438         item.call(uiTooltip().destroyAny);
67439         if (d.id === previousBackgroundID()) {
67440           item.call(
67441             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
67442           );
67443         } else if (description || isOverflowing) {
67444           item.call(
67445             uiTooltip().placement(placement).title(() => description || d.label())
67446           );
67447         }
67448       });
67449     }
67450     function drawListItems(layerList, type3, change, filter2) {
67451       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a, b) {
67452         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
67453       });
67454       var layerLinks = layerList.selectAll("li").data(sources, function(d, i2) {
67455         return d.id + "---" + i2;
67456       });
67457       layerLinks.exit().remove();
67458       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d) {
67459         return d.id === "custom";
67460       }).classed("best", function(d) {
67461         return d.best();
67462       });
67463       var label = enter.append("label");
67464       label.append("input").attr("type", type3).attr("name", "background-layer").attr("value", function(d) {
67465         return d.id;
67466       }).on("change", change);
67467       label.append("span").each(function(d) {
67468         d.label()(select_default2(this));
67469       });
67470       enter.filter(function(d) {
67471         return d.id === "custom";
67472       }).append("button").attr("class", "layer-browse").call(
67473         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
67474       ).on("click", function(d3_event) {
67475         d3_event.preventDefault();
67476         editCustom();
67477       }).call(svgIcon("#iD-icon-more"));
67478       enter.filter(function(d) {
67479         return d.best();
67480       }).append("div").attr("class", "best").call(
67481         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
67482       ).append("span").text("\u2605");
67483       layerList.call(updateLayerSelections);
67484     }
67485     function updateLayerSelections(selection2) {
67486       function active(d) {
67487         return context.background().showsLayer(d);
67488       }
67489       selection2.selectAll("li").classed("active", active).classed("switch", function(d) {
67490         return d.id === previousBackgroundID();
67491       }).call(setTooltips).selectAll("input").property("checked", active);
67492     }
67493     function chooseBackground(d) {
67494       if (d.id === "custom" && !d.template()) {
67495         return editCustom();
67496       }
67497       var previousBackground = context.background().baseLayerSource();
67498       corePreferences("background-last-used-toggle", previousBackground.id);
67499       corePreferences("background-last-used", d.id);
67500       context.background().baseLayerSource(d);
67501     }
67502     function customChanged(d) {
67503       if (d && d.template) {
67504         _customSource.template(d.template);
67505         chooseBackground(_customSource);
67506       } else {
67507         _customSource.template("");
67508         chooseBackground(context.background().findSource("none"));
67509       }
67510     }
67511     function editCustom() {
67512       context.container().call(_settingsCustomBackground);
67513     }
67514     context.background().on("change.background_list", function() {
67515       _backgroundList.call(updateLayerSelections);
67516     });
67517     context.map().on(
67518       "move.background_list",
67519       debounce_default(function() {
67520         window.requestIdleCallback(section.reRender);
67521       }, 1e3)
67522     );
67523     return section;
67524   }
67525
67526   // modules/ui/sections/background_offset.js
67527   function uiSectionBackgroundOffset(context) {
67528     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
67529     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
67530     var _directions = [
67531       ["top", [0, -0.5]],
67532       ["left", [-0.5, 0]],
67533       ["right", [0.5, 0]],
67534       ["bottom", [0, 0.5]]
67535     ];
67536     function updateValue() {
67537       var meters = geoOffsetToMeters(context.background().offset());
67538       var x = +meters[0].toFixed(2);
67539       var y = +meters[1].toFixed(2);
67540       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x + ", " + y);
67541       context.container().selectAll(".nudge-reset").classed("disabled", function() {
67542         return x === 0 && y === 0;
67543       });
67544     }
67545     function resetOffset() {
67546       context.background().offset([0, 0]);
67547       updateValue();
67548     }
67549     function nudge(d) {
67550       context.background().nudge(d, context.map().zoom());
67551       updateValue();
67552     }
67553     function inputOffset() {
67554       var input = select_default2(this);
67555       var d = input.node().value;
67556       if (d === "")
67557         return resetOffset();
67558       d = d.replace(/;/g, ",").split(",").map(function(n2) {
67559         return !isNaN(n2) && n2;
67560       });
67561       if (d.length !== 2 || !d[0] || !d[1]) {
67562         input.classed("error", true);
67563         return;
67564       }
67565       context.background().offset(geoMetersToOffset(d));
67566       updateValue();
67567     }
67568     function dragOffset(d3_event) {
67569       if (d3_event.button !== 0)
67570         return;
67571       var origin = [d3_event.clientX, d3_event.clientY];
67572       var pointerId = d3_event.pointerId || "mouse";
67573       context.container().append("div").attr("class", "nudge-surface");
67574       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
67575       if (_pointerPrefix === "pointer") {
67576         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
67577       }
67578       function pointermove(d3_event2) {
67579         if (pointerId !== (d3_event2.pointerId || "mouse"))
67580           return;
67581         var latest = [d3_event2.clientX, d3_event2.clientY];
67582         var d = [
67583           -(origin[0] - latest[0]) / 4,
67584           -(origin[1] - latest[1]) / 4
67585         ];
67586         origin = latest;
67587         nudge(d);
67588       }
67589       function pointerup(d3_event2) {
67590         if (pointerId !== (d3_event2.pointerId || "mouse"))
67591           return;
67592         if (d3_event2.button !== 0)
67593           return;
67594         context.container().selectAll(".nudge-surface").remove();
67595         select_default2(window).on(".drag-bg-offset", null);
67596       }
67597     }
67598     function renderDisclosureContent(selection2) {
67599       var container = selection2.selectAll(".nudge-container").data([0]);
67600       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
67601       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
67602       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
67603       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
67604       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
67605       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d) {
67606         return _t(`background.nudge.${d[0]}`);
67607       }).attr("class", function(d) {
67608         return d[0] + " nudge";
67609       }).on("click", function(d3_event, d) {
67610         nudge(d[1]);
67611       });
67612       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
67613         d3_event.preventDefault();
67614         resetOffset();
67615       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
67616       updateValue();
67617     }
67618     context.background().on("change.backgroundOffset-update", updateValue);
67619     return section;
67620   }
67621
67622   // modules/ui/sections/overlay_list.js
67623   function uiSectionOverlayList(context) {
67624     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
67625     var _overlayList = select_default2(null);
67626     function setTooltips(selection2) {
67627       selection2.each(function(d, i2, nodes) {
67628         var item = select_default2(this).select("label");
67629         var span = item.select("span");
67630         var placement = i2 < nodes.length / 2 ? "bottom" : "top";
67631         var description = d.description();
67632         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
67633         item.call(uiTooltip().destroyAny);
67634         if (description || isOverflowing) {
67635           item.call(
67636             uiTooltip().placement(placement).title(() => description || d.name())
67637           );
67638         }
67639       });
67640     }
67641     function updateLayerSelections(selection2) {
67642       function active(d) {
67643         return context.background().showsLayer(d);
67644       }
67645       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
67646     }
67647     function chooseOverlay(d3_event, d) {
67648       d3_event.preventDefault();
67649       context.background().toggleOverlayLayer(d);
67650       _overlayList.call(updateLayerSelections);
67651       document.activeElement.blur();
67652     }
67653     function drawListItems(layerList, type3, change, filter2) {
67654       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
67655       var layerLinks = layerList.selectAll("li").data(sources, function(d) {
67656         return d.name();
67657       });
67658       layerLinks.exit().remove();
67659       var enter = layerLinks.enter().append("li");
67660       var label = enter.append("label");
67661       label.append("input").attr("type", type3).attr("name", "layers").on("change", change);
67662       label.append("span").each(function(d) {
67663         d.label()(select_default2(this));
67664       });
67665       layerList.selectAll("li").sort(sortSources);
67666       layerList.call(updateLayerSelections);
67667       function sortSources(a, b) {
67668         return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
67669       }
67670     }
67671     function renderDisclosureContent(selection2) {
67672       var container = selection2.selectAll(".layer-overlay-list").data([0]);
67673       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
67674       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d) {
67675         return !d.isHidden() && d.overlay;
67676       });
67677     }
67678     context.map().on(
67679       "move.overlay_list",
67680       debounce_default(function() {
67681         window.requestIdleCallback(section.reRender);
67682       }, 1e3)
67683     );
67684     return section;
67685   }
67686
67687   // modules/ui/panes/background.js
67688   function uiPaneBackground(context) {
67689     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
67690       uiSectionBackgroundList(context),
67691       uiSectionOverlayList(context),
67692       uiSectionBackgroundDisplayOptions(context),
67693       uiSectionBackgroundOffset(context)
67694     ]);
67695     return backgroundPane;
67696   }
67697
67698   // modules/ui/panes/help.js
67699   function uiPaneHelp(context) {
67700     var docKeys = [
67701       ["help", [
67702         "welcome",
67703         "open_data_h",
67704         "open_data",
67705         "before_start_h",
67706         "before_start",
67707         "open_source_h",
67708         "open_source",
67709         "open_source_help"
67710       ]],
67711       ["overview", [
67712         "navigation_h",
67713         "navigation_drag",
67714         "navigation_zoom",
67715         "features_h",
67716         "features",
67717         "nodes_ways"
67718       ]],
67719       ["editing", [
67720         "select_h",
67721         "select_left_click",
67722         "select_right_click",
67723         "select_space",
67724         "multiselect_h",
67725         "multiselect",
67726         "multiselect_shift_click",
67727         "multiselect_lasso",
67728         "undo_redo_h",
67729         "undo_redo",
67730         "save_h",
67731         "save",
67732         "save_validation",
67733         "upload_h",
67734         "upload",
67735         "backups_h",
67736         "backups",
67737         "keyboard_h",
67738         "keyboard"
67739       ]],
67740       ["feature_editor", [
67741         "intro",
67742         "definitions",
67743         "type_h",
67744         "type",
67745         "type_picker",
67746         "fields_h",
67747         "fields_all_fields",
67748         "fields_example",
67749         "fields_add_field",
67750         "tags_h",
67751         "tags_all_tags",
67752         "tags_resources"
67753       ]],
67754       ["points", [
67755         "intro",
67756         "add_point_h",
67757         "add_point",
67758         "add_point_finish",
67759         "move_point_h",
67760         "move_point",
67761         "delete_point_h",
67762         "delete_point",
67763         "delete_point_command"
67764       ]],
67765       ["lines", [
67766         "intro",
67767         "add_line_h",
67768         "add_line",
67769         "add_line_draw",
67770         "add_line_continue",
67771         "add_line_finish",
67772         "modify_line_h",
67773         "modify_line_dragnode",
67774         "modify_line_addnode",
67775         "connect_line_h",
67776         "connect_line",
67777         "connect_line_display",
67778         "connect_line_drag",
67779         "connect_line_tag",
67780         "disconnect_line_h",
67781         "disconnect_line_command",
67782         "move_line_h",
67783         "move_line_command",
67784         "move_line_connected",
67785         "delete_line_h",
67786         "delete_line",
67787         "delete_line_command"
67788       ]],
67789       ["areas", [
67790         "intro",
67791         "point_or_area_h",
67792         "point_or_area",
67793         "add_area_h",
67794         "add_area_command",
67795         "add_area_draw",
67796         "add_area_continue",
67797         "add_area_finish",
67798         "square_area_h",
67799         "square_area_command",
67800         "modify_area_h",
67801         "modify_area_dragnode",
67802         "modify_area_addnode",
67803         "delete_area_h",
67804         "delete_area",
67805         "delete_area_command"
67806       ]],
67807       ["relations", [
67808         "intro",
67809         "edit_relation_h",
67810         "edit_relation",
67811         "edit_relation_add",
67812         "edit_relation_delete",
67813         "maintain_relation_h",
67814         "maintain_relation",
67815         "relation_types_h",
67816         "multipolygon_h",
67817         "multipolygon",
67818         "multipolygon_create",
67819         "multipolygon_merge",
67820         "turn_restriction_h",
67821         "turn_restriction",
67822         "turn_restriction_field",
67823         "turn_restriction_editing",
67824         "route_h",
67825         "route",
67826         "route_add",
67827         "boundary_h",
67828         "boundary",
67829         "boundary_add"
67830       ]],
67831       ["operations", [
67832         "intro",
67833         "intro_2",
67834         "straighten",
67835         "orthogonalize",
67836         "circularize",
67837         "move",
67838         "rotate",
67839         "reflect",
67840         "continue",
67841         "reverse",
67842         "disconnect",
67843         "split",
67844         "extract",
67845         "merge",
67846         "delete",
67847         "downgrade",
67848         "copy_paste"
67849       ]],
67850       ["notes", [
67851         "intro",
67852         "add_note_h",
67853         "add_note",
67854         "place_note",
67855         "move_note",
67856         "update_note_h",
67857         "update_note",
67858         "save_note_h",
67859         "save_note"
67860       ]],
67861       ["imagery", [
67862         "intro",
67863         "sources_h",
67864         "choosing",
67865         "sources",
67866         "offsets_h",
67867         "offset",
67868         "offset_change"
67869       ]],
67870       ["streetlevel", [
67871         "intro",
67872         "using_h",
67873         "using",
67874         "photos",
67875         "viewer"
67876       ]],
67877       ["gps", [
67878         "intro",
67879         "survey",
67880         "using_h",
67881         "using",
67882         "tracing",
67883         "upload"
67884       ]],
67885       ["qa", [
67886         "intro",
67887         "tools_h",
67888         "tools",
67889         "issues_h",
67890         "issues"
67891       ]]
67892     ];
67893     var headings = {
67894       "help.help.open_data_h": 3,
67895       "help.help.before_start_h": 3,
67896       "help.help.open_source_h": 3,
67897       "help.overview.navigation_h": 3,
67898       "help.overview.features_h": 3,
67899       "help.editing.select_h": 3,
67900       "help.editing.multiselect_h": 3,
67901       "help.editing.undo_redo_h": 3,
67902       "help.editing.save_h": 3,
67903       "help.editing.upload_h": 3,
67904       "help.editing.backups_h": 3,
67905       "help.editing.keyboard_h": 3,
67906       "help.feature_editor.type_h": 3,
67907       "help.feature_editor.fields_h": 3,
67908       "help.feature_editor.tags_h": 3,
67909       "help.points.add_point_h": 3,
67910       "help.points.move_point_h": 3,
67911       "help.points.delete_point_h": 3,
67912       "help.lines.add_line_h": 3,
67913       "help.lines.modify_line_h": 3,
67914       "help.lines.connect_line_h": 3,
67915       "help.lines.disconnect_line_h": 3,
67916       "help.lines.move_line_h": 3,
67917       "help.lines.delete_line_h": 3,
67918       "help.areas.point_or_area_h": 3,
67919       "help.areas.add_area_h": 3,
67920       "help.areas.square_area_h": 3,
67921       "help.areas.modify_area_h": 3,
67922       "help.areas.delete_area_h": 3,
67923       "help.relations.edit_relation_h": 3,
67924       "help.relations.maintain_relation_h": 3,
67925       "help.relations.relation_types_h": 2,
67926       "help.relations.multipolygon_h": 3,
67927       "help.relations.turn_restriction_h": 3,
67928       "help.relations.route_h": 3,
67929       "help.relations.boundary_h": 3,
67930       "help.notes.add_note_h": 3,
67931       "help.notes.update_note_h": 3,
67932       "help.notes.save_note_h": 3,
67933       "help.imagery.sources_h": 3,
67934       "help.imagery.offsets_h": 3,
67935       "help.streetlevel.using_h": 3,
67936       "help.gps.using_h": 3,
67937       "help.qa.tools_h": 3,
67938       "help.qa.issues_h": 3
67939     };
67940     var docs = docKeys.map(function(key) {
67941       var helpkey = "help." + key[0];
67942       var helpPaneReplacements = { version: context.version };
67943       var text2 = key[1].reduce(function(all, part) {
67944         var subkey = helpkey + "." + part;
67945         var depth = headings[subkey];
67946         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
67947         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
67948       }, "");
67949       return {
67950         title: _t.html(helpkey + ".title"),
67951         content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
67952       };
67953     });
67954     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
67955     helpPane.renderContent = function(content) {
67956       function clickHelp(d, i2) {
67957         var rtl = _mainLocalizer.textDirection() === "rtl";
67958         content.property("scrollTop", 0);
67959         helpPane.selection().select(".pane-heading h2").html(d.title);
67960         body.html(d.content);
67961         body.selectAll("a").attr("target", "_blank");
67962         menuItems.classed("selected", function(m) {
67963           return m.title === d.title;
67964         });
67965         nav.html("");
67966         if (rtl) {
67967           nav.call(drawNext).call(drawPrevious);
67968         } else {
67969           nav.call(drawPrevious).call(drawNext);
67970         }
67971         function drawNext(selection2) {
67972           if (i2 < docs.length - 1) {
67973             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
67974               d3_event.preventDefault();
67975               clickHelp(docs[i2 + 1], i2 + 1);
67976             });
67977             nextLink.append("span").html(docs[i2 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
67978           }
67979         }
67980         function drawPrevious(selection2) {
67981           if (i2 > 0) {
67982             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
67983               d3_event.preventDefault();
67984               clickHelp(docs[i2 - 1], i2 - 1);
67985             });
67986             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i2 - 1].title);
67987           }
67988         }
67989       }
67990       function clickWalkthrough(d3_event) {
67991         d3_event.preventDefault();
67992         if (context.inIntro())
67993           return;
67994         context.container().call(uiIntro(context));
67995         context.ui().togglePanes();
67996       }
67997       function clickShortcuts(d3_event) {
67998         d3_event.preventDefault();
67999         context.container().call(context.ui().shortcuts, true);
68000       }
68001       var toc = content.append("ul").attr("class", "toc");
68002       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d) {
68003         return d.title;
68004       }).on("click", function(d3_event, d) {
68005         d3_event.preventDefault();
68006         clickHelp(d, docs.indexOf(d));
68007       });
68008       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
68009         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
68010       ).append("a").attr("href", "#").on("click", clickShortcuts);
68011       shortcuts.append("div").call(_t.append("shortcuts.title"));
68012       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
68013       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68014       walkthrough.append("div").call(_t.append("splash.walkthrough"));
68015       var helpContent = content.append("div").attr("class", "left-content");
68016       var body = helpContent.append("div").attr("class", "body");
68017       var nav = helpContent.append("div").attr("class", "nav");
68018       clickHelp(docs[0], 0);
68019     };
68020     return helpPane;
68021   }
68022
68023   // modules/ui/sections/validation_issues.js
68024   function uiSectionValidationIssues(id2, severity, context) {
68025     var _issues = [];
68026     var section = uiSection(id2, context).label(function() {
68027       if (!_issues)
68028         return "";
68029       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
68030       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
68031     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
68032       return _issues && _issues.length;
68033     });
68034     function getOptions() {
68035       return {
68036         what: corePreferences("validate-what") || "edited",
68037         where: corePreferences("validate-where") || "all"
68038       };
68039     }
68040     function reloadIssues() {
68041       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
68042     }
68043     function renderDisclosureContent(selection2) {
68044       var center = context.map().center();
68045       var graph = context.graph();
68046       var issues = _issues.map(function withDistance(issue) {
68047         var extent = issue.extent(graph);
68048         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
68049         return Object.assign(issue, { dist });
68050       }).sort(function byDistance(a, b) {
68051         return a.dist - b.dist;
68052       });
68053       issues = issues.slice(0, 1e3);
68054       selection2.call(drawIssuesList, issues);
68055     }
68056     function drawIssuesList(selection2, issues) {
68057       var list = selection2.selectAll(".issues-list").data([0]);
68058       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
68059       var items = list.selectAll("li").data(issues, function(d) {
68060         return d.key;
68061       });
68062       items.exit().remove();
68063       var itemsEnter = items.enter().append("li").attr("class", function(d) {
68064         return "issue severity-" + d.severity;
68065       });
68066       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d) {
68067         context.validator().focusIssue(d);
68068       }).on("mouseover", function(d3_event, d) {
68069         utilHighlightEntities(d.entityIds, true, context);
68070       }).on("mouseout", function(d3_event, d) {
68071         utilHighlightEntities(d.entityIds, false, context);
68072       });
68073       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
68074       textEnter.append("span").attr("class", "issue-icon").each(function(d) {
68075         var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
68076         select_default2(this).call(svgIcon(iconName));
68077       });
68078       textEnter.append("span").attr("class", "issue-message");
68079       items = items.merge(itemsEnter).order();
68080       items.selectAll(".issue-message").text("").each(function(d) {
68081         return d.message(context)(select_default2(this));
68082       });
68083     }
68084     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
68085       window.requestIdleCallback(function() {
68086         reloadIssues();
68087         section.reRender();
68088       });
68089     });
68090     context.map().on(
68091       "move.uiSectionValidationIssues" + id2,
68092       debounce_default(function() {
68093         window.requestIdleCallback(function() {
68094           if (getOptions().where === "visible") {
68095             reloadIssues();
68096           }
68097           section.reRender();
68098         });
68099       }, 1e3)
68100     );
68101     return section;
68102   }
68103
68104   // modules/ui/sections/validation_options.js
68105   function uiSectionValidationOptions(context) {
68106     var section = uiSection("issues-options", context).content(renderContent);
68107     function renderContent(selection2) {
68108       var container = selection2.selectAll(".issues-options-container").data([0]);
68109       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
68110       var data = [
68111         { key: "what", values: ["edited", "all"] },
68112         { key: "where", values: ["visible", "all"] }
68113       ];
68114       var options2 = container.selectAll(".issues-option").data(data, function(d) {
68115         return d.key;
68116       });
68117       var optionsEnter = options2.enter().append("div").attr("class", function(d) {
68118         return "issues-option issues-option-" + d.key;
68119       });
68120       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d) {
68121         return _t.html("issues.options." + d.key + ".title");
68122       });
68123       var valuesEnter = optionsEnter.selectAll("label").data(function(d) {
68124         return d.values.map(function(val) {
68125           return { value: val, key: d.key };
68126         });
68127       }).enter().append("label");
68128       valuesEnter.append("input").attr("type", "radio").attr("name", function(d) {
68129         return "issues-option-" + d.key;
68130       }).attr("value", function(d) {
68131         return d.value;
68132       }).property("checked", function(d) {
68133         return getOptions()[d.key] === d.value;
68134       }).on("change", function(d3_event, d) {
68135         updateOptionValue(d3_event, d.key, d.value);
68136       });
68137       valuesEnter.append("span").html(function(d) {
68138         return _t.html("issues.options." + d.key + "." + d.value);
68139       });
68140     }
68141     function getOptions() {
68142       return {
68143         what: corePreferences("validate-what") || "edited",
68144         where: corePreferences("validate-where") || "all"
68145       };
68146     }
68147     function updateOptionValue(d3_event, d, val) {
68148       if (!val && d3_event && d3_event.target) {
68149         val = d3_event.target.value;
68150       }
68151       corePreferences("validate-" + d, val);
68152       context.validator().validate();
68153     }
68154     return section;
68155   }
68156
68157   // modules/ui/sections/validation_rules.js
68158   function uiSectionValidationRules(context) {
68159     var MINSQUARE = 0;
68160     var MAXSQUARE = 20;
68161     var DEFAULTSQUARE = 5;
68162     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
68163     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
68164       return key !== "maprules";
68165     }).sort(function(key1, key2) {
68166       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
68167     });
68168     function renderDisclosureContent(selection2) {
68169       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
68170       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
68171       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
68172       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
68173       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
68174         d3_event.preventDefault();
68175         context.validator().disableRules(_ruleKeys);
68176       });
68177       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
68178         d3_event.preventDefault();
68179         context.validator().disableRules([]);
68180       });
68181       container = container.merge(containerEnter);
68182       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
68183     }
68184     function drawListItems(selection2, data, type3, name, change, active) {
68185       var items = selection2.selectAll("li").data(data);
68186       items.exit().remove();
68187       var enter = items.enter().append("li");
68188       if (name === "rule") {
68189         enter.call(
68190           uiTooltip().title(function(d) {
68191             return _t.append("issues." + d + ".tip");
68192           }).placement("top")
68193         );
68194       }
68195       var label = enter.append("label");
68196       label.append("input").attr("type", type3).attr("name", name).on("change", change);
68197       label.append("span").html(function(d) {
68198         var params = {};
68199         if (d === "unsquare_way") {
68200           params.val = { html: '<span class="square-degrees"></span>' };
68201         }
68202         return _t.html("issues." + d + ".title", params);
68203       });
68204       items = items.merge(enter);
68205       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
68206       var degStr = corePreferences("validate-square-degrees");
68207       if (degStr === null) {
68208         degStr = DEFAULTSQUARE.toString();
68209       }
68210       var span = items.selectAll(".square-degrees");
68211       var input = span.selectAll(".square-degrees-input").data([0]);
68212       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) {
68213         d3_event.preventDefault();
68214         d3_event.stopPropagation();
68215         this.select();
68216       }).on("keyup", function(d3_event) {
68217         if (d3_event.keyCode === 13) {
68218           this.blur();
68219           this.select();
68220         }
68221       }).on("blur", changeSquare).merge(input).property("value", degStr);
68222     }
68223     function changeSquare() {
68224       var input = select_default2(this);
68225       var degStr = utilGetSetValue(input).trim();
68226       var degNum = parseFloat(degStr, 10);
68227       if (!isFinite(degNum)) {
68228         degNum = DEFAULTSQUARE;
68229       } else if (degNum > MAXSQUARE) {
68230         degNum = MAXSQUARE;
68231       } else if (degNum < MINSQUARE) {
68232         degNum = MINSQUARE;
68233       }
68234       degNum = Math.round(degNum * 10) / 10;
68235       degStr = degNum.toString();
68236       input.property("value", degStr);
68237       corePreferences("validate-square-degrees", degStr);
68238       context.validator().revalidateUnsquare();
68239     }
68240     function isRuleEnabled(d) {
68241       return context.validator().isRuleEnabled(d);
68242     }
68243     function toggleRule(d3_event, d) {
68244       context.validator().toggleRule(d);
68245     }
68246     context.validator().on("validated.uiSectionValidationRules", function() {
68247       window.requestIdleCallback(section.reRender);
68248     });
68249     return section;
68250   }
68251
68252   // modules/ui/sections/validation_status.js
68253   function uiSectionValidationStatus(context) {
68254     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
68255       var issues = context.validator().getIssues(getOptions());
68256       return issues.length === 0;
68257     });
68258     function getOptions() {
68259       return {
68260         what: corePreferences("validate-what") || "edited",
68261         where: corePreferences("validate-where") || "all"
68262       };
68263     }
68264     function renderContent(selection2) {
68265       var box = selection2.selectAll(".box").data([0]);
68266       var boxEnter = box.enter().append("div").attr("class", "box");
68267       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
68268       var noIssuesMessage = boxEnter.append("span");
68269       noIssuesMessage.append("strong").attr("class", "message");
68270       noIssuesMessage.append("br");
68271       noIssuesMessage.append("span").attr("class", "details");
68272       renderIgnoredIssuesReset(selection2);
68273       setNoIssuesText(selection2);
68274     }
68275     function renderIgnoredIssuesReset(selection2) {
68276       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
68277       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
68278       resetIgnored.exit().remove();
68279       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
68280       resetIgnoredEnter.append("a").attr("href", "#");
68281       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
68282       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
68283       resetIgnored.on("click", function(d3_event) {
68284         d3_event.preventDefault();
68285         context.validator().resetIgnoredIssues();
68286       });
68287     }
68288     function setNoIssuesText(selection2) {
68289       var opts = getOptions();
68290       function checkForHiddenIssues(cases) {
68291         for (var type3 in cases) {
68292           var hiddenOpts = cases[type3];
68293           var hiddenIssues = context.validator().getIssues(hiddenOpts);
68294           if (hiddenIssues.length) {
68295             selection2.select(".box .details").html("").call(_t.append(
68296               "issues.no_issues.hidden_issues." + type3,
68297               { count: hiddenIssues.length.toString() }
68298             ));
68299             return;
68300           }
68301         }
68302         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
68303       }
68304       var messageType;
68305       if (opts.what === "edited" && opts.where === "visible") {
68306         messageType = "edits_in_view";
68307         checkForHiddenIssues({
68308           elsewhere: { what: "edited", where: "all" },
68309           everything_else: { what: "all", where: "visible" },
68310           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
68311           everything_else_elsewhere: { what: "all", where: "all" },
68312           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
68313           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
68314           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
68315         });
68316       } else if (opts.what === "edited" && opts.where === "all") {
68317         messageType = "edits";
68318         checkForHiddenIssues({
68319           everything_else: { what: "all", where: "all" },
68320           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
68321           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
68322         });
68323       } else if (opts.what === "all" && opts.where === "visible") {
68324         messageType = "everything_in_view";
68325         checkForHiddenIssues({
68326           elsewhere: { what: "all", where: "all" },
68327           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
68328           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
68329           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
68330           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
68331         });
68332       } else if (opts.what === "all" && opts.where === "all") {
68333         messageType = "everything";
68334         checkForHiddenIssues({
68335           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
68336           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
68337         });
68338       }
68339       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
68340         messageType = "no_edits";
68341       }
68342       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
68343     }
68344     context.validator().on("validated.uiSectionValidationStatus", function() {
68345       window.requestIdleCallback(section.reRender);
68346     });
68347     context.map().on(
68348       "move.uiSectionValidationStatus",
68349       debounce_default(function() {
68350         window.requestIdleCallback(section.reRender);
68351       }, 1e3)
68352     );
68353     return section;
68354   }
68355
68356   // modules/ui/panes/issues.js
68357   function uiPaneIssues(context) {
68358     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
68359       uiSectionValidationOptions(context),
68360       uiSectionValidationStatus(context),
68361       uiSectionValidationIssues("issues-errors", "error", context),
68362       uiSectionValidationIssues("issues-warnings", "warning", context),
68363       uiSectionValidationRules(context)
68364     ]);
68365     return issuesPane;
68366   }
68367
68368   // modules/ui/settings/custom_data.js
68369   function uiSettingsCustomData(context) {
68370     var dispatch10 = dispatch_default("change");
68371     function render(selection2) {
68372       var dataLayer = context.layers().layer("data");
68373       var _origSettings = {
68374         fileList: dataLayer && dataLayer.fileList() || null,
68375         url: corePreferences("settings-custom-data-url")
68376       };
68377       var _currSettings = {
68378         fileList: dataLayer && dataLayer.fileList() || null,
68379         url: corePreferences("settings-custom-data-url")
68380       };
68381       var modal = uiConfirm(selection2).okButton();
68382       modal.classed("settings-modal settings-custom-data", true);
68383       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
68384       var textSection = modal.select(".modal-section.message-text");
68385       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
68386       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) {
68387         var files = d3_event.target.files;
68388         if (files && files.length) {
68389           _currSettings.url = "";
68390           textSection.select(".field-url").property("value", "");
68391           _currSettings.fileList = files;
68392         } else {
68393           _currSettings.fileList = null;
68394         }
68395       });
68396       textSection.append("h4").call(_t.append("settings.custom_data.or"));
68397       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
68398       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
68399       var buttonSection = modal.select(".modal-section.buttons");
68400       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
68401       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
68402       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
68403       function isSaveDisabled() {
68404         return null;
68405       }
68406       function clickCancel() {
68407         textSection.select(".field-url").property("value", _origSettings.url);
68408         corePreferences("settings-custom-data-url", _origSettings.url);
68409         this.blur();
68410         modal.close();
68411       }
68412       function clickSave() {
68413         _currSettings.url = textSection.select(".field-url").property("value").trim();
68414         if (_currSettings.url) {
68415           _currSettings.fileList = null;
68416         }
68417         if (_currSettings.fileList) {
68418           _currSettings.url = "";
68419         }
68420         corePreferences("settings-custom-data-url", _currSettings.url);
68421         this.blur();
68422         modal.close();
68423         dispatch10.call("change", this, _currSettings);
68424       }
68425     }
68426     return utilRebind(render, dispatch10, "on");
68427   }
68428
68429   // modules/ui/sections/data_layers.js
68430   function uiSectionDataLayers(context) {
68431     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
68432     var layers = context.layers();
68433     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
68434     function renderDisclosureContent(selection2) {
68435       var container = selection2.selectAll(".data-layer-container").data([0]);
68436       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
68437     }
68438     function showsLayer(which) {
68439       var layer = layers.layer(which);
68440       if (layer) {
68441         return layer.enabled();
68442       }
68443       return false;
68444     }
68445     function setLayer(which, enabled) {
68446       var mode = context.mode();
68447       if (mode && /^draw/.test(mode.id))
68448         return;
68449       var layer = layers.layer(which);
68450       if (layer) {
68451         layer.enabled(enabled);
68452         if (!enabled && (which === "osm" || which === "notes")) {
68453           context.enter(modeBrowse(context));
68454         }
68455       }
68456     }
68457     function toggleLayer(which) {
68458       setLayer(which, !showsLayer(which));
68459     }
68460     function drawOsmItems(selection2) {
68461       var osmKeys = ["osm", "notes"];
68462       var osmLayers = layers.all().filter(function(obj) {
68463         return osmKeys.indexOf(obj.id) !== -1;
68464       });
68465       var ul = selection2.selectAll(".layer-list-osm").data([0]);
68466       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
68467       var li = ul.selectAll(".list-item").data(osmLayers);
68468       li.exit().remove();
68469       var liEnter = li.enter().append("li").attr("class", function(d) {
68470         return "list-item list-item-" + d.id;
68471       });
68472       var labelEnter = liEnter.append("label").each(function(d) {
68473         if (d.id === "osm") {
68474           select_default2(this).call(
68475             uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
68476           );
68477         } else {
68478           select_default2(this).call(
68479             uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).placement("bottom")
68480           );
68481         }
68482       });
68483       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
68484         toggleLayer(d.id);
68485       });
68486       labelEnter.append("span").html(function(d) {
68487         return _t.html("map_data.layers." + d.id + ".title");
68488       });
68489       li.merge(liEnter).classed("active", function(d) {
68490         return d.layer.enabled();
68491       }).selectAll("input").property("checked", function(d) {
68492         return d.layer.enabled();
68493       });
68494     }
68495     function drawQAItems(selection2) {
68496       var qaKeys = ["keepRight", "improveOSM", "osmose"];
68497       var qaLayers = layers.all().filter(function(obj) {
68498         return qaKeys.indexOf(obj.id) !== -1;
68499       });
68500       var ul = selection2.selectAll(".layer-list-qa").data([0]);
68501       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
68502       var li = ul.selectAll(".list-item").data(qaLayers);
68503       li.exit().remove();
68504       var liEnter = li.enter().append("li").attr("class", function(d) {
68505         return "list-item list-item-" + d.id;
68506       });
68507       var labelEnter = liEnter.append("label").each(function(d) {
68508         select_default2(this).call(
68509           uiTooltip().title(() => _t.append("map_data.layers." + d.id + ".tooltip")).placement("bottom")
68510         );
68511       });
68512       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
68513         toggleLayer(d.id);
68514       });
68515       labelEnter.append("span").each(function(d) {
68516         _t.append("map_data.layers." + d.id + ".title")(select_default2(this));
68517       });
68518       li.merge(liEnter).classed("active", function(d) {
68519         return d.layer.enabled();
68520       }).selectAll("input").property("checked", function(d) {
68521         return d.layer.enabled();
68522       });
68523     }
68524     function drawVectorItems(selection2) {
68525       var dataLayer = layers.layer("data");
68526       var vtData = [
68527         {
68528           name: "Detroit Neighborhoods/Parks",
68529           src: "neighborhoods-parks",
68530           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
68531           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"
68532         },
68533         {
68534           name: "Detroit Composite POIs",
68535           src: "composite-poi",
68536           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
68537           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"
68538         },
68539         {
68540           name: "Detroit All-The-Places POIs",
68541           src: "alltheplaces-poi",
68542           tooltip: "Public domain business location data created by web scrapers.",
68543           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"
68544         }
68545       ];
68546       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
68547       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
68548       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
68549       container.exit().remove();
68550       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
68551       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
68552       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
68553       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");
68554       container = container.merge(containerEnter);
68555       var ul = container.selectAll(".layer-list-vectortile");
68556       var li = ul.selectAll(".list-item").data(vtData);
68557       li.exit().remove();
68558       var liEnter = li.enter().append("li").attr("class", function(d) {
68559         return "list-item list-item-" + d.src;
68560       });
68561       var labelEnter = liEnter.append("label").each(function(d) {
68562         select_default2(this).call(
68563           uiTooltip().title(d.tooltip).placement("top")
68564         );
68565       });
68566       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
68567       labelEnter.append("span").text(function(d) {
68568         return d.name;
68569       });
68570       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
68571       function isVTLayerSelected(d) {
68572         return dataLayer && dataLayer.template() === d.template;
68573       }
68574       function selectVTLayer(d3_event, d) {
68575         corePreferences("settings-custom-data-url", d.template);
68576         if (dataLayer) {
68577           dataLayer.template(d.template, d.src);
68578           dataLayer.enabled(true);
68579         }
68580       }
68581     }
68582     function drawCustomDataItems(selection2) {
68583       var dataLayer = layers.layer("data");
68584       var hasData = dataLayer && dataLayer.hasData();
68585       var showsData = hasData && dataLayer.enabled();
68586       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
68587       ul.exit().remove();
68588       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
68589       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
68590       var labelEnter = liEnter.append("label").call(
68591         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
68592       );
68593       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
68594         toggleLayer("data");
68595       });
68596       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
68597       liEnter.append("button").attr("class", "open-data-options").call(
68598         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68599       ).on("click", function(d3_event) {
68600         d3_event.preventDefault();
68601         editCustom();
68602       }).call(svgIcon("#iD-icon-more"));
68603       liEnter.append("button").attr("class", "zoom-to-data").call(
68604         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68605       ).on("click", function(d3_event) {
68606         if (select_default2(this).classed("disabled"))
68607           return;
68608         d3_event.preventDefault();
68609         d3_event.stopPropagation();
68610         dataLayer.fitZoom();
68611       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
68612       ul = ul.merge(ulEnter);
68613       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
68614       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
68615     }
68616     function editCustom() {
68617       context.container().call(settingsCustomData);
68618     }
68619     function customChanged(d) {
68620       var dataLayer = layers.layer("data");
68621       if (d && d.url) {
68622         dataLayer.url(d.url);
68623       } else if (d && d.fileList) {
68624         dataLayer.fileList(d.fileList);
68625       }
68626     }
68627     function drawPanelItems(selection2) {
68628       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
68629       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
68630         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
68631       );
68632       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68633         d3_event.preventDefault();
68634         context.ui().info.toggle("history");
68635       });
68636       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
68637       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
68638         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
68639       );
68640       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68641         d3_event.preventDefault();
68642         context.ui().info.toggle("measurement");
68643       });
68644       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
68645     }
68646     context.layers().on("change.uiSectionDataLayers", section.reRender);
68647     context.map().on(
68648       "move.uiSectionDataLayers",
68649       debounce_default(function() {
68650         window.requestIdleCallback(section.reRender);
68651       }, 1e3)
68652     );
68653     return section;
68654   }
68655
68656   // modules/ui/sections/map_features.js
68657   function uiSectionMapFeatures(context) {
68658     var _features = context.features().keys();
68659     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
68660     function renderDisclosureContent(selection2) {
68661       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
68662       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
68663       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
68664       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
68665       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
68666         d3_event.preventDefault();
68667         context.features().disableAll();
68668       });
68669       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
68670         d3_event.preventDefault();
68671         context.features().enableAll();
68672       });
68673       container = container.merge(containerEnter);
68674       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
68675     }
68676     function drawListItems(selection2, data, type3, name, change, active) {
68677       var items = selection2.selectAll("li").data(data);
68678       items.exit().remove();
68679       var enter = items.enter().append("li").call(
68680         uiTooltip().title(function(d) {
68681           var tip = _t.append(name + "." + d + ".tooltip");
68682           if (autoHiddenFeature(d)) {
68683             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
68684             return (selection3) => {
68685               selection3.call(tip);
68686               selection3.append("div").call(msg);
68687             };
68688           }
68689           return tip;
68690         }).placement("top")
68691       );
68692       var label = enter.append("label");
68693       label.append("input").attr("type", type3).attr("name", name).on("change", change);
68694       label.append("span").html(function(d) {
68695         return _t.html(name + "." + d + ".description");
68696       });
68697       items = items.merge(enter);
68698       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
68699     }
68700     function autoHiddenFeature(d) {
68701       return context.features().autoHidden(d);
68702     }
68703     function showsFeature(d) {
68704       return context.features().enabled(d);
68705     }
68706     function clickFeature(d3_event, d) {
68707       context.features().toggle(d);
68708     }
68709     function showsLayer(id2) {
68710       var layer = context.layers().layer(id2);
68711       return layer && layer.enabled();
68712     }
68713     context.features().on("change.map_features", section.reRender);
68714     return section;
68715   }
68716
68717   // modules/ui/sections/map_style_options.js
68718   function uiSectionMapStyleOptions(context) {
68719     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
68720     function renderDisclosureContent(selection2) {
68721       var container = selection2.selectAll(".layer-fill-list").data([0]);
68722       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
68723       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
68724       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
68725         return context.surface().classed("highlight-edited");
68726       });
68727     }
68728     function drawListItems(selection2, data, type3, name, change, active) {
68729       var items = selection2.selectAll("li").data(data);
68730       items.exit().remove();
68731       var enter = items.enter().append("li").call(
68732         uiTooltip().title(function(d) {
68733           return _t.append(name + "." + d + ".tooltip");
68734         }).keys(function(d) {
68735           var key = d === "wireframe" ? _t("area_fill.wireframe.key") : null;
68736           if (d === "highlight_edits")
68737             key = _t("map_data.highlight_edits.key");
68738           return key ? [key] : null;
68739         }).placement("top")
68740       );
68741       var label = enter.append("label");
68742       label.append("input").attr("type", type3).attr("name", name).on("change", change);
68743       label.append("span").html(function(d) {
68744         return _t.html(name + "." + d + ".description");
68745       });
68746       items = items.merge(enter);
68747       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
68748     }
68749     function isActiveFill(d) {
68750       return context.map().activeAreaFill() === d;
68751     }
68752     function toggleHighlightEdited(d3_event) {
68753       d3_event.preventDefault();
68754       context.map().toggleHighlightEdited();
68755     }
68756     function setFill(d3_event, d) {
68757       context.map().activeAreaFill(d);
68758     }
68759     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
68760     return section;
68761   }
68762
68763   // modules/ui/sections/photo_overlays.js
68764   function uiSectionPhotoOverlays(context) {
68765     var layers = context.layers();
68766     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
68767     function renderDisclosureContent(selection2) {
68768       var container = selection2.selectAll(".photo-overlay-container").data([0]);
68769       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter);
68770     }
68771     function drawPhotoItems(selection2) {
68772       var photoKeys = context.photos().overlayLayerIDs();
68773       var photoLayers = layers.all().filter(function(obj) {
68774         return photoKeys.indexOf(obj.id) !== -1;
68775       });
68776       var data = photoLayers.filter(function(obj) {
68777         return obj.layer.supported();
68778       });
68779       function layerSupported(d) {
68780         return d.layer && d.layer.supported();
68781       }
68782       function layerEnabled(d) {
68783         return layerSupported(d) && d.layer.enabled();
68784       }
68785       var ul = selection2.selectAll(".layer-list-photos").data([0]);
68786       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
68787       var li = ul.selectAll(".list-item-photos").data(data);
68788       li.exit().remove();
68789       var liEnter = li.enter().append("li").attr("class", function(d) {
68790         var classes = "list-item-photos list-item-" + d.id;
68791         if (d.id === "mapillary-signs" || d.id === "mapillary-map-features") {
68792           classes += " indented";
68793         }
68794         return classes;
68795       });
68796       var labelEnter = liEnter.append("label").each(function(d) {
68797         var titleID;
68798         if (d.id === "mapillary-signs")
68799           titleID = "mapillary.signs.tooltip";
68800         else if (d.id === "mapillary")
68801           titleID = "mapillary_images.tooltip";
68802         else if (d.id === "kartaview")
68803           titleID = "kartaview_images.tooltip";
68804         else
68805           titleID = d.id.replace(/-/g, "_") + ".tooltip";
68806         select_default2(this).call(
68807           uiTooltip().title(() => _t.append(titleID)).placement("top")
68808         );
68809       });
68810       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
68811         toggleLayer(d.id);
68812       });
68813       labelEnter.append("span").html(function(d) {
68814         var id2 = d.id;
68815         if (id2 === "mapillary-signs")
68816           id2 = "photo_overlays.traffic_signs";
68817         return _t.html(id2.replace(/-/g, "_") + ".title");
68818       });
68819       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("checked", layerEnabled);
68820     }
68821     function drawPhotoTypeItems(selection2) {
68822       var data = context.photos().allPhotoTypes();
68823       function typeEnabled(d) {
68824         return context.photos().showsPhotoType(d);
68825       }
68826       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
68827       ul.exit().remove();
68828       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
68829       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
68830       li.exit().remove();
68831       var liEnter = li.enter().append("li").attr("class", function(d) {
68832         return "list-item-photo-types list-item-" + d;
68833       });
68834       var labelEnter = liEnter.append("label").each(function(d) {
68835         select_default2(this).call(
68836           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d + ".tooltip")).placement("top")
68837         );
68838       });
68839       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
68840         context.photos().togglePhotoType(d);
68841       });
68842       labelEnter.append("span").html(function(d) {
68843         return _t.html("photo_overlays.photo_type." + d + ".title");
68844       });
68845       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
68846     }
68847     function drawDateFilter(selection2) {
68848       var data = context.photos().dateFilters();
68849       function filterEnabled(d) {
68850         return context.photos().dateFilterValue(d);
68851       }
68852       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
68853       ul.exit().remove();
68854       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
68855       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
68856       li.exit().remove();
68857       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
68858       var labelEnter = liEnter.append("label").each(function(d) {
68859         select_default2(this).call(
68860           uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d + ".tooltip")).placement("top")
68861         );
68862       });
68863       labelEnter.append("span").each(function(d) {
68864         _t.append("photo_overlays.date_filter." + d + ".title")(select_default2(this));
68865       });
68866       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d) {
68867         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d) || "");
68868       }).on("change", function(d3_event, d) {
68869         var value = utilGetSetValue(select_default2(this)).trim();
68870         context.photos().setDateFilter(d, value, true);
68871         li.selectAll("input").each(function(d2) {
68872           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
68873         });
68874       });
68875       li = li.merge(liEnter).classed("active", filterEnabled);
68876     }
68877     function drawUsernameFilter(selection2) {
68878       function filterEnabled() {
68879         return context.photos().usernames();
68880       }
68881       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
68882       ul.exit().remove();
68883       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
68884       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
68885       li.exit().remove();
68886       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
68887       var labelEnter = liEnter.append("label").each(function() {
68888         select_default2(this).call(
68889           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
68890         );
68891       });
68892       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
68893       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
68894         var value = select_default2(this).property("value");
68895         context.photos().setUsernameFilter(value, true);
68896         select_default2(this).property("value", usernameValue);
68897       });
68898       li.merge(liEnter).classed("active", filterEnabled);
68899       function usernameValue() {
68900         var usernames = context.photos().usernames();
68901         if (usernames)
68902           return usernames.join("; ");
68903         return usernames;
68904       }
68905     }
68906     function toggleLayer(which) {
68907       setLayer(which, !showsLayer(which));
68908     }
68909     function showsLayer(which) {
68910       var layer = layers.layer(which);
68911       if (layer) {
68912         return layer.enabled();
68913       }
68914       return false;
68915     }
68916     function setLayer(which, enabled) {
68917       var layer = layers.layer(which);
68918       if (layer) {
68919         layer.enabled(enabled);
68920       }
68921     }
68922     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
68923     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
68924     return section;
68925   }
68926
68927   // modules/ui/panes/map_data.js
68928   function uiPaneMapData(context) {
68929     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([
68930       uiSectionDataLayers(context),
68931       uiSectionPhotoOverlays(context),
68932       uiSectionMapStyleOptions(context),
68933       uiSectionMapFeatures(context)
68934     ]);
68935     return mapDataPane;
68936   }
68937
68938   // modules/ui/panes/preferences.js
68939   function uiPanePreferences(context) {
68940     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
68941       uiSectionPrivacy(context)
68942     ]);
68943     return preferencesPane;
68944   }
68945
68946   // modules/ui/init.js
68947   function uiInit(context) {
68948     var _initCounter = 0;
68949     var _needWidth = {};
68950     var _lastPointerType;
68951     function render(container) {
68952       container.on("click.ui", function(d3_event) {
68953         if (d3_event.button !== 0)
68954           return;
68955         if (!d3_event.composedPath)
68956           return;
68957         var isOkayTarget = d3_event.composedPath().some(function(node) {
68958           return node.nodeType === 1 && (node.nodeName === "INPUT" || node.nodeName === "LABEL" || node.nodeName === "A");
68959         });
68960         if (isOkayTarget)
68961           return;
68962         d3_event.preventDefault();
68963       });
68964       var detected = utilDetect();
68965       if ("GestureEvent" in window && !detected.isMobileWebKit) {
68966         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
68967           d3_event.preventDefault();
68968         });
68969       }
68970       if ("PointerEvent" in window) {
68971         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
68972           var pointerType = d3_event.pointerType || "mouse";
68973           if (_lastPointerType !== pointerType) {
68974             _lastPointerType = pointerType;
68975             container.attr("pointer", pointerType);
68976           }
68977         }, true);
68978       } else {
68979         _lastPointerType = "mouse";
68980         container.attr("pointer", "mouse");
68981       }
68982       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
68983       container.call(uiFullScreen(context));
68984       var map2 = context.map();
68985       map2.redrawEnable(false);
68986       map2.on("hitMinZoom.ui", function() {
68987         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
68988       });
68989       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
68990       container.append("div").attr("class", "sidebar").call(ui.sidebar);
68991       var content = container.append("div").attr("class", "main-content active");
68992       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
68993       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
68994       var overMap = content.append("div").attr("class", "over-map");
68995       overMap.append("div").attr("class", "select-trap").text("t");
68996       overMap.call(uiMapInMap(context)).call(uiNotice(context));
68997       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
68998       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
68999       var controls = controlsWrap.append("div").attr("class", "map-controls");
69000       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
69001       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
69002       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
69003       controlsWrap.on("wheel.mapControls", function(d3_event) {
69004         if (!d3_event.deltaX) {
69005           controlsWrap.node().scrollTop += d3_event.deltaY;
69006         }
69007       });
69008       var panes = overMap.append("div").attr("class", "map-panes");
69009       var uiPanes = [
69010         uiPaneBackground(context),
69011         uiPaneMapData(context),
69012         uiPaneIssues(context),
69013         uiPanePreferences(context),
69014         uiPaneHelp(context)
69015       ];
69016       uiPanes.forEach(function(pane) {
69017         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
69018         panes.call(pane.renderPane);
69019       });
69020       ui.info = uiInfo(context);
69021       overMap.call(ui.info);
69022       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
69023       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
69024       var about = content.append("div").attr("class", "map-footer");
69025       about.append("div").attr("class", "api-status").call(uiStatus(context));
69026       var footer = about.append("div").attr("class", "map-footer-bar fillD");
69027       footer.append("div").attr("class", "flash-wrap footer-hide");
69028       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
69029       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
69030       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
69031       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
69032       var apiConnections = context.apiConnections();
69033       if (apiConnections && apiConnections.length > 1) {
69034         aboutList.append("li").attr("class", "source-switch").call(
69035           uiSourceSwitch(context).keys(apiConnections)
69036         );
69037       }
69038       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
69039       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
69040       var issueLinks = aboutList.append("li");
69041       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"));
69042       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"));
69043       aboutList.append("li").attr("class", "version").call(uiVersion(context));
69044       if (!context.embed()) {
69045         aboutList.call(uiAccount(context));
69046       }
69047       ui.onResize();
69048       map2.redrawEnable(true);
69049       ui.hash = behaviorHash(context);
69050       ui.hash();
69051       if (!ui.hash.hadLocation) {
69052         map2.centerZoom([0, 0], 2);
69053       }
69054       window.onbeforeunload = function() {
69055         return context.save();
69056       };
69057       window.onunload = function() {
69058         context.history().unlock();
69059       };
69060       select_default2(window).on("resize.editor", function() {
69061         ui.onResize();
69062       });
69063       var panPixels = 80;
69064       context.keybinding().on("\u232B", function(d3_event) {
69065         d3_event.preventDefault();
69066       }).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) {
69067         if (d3_event) {
69068           d3_event.stopImmediatePropagation();
69069           d3_event.preventDefault();
69070         }
69071         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
69072         if (previousBackground) {
69073           var currentBackground = context.background().baseLayerSource();
69074           corePreferences("background-last-used-toggle", currentBackground.id);
69075           corePreferences("background-last-used", previousBackground.id);
69076           context.background().baseLayerSource(previousBackground);
69077         }
69078       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
69079         d3_event.preventDefault();
69080         d3_event.stopPropagation();
69081         context.map().toggleWireframe();
69082       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
69083         d3_event.preventDefault();
69084         d3_event.stopPropagation();
69085         var mode = context.mode();
69086         if (mode && /^draw/.test(mode.id))
69087           return;
69088         var layer = context.layers().layer("osm");
69089         if (layer) {
69090           layer.enabled(!layer.enabled());
69091           if (!layer.enabled()) {
69092             context.enter(modeBrowse(context));
69093           }
69094         }
69095       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
69096         d3_event.preventDefault();
69097         context.map().toggleHighlightEdited();
69098       });
69099       context.on("enter.editor", function(entered) {
69100         container.classed("mode-" + entered.id, true);
69101       }).on("exit.editor", function(exited) {
69102         container.classed("mode-" + exited.id, false);
69103       });
69104       context.enter(modeBrowse(context));
69105       if (!_initCounter++) {
69106         if (!ui.hash.startWalkthrough) {
69107           context.container().call(uiSplash(context)).call(uiRestore(context));
69108         }
69109         context.container().call(ui.shortcuts);
69110       }
69111       var osm = context.connection();
69112       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
69113       if (osm && auth) {
69114         osm.on("authLoading.ui", function() {
69115           context.container().call(auth);
69116         }).on("authDone.ui", function() {
69117           auth.close();
69118         });
69119       }
69120       _initCounter++;
69121       if (ui.hash.startWalkthrough) {
69122         ui.hash.startWalkthrough = false;
69123         context.container().call(uiIntro(context));
69124       }
69125       function pan(d) {
69126         return function(d3_event) {
69127           if (d3_event.shiftKey)
69128             return;
69129           if (context.container().select(".combobox").size())
69130             return;
69131           d3_event.preventDefault();
69132           context.map().pan(d, 100);
69133         };
69134       }
69135     }
69136     let ui = {};
69137     let _loadPromise;
69138     ui.ensureLoaded = () => {
69139       if (_loadPromise)
69140         return _loadPromise;
69141       return _loadPromise = Promise.all([
69142         _mainLocalizer.ensureLoaded(),
69143         _mainPresetIndex.ensureLoaded()
69144       ]).then(() => {
69145         if (!context.container().empty())
69146           render(context.container());
69147       }).catch((err) => console.error(err));
69148     };
69149     ui.restart = function() {
69150       context.keybinding().clear();
69151       _loadPromise = null;
69152       context.container().selectAll("*").remove();
69153       ui.ensureLoaded();
69154     };
69155     ui.lastPointerType = function() {
69156       return _lastPointerType;
69157     };
69158     ui.svgDefs = svgDefs(context);
69159     ui.flash = uiFlash(context);
69160     ui.sidebar = uiSidebar(context);
69161     ui.photoviewer = uiPhotoviewer(context);
69162     ui.shortcuts = uiShortcuts(context);
69163     ui.onResize = function(withPan) {
69164       var map2 = context.map();
69165       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
69166       utilGetDimensions(context.container().select(".sidebar"), true);
69167       if (withPan !== void 0) {
69168         map2.redrawEnable(false);
69169         map2.pan(withPan);
69170         map2.redrawEnable(true);
69171       }
69172       map2.dimensions(mapDimensions);
69173       ui.photoviewer.onMapResize();
69174       ui.checkOverflow(".top-toolbar");
69175       ui.checkOverflow(".map-footer-bar");
69176       var resizeWindowEvent = document.createEvent("Event");
69177       resizeWindowEvent.initEvent("resizeWindow", true, true);
69178       document.dispatchEvent(resizeWindowEvent);
69179     };
69180     ui.checkOverflow = function(selector, reset) {
69181       if (reset) {
69182         delete _needWidth[selector];
69183       }
69184       var selection2 = context.container().select(selector);
69185       if (selection2.empty())
69186         return;
69187       var scrollWidth = selection2.property("scrollWidth");
69188       var clientWidth = selection2.property("clientWidth");
69189       var needed = _needWidth[selector] || scrollWidth;
69190       if (scrollWidth > clientWidth) {
69191         selection2.classed("narrow", true);
69192         if (!_needWidth[selector]) {
69193           _needWidth[selector] = scrollWidth;
69194         }
69195       } else if (scrollWidth >= needed) {
69196         selection2.classed("narrow", false);
69197       }
69198     };
69199     ui.togglePanes = function(showPane) {
69200       var hidePanes = context.container().selectAll(".map-pane.shown");
69201       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
69202       hidePanes.classed("shown", false).classed("hide", true);
69203       context.container().selectAll(".map-pane-control button").classed("active", false);
69204       if (showPane) {
69205         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
69206         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
69207         showPane.classed("shown", true).classed("hide", false);
69208         if (hidePanes.empty()) {
69209           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
69210         } else {
69211           showPane.style(side, "0px");
69212         }
69213       } else {
69214         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
69215           select_default2(this).classed("shown", false).classed("hide", true);
69216         });
69217       }
69218     };
69219     var _editMenu = uiEditMenu(context);
69220     ui.editMenu = function() {
69221       return _editMenu;
69222     };
69223     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
69224       ui.closeEditMenu();
69225       if (!operations && context.mode().operations)
69226         operations = context.mode().operations();
69227       if (!operations || !operations.length)
69228         return;
69229       if (!context.map().editableDataEnabled())
69230         return;
69231       var surfaceNode = context.surface().node();
69232       if (surfaceNode.focus) {
69233         surfaceNode.focus();
69234       }
69235       operations.forEach(function(operation) {
69236         if (operation.point)
69237           operation.point(anchorPoint);
69238       });
69239       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
69240       context.map().supersurface.call(_editMenu);
69241     };
69242     ui.closeEditMenu = function() {
69243       context.map().supersurface.select(".edit-menu").remove();
69244     };
69245     var _saveLoading = select_default2(null);
69246     context.uploader().on("saveStarted.ui", function() {
69247       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
69248       context.container().call(_saveLoading);
69249     }).on("saveEnded.ui", function() {
69250       _saveLoading.close();
69251       _saveLoading = select_default2(null);
69252     });
69253     return ui;
69254   }
69255
69256   // modules/core/context.js
69257   function coreContext() {
69258     const dispatch10 = dispatch_default("enter", "exit", "change");
69259     let context = utilRebind({}, dispatch10, "on");
69260     let _deferred2 = /* @__PURE__ */ new Set();
69261     context.version = "2.22.0";
69262     context.privacyVersion = "20201202";
69263     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
69264     context.changeset = null;
69265     let _defaultChangesetComment = context.initialHashParams.comment;
69266     let _defaultChangesetSource = context.initialHashParams.source;
69267     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
69268     context.defaultChangesetComment = function(val) {
69269       if (!arguments.length)
69270         return _defaultChangesetComment;
69271       _defaultChangesetComment = val;
69272       return context;
69273     };
69274     context.defaultChangesetSource = function(val) {
69275       if (!arguments.length)
69276         return _defaultChangesetSource;
69277       _defaultChangesetSource = val;
69278       return context;
69279     };
69280     context.defaultChangesetHashtags = function(val) {
69281       if (!arguments.length)
69282         return _defaultChangesetHashtags;
69283       _defaultChangesetHashtags = val;
69284       return context;
69285     };
69286     let _setsDocumentTitle = true;
69287     context.setsDocumentTitle = function(val) {
69288       if (!arguments.length)
69289         return _setsDocumentTitle;
69290       _setsDocumentTitle = val;
69291       return context;
69292     };
69293     let _documentTitleBase = document.title;
69294     context.documentTitleBase = function(val) {
69295       if (!arguments.length)
69296         return _documentTitleBase;
69297       _documentTitleBase = val;
69298       return context;
69299     };
69300     let _ui;
69301     context.ui = () => _ui;
69302     context.lastPointerType = () => _ui.lastPointerType();
69303     let _keybinding = utilKeybinding("context");
69304     context.keybinding = () => _keybinding;
69305     select_default2(document).call(_keybinding);
69306     let _connection = services.osm;
69307     let _history;
69308     let _validator;
69309     let _uploader;
69310     context.connection = () => _connection;
69311     context.history = () => _history;
69312     context.validator = () => _validator;
69313     context.uploader = () => _uploader;
69314     context.preauth = (options2) => {
69315       if (_connection) {
69316         _connection.switch(options2);
69317       }
69318       return context;
69319     };
69320     let _apiConnections;
69321     context.apiConnections = function(val) {
69322       if (!arguments.length)
69323         return _apiConnections;
69324       _apiConnections = val;
69325       return context;
69326     };
69327     context.locale = function(locale2) {
69328       if (!arguments.length)
69329         return _mainLocalizer.localeCode();
69330       _mainLocalizer.preferredLocaleCodes(locale2);
69331       return context;
69332     };
69333     function afterLoad(cid, callback) {
69334       return (err, result) => {
69335         if (err) {
69336           if (err.status === 400 || err.status === 401 || err.status === 403) {
69337             if (_connection) {
69338               _connection.logout();
69339             }
69340           }
69341           if (typeof callback === "function") {
69342             callback(err);
69343           }
69344           return;
69345         } else if (_connection && _connection.getConnectionId() !== cid) {
69346           if (typeof callback === "function") {
69347             callback({ message: "Connection Switched", status: -1 });
69348           }
69349           return;
69350         } else {
69351           _history.merge(result.data, result.extent);
69352           if (typeof callback === "function") {
69353             callback(err, result);
69354           }
69355           return;
69356         }
69357       };
69358     }
69359     context.loadTiles = (projection2, callback) => {
69360       const handle = window.requestIdleCallback(() => {
69361         _deferred2.delete(handle);
69362         if (_connection && context.editableDataEnabled()) {
69363           const cid = _connection.getConnectionId();
69364           _connection.loadTiles(projection2, afterLoad(cid, callback));
69365         }
69366       });
69367       _deferred2.add(handle);
69368     };
69369     context.loadTileAtLoc = (loc, callback) => {
69370       const handle = window.requestIdleCallback(() => {
69371         _deferred2.delete(handle);
69372         if (_connection && context.editableDataEnabled()) {
69373           const cid = _connection.getConnectionId();
69374           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
69375         }
69376       });
69377       _deferred2.add(handle);
69378     };
69379     context.loadEntity = (entityID, callback) => {
69380       if (_connection) {
69381         const cid = _connection.getConnectionId();
69382         _connection.loadEntity(entityID, afterLoad(cid, callback));
69383         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
69384       }
69385     };
69386     context.zoomToEntity = (entityID, zoomTo) => {
69387       context.loadEntity(entityID, (err, result) => {
69388         if (err)
69389           return;
69390         if (zoomTo !== false) {
69391           const entity = result.data.find((e) => e.id === entityID);
69392           if (entity) {
69393             _map.zoomTo(entity);
69394           }
69395         }
69396       });
69397       _map.on("drawn.zoomToEntity", () => {
69398         if (!context.hasEntity(entityID))
69399           return;
69400         _map.on("drawn.zoomToEntity", null);
69401         context.on("enter.zoomToEntity", null);
69402         context.enter(modeSelect(context, [entityID]));
69403       });
69404       context.on("enter.zoomToEntity", () => {
69405         if (_mode.id !== "browse") {
69406           _map.on("drawn.zoomToEntity", null);
69407           context.on("enter.zoomToEntity", null);
69408         }
69409       });
69410     };
69411     let _minEditableZoom = 16;
69412     context.minEditableZoom = function(val) {
69413       if (!arguments.length)
69414         return _minEditableZoom;
69415       _minEditableZoom = val;
69416       if (_connection) {
69417         _connection.tileZoom(val);
69418       }
69419       return context;
69420     };
69421     context.maxCharsForTagKey = () => 255;
69422     context.maxCharsForTagValue = () => 255;
69423     context.maxCharsForRelationRole = () => 255;
69424     function cleanOsmString(val, maxChars) {
69425       if (val === void 0 || val === null) {
69426         val = "";
69427       } else {
69428         val = val.toString();
69429       }
69430       val = val.trim();
69431       if (val.normalize)
69432         val = val.normalize("NFC");
69433       return utilUnicodeCharsTruncated(val, maxChars);
69434     }
69435     context.cleanTagKey = (val) => cleanOsmString(val, context.maxCharsForTagKey());
69436     context.cleanTagValue = (val) => cleanOsmString(val, context.maxCharsForTagValue());
69437     context.cleanRelationRole = (val) => cleanOsmString(val, context.maxCharsForRelationRole());
69438     let _inIntro = false;
69439     context.inIntro = function(val) {
69440       if (!arguments.length)
69441         return _inIntro;
69442       _inIntro = val;
69443       return context;
69444     };
69445     context.save = () => {
69446       if (_inIntro || context.container().select(".modal").size())
69447         return;
69448       let canSave;
69449       if (_mode && _mode.id === "save") {
69450         canSave = false;
69451         if (services.osm && services.osm.isChangesetInflight()) {
69452           _history.clearSaved();
69453           return;
69454         }
69455       } else {
69456         canSave = context.selectedIDs().every((id2) => {
69457           const entity = context.hasEntity(id2);
69458           return entity && !entity.isDegenerate();
69459         });
69460       }
69461       if (canSave) {
69462         _history.save();
69463       }
69464       if (_history.hasChanges()) {
69465         return _t("save.unsaved_changes");
69466       }
69467     };
69468     context.debouncedSave = debounce_default(context.save, 350);
69469     function withDebouncedSave(fn) {
69470       return function() {
69471         const result = fn.apply(_history, arguments);
69472         context.debouncedSave();
69473         return result;
69474       };
69475     }
69476     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
69477     context.entity = (id2) => _history.graph().entity(id2);
69478     let _mode;
69479     context.mode = () => _mode;
69480     context.enter = (newMode) => {
69481       if (_mode) {
69482         _mode.exit();
69483         dispatch10.call("exit", this, _mode);
69484       }
69485       _mode = newMode;
69486       _mode.enter();
69487       dispatch10.call("enter", this, _mode);
69488     };
69489     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
69490     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
69491     let _selectedNoteID;
69492     context.selectedNoteID = function(noteID) {
69493       if (!arguments.length)
69494         return _selectedNoteID;
69495       _selectedNoteID = noteID;
69496       return context;
69497     };
69498     let _selectedErrorID;
69499     context.selectedErrorID = function(errorID) {
69500       if (!arguments.length)
69501         return _selectedErrorID;
69502       _selectedErrorID = errorID;
69503       return context;
69504     };
69505     context.install = (behavior) => context.surface().call(behavior);
69506     context.uninstall = (behavior) => context.surface().call(behavior.off);
69507     let _copyGraph;
69508     context.copyGraph = () => _copyGraph;
69509     let _copyIDs = [];
69510     context.copyIDs = function(val) {
69511       if (!arguments.length)
69512         return _copyIDs;
69513       _copyIDs = val;
69514       _copyGraph = _history.graph();
69515       return context;
69516     };
69517     let _copyLonLat;
69518     context.copyLonLat = function(val) {
69519       if (!arguments.length)
69520         return _copyLonLat;
69521       _copyLonLat = val;
69522       return context;
69523     };
69524     let _background;
69525     context.background = () => _background;
69526     let _features;
69527     context.features = () => _features;
69528     context.hasHiddenConnections = (id2) => {
69529       const graph = _history.graph();
69530       const entity = graph.entity(id2);
69531       return _features.hasHiddenConnections(entity, graph);
69532     };
69533     let _photos;
69534     context.photos = () => _photos;
69535     let _map;
69536     context.map = () => _map;
69537     context.layers = () => _map.layers();
69538     context.surface = () => _map.surface;
69539     context.editableDataEnabled = () => _map.editableDataEnabled();
69540     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
69541     context.editable = () => {
69542       const mode = context.mode();
69543       if (!mode || mode.id === "save")
69544         return false;
69545       return _map.editableDataEnabled();
69546     };
69547     let _debugFlags = {
69548       tile: false,
69549       collision: false,
69550       imagery: false,
69551       target: false,
69552       downloaded: false
69553     };
69554     context.debugFlags = () => _debugFlags;
69555     context.getDebug = (flag) => flag && _debugFlags[flag];
69556     context.setDebug = function(flag, val) {
69557       if (arguments.length === 1)
69558         val = true;
69559       _debugFlags[flag] = val;
69560       dispatch10.call("change");
69561       return context;
69562     };
69563     let _container = select_default2(null);
69564     context.container = function(val) {
69565       if (!arguments.length)
69566         return _container;
69567       _container = val;
69568       _container.classed("ideditor", true);
69569       return context;
69570     };
69571     context.containerNode = function(val) {
69572       if (!arguments.length)
69573         return context.container().node();
69574       context.container(select_default2(val));
69575       return context;
69576     };
69577     let _embed;
69578     context.embed = function(val) {
69579       if (!arguments.length)
69580         return _embed;
69581       _embed = val;
69582       return context;
69583     };
69584     let _assetPath = "";
69585     context.assetPath = function(val) {
69586       if (!arguments.length)
69587         return _assetPath;
69588       _assetPath = val;
69589       _mainFileFetcher.assetPath(val);
69590       return context;
69591     };
69592     let _assetMap = {};
69593     context.assetMap = function(val) {
69594       if (!arguments.length)
69595         return _assetMap;
69596       _assetMap = val;
69597       _mainFileFetcher.assetMap(val);
69598       return context;
69599     };
69600     context.asset = (val) => {
69601       if (/^http(s)?:\/\//i.test(val))
69602         return val;
69603       const filename = _assetPath + val;
69604       return _assetMap[filename] || filename;
69605     };
69606     context.imagePath = (val) => context.asset(`img/${val}`);
69607     context.reset = context.flush = () => {
69608       context.debouncedSave.cancel();
69609       Array.from(_deferred2).forEach((handle) => {
69610         window.cancelIdleCallback(handle);
69611         _deferred2.delete(handle);
69612       });
69613       Object.values(services).forEach((service) => {
69614         if (service && typeof service.reset === "function") {
69615           service.reset(context);
69616         }
69617       });
69618       context.changeset = null;
69619       _validator.reset();
69620       _features.reset();
69621       _history.reset();
69622       _uploader.reset();
69623       context.container().select(".inspector-wrap *").remove();
69624       return context;
69625     };
69626     context.projection = geoRawMercator();
69627     context.curtainProjection = geoRawMercator();
69628     context.init = () => {
69629       instantiateInternal();
69630       initializeDependents();
69631       return context;
69632       function instantiateInternal() {
69633         _history = coreHistory(context);
69634         context.graph = _history.graph;
69635         context.pauseChangeDispatch = _history.pauseChangeDispatch;
69636         context.resumeChangeDispatch = _history.resumeChangeDispatch;
69637         context.perform = withDebouncedSave(_history.perform);
69638         context.replace = withDebouncedSave(_history.replace);
69639         context.pop = withDebouncedSave(_history.pop);
69640         context.overwrite = withDebouncedSave(_history.overwrite);
69641         context.undo = withDebouncedSave(_history.undo);
69642         context.redo = withDebouncedSave(_history.redo);
69643         _validator = coreValidator(context);
69644         _uploader = coreUploader(context);
69645         _background = rendererBackground(context);
69646         _features = rendererFeatures(context);
69647         _map = rendererMap(context);
69648         _photos = rendererPhotos(context);
69649         _ui = uiInit(context);
69650       }
69651       function initializeDependents() {
69652         if (context.initialHashParams.presets) {
69653           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
69654         }
69655         if (context.initialHashParams.locale) {
69656           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
69657         }
69658         _mainLocalizer.ensureLoaded();
69659         _mainPresetIndex.ensureLoaded();
69660         _background.ensureLoaded();
69661         Object.values(services).forEach((service) => {
69662           if (service && typeof service.init === "function") {
69663             service.init();
69664           }
69665         });
69666         _map.init();
69667         _validator.init();
69668         _features.init();
69669         if (services.maprules && context.initialHashParams.maprules) {
69670           json_default(context.initialHashParams.maprules).then((mapcss) => {
69671             services.maprules.init();
69672             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
69673           }).catch(() => {
69674           });
69675         }
69676         if (!context.container().empty()) {
69677           _ui.ensureLoaded().then(() => {
69678             _background.init();
69679             _photos.init();
69680           });
69681         }
69682       }
69683     };
69684     return context;
69685   }
69686
69687   // modules/services/nsi.js
69688   var _nsiStatus = "loading";
69689   var _nsi = {};
69690   var buildingPreset = {
69691     "building/commercial": true,
69692     "building/government": true,
69693     "building/hotel": true,
69694     "building/retail": true,
69695     "building/office": true,
69696     "building/supermarket": true,
69697     "building/yes": true
69698   };
69699   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
69700   var notBranches = /(coop|express|wireless|factory|outlet)/i;
69701   function setNsiSources() {
69702     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
69703     const v = (0, import_vparse2.default)(nsiVersion);
69704     const vMinor = `${v.major}.${v.minor}`;
69705     const sources = {
69706       "nsi_data": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/nsi.min.json`,
69707       "nsi_dissolved": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/dissolved.min.json`,
69708       "nsi_features": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/featureCollection.min.json`,
69709       "nsi_generics": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/genericWords.min.json`,
69710       "nsi_presets": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/presets/nsi-id-presets.min.json`,
69711       "nsi_replacements": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/replacements.min.json`,
69712       "nsi_trees": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/trees.min.json`
69713     };
69714     let fileMap = _mainFileFetcher.fileMap();
69715     for (const k in sources) {
69716       if (!fileMap[k])
69717         fileMap[k] = sources[k];
69718     }
69719   }
69720   function loadNsiPresets() {
69721     return Promise.all([
69722       _mainFileFetcher.get("nsi_presets"),
69723       _mainFileFetcher.get("nsi_features")
69724     ]).then((vals) => {
69725       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
69726       _mainPresetIndex.merge({
69727         presets: vals[0].presets,
69728         featureCollection: vals[1]
69729       });
69730     });
69731   }
69732   function loadNsiData() {
69733     return Promise.all([
69734       _mainFileFetcher.get("nsi_data"),
69735       _mainFileFetcher.get("nsi_dissolved"),
69736       _mainFileFetcher.get("nsi_replacements"),
69737       _mainFileFetcher.get("nsi_trees")
69738     ]).then((vals) => {
69739       _nsi = {
69740         data: vals[0].nsi,
69741         dissolved: vals[1].dissolved,
69742         replacements: vals[2].replacements,
69743         trees: vals[3].trees,
69744         kvt: /* @__PURE__ */ new Map(),
69745         qids: /* @__PURE__ */ new Map(),
69746         ids: /* @__PURE__ */ new Map()
69747       };
69748       _nsi.matcher = new Matcher();
69749       _nsi.matcher.buildMatchIndex(_nsi.data);
69750       _nsi.matcher.buildLocationIndex(_nsi.data, _mainLocations.loco());
69751       Object.keys(_nsi.data).forEach((tkv) => {
69752         const category = _nsi.data[tkv];
69753         const parts = tkv.split("/", 3);
69754         const t = parts[0];
69755         const k = parts[1];
69756         const v = parts[2];
69757         let vmap = _nsi.kvt.get(k);
69758         if (!vmap) {
69759           vmap = /* @__PURE__ */ new Map();
69760           _nsi.kvt.set(k, vmap);
69761         }
69762         vmap.set(v, t);
69763         const tree = _nsi.trees[t];
69764         const mainTag = tree.mainTag;
69765         const items = category.items || [];
69766         items.forEach((item) => {
69767           item.tkv = tkv;
69768           item.mainTag = mainTag;
69769           _nsi.ids.set(item.id, item);
69770           const wd = item.tags[mainTag];
69771           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
69772           if (wd)
69773             _nsi.qids.set(wd, wd);
69774           if (wp && wd)
69775             _nsi.qids.set(wp, wd);
69776         });
69777       });
69778     });
69779   }
69780   function gatherKVs(tags) {
69781     let primary = /* @__PURE__ */ new Set();
69782     let alternate = /* @__PURE__ */ new Set();
69783     Object.keys(tags).forEach((osmkey) => {
69784       const osmvalue = tags[osmkey];
69785       if (!osmvalue)
69786         return;
69787       if (osmkey === "route_master")
69788         osmkey = "route";
69789       const vmap = _nsi.kvt.get(osmkey);
69790       if (!vmap)
69791         return;
69792       if (vmap.get(osmvalue)) {
69793         primary.add(`${osmkey}/${osmvalue}`);
69794       } else if (osmvalue === "yes") {
69795         alternate.add(`${osmkey}/${osmvalue}`);
69796       }
69797     });
69798     const preset = _mainPresetIndex.matchTags(tags, "area");
69799     if (buildingPreset[preset.id]) {
69800       alternate.add("building/yes");
69801     }
69802     return { primary, alternate };
69803   }
69804   function identifyTree(tags) {
69805     let unknown;
69806     let t;
69807     Object.keys(tags).forEach((osmkey) => {
69808       if (t)
69809         return;
69810       const osmvalue = tags[osmkey];
69811       if (!osmvalue)
69812         return;
69813       if (osmkey === "route_master")
69814         osmkey = "route";
69815       const vmap = _nsi.kvt.get(osmkey);
69816       if (!vmap)
69817         return;
69818       if (osmvalue === "yes") {
69819         unknown = "unknown";
69820       } else {
69821         t = vmap.get(osmvalue);
69822       }
69823     });
69824     return t || unknown || null;
69825   }
69826   function gatherNames(tags) {
69827     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
69828     let primary = /* @__PURE__ */ new Set();
69829     let alternate = /* @__PURE__ */ new Set();
69830     let foundSemi = false;
69831     let testNameFragments = false;
69832     let patterns2;
69833     let t = identifyTree(tags);
69834     if (!t)
69835       return empty2;
69836     if (t === "transit") {
69837       patterns2 = {
69838         primary: /^network$/i,
69839         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
69840       };
69841     } else if (t === "flags") {
69842       patterns2 = {
69843         primary: /^(flag:name|flag:name:\w+)$/i,
69844         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
69845       };
69846     } else if (t === "brands") {
69847       testNameFragments = true;
69848       patterns2 = {
69849         primary: /^(name|name:\w+)$/i,
69850         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
69851       };
69852     } else if (t === "operators") {
69853       testNameFragments = true;
69854       patterns2 = {
69855         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
69856         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
69857       };
69858     } else {
69859       testNameFragments = true;
69860       patterns2 = {
69861         primary: /^(name|name:\w+)$/i,
69862         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
69863       };
69864     }
69865     if (tags.name && testNameFragments) {
69866       const nameParts = tags.name.split(/[\s\-\/,.]/);
69867       for (let split = nameParts.length; split > 0; split--) {
69868         const name = nameParts.slice(0, split).join(" ");
69869         primary.add(name);
69870       }
69871     }
69872     Object.keys(tags).forEach((osmkey) => {
69873       const osmvalue = tags[osmkey];
69874       if (!osmvalue)
69875         return;
69876       if (isNamelike(osmkey, "primary")) {
69877         if (/;/.test(osmvalue)) {
69878           foundSemi = true;
69879         } else {
69880           primary.add(osmvalue);
69881           alternate.delete(osmvalue);
69882         }
69883       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
69884         if (/;/.test(osmvalue)) {
69885           foundSemi = true;
69886         } else {
69887           alternate.add(osmvalue);
69888         }
69889       }
69890     });
69891     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
69892       const osmvalue = tags.country;
69893       if (/;/.test(osmvalue)) {
69894         foundSemi = true;
69895       } else {
69896         alternate.add(osmvalue);
69897       }
69898     }
69899     if (foundSemi) {
69900       return empty2;
69901     } else {
69902       return { primary, alternate };
69903     }
69904     function isNamelike(osmkey, which) {
69905       if (osmkey === "old_name")
69906         return false;
69907       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
69908     }
69909   }
69910   function gatherTuples(tryKVs, tryNames) {
69911     let tuples = [];
69912     ["primary", "alternate"].forEach((whichName) => {
69913       const arr = Array.from(tryNames[whichName]).sort((a, b) => b.length - a.length);
69914       arr.forEach((n2) => {
69915         ["primary", "alternate"].forEach((whichKV) => {
69916           tryKVs[whichKV].forEach((kv) => {
69917             const parts = kv.split("/", 2);
69918             const k = parts[0];
69919             const v = parts[1];
69920             tuples.push({ k, v, n: n2 });
69921           });
69922         });
69923       });
69924     });
69925     return tuples;
69926   }
69927   function _upgradeTags(tags, loc) {
69928     let newTags = Object.assign({}, tags);
69929     let changed = false;
69930     Object.keys(newTags).forEach((osmkey) => {
69931       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
69932       if (matchTag) {
69933         const prefix = matchTag[1] || "";
69934         const wd = newTags[osmkey];
69935         const replace = _nsi.replacements[wd];
69936         if (replace && replace.wikidata !== void 0) {
69937           changed = true;
69938           if (replace.wikidata) {
69939             newTags[osmkey] = replace.wikidata;
69940           } else {
69941             delete newTags[osmkey];
69942           }
69943         }
69944         if (replace && replace.wikipedia !== void 0) {
69945           changed = true;
69946           const wpkey = `${prefix}wikipedia`;
69947           if (replace.wikipedia) {
69948             newTags[wpkey] = replace.wikipedia;
69949           } else {
69950             delete newTags[wpkey];
69951           }
69952         }
69953       }
69954     });
69955     const isRouteMaster = tags.type === "route_master";
69956     const tryKVs = gatherKVs(tags);
69957     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
69958       return changed ? { newTags, matched: null } : null;
69959     }
69960     const tryNames = gatherNames(tags);
69961     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
69962     if (foundQID)
69963       tryNames.primary.add(foundQID);
69964     if (!tryNames.primary.size && !tryNames.alternate.size) {
69965       return changed ? { newTags, matched: null } : null;
69966     }
69967     const tuples = gatherTuples(tryKVs, tryNames);
69968     let foundPrimary = false;
69969     let bestItem;
69970     for (let i2 = 0; i2 < tuples.length && !foundPrimary; i2++) {
69971       const tuple = tuples[i2];
69972       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
69973       if (!hits || !hits.length)
69974         continue;
69975       if (hits[0].match !== "primary" && hits[0].match !== "alternate")
69976         break;
69977       for (let j2 = 0; j2 < hits.length; j2++) {
69978         const hit = hits[j2];
69979         const isPrimary = hits[j2].match === "primary";
69980         const itemID = hit.itemID;
69981         if (_nsi.dissolved[itemID])
69982           continue;
69983         const item = _nsi.ids.get(itemID);
69984         if (!item)
69985           continue;
69986         const mainTag = item.mainTag;
69987         const itemQID = item.tags[mainTag];
69988         const notQID = newTags[`not:${mainTag}`];
69989         if (!itemQID || itemQID === notQID || newTags.office && !item.tags.office) {
69990           continue;
69991         }
69992         if (!bestItem || isPrimary) {
69993           bestItem = item;
69994           if (isPrimary) {
69995             foundPrimary = true;
69996           }
69997           break;
69998         }
69999       }
70000     }
70001     if (bestItem) {
70002       const itemID = bestItem.id;
70003       const item = JSON.parse(JSON.stringify(bestItem));
70004       const tkv = item.tkv;
70005       const parts = tkv.split("/", 3);
70006       const k = parts[1];
70007       const v = parts[2];
70008       const category = _nsi.data[tkv];
70009       const properties = category.properties || {};
70010       let preserveTags = item.preserveTags || properties.preserveTags || [];
70011       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
70012         if (k !== osmkey)
70013           preserveTags.push(`^${osmkey}$`);
70014       });
70015       const regexes = preserveTags.map((s) => new RegExp(s, "i"));
70016       let keepTags = {};
70017       Object.keys(newTags).forEach((osmkey) => {
70018         if (regexes.some((regex) => regex.test(osmkey))) {
70019           keepTags[osmkey] = newTags[osmkey];
70020         }
70021       });
70022       _nsi.kvt.forEach((vmap, k2) => {
70023         if (newTags[k2] === "yes")
70024           delete newTags[k2];
70025       });
70026       if (foundQID) {
70027         delete newTags.wikipedia;
70028         delete newTags.wikidata;
70029       }
70030       Object.assign(newTags, item.tags, keepTags);
70031       if (isRouteMaster) {
70032         newTags.route_master = newTags.route;
70033         delete newTags.route;
70034       }
70035       const origName = tags.name;
70036       const newName = newTags.name;
70037       if (newName && origName && newName !== origName && !newTags.branch) {
70038         const newNames = gatherNames(newTags);
70039         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
70040         const isMoved = newSet.has(origName);
70041         if (!isMoved) {
70042           const nameParts = origName.split(/[\s\-\/,.]/);
70043           for (let split = nameParts.length; split > 0; split--) {
70044             const name = nameParts.slice(0, split).join(" ");
70045             const branch = nameParts.slice(split).join(" ");
70046             const nameHits = _nsi.matcher.match(k, v, name, loc);
70047             if (!nameHits || !nameHits.length)
70048               continue;
70049             if (nameHits.some((hit) => hit.itemID === itemID)) {
70050               if (branch) {
70051                 if (notBranches.test(branch)) {
70052                   newTags.name = origName;
70053                 } else {
70054                   const branchHits = _nsi.matcher.match(k, v, branch, loc);
70055                   if (branchHits && branchHits.length) {
70056                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
70057                       return null;
70058                     }
70059                   } else {
70060                     newTags.branch = branch;
70061                   }
70062                 }
70063               }
70064               break;
70065             }
70066           }
70067         }
70068       }
70069       return { newTags, matched: item };
70070     }
70071     return changed ? { newTags, matched: null } : null;
70072   }
70073   function _isGenericName(tags) {
70074     const n2 = tags.name;
70075     if (!n2)
70076       return false;
70077     const tryNames = { primary: /* @__PURE__ */ new Set([n2]), alternate: /* @__PURE__ */ new Set() };
70078     const tryKVs = gatherKVs(tags);
70079     if (!tryKVs.primary.size && !tryKVs.alternate.size)
70080       return false;
70081     const tuples = gatherTuples(tryKVs, tryNames);
70082     for (let i2 = 0; i2 < tuples.length; i2++) {
70083       const tuple = tuples[i2];
70084       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
70085       if (hits && hits.length && hits[0].match === "excludeGeneric")
70086         return true;
70087     }
70088     return false;
70089   }
70090   var nsi_default = {
70091     init: () => {
70092       setNsiSources();
70093       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => delay(100)).then(() => _mainLocations.mergeLocationSets([])).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
70094       function delay(msec) {
70095         return new Promise((resolve) => {
70096           window.setTimeout(resolve, msec);
70097         });
70098       }
70099     },
70100     reset: () => {
70101     },
70102     status: () => _nsiStatus,
70103     isGenericName: (tags) => _isGenericName(tags),
70104     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
70105     cache: () => _nsi
70106   };
70107
70108   // modules/services/kartaview.js
70109   var import_rbush8 = __toESM(require_rbush_min());
70110   var apibase2 = "https://kartaview.org";
70111   var maxResults = 1e3;
70112   var tileZoom = 14;
70113   var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
70114   var dispatch6 = dispatch_default("loadedImages");
70115   var imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
70116   var _oscCache;
70117   var _oscSelectedImage;
70118   var _loadViewerPromise2;
70119   function abortRequest4(controller) {
70120     controller.abort();
70121   }
70122   function maxPageAtZoom(z) {
70123     if (z < 15)
70124       return 2;
70125     if (z === 15)
70126       return 5;
70127     if (z === 16)
70128       return 10;
70129     if (z === 17)
70130       return 20;
70131     if (z === 18)
70132       return 40;
70133     if (z > 18)
70134       return 80;
70135   }
70136   function loadTiles2(which, url, projection2) {
70137     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
70138     var tiles = tiler4.getTiles(projection2);
70139     var cache = _oscCache[which];
70140     Object.keys(cache.inflight).forEach(function(k) {
70141       var wanted = tiles.find(function(tile) {
70142         return k.indexOf(tile.id + ",") === 0;
70143       });
70144       if (!wanted) {
70145         abortRequest4(cache.inflight[k]);
70146         delete cache.inflight[k];
70147       }
70148     });
70149     tiles.forEach(function(tile) {
70150       loadNextTilePage(which, currZoom, url, tile);
70151     });
70152   }
70153   function loadNextTilePage(which, currZoom, url, tile) {
70154     var cache = _oscCache[which];
70155     var bbox = tile.extent.bbox();
70156     var maxPages = maxPageAtZoom(currZoom);
70157     var nextPage = cache.nextPage[tile.id] || 1;
70158     var params = utilQsString({
70159       ipp: maxResults,
70160       page: nextPage,
70161       bbTopLeft: [bbox.maxY, bbox.minX].join(","),
70162       bbBottomRight: [bbox.minY, bbox.maxX].join(",")
70163     }, true);
70164     if (nextPage > maxPages)
70165       return;
70166     var id2 = tile.id + "," + String(nextPage);
70167     if (cache.loaded[id2] || cache.inflight[id2])
70168       return;
70169     var controller = new AbortController();
70170     cache.inflight[id2] = controller;
70171     var options2 = {
70172       method: "POST",
70173       signal: controller.signal,
70174       body: params,
70175       headers: { "Content-Type": "application/x-www-form-urlencoded" }
70176     };
70177     json_default(url, options2).then(function(data) {
70178       cache.loaded[id2] = true;
70179       delete cache.inflight[id2];
70180       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
70181         throw new Error("No Data");
70182       }
70183       var features2 = data.currentPageItems.map(function(item) {
70184         var loc = [+item.lng, +item.lat];
70185         var d;
70186         if (which === "images") {
70187           d = {
70188             loc,
70189             key: item.id,
70190             ca: +item.heading,
70191             captured_at: item.shot_date || item.date_added,
70192             captured_by: item.username,
70193             imagePath: item.lth_name,
70194             sequence_id: item.sequence_id,
70195             sequence_index: +item.sequence_index
70196           };
70197           var seq = _oscCache.sequences[d.sequence_id];
70198           if (!seq) {
70199             seq = { rotation: 0, images: [] };
70200             _oscCache.sequences[d.sequence_id] = seq;
70201           }
70202           seq.images[d.sequence_index] = d;
70203           _oscCache.images.forImageKey[d.key] = d;
70204         }
70205         return {
70206           minX: loc[0],
70207           minY: loc[1],
70208           maxX: loc[0],
70209           maxY: loc[1],
70210           data: d
70211         };
70212       });
70213       cache.rtree.load(features2);
70214       if (data.currentPageItems.length === maxResults) {
70215         cache.nextPage[tile.id] = nextPage + 1;
70216         loadNextTilePage(which, currZoom, url, tile);
70217       } else {
70218         cache.nextPage[tile.id] = Infinity;
70219       }
70220       if (which === "images") {
70221         dispatch6.call("loadedImages");
70222       }
70223     }).catch(function() {
70224       cache.loaded[id2] = true;
70225       delete cache.inflight[id2];
70226     });
70227   }
70228   function partitionViewport2(projection2) {
70229     var z = geoScaleToZoom(projection2.scale());
70230     var z2 = Math.ceil(z * 2) / 2 + 2.5;
70231     var tiler8 = utilTiler().zoomExtent([z2, z2]);
70232     return tiler8.getTiles(projection2).map(function(tile) {
70233       return tile.extent;
70234     });
70235   }
70236   function searchLimited2(limit, projection2, rtree) {
70237     limit = limit || 5;
70238     return partitionViewport2(projection2).reduce(function(result, extent) {
70239       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
70240         return d.data;
70241       });
70242       return found.length ? result.concat(found) : result;
70243     }, []);
70244   }
70245   var kartaview_default = {
70246     init: function() {
70247       if (!_oscCache) {
70248         this.reset();
70249       }
70250       this.event = utilRebind(this, dispatch6, "on");
70251     },
70252     reset: function() {
70253       if (_oscCache) {
70254         Object.values(_oscCache.images.inflight).forEach(abortRequest4);
70255       }
70256       _oscCache = {
70257         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
70258         sequences: {}
70259       };
70260       _oscSelectedImage = null;
70261     },
70262     images: function(projection2) {
70263       var limit = 5;
70264       return searchLimited2(limit, projection2, _oscCache.images.rtree);
70265     },
70266     sequences: function(projection2) {
70267       var viewport = projection2.clipExtent();
70268       var min3 = [viewport[0][0], viewport[1][1]];
70269       var max3 = [viewport[1][0], viewport[0][1]];
70270       var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
70271       var sequenceKeys = {};
70272       _oscCache.images.rtree.search(bbox).forEach(function(d) {
70273         sequenceKeys[d.data.sequence_id] = true;
70274       });
70275       var lineStrings = [];
70276       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
70277         var seq = _oscCache.sequences[sequenceKey];
70278         var images = seq && seq.images;
70279         if (images) {
70280           lineStrings.push({
70281             type: "LineString",
70282             coordinates: images.map(function(d) {
70283               return d.loc;
70284             }).filter(Boolean),
70285             properties: {
70286               captured_at: images[0] ? images[0].captured_at : null,
70287               captured_by: images[0] ? images[0].captured_by : null,
70288               key: sequenceKey
70289             }
70290           });
70291         }
70292       });
70293       return lineStrings;
70294     },
70295     cachedImage: function(imageKey) {
70296       return _oscCache.images.forImageKey[imageKey];
70297     },
70298     loadImages: function(projection2) {
70299       var url = apibase2 + "/1.0/list/nearby-photos/";
70300       loadTiles2("images", url, projection2);
70301     },
70302     ensureViewerLoaded: function(context) {
70303       if (_loadViewerPromise2)
70304         return _loadViewerPromise2;
70305       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
70306       var that = this;
70307       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan)).on("dblclick.zoom", null);
70308       wrapEnter.append("div").attr("class", "photo-attribution fillD");
70309       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
70310       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
70311       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
70312       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
70313       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
70314       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
70315       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
70316         imgZoom = zoom_default2().extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]).scaleExtent([1, 15]).on("zoom", zoomPan);
70317       });
70318       function zoomPan(d3_event) {
70319         var t = d3_event.transform;
70320         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t.x, t.y, t.k);
70321       }
70322       function rotate(deg) {
70323         return function() {
70324           if (!_oscSelectedImage)
70325             return;
70326           var sequenceKey = _oscSelectedImage.sequence_id;
70327           var sequence = _oscCache.sequences[sequenceKey];
70328           if (!sequence)
70329             return;
70330           var r = sequence.rotation || 0;
70331           r += deg;
70332           if (r > 180)
70333             r -= 360;
70334           if (r < -180)
70335             r += 360;
70336           sequence.rotation = r;
70337           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
70338           wrap3.transition().duration(100).call(imgZoom.transform, identity2);
70339           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r + "deg)");
70340         };
70341       }
70342       function step(stepBy) {
70343         return function() {
70344           if (!_oscSelectedImage)
70345             return;
70346           var sequenceKey = _oscSelectedImage.sequence_id;
70347           var sequence = _oscCache.sequences[sequenceKey];
70348           if (!sequence)
70349             return;
70350           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
70351           var nextImage = sequence.images[nextIndex];
70352           if (!nextImage)
70353             return;
70354           context.map().centerEase(nextImage.loc);
70355           that.selectImage(context, nextImage.key);
70356         };
70357       }
70358       _loadViewerPromise2 = Promise.resolve();
70359       return _loadViewerPromise2;
70360     },
70361     showViewer: function(context) {
70362       var viewer = context.container().select(".photoviewer").classed("hide", false);
70363       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
70364       if (isHidden) {
70365         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
70366         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
70367       }
70368       return this;
70369     },
70370     hideViewer: function(context) {
70371       _oscSelectedImage = null;
70372       this.updateUrlImage(null);
70373       var viewer = context.container().select(".photoviewer");
70374       if (!viewer.empty())
70375         viewer.datum(null);
70376       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
70377       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
70378       return this.setStyles(context, null, true);
70379     },
70380     selectImage: function(context, imageKey) {
70381       var d = this.cachedImage(imageKey);
70382       _oscSelectedImage = d;
70383       this.updateUrlImage(imageKey);
70384       var viewer = context.container().select(".photoviewer");
70385       if (!viewer.empty())
70386         viewer.datum(d);
70387       this.setStyles(context, null, true);
70388       context.container().selectAll(".icon-sign").classed("currentView", false);
70389       if (!d)
70390         return this;
70391       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
70392       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
70393       var attribution = wrap2.selectAll(".photo-attribution").text("");
70394       wrap2.transition().duration(100).call(imgZoom.transform, identity2);
70395       imageWrap.selectAll(".kartaview-image").remove();
70396       if (d) {
70397         var sequence = _oscCache.sequences[d.sequence_id];
70398         var r = sequence && sequence.rotation || 0;
70399         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d.imagePath).style("transform", "rotate(" + r + "deg)");
70400         if (d.captured_by) {
70401           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d.captured_by)).text("@" + d.captured_by);
70402           attribution.append("span").text("|");
70403         }
70404         if (d.captured_at) {
70405           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d.captured_at));
70406           attribution.append("span").text("|");
70407         }
70408         attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://kartaview.org/details/" + d.sequence_id + "/" + d.sequence_index).text("kartaview.org");
70409       }
70410       return this;
70411       function localeDateString2(s) {
70412         if (!s)
70413           return null;
70414         var options2 = { day: "numeric", month: "short", year: "numeric" };
70415         var d2 = new Date(s);
70416         if (isNaN(d2.getTime()))
70417           return null;
70418         return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
70419       }
70420     },
70421     getSelectedImage: function() {
70422       return _oscSelectedImage;
70423     },
70424     getSequenceKeyForImage: function(d) {
70425       return d && d.sequence_id;
70426     },
70427     setStyles: function(context, hovered, reset) {
70428       if (reset) {
70429         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
70430         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
70431       }
70432       var hoveredImageKey = hovered && hovered.key;
70433       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
70434       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
70435       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d) {
70436         return d.key;
70437       }) || [];
70438       var viewer = context.container().select(".photoviewer");
70439       var selected = viewer.empty() ? void 0 : viewer.datum();
70440       var selectedImageKey = selected && selected.key;
70441       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
70442       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
70443       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d) {
70444         return d.key;
70445       }) || [];
70446       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
70447       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d) {
70448         return highlightedImageKeys.indexOf(d.key) !== -1;
70449       }).classed("hovered", function(d) {
70450         return d.key === hoveredImageKey;
70451       }).classed("currentView", function(d) {
70452         return d.key === selectedImageKey;
70453       });
70454       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d) {
70455         return d.properties.key === hoveredSequenceKey;
70456       }).classed("currentView", function(d) {
70457         return d.properties.key === selectedSequenceKey;
70458       });
70459       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
70460       function viewfieldPath() {
70461         var d = this.parentNode.__data__;
70462         if (d.pano && d.key !== selectedImageKey) {
70463           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
70464         } else {
70465           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
70466         }
70467       }
70468       return this;
70469     },
70470     updateUrlImage: function(imageKey) {
70471       if (!window.mocha) {
70472         var hash = utilStringQs(window.location.hash);
70473         if (imageKey) {
70474           hash.photo = "kartaview/" + imageKey;
70475         } else {
70476           delete hash.photo;
70477         }
70478         window.location.replace("#" + utilQsString(hash, true));
70479       }
70480     },
70481     cache: function() {
70482       return _oscCache;
70483     }
70484   };
70485
70486   // node_modules/osm-auth/src/osm-auth.mjs
70487   var import_store = __toESM(require_store_legacy(), 1);
70488   function osmAuth(o) {
70489     var oauth2 = {};
70490     oauth2.authenticated = function() {
70491       return !!token("oauth2_access_token");
70492     };
70493     oauth2.logout = function() {
70494       token("oauth2_access_token", "");
70495       token("oauth_token", "");
70496       token("oauth_token_secret", "");
70497       token("oauth_request_token_secret", "");
70498       return oauth2;
70499     };
70500     oauth2.authenticate = function(callback) {
70501       if (oauth2.authenticated()) {
70502         callback(null, oauth2);
70503         return;
70504       }
70505       oauth2.logout();
70506       var url = o.url + "/oauth2/authorize?" + utilQsString2({
70507         client_id: o.client_id,
70508         redirect_uri: o.redirect_uri,
70509         response_type: "code",
70510         scope: o.scope
70511       });
70512       if (!o.singlepage) {
70513         var w = 600;
70514         var h = 550;
70515         var settings = [
70516           ["width", w],
70517           ["height", h],
70518           ["left", screen.width / 2 - w / 2],
70519           ["top", screen.height / 2 - h / 2]
70520         ].map(function(x) {
70521           return x.join("=");
70522         }).join(",");
70523         var popup = window.open("about:blank", "oauth_window", settings);
70524         oauth2.popupWindow = popup;
70525         popup.location = url;
70526         if (!popup) {
70527           var error = new Error("Popup was blocked");
70528           error.status = "popup-blocked";
70529           throw error;
70530         }
70531       }
70532       window.authComplete = function(url2) {
70533         var params = utilStringQs2(url2.split("?")[1]);
70534         getAccessToken(params.code);
70535         delete window.authComplete;
70536       };
70537       function getAccessToken(auth_code) {
70538         var url2 = o.url + "/oauth2/token?" + utilQsString2({
70539           client_id: o.client_id,
70540           grant_type: "authorization_code",
70541           code: auth_code,
70542           redirect_uri: o.redirect_uri,
70543           client_secret: o.client_secret
70544         });
70545         oauth2.rawxhr("POST", url2, null, null, null, accessTokenDone);
70546         o.loading();
70547       }
70548       function accessTokenDone(err, xhr) {
70549         o.done();
70550         if (err) {
70551           callback(err);
70552           return;
70553         }
70554         var access_token = JSON.parse(xhr.response);
70555         token("oauth2_access_token", access_token.access_token);
70556         callback(null, oauth2);
70557       }
70558     };
70559     oauth2.bringPopupWindowToFront = function() {
70560       var broughtPopupToFront = false;
70561       try {
70562         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
70563           oauth2.popupWindow.focus();
70564           broughtPopupToFront = true;
70565         }
70566       } catch (err) {
70567       }
70568       return broughtPopupToFront;
70569     };
70570     oauth2.bootstrapToken = function(auth_code, callback) {
70571       function getAccessToken(auth_code2) {
70572         var url = o.url + "/oauth2/token?" + utilQsString2({
70573           client_id: o.client_id,
70574           grant_type: "authorization_code",
70575           code: auth_code2,
70576           redirect_uri: o.redirect_uri,
70577           client_secret: o.client_secret
70578         });
70579         oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
70580         o.loading();
70581       }
70582       function accessTokenDone(err, xhr) {
70583         o.done();
70584         if (err) {
70585           callback(err);
70586           return;
70587         }
70588         var access_token = JSON.parse(xhr.response);
70589         token("oauth2_access_token", access_token.access_token);
70590         callback(null, oauth2);
70591       }
70592       getAccessToken(auth_code);
70593     };
70594     oauth2.xhr = function(options2, callback) {
70595       if (oauth2.authenticated()) {
70596         return run();
70597       } else {
70598         if (o.auto) {
70599           oauth2.authenticate(run);
70600           return;
70601         } else {
70602           callback("not authenticated", null);
70603           return;
70604         }
70605       }
70606       function run() {
70607         var url = options2.prefix !== false ? o.url + options2.path : options2.path;
70608         return oauth2.rawxhr(
70609           options2.method,
70610           url,
70611           token("oauth2_access_token"),
70612           options2.content,
70613           options2.headers,
70614           done
70615         );
70616       }
70617       function done(err, xhr) {
70618         if (err) {
70619           callback(err);
70620         } else if (xhr.responseXML) {
70621           callback(err, xhr.responseXML);
70622         } else {
70623           callback(err, xhr.response);
70624         }
70625       }
70626     };
70627     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
70628       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
70629       if (access_token) {
70630         headers.Authorization = "Bearer " + access_token;
70631       }
70632       var xhr = new XMLHttpRequest();
70633       xhr.onreadystatechange = function() {
70634         if (4 === xhr.readyState && 0 !== xhr.status) {
70635           if (/^20\d$/.test(xhr.status)) {
70636             callback(null, xhr);
70637           } else {
70638             callback(xhr, null);
70639           }
70640         }
70641       };
70642       xhr.onerror = function(e) {
70643         callback(e, null);
70644       };
70645       xhr.open(method, url, true);
70646       for (var h in headers)
70647         xhr.setRequestHeader(h, headers[h]);
70648       xhr.send(data);
70649       return xhr;
70650     };
70651     oauth2.preauth = function(val) {
70652       if (val && val.access_token) {
70653         token("oauth2_access_token", val.access_token);
70654       }
70655       return oauth2;
70656     };
70657     oauth2.options = function(val) {
70658       if (!arguments.length)
70659         return o;
70660       o = val;
70661       o.url = o.url || "https://www.openstreetmap.org";
70662       o.auto = o.auto || false;
70663       o.singlepage = o.singlepage || false;
70664       o.loading = o.loading || function() {
70665       };
70666       o.done = o.done || function() {
70667       };
70668       return oauth2.preauth(o);
70669     };
70670     var token;
70671     if (import_store.default.enabled) {
70672       token = function(x, y) {
70673         if (arguments.length === 1)
70674           return import_store.default.get(o.url + x);
70675         else if (arguments.length === 2)
70676           return import_store.default.set(o.url + x, y);
70677       };
70678     } else {
70679       var storage = {};
70680       token = function(x, y) {
70681         if (arguments.length === 1)
70682           return storage[o.url + x];
70683         else if (arguments.length === 2)
70684           return storage[o.url + x] = y;
70685       };
70686     }
70687     oauth2.options(o);
70688     return oauth2;
70689   }
70690   function utilQsString2(obj) {
70691     return Object.keys(obj).sort().map(function(key) {
70692       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
70693     }).join("&");
70694   }
70695   function utilStringQs2(str2) {
70696     var i2 = 0;
70697     while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
70698       i2++;
70699     str2 = str2.slice(i2);
70700     return str2.split("&").reduce(function(obj, pair2) {
70701       var parts = pair2.split("=");
70702       if (parts.length === 2) {
70703         obj[parts[0]] = decodeURIComponent(parts[1]);
70704       }
70705       return obj;
70706     }, {});
70707   }
70708
70709   // modules/services/osm.js
70710   var import_rbush9 = __toESM(require_rbush_min());
70711   var tiler5 = utilTiler();
70712   var dispatch7 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
70713   var urlroot = "https://www.openstreetmap.org";
70714   var redirectPath = window.location.origin + window.location.pathname;
70715   var oauth = osmAuth({
70716     url: urlroot,
70717     client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
70718     client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q",
70719     scope: "read_prefs write_prefs write_api read_gpx write_notes",
70720     redirect_uri: redirectPath + "land.html",
70721     loading: authLoading,
70722     done: authDone
70723   });
70724   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
70725   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
70726   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
70727   var _userCache = { toLoad: {}, user: {} };
70728   var _cachedApiStatus;
70729   var _changeset = {};
70730   var _deferred = /* @__PURE__ */ new Set();
70731   var _connectionID = 1;
70732   var _tileZoom4 = 16;
70733   var _noteZoom = 12;
70734   var _rateLimitError;
70735   var _userChangesets;
70736   var _userDetails;
70737   var _off;
70738   var _maxWayNodes = 2e3;
70739   function authLoading() {
70740     dispatch7.call("authLoading");
70741   }
70742   function authDone() {
70743     dispatch7.call("authDone");
70744   }
70745   function abortRequest5(controllerOrXHR) {
70746     if (controllerOrXHR) {
70747       controllerOrXHR.abort();
70748     }
70749   }
70750   function hasInflightRequests(cache) {
70751     return Object.keys(cache.inflight).length;
70752   }
70753   function abortUnwantedRequests4(cache, visibleTiles) {
70754     Object.keys(cache.inflight).forEach(function(k) {
70755       if (cache.toLoad[k])
70756         return;
70757       if (visibleTiles.find(function(tile) {
70758         return k === tile.id;
70759       }))
70760         return;
70761       abortRequest5(cache.inflight[k]);
70762       delete cache.inflight[k];
70763     });
70764   }
70765   function getLoc(attrs) {
70766     var lon = attrs.lon && attrs.lon.value;
70767     var lat = attrs.lat && attrs.lat.value;
70768     return [parseFloat(lon), parseFloat(lat)];
70769   }
70770   function getNodes(obj) {
70771     var elems = obj.getElementsByTagName("nd");
70772     var nodes = new Array(elems.length);
70773     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
70774       nodes[i2] = "n" + elems[i2].attributes.ref.value;
70775     }
70776     return nodes;
70777   }
70778   function getNodesJSON(obj) {
70779     var elems = obj.nodes;
70780     var nodes = new Array(elems.length);
70781     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
70782       nodes[i2] = "n" + elems[i2];
70783     }
70784     return nodes;
70785   }
70786   function getTags(obj) {
70787     var elems = obj.getElementsByTagName("tag");
70788     var tags = {};
70789     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
70790       var attrs = elems[i2].attributes;
70791       tags[attrs.k.value] = attrs.v.value;
70792     }
70793     return tags;
70794   }
70795   function getMembers(obj) {
70796     var elems = obj.getElementsByTagName("member");
70797     var members = new Array(elems.length);
70798     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
70799       var attrs = elems[i2].attributes;
70800       members[i2] = {
70801         id: attrs.type.value[0] + attrs.ref.value,
70802         type: attrs.type.value,
70803         role: attrs.role.value
70804       };
70805     }
70806     return members;
70807   }
70808   function getMembersJSON(obj) {
70809     var elems = obj.members;
70810     var members = new Array(elems.length);
70811     for (var i2 = 0, l = elems.length; i2 < l; i2++) {
70812       var attrs = elems[i2];
70813       members[i2] = {
70814         id: attrs.type[0] + attrs.ref,
70815         type: attrs.type,
70816         role: attrs.role
70817       };
70818     }
70819     return members;
70820   }
70821   function getVisible(attrs) {
70822     return !attrs.visible || attrs.visible.value !== "false";
70823   }
70824   function parseComments(comments) {
70825     var parsedComments = [];
70826     for (var i2 = 0; i2 < comments.length; i2++) {
70827       var comment = comments[i2];
70828       if (comment.nodeName === "comment") {
70829         var childNodes = comment.childNodes;
70830         var parsedComment = {};
70831         for (var j2 = 0; j2 < childNodes.length; j2++) {
70832           var node = childNodes[j2];
70833           var nodeName = node.nodeName;
70834           if (nodeName === "#text")
70835             continue;
70836           parsedComment[nodeName] = node.textContent;
70837           if (nodeName === "uid") {
70838             var uid = node.textContent;
70839             if (uid && !_userCache.user[uid]) {
70840               _userCache.toLoad[uid] = true;
70841             }
70842           }
70843         }
70844         if (parsedComment) {
70845           parsedComments.push(parsedComment);
70846         }
70847       }
70848     }
70849     return parsedComments;
70850   }
70851   function encodeNoteRtree(note) {
70852     return {
70853       minX: note.loc[0],
70854       minY: note.loc[1],
70855       maxX: note.loc[0],
70856       maxY: note.loc[1],
70857       data: note
70858     };
70859   }
70860   var jsonparsers = {
70861     node: function nodeData(obj, uid) {
70862       return new osmNode({
70863         id: uid,
70864         visible: typeof obj.visible === "boolean" ? obj.visible : true,
70865         version: obj.version && obj.version.toString(),
70866         changeset: obj.changeset && obj.changeset.toString(),
70867         timestamp: obj.timestamp,
70868         user: obj.user,
70869         uid: obj.uid && obj.uid.toString(),
70870         loc: [parseFloat(obj.lon), parseFloat(obj.lat)],
70871         tags: obj.tags
70872       });
70873     },
70874     way: function wayData(obj, uid) {
70875       return new osmWay({
70876         id: uid,
70877         visible: typeof obj.visible === "boolean" ? obj.visible : true,
70878         version: obj.version && obj.version.toString(),
70879         changeset: obj.changeset && obj.changeset.toString(),
70880         timestamp: obj.timestamp,
70881         user: obj.user,
70882         uid: obj.uid && obj.uid.toString(),
70883         tags: obj.tags,
70884         nodes: getNodesJSON(obj)
70885       });
70886     },
70887     relation: function relationData(obj, uid) {
70888       return new osmRelation({
70889         id: uid,
70890         visible: typeof obj.visible === "boolean" ? obj.visible : true,
70891         version: obj.version && obj.version.toString(),
70892         changeset: obj.changeset && obj.changeset.toString(),
70893         timestamp: obj.timestamp,
70894         user: obj.user,
70895         uid: obj.uid && obj.uid.toString(),
70896         tags: obj.tags,
70897         members: getMembersJSON(obj)
70898       });
70899     },
70900     user: function parseUser(obj, uid) {
70901       return {
70902         id: uid,
70903         display_name: obj.display_name,
70904         account_created: obj.account_created,
70905         image_url: obj.img && obj.img.href,
70906         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
70907         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
70908       };
70909     }
70910   };
70911   function parseJSON(payload, callback, options2) {
70912     options2 = Object.assign({ skipSeen: true }, options2);
70913     if (!payload) {
70914       return callback({ message: "No JSON", status: -1 });
70915     }
70916     var json = payload;
70917     if (typeof json !== "object")
70918       json = JSON.parse(payload);
70919     if (!json.elements)
70920       return callback({ message: "No JSON", status: -1 });
70921     var children2 = json.elements;
70922     var handle = window.requestIdleCallback(function() {
70923       _deferred.delete(handle);
70924       var results = [];
70925       var result;
70926       for (var i2 = 0; i2 < children2.length; i2++) {
70927         result = parseChild(children2[i2]);
70928         if (result)
70929           results.push(result);
70930       }
70931       callback(null, results);
70932     });
70933     _deferred.add(handle);
70934     function parseChild(child) {
70935       var parser3 = jsonparsers[child.type];
70936       if (!parser3)
70937         return null;
70938       var uid;
70939       uid = osmEntity.id.fromOSM(child.type, child.id);
70940       if (options2.skipSeen) {
70941         if (_tileCache.seen[uid])
70942           return null;
70943         _tileCache.seen[uid] = true;
70944       }
70945       return parser3(child, uid);
70946     }
70947   }
70948   function parseUserJSON(payload, callback, options2) {
70949     options2 = Object.assign({ skipSeen: true }, options2);
70950     if (!payload) {
70951       return callback({ message: "No JSON", status: -1 });
70952     }
70953     var json = payload;
70954     if (typeof json !== "object")
70955       json = JSON.parse(payload);
70956     if (!json.users && !json.user)
70957       return callback({ message: "No JSON", status: -1 });
70958     var objs = json.users || [json];
70959     var handle = window.requestIdleCallback(function() {
70960       _deferred.delete(handle);
70961       var results = [];
70962       var result;
70963       for (var i2 = 0; i2 < objs.length; i2++) {
70964         result = parseObj(objs[i2]);
70965         if (result)
70966           results.push(result);
70967       }
70968       callback(null, results);
70969     });
70970     _deferred.add(handle);
70971     function parseObj(obj) {
70972       var uid = obj.user.id && obj.user.id.toString();
70973       if (options2.skipSeen && _userCache.user[uid]) {
70974         delete _userCache.toLoad[uid];
70975         return null;
70976       }
70977       var user = jsonparsers.user(obj.user, uid);
70978       _userCache.user[uid] = user;
70979       delete _userCache.toLoad[uid];
70980       return user;
70981     }
70982   }
70983   var parsers = {
70984     node: function nodeData2(obj, uid) {
70985       var attrs = obj.attributes;
70986       return new osmNode({
70987         id: uid,
70988         visible: getVisible(attrs),
70989         version: attrs.version.value,
70990         changeset: attrs.changeset && attrs.changeset.value,
70991         timestamp: attrs.timestamp && attrs.timestamp.value,
70992         user: attrs.user && attrs.user.value,
70993         uid: attrs.uid && attrs.uid.value,
70994         loc: getLoc(attrs),
70995         tags: getTags(obj)
70996       });
70997     },
70998     way: function wayData2(obj, uid) {
70999       var attrs = obj.attributes;
71000       return new osmWay({
71001         id: uid,
71002         visible: getVisible(attrs),
71003         version: attrs.version.value,
71004         changeset: attrs.changeset && attrs.changeset.value,
71005         timestamp: attrs.timestamp && attrs.timestamp.value,
71006         user: attrs.user && attrs.user.value,
71007         uid: attrs.uid && attrs.uid.value,
71008         tags: getTags(obj),
71009         nodes: getNodes(obj)
71010       });
71011     },
71012     relation: function relationData2(obj, uid) {
71013       var attrs = obj.attributes;
71014       return new osmRelation({
71015         id: uid,
71016         visible: getVisible(attrs),
71017         version: attrs.version.value,
71018         changeset: attrs.changeset && attrs.changeset.value,
71019         timestamp: attrs.timestamp && attrs.timestamp.value,
71020         user: attrs.user && attrs.user.value,
71021         uid: attrs.uid && attrs.uid.value,
71022         tags: getTags(obj),
71023         members: getMembers(obj)
71024       });
71025     },
71026     note: function parseNote(obj, uid) {
71027       var attrs = obj.attributes;
71028       var childNodes = obj.childNodes;
71029       var props = {};
71030       props.id = uid;
71031       props.loc = getLoc(attrs);
71032       var coincident = false;
71033       var epsilon3 = 1e-5;
71034       do {
71035         if (coincident) {
71036           props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
71037         }
71038         var bbox = geoExtent(props.loc).bbox();
71039         coincident = _noteCache.rtree.search(bbox).length;
71040       } while (coincident);
71041       for (var i2 = 0; i2 < childNodes.length; i2++) {
71042         var node = childNodes[i2];
71043         var nodeName = node.nodeName;
71044         if (nodeName === "#text")
71045           continue;
71046         if (nodeName === "comments") {
71047           props[nodeName] = parseComments(node.childNodes);
71048         } else {
71049           props[nodeName] = node.textContent;
71050         }
71051       }
71052       var note = new osmNote(props);
71053       var item = encodeNoteRtree(note);
71054       _noteCache.note[note.id] = note;
71055       _noteCache.rtree.insert(item);
71056       return note;
71057     },
71058     user: function parseUser2(obj, uid) {
71059       var attrs = obj.attributes;
71060       var user = {
71061         id: uid,
71062         display_name: attrs.display_name && attrs.display_name.value,
71063         account_created: attrs.account_created && attrs.account_created.value,
71064         changesets_count: "0",
71065         active_blocks: "0"
71066       };
71067       var img = obj.getElementsByTagName("img");
71068       if (img && img[0] && img[0].getAttribute("href")) {
71069         user.image_url = img[0].getAttribute("href");
71070       }
71071       var changesets = obj.getElementsByTagName("changesets");
71072       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
71073         user.changesets_count = changesets[0].getAttribute("count");
71074       }
71075       var blocks = obj.getElementsByTagName("blocks");
71076       if (blocks && blocks[0]) {
71077         var received = blocks[0].getElementsByTagName("received");
71078         if (received && received[0] && received[0].getAttribute("active")) {
71079           user.active_blocks = received[0].getAttribute("active");
71080         }
71081       }
71082       _userCache.user[uid] = user;
71083       delete _userCache.toLoad[uid];
71084       return user;
71085     }
71086   };
71087   function parseXML(xml, callback, options2) {
71088     options2 = Object.assign({ skipSeen: true }, options2);
71089     if (!xml || !xml.childNodes) {
71090       return callback({ message: "No XML", status: -1 });
71091     }
71092     var root3 = xml.childNodes[0];
71093     var children2 = root3.childNodes;
71094     var handle = window.requestIdleCallback(function() {
71095       _deferred.delete(handle);
71096       var results = [];
71097       var result;
71098       for (var i2 = 0; i2 < children2.length; i2++) {
71099         result = parseChild(children2[i2]);
71100         if (result)
71101           results.push(result);
71102       }
71103       callback(null, results);
71104     });
71105     _deferred.add(handle);
71106     function parseChild(child) {
71107       var parser3 = parsers[child.nodeName];
71108       if (!parser3)
71109         return null;
71110       var uid;
71111       if (child.nodeName === "user") {
71112         uid = child.attributes.id.value;
71113         if (options2.skipSeen && _userCache.user[uid]) {
71114           delete _userCache.toLoad[uid];
71115           return null;
71116         }
71117       } else if (child.nodeName === "note") {
71118         uid = child.getElementsByTagName("id")[0].textContent;
71119       } else {
71120         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
71121         if (options2.skipSeen) {
71122           if (_tileCache.seen[uid])
71123             return null;
71124           _tileCache.seen[uid] = true;
71125         }
71126       }
71127       return parser3(child, uid);
71128     }
71129   }
71130   function updateRtree4(item, replace) {
71131     _noteCache.rtree.remove(item, function isEql(a, b) {
71132       return a.data.id === b.data.id;
71133     });
71134     if (replace) {
71135       _noteCache.rtree.insert(item);
71136     }
71137   }
71138   function wrapcb(thisArg, callback, cid) {
71139     return function(err, result) {
71140       if (err) {
71141         if (err.status === 400 || err.status === 401 || err.status === 403) {
71142           thisArg.logout();
71143         }
71144         return callback.call(thisArg, err);
71145       } else if (thisArg.getConnectionId() !== cid) {
71146         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
71147       } else {
71148         return callback.call(thisArg, err, result);
71149       }
71150     };
71151   }
71152   var osm_default = {
71153     init: function() {
71154       utilRebind(this, dispatch7, "on");
71155     },
71156     reset: function() {
71157       Array.from(_deferred).forEach(function(handle) {
71158         window.cancelIdleCallback(handle);
71159         _deferred.delete(handle);
71160       });
71161       _connectionID++;
71162       _userChangesets = void 0;
71163       _userDetails = void 0;
71164       _rateLimitError = void 0;
71165       Object.values(_tileCache.inflight).forEach(abortRequest5);
71166       Object.values(_noteCache.inflight).forEach(abortRequest5);
71167       Object.values(_noteCache.inflightPost).forEach(abortRequest5);
71168       if (_changeset.inflight)
71169         abortRequest5(_changeset.inflight);
71170       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
71171       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
71172       _userCache = { toLoad: {}, user: {} };
71173       _cachedApiStatus = void 0;
71174       _changeset = {};
71175       return this;
71176     },
71177     getConnectionId: function() {
71178       return _connectionID;
71179     },
71180     getUrlRoot: function() {
71181       return urlroot;
71182     },
71183     changesetURL: function(changesetID) {
71184       return urlroot + "/changeset/" + changesetID;
71185     },
71186     changesetsURL: function(center, zoom) {
71187       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
71188       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
71189     },
71190     entityURL: function(entity) {
71191       return urlroot + "/" + entity.type + "/" + entity.osmId();
71192     },
71193     historyURL: function(entity) {
71194       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
71195     },
71196     userURL: function(username) {
71197       return urlroot + "/user/" + encodeURIComponent(username);
71198     },
71199     noteURL: function(note) {
71200       return urlroot + "/note/" + note.id;
71201     },
71202     noteReportURL: function(note) {
71203       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
71204     },
71205     loadFromAPI: function(path, callback, options2) {
71206       options2 = Object.assign({ skipSeen: true }, options2);
71207       var that = this;
71208       var cid = _connectionID;
71209       function done(err, payload) {
71210         if (that.getConnectionId() !== cid) {
71211           if (callback)
71212             callback({ message: "Connection Switched", status: -1 });
71213           return;
71214         }
71215         var isAuthenticated = that.authenticated();
71216         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
71217           that.logout();
71218           that.loadFromAPI(path, callback, options2);
71219         } else {
71220           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
71221             _rateLimitError = err;
71222             dispatch7.call("change");
71223             that.reloadApiStatus();
71224           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
71225             that.reloadApiStatus();
71226           }
71227           if (callback) {
71228             if (err) {
71229               return callback(err);
71230             } else {
71231               if (path.indexOf(".json") !== -1) {
71232                 return parseJSON(payload, callback, options2);
71233               } else {
71234                 return parseXML(payload, callback, options2);
71235               }
71236             }
71237           }
71238         }
71239       }
71240       if (this.authenticated()) {
71241         return oauth.xhr({ method: "GET", path }, done);
71242       } else {
71243         var url = urlroot + path;
71244         var controller = new AbortController();
71245         var fn;
71246         if (path.indexOf(".json") !== -1) {
71247           fn = json_default;
71248         } else {
71249           fn = xml_default;
71250         }
71251         fn(url, { signal: controller.signal }).then(function(data) {
71252           done(null, data);
71253         }).catch(function(err) {
71254           if (err.name === "AbortError")
71255             return;
71256           var match = err.message.match(/^\d{3}/);
71257           if (match) {
71258             done({ status: +match[0], statusText: err.message });
71259           } else {
71260             done(err.message);
71261           }
71262         });
71263         return controller;
71264       }
71265     },
71266     loadEntity: function(id2, callback) {
71267       var type3 = osmEntity.id.type(id2);
71268       var osmID = osmEntity.id.toOSM(id2);
71269       var options2 = { skipSeen: false };
71270       this.loadFromAPI(
71271         "/api/0.6/" + type3 + "/" + osmID + (type3 !== "node" ? "/full" : "") + ".json",
71272         function(err, entities) {
71273           if (callback)
71274             callback(err, { data: entities });
71275         },
71276         options2
71277       );
71278     },
71279     loadEntityVersion: function(id2, version, callback) {
71280       var type3 = osmEntity.id.type(id2);
71281       var osmID = osmEntity.id.toOSM(id2);
71282       var options2 = { skipSeen: false };
71283       this.loadFromAPI(
71284         "/api/0.6/" + type3 + "/" + osmID + "/" + version + ".json",
71285         function(err, entities) {
71286           if (callback)
71287             callback(err, { data: entities });
71288         },
71289         options2
71290       );
71291     },
71292     loadEntityRelations: function(id2, callback) {
71293       var type3 = osmEntity.id.type(id2);
71294       var osmID = osmEntity.id.toOSM(id2);
71295       var options2 = { skipSeen: false };
71296       this.loadFromAPI(
71297         "/api/0.6/" + type3 + "/" + osmID + "/relations.json",
71298         function(err, entities) {
71299           if (callback)
71300             callback(err, { data: entities });
71301         },
71302         options2
71303       );
71304     },
71305     loadMultiple: function(ids, callback) {
71306       var that = this;
71307       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
71308       Object.keys(groups).forEach(function(k) {
71309         var type3 = k + "s";
71310         var osmIDs = groups[k].map(function(id2) {
71311           return osmEntity.id.toOSM(id2);
71312         });
71313         var options2 = { skipSeen: false };
71314         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
71315           that.loadFromAPI(
71316             "/api/0.6/" + type3 + ".json?" + type3 + "=" + arr.join(),
71317             function(err, entities) {
71318               if (callback)
71319                 callback(err, { data: entities });
71320             },
71321             options2
71322           );
71323         });
71324       });
71325     },
71326     putChangeset: function(changeset, changes, callback) {
71327       var cid = _connectionID;
71328       if (_changeset.inflight) {
71329         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
71330       } else if (_changeset.open) {
71331         return createdChangeset.call(this, null, _changeset.open);
71332       } else {
71333         var options2 = {
71334           method: "PUT",
71335           path: "/api/0.6/changeset/create",
71336           headers: { "Content-Type": "text/xml" },
71337           content: JXON.stringify(changeset.asJXON())
71338         };
71339         _changeset.inflight = oauth.xhr(
71340           options2,
71341           wrapcb(this, createdChangeset, cid)
71342         );
71343       }
71344       function createdChangeset(err, changesetID) {
71345         _changeset.inflight = null;
71346         if (err) {
71347           return callback(err, changeset);
71348         }
71349         _changeset.open = changesetID;
71350         changeset = changeset.update({ id: changesetID });
71351         var options3 = {
71352           method: "POST",
71353           path: "/api/0.6/changeset/" + changesetID + "/upload",
71354           headers: { "Content-Type": "text/xml" },
71355           content: JXON.stringify(changeset.osmChangeJXON(changes))
71356         };
71357         _changeset.inflight = oauth.xhr(
71358           options3,
71359           wrapcb(this, uploadedChangeset, cid)
71360         );
71361       }
71362       function uploadedChangeset(err) {
71363         _changeset.inflight = null;
71364         if (err)
71365           return callback(err, changeset);
71366         window.setTimeout(function() {
71367           callback(null, changeset);
71368         }, 2500);
71369         _changeset.open = null;
71370         if (this.getConnectionId() === cid) {
71371           oauth.xhr({
71372             method: "PUT",
71373             path: "/api/0.6/changeset/" + changeset.id + "/close",
71374             headers: { "Content-Type": "text/xml" }
71375           }, function() {
71376             return true;
71377           });
71378         }
71379       }
71380     },
71381     loadUsers: function(uids, callback) {
71382       var toLoad = [];
71383       var cached = [];
71384       utilArrayUniq(uids).forEach(function(uid) {
71385         if (_userCache.user[uid]) {
71386           delete _userCache.toLoad[uid];
71387           cached.push(_userCache.user[uid]);
71388         } else {
71389           toLoad.push(uid);
71390         }
71391       });
71392       if (cached.length || !this.authenticated()) {
71393         callback(void 0, cached);
71394         if (!this.authenticated())
71395           return;
71396       }
71397       utilArrayChunk(toLoad, 150).forEach(function(arr) {
71398         oauth.xhr(
71399           { method: "GET", path: "/api/0.6/users.json?users=" + arr.join() },
71400           wrapcb(this, done, _connectionID)
71401         );
71402       }.bind(this));
71403       function done(err, payload) {
71404         if (err)
71405           return callback(err);
71406         var options2 = { skipSeen: true };
71407         return parseUserJSON(payload, function(err2, results) {
71408           if (err2)
71409             return callback(err2);
71410           return callback(void 0, results);
71411         }, options2);
71412       }
71413     },
71414     loadUser: function(uid, callback) {
71415       if (_userCache.user[uid] || !this.authenticated()) {
71416         delete _userCache.toLoad[uid];
71417         return callback(void 0, _userCache.user[uid]);
71418       }
71419       oauth.xhr(
71420         { method: "GET", path: "/api/0.6/user/" + uid + ".json" },
71421         wrapcb(this, done, _connectionID)
71422       );
71423       function done(err, payload) {
71424         if (err)
71425           return callback(err);
71426         var options2 = { skipSeen: true };
71427         return parseUserJSON(payload, function(err2, results) {
71428           if (err2)
71429             return callback(err2);
71430           return callback(void 0, results[0]);
71431         }, options2);
71432       }
71433     },
71434     userDetails: function(callback) {
71435       if (_userDetails) {
71436         return callback(void 0, _userDetails);
71437       }
71438       oauth.xhr(
71439         { method: "GET", path: "/api/0.6/user/details.json" },
71440         wrapcb(this, done, _connectionID)
71441       );
71442       function done(err, payload) {
71443         if (err)
71444           return callback(err);
71445         var options2 = { skipSeen: false };
71446         return parseUserJSON(payload, function(err2, results) {
71447           if (err2)
71448             return callback(err2);
71449           _userDetails = results[0];
71450           return callback(void 0, _userDetails);
71451         }, options2);
71452       }
71453     },
71454     userChangesets: function(callback) {
71455       if (_userChangesets) {
71456         return callback(void 0, _userChangesets);
71457       }
71458       this.userDetails(
71459         wrapcb(this, gotDetails, _connectionID)
71460       );
71461       function gotDetails(err, user) {
71462         if (err) {
71463           return callback(err);
71464         }
71465         oauth.xhr(
71466           { method: "GET", path: "/api/0.6/changesets?user=" + user.id },
71467           wrapcb(this, done, _connectionID)
71468         );
71469       }
71470       function done(err, xml) {
71471         if (err) {
71472           return callback(err);
71473         }
71474         _userChangesets = Array.prototype.map.call(
71475           xml.getElementsByTagName("changeset"),
71476           function(changeset) {
71477             return { tags: getTags(changeset) };
71478           }
71479         ).filter(function(changeset) {
71480           var comment = changeset.tags.comment;
71481           return comment && comment !== "";
71482         });
71483         return callback(void 0, _userChangesets);
71484       }
71485     },
71486     status: function(callback) {
71487       var url = urlroot + "/api/capabilities";
71488       var errback = wrapcb(this, done, _connectionID);
71489       xml_default(url).then(function(data) {
71490         errback(null, data);
71491       }).catch(function(err) {
71492         errback(err.message);
71493       });
71494       function done(err, xml) {
71495         if (err) {
71496           return callback(err, null);
71497         }
71498         var elements = xml.getElementsByTagName("blacklist");
71499         var regexes = [];
71500         for (var i2 = 0; i2 < elements.length; i2++) {
71501           var regexString = elements[i2].getAttribute("regex");
71502           if (regexString) {
71503             try {
71504               var regex = new RegExp(regexString);
71505               regexes.push(regex);
71506             } catch (e) {
71507             }
71508           }
71509         }
71510         if (regexes.length) {
71511           _imageryBlocklists = regexes;
71512         }
71513         if (_rateLimitError) {
71514           return callback(_rateLimitError, "rateLimited");
71515         } else {
71516           var waynodes = xml.getElementsByTagName("waynodes");
71517           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
71518           if (maxWayNodes && isFinite(maxWayNodes))
71519             _maxWayNodes = maxWayNodes;
71520           var apiStatus = xml.getElementsByTagName("status");
71521           var val = apiStatus[0].getAttribute("api");
71522           return callback(void 0, val);
71523         }
71524       }
71525     },
71526     reloadApiStatus: function() {
71527       if (!this.throttledReloadApiStatus) {
71528         var that = this;
71529         this.throttledReloadApiStatus = throttle_default(function() {
71530           that.status(function(err, status) {
71531             if (status !== _cachedApiStatus) {
71532               _cachedApiStatus = status;
71533               dispatch7.call("apiStatusChange", that, err, status);
71534             }
71535           });
71536         }, 500);
71537       }
71538       this.throttledReloadApiStatus();
71539     },
71540     maxWayNodes: function() {
71541       return _maxWayNodes;
71542     },
71543     loadTiles: function(projection2, callback) {
71544       if (_off)
71545         return;
71546       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
71547       var hadRequests = hasInflightRequests(_tileCache);
71548       abortUnwantedRequests4(_tileCache, tiles);
71549       if (hadRequests && !hasInflightRequests(_tileCache)) {
71550         dispatch7.call("loaded");
71551       }
71552       tiles.forEach(function(tile) {
71553         this.loadTile(tile, callback);
71554       }, this);
71555     },
71556     loadTile: function(tile, callback) {
71557       if (_off)
71558         return;
71559       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
71560         return;
71561       if (!hasInflightRequests(_tileCache)) {
71562         dispatch7.call("loading");
71563       }
71564       var path = "/api/0.6/map.json?bbox=";
71565       var options2 = { skipSeen: true };
71566       _tileCache.inflight[tile.id] = this.loadFromAPI(
71567         path + tile.extent.toParam(),
71568         tileCallback,
71569         options2
71570       );
71571       function tileCallback(err, parsed) {
71572         delete _tileCache.inflight[tile.id];
71573         if (!err) {
71574           delete _tileCache.toLoad[tile.id];
71575           _tileCache.loaded[tile.id] = true;
71576           var bbox = tile.extent.bbox();
71577           bbox.id = tile.id;
71578           _tileCache.rtree.insert(bbox);
71579         }
71580         if (callback) {
71581           callback(err, Object.assign({ data: parsed }, tile));
71582         }
71583         if (!hasInflightRequests(_tileCache)) {
71584           dispatch7.call("loaded");
71585         }
71586       }
71587     },
71588     isDataLoaded: function(loc) {
71589       var bbox = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
71590       return _tileCache.rtree.collides(bbox);
71591     },
71592     loadTileAtLoc: function(loc, callback) {
71593       if (Object.keys(_tileCache.toLoad).length > 50)
71594         return;
71595       var k = geoZoomToScale(_tileZoom4 + 1);
71596       var offset = geoRawMercator().scale(k)(loc);
71597       var projection2 = geoRawMercator().transform({ k, x: -offset[0], y: -offset[1] });
71598       var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
71599       tiles.forEach(function(tile) {
71600         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
71601           return;
71602         _tileCache.toLoad[tile.id] = true;
71603         this.loadTile(tile, callback);
71604       }, this);
71605     },
71606     loadNotes: function(projection2, noteOptions) {
71607       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
71608       if (_off)
71609         return;
71610       var that = this;
71611       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
71612       var throttleLoadUsers = throttle_default(function() {
71613         var uids = Object.keys(_userCache.toLoad);
71614         if (!uids.length)
71615           return;
71616         that.loadUsers(uids, function() {
71617         });
71618       }, 750);
71619       var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
71620       abortUnwantedRequests4(_noteCache, tiles);
71621       tiles.forEach(function(tile) {
71622         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
71623           return;
71624         var options2 = { skipSeen: false };
71625         _noteCache.inflight[tile.id] = that.loadFromAPI(
71626           path + tile.extent.toParam(),
71627           function(err) {
71628             delete _noteCache.inflight[tile.id];
71629             if (!err) {
71630               _noteCache.loaded[tile.id] = true;
71631             }
71632             throttleLoadUsers();
71633             dispatch7.call("loadedNotes");
71634           },
71635           options2
71636         );
71637       });
71638     },
71639     postNoteCreate: function(note, callback) {
71640       if (!this.authenticated()) {
71641         return callback({ message: "Not Authenticated", status: -3 }, note);
71642       }
71643       if (_noteCache.inflightPost[note.id]) {
71644         return callback({ message: "Note update already inflight", status: -2 }, note);
71645       }
71646       if (!note.loc[0] || !note.loc[1] || !note.newComment)
71647         return;
71648       var comment = note.newComment;
71649       if (note.newCategory && note.newCategory !== "None") {
71650         comment += " #" + note.newCategory;
71651       }
71652       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
71653       _noteCache.inflightPost[note.id] = oauth.xhr(
71654         { method: "POST", path },
71655         wrapcb(this, done, _connectionID)
71656       );
71657       function done(err, xml) {
71658         delete _noteCache.inflightPost[note.id];
71659         if (err) {
71660           return callback(err);
71661         }
71662         this.removeNote(note);
71663         var options2 = { skipSeen: false };
71664         return parseXML(xml, function(err2, results) {
71665           if (err2) {
71666             return callback(err2);
71667           } else {
71668             return callback(void 0, results[0]);
71669           }
71670         }, options2);
71671       }
71672     },
71673     postNoteUpdate: function(note, newStatus, callback) {
71674       if (!this.authenticated()) {
71675         return callback({ message: "Not Authenticated", status: -3 }, note);
71676       }
71677       if (_noteCache.inflightPost[note.id]) {
71678         return callback({ message: "Note update already inflight", status: -2 }, note);
71679       }
71680       var action;
71681       if (note.status !== "closed" && newStatus === "closed") {
71682         action = "close";
71683       } else if (note.status !== "open" && newStatus === "open") {
71684         action = "reopen";
71685       } else {
71686         action = "comment";
71687         if (!note.newComment)
71688           return;
71689       }
71690       var path = "/api/0.6/notes/" + note.id + "/" + action;
71691       if (note.newComment) {
71692         path += "?" + utilQsString({ text: note.newComment });
71693       }
71694       _noteCache.inflightPost[note.id] = oauth.xhr(
71695         { method: "POST", path },
71696         wrapcb(this, done, _connectionID)
71697       );
71698       function done(err, xml) {
71699         delete _noteCache.inflightPost[note.id];
71700         if (err) {
71701           return callback(err);
71702         }
71703         this.removeNote(note);
71704         if (action === "close") {
71705           _noteCache.closed[note.id] = true;
71706         } else if (action === "reopen") {
71707           delete _noteCache.closed[note.id];
71708         }
71709         var options2 = { skipSeen: false };
71710         return parseXML(xml, function(err2, results) {
71711           if (err2) {
71712             return callback(err2);
71713           } else {
71714             return callback(void 0, results[0]);
71715           }
71716         }, options2);
71717       }
71718     },
71719     switch: function(newOptions) {
71720       urlroot = newOptions.url;
71721       var oldOptions = utilObjectOmit(oauth.options(), "access_token");
71722       oauth.options(Object.assign(oldOptions, newOptions));
71723       this.reset();
71724       this.userChangesets(function() {
71725       });
71726       dispatch7.call("change");
71727       return this;
71728     },
71729     toggle: function(val) {
71730       _off = !val;
71731       return this;
71732     },
71733     isChangesetInflight: function() {
71734       return !!_changeset.inflight;
71735     },
71736     caches: function(obj) {
71737       function cloneCache(source) {
71738         var target = {};
71739         Object.keys(source).forEach(function(k) {
71740           if (k === "rtree") {
71741             target.rtree = new import_rbush9.default().fromJSON(source.rtree.toJSON());
71742           } else if (k === "note") {
71743             target.note = {};
71744             Object.keys(source.note).forEach(function(id2) {
71745               target.note[id2] = osmNote(source.note[id2]);
71746             });
71747           } else {
71748             target[k] = JSON.parse(JSON.stringify(source[k]));
71749           }
71750         });
71751         return target;
71752       }
71753       if (!arguments.length) {
71754         return {
71755           tile: cloneCache(_tileCache),
71756           note: cloneCache(_noteCache),
71757           user: cloneCache(_userCache)
71758         };
71759       }
71760       if (obj === "get") {
71761         return {
71762           tile: _tileCache,
71763           note: _noteCache,
71764           user: _userCache
71765         };
71766       }
71767       if (obj.tile) {
71768         _tileCache = obj.tile;
71769         _tileCache.inflight = {};
71770       }
71771       if (obj.note) {
71772         _noteCache = obj.note;
71773         _noteCache.inflight = {};
71774         _noteCache.inflightPost = {};
71775       }
71776       if (obj.user) {
71777         _userCache = obj.user;
71778       }
71779       return this;
71780     },
71781     logout: function() {
71782       _userChangesets = void 0;
71783       _userDetails = void 0;
71784       oauth.logout();
71785       dispatch7.call("change");
71786       return this;
71787     },
71788     authenticated: function() {
71789       return oauth.authenticated();
71790     },
71791     authenticate: function(callback) {
71792       var that = this;
71793       var cid = _connectionID;
71794       _userChangesets = void 0;
71795       _userDetails = void 0;
71796       function done(err, res) {
71797         if (err) {
71798           if (callback)
71799             callback(err);
71800           return;
71801         }
71802         if (that.getConnectionId() !== cid) {
71803           if (callback)
71804             callback({ message: "Connection Switched", status: -1 });
71805           return;
71806         }
71807         _rateLimitError = void 0;
71808         dispatch7.call("change");
71809         if (callback)
71810           callback(err, res);
71811         that.userChangesets(function() {
71812         });
71813       }
71814       oauth.authenticate(done);
71815     },
71816     imageryBlocklists: function() {
71817       return _imageryBlocklists;
71818     },
71819     tileZoom: function(val) {
71820       if (!arguments.length)
71821         return _tileZoom4;
71822       _tileZoom4 = val;
71823       return this;
71824     },
71825     notes: function(projection2) {
71826       var viewport = projection2.clipExtent();
71827       var min3 = [viewport[0][0], viewport[1][1]];
71828       var max3 = [viewport[1][0], viewport[0][1]];
71829       var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
71830       return _noteCache.rtree.search(bbox).map(function(d) {
71831         return d.data;
71832       });
71833     },
71834     getNote: function(id2) {
71835       return _noteCache.note[id2];
71836     },
71837     removeNote: function(note) {
71838       if (!(note instanceof osmNote) || !note.id)
71839         return;
71840       delete _noteCache.note[note.id];
71841       updateRtree4(encodeNoteRtree(note), false);
71842     },
71843     replaceNote: function(note) {
71844       if (!(note instanceof osmNote) || !note.id)
71845         return;
71846       _noteCache.note[note.id] = note;
71847       updateRtree4(encodeNoteRtree(note), true);
71848       return note;
71849     },
71850     getClosedIDs: function() {
71851       return Object.keys(_noteCache.closed).sort();
71852     }
71853   };
71854
71855   // modules/services/osm_wikibase.js
71856   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
71857   var _inflight2 = {};
71858   var _wikibaseCache = {};
71859   var _localeIDs = { en: false };
71860   var debouncedRequest = debounce_default(request, 500, { leading: false });
71861   function request(url, callback) {
71862     if (_inflight2[url])
71863       return;
71864     var controller = new AbortController();
71865     _inflight2[url] = controller;
71866     json_default(url, { signal: controller.signal }).then(function(result) {
71867       delete _inflight2[url];
71868       if (callback)
71869         callback(null, result);
71870     }).catch(function(err) {
71871       delete _inflight2[url];
71872       if (err.name === "AbortError")
71873         return;
71874       if (callback)
71875         callback(err.message);
71876     });
71877   }
71878   var osm_wikibase_default = {
71879     init: function() {
71880       _inflight2 = {};
71881       _wikibaseCache = {};
71882       _localeIDs = {};
71883     },
71884     reset: function() {
71885       Object.values(_inflight2).forEach(function(controller) {
71886         controller.abort();
71887       });
71888       _inflight2 = {};
71889     },
71890     claimToValue: function(entity, property, langCode) {
71891       if (!entity.claims[property])
71892         return void 0;
71893       var locale2 = _localeIDs[langCode];
71894       var preferredPick, localePick;
71895       entity.claims[property].forEach(function(stmt) {
71896         if (!preferredPick && stmt.rank === "preferred") {
71897           preferredPick = stmt;
71898         }
71899         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
71900           localePick = stmt;
71901         }
71902       });
71903       var result = localePick || preferredPick;
71904       if (result) {
71905         var datavalue = result.mainsnak.datavalue;
71906         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
71907       } else {
71908         return void 0;
71909       }
71910     },
71911     monolingualClaimToValueObj: function(entity, property) {
71912       if (!entity || !entity.claims[property])
71913         return void 0;
71914       return entity.claims[property].reduce(function(acc, obj) {
71915         var value = obj.mainsnak.datavalue.value;
71916         acc[value.language] = value.text;
71917         return acc;
71918       }, {});
71919     },
71920     toSitelink: function(key, value) {
71921       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
71922       return result.replace(/_/g, " ").trim();
71923     },
71924     getEntity: function(params, callback) {
71925       var doRequest = params.debounce ? debouncedRequest : request;
71926       var that = this;
71927       var titles = [];
71928       var result = {};
71929       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
71930       var keySitelink = params.key ? this.toSitelink(params.key) : false;
71931       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
71932       var localeSitelink;
71933       if (params.langCodes) {
71934         params.langCodes.forEach(function(langCode) {
71935           if (_localeIDs[langCode] === void 0) {
71936             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
71937             titles.push(localeSitelink);
71938           }
71939         });
71940       }
71941       if (rtypeSitelink) {
71942         if (_wikibaseCache[rtypeSitelink]) {
71943           result.rtype = _wikibaseCache[rtypeSitelink];
71944         } else {
71945           titles.push(rtypeSitelink);
71946         }
71947       }
71948       if (keySitelink) {
71949         if (_wikibaseCache[keySitelink]) {
71950           result.key = _wikibaseCache[keySitelink];
71951         } else {
71952           titles.push(keySitelink);
71953         }
71954       }
71955       if (tagSitelink) {
71956         if (_wikibaseCache[tagSitelink]) {
71957           result.tag = _wikibaseCache[tagSitelink];
71958         } else {
71959           titles.push(tagSitelink);
71960         }
71961       }
71962       if (!titles.length) {
71963         return callback(null, result);
71964       }
71965       var obj = {
71966         action: "wbgetentities",
71967         sites: "wiki",
71968         titles: titles.join("|"),
71969         languages: params.langCodes.join("|"),
71970         languagefallback: 1,
71971         origin: "*",
71972         format: "json"
71973       };
71974       var url = apibase3 + "?" + utilQsString(obj);
71975       doRequest(url, function(err, d) {
71976         if (err) {
71977           callback(err);
71978         } else if (!d.success || d.error) {
71979           callback(d.error.messages.map(function(v) {
71980             return v.html["*"];
71981           }).join("<br>"));
71982         } else {
71983           var localeID = false;
71984           Object.values(d.entities).forEach(function(res) {
71985             if (res.missing !== "") {
71986               var title = res.sitelinks.wiki.title;
71987               if (title === rtypeSitelink) {
71988                 _wikibaseCache[rtypeSitelink] = res;
71989                 result.rtype = res;
71990               } else if (title === keySitelink) {
71991                 _wikibaseCache[keySitelink] = res;
71992                 result.key = res;
71993               } else if (title === tagSitelink) {
71994                 _wikibaseCache[tagSitelink] = res;
71995                 result.tag = res;
71996               } else if (title === localeSitelink) {
71997                 localeID = res.id;
71998               } else {
71999                 console.log("Unexpected title " + title);
72000               }
72001             }
72002           });
72003           if (localeSitelink) {
72004             that.addLocale(params.langCodes[0], localeID);
72005           }
72006           callback(null, result);
72007         }
72008       });
72009     },
72010     getDocs: function(params, callback) {
72011       var that = this;
72012       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
72013         return code.toLowerCase();
72014       });
72015       params.langCodes = langCodes;
72016       this.getEntity(params, function(err, data) {
72017         if (err) {
72018           callback(err);
72019           return;
72020         }
72021         var entity = data.rtype || data.tag || data.key;
72022         if (!entity) {
72023           callback("No entity");
72024           return;
72025         }
72026         var i2;
72027         var description;
72028         for (i2 in langCodes) {
72029           let code2 = langCodes[i2];
72030           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
72031             description = entity.descriptions[code2];
72032             break;
72033           }
72034         }
72035         if (!description && Object.values(entity.descriptions).length)
72036           description = Object.values(entity.descriptions)[0];
72037         var result = {
72038           title: entity.title,
72039           description: description ? description.value : "",
72040           descriptionLocaleCode: description ? description.language : "",
72041           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
72042         };
72043         if (entity.claims) {
72044           var imageroot;
72045           var image = that.claimToValue(entity, "P4", langCodes[0]);
72046           if (image) {
72047             imageroot = "https://commons.wikimedia.org/w/index.php";
72048           } else {
72049             image = that.claimToValue(entity, "P28", langCodes[0]);
72050             if (image) {
72051               imageroot = "https://wiki.openstreetmap.org/w/index.php";
72052             }
72053           }
72054           if (imageroot && image) {
72055             result.imageURL = imageroot + "?" + utilQsString({
72056               title: "Special:Redirect/file/" + image,
72057               width: 400
72058             });
72059           }
72060         }
72061         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
72062         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
72063         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
72064         var wikis = [rtypeWiki, tagWiki, keyWiki];
72065         for (i2 in wikis) {
72066           var wiki = wikis[i2];
72067           for (var j2 in langCodes) {
72068             var code = langCodes[j2];
72069             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
72070             var info = getWikiInfo(wiki, code, referenceId);
72071             if (info) {
72072               result.wiki = info;
72073               break;
72074             }
72075           }
72076           if (result.wiki)
72077             break;
72078         }
72079         callback(null, result);
72080         function getWikiInfo(wiki2, langCode, tKey) {
72081           if (wiki2 && wiki2[langCode]) {
72082             return {
72083               title: wiki2[langCode],
72084               text: tKey,
72085               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
72086             };
72087           }
72088         }
72089       });
72090     },
72091     addLocale: function(langCode, qid) {
72092       _localeIDs[langCode] = qid;
72093     },
72094     apibase: function(val) {
72095       if (!arguments.length)
72096         return apibase3;
72097       apibase3 = val;
72098       return this;
72099     }
72100   };
72101
72102   // modules/services/streetside.js
72103   var import_rbush10 = __toESM(require_rbush_min());
72104
72105   // modules/util/jsonp_request.js
72106   var jsonpCache = {};
72107   window.jsonpCache = jsonpCache;
72108   function jsonpRequest(url, callback) {
72109     var request3 = {
72110       abort: function() {
72111       }
72112     };
72113     if (window.JSONP_FIX) {
72114       if (window.JSONP_DELAY === 0) {
72115         callback(window.JSONP_FIX);
72116       } else {
72117         var t = window.setTimeout(function() {
72118           callback(window.JSONP_FIX);
72119         }, window.JSONP_DELAY || 0);
72120         request3.abort = function() {
72121           window.clearTimeout(t);
72122         };
72123       }
72124       return request3;
72125     }
72126     function rand() {
72127       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
72128       var c = "";
72129       var i2 = -1;
72130       while (++i2 < 15)
72131         c += chars.charAt(Math.floor(Math.random() * 52));
72132       return c;
72133     }
72134     function create2(url2) {
72135       var e = url2.match(/callback=(\w+)/);
72136       var c = e ? e[1] : rand();
72137       jsonpCache[c] = function(data) {
72138         if (jsonpCache[c]) {
72139           callback(data);
72140         }
72141         finalize();
72142       };
72143       function finalize() {
72144         delete jsonpCache[c];
72145         script.remove();
72146       }
72147       request3.abort = finalize;
72148       return "jsonpCache." + c;
72149     }
72150     var cb = create2(url);
72151     var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
72152     return request3;
72153   }
72154
72155   // modules/services/streetside.js
72156   var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
72157   var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
72158   var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
72159   var pannellumViewerCSS = "pannellum-streetside/pannellum.css";
72160   var pannellumViewerJS = "pannellum-streetside/pannellum.js";
72161   var maxResults2 = 2e3;
72162   var tileZoom2 = 16.5;
72163   var tiler6 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
72164   var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
72165   var minHfov = 10;
72166   var maxHfov = 90;
72167   var defaultHfov = 45;
72168   var _hires = false;
72169   var _resolution = 512;
72170   var _currScene = 0;
72171   var _ssCache;
72172   var _pannellumViewer;
72173   var _sceneOptions = {
72174     showFullscreenCtrl: false,
72175     autoLoad: true,
72176     compass: true,
72177     yaw: 0,
72178     minHfov,
72179     maxHfov,
72180     hfov: defaultHfov,
72181     type: "cubemap",
72182     cubeMap: []
72183   };
72184   var _loadViewerPromise3;
72185   function abortRequest6(i2) {
72186     i2.abort();
72187   }
72188   function localeTimestamp(s) {
72189     if (!s)
72190       return null;
72191     const options2 = { day: "numeric", month: "short", year: "numeric" };
72192     const d = new Date(s);
72193     if (isNaN(d.getTime()))
72194       return null;
72195     return d.toLocaleString(_mainLocalizer.localeCode(), options2);
72196   }
72197   function loadTiles3(which, url, projection2, margin) {
72198     const tiles = tiler6.margin(margin).getTiles(projection2);
72199     const cache = _ssCache[which];
72200     Object.keys(cache.inflight).forEach((k) => {
72201       const wanted = tiles.find((tile) => k.indexOf(tile.id + ",") === 0);
72202       if (!wanted) {
72203         abortRequest6(cache.inflight[k]);
72204         delete cache.inflight[k];
72205       }
72206     });
72207     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
72208   }
72209   function loadNextTilePage2(which, url, tile) {
72210     const cache = _ssCache[which];
72211     const nextPage = cache.nextPage[tile.id] || 0;
72212     const id2 = tile.id + "," + String(nextPage);
72213     if (cache.loaded[id2] || cache.inflight[id2])
72214       return;
72215     cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
72216       cache.loaded[id2] = true;
72217       delete cache.inflight[id2];
72218       if (!bubbles)
72219         return;
72220       bubbles.shift();
72221       const features2 = bubbles.map((bubble) => {
72222         if (cache.points[bubble.id])
72223           return null;
72224         const loc = [bubble.lo, bubble.la];
72225         const d = {
72226           loc,
72227           key: bubble.id,
72228           ca: bubble.he,
72229           captured_at: bubble.cd,
72230           captured_by: "microsoft",
72231           pr: bubble.pr,
72232           ne: bubble.ne,
72233           pano: true,
72234           sequenceKey: null
72235         };
72236         cache.points[bubble.id] = d;
72237         if (bubble.pr === void 0) {
72238           cache.leaders.push(bubble.id);
72239         }
72240         return {
72241           minX: loc[0],
72242           minY: loc[1],
72243           maxX: loc[0],
72244           maxY: loc[1],
72245           data: d
72246         };
72247       }).filter(Boolean);
72248       cache.rtree.load(features2);
72249       connectSequences();
72250       if (which === "bubbles") {
72251         dispatch8.call("loadedImages");
72252       }
72253     });
72254   }
72255   function connectSequences() {
72256     let cache = _ssCache.bubbles;
72257     let keepLeaders = [];
72258     for (let i2 = 0; i2 < cache.leaders.length; i2++) {
72259       let bubble = cache.points[cache.leaders[i2]];
72260       let seen = {};
72261       let sequence = { key: bubble.key, bubbles: [] };
72262       let complete = false;
72263       do {
72264         sequence.bubbles.push(bubble);
72265         seen[bubble.key] = true;
72266         if (bubble.ne === void 0) {
72267           complete = true;
72268         } else {
72269           bubble = cache.points[bubble.ne];
72270         }
72271       } while (bubble && !seen[bubble.key] && !complete);
72272       if (complete) {
72273         _ssCache.sequences[sequence.key] = sequence;
72274         for (let j2 = 0; j2 < sequence.bubbles.length; j2++) {
72275           sequence.bubbles[j2].sequenceKey = sequence.key;
72276         }
72277         sequence.geojson = {
72278           type: "LineString",
72279           properties: {
72280             captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
72281             captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
72282             key: sequence.key
72283           },
72284           coordinates: sequence.bubbles.map((d) => d.loc)
72285         };
72286       } else {
72287         keepLeaders.push(cache.leaders[i2]);
72288       }
72289     }
72290     cache.leaders = keepLeaders;
72291   }
72292   function getBubbles(url, tile, callback) {
72293     let rect = tile.extent.rectangle();
72294     let urlForRequest = url + utilQsString({
72295       n: rect[3],
72296       s: rect[1],
72297       e: rect[2],
72298       w: rect[0],
72299       c: maxResults2,
72300       appkey: bubbleAppKey,
72301       jsCallback: "{callback}"
72302     });
72303     return jsonpRequest(urlForRequest, (data) => {
72304       if (!data || data.error) {
72305         callback(null);
72306       } else {
72307         callback(data);
72308       }
72309     });
72310   }
72311   function partitionViewport3(projection2) {
72312     let z = geoScaleToZoom(projection2.scale());
72313     let z2 = Math.ceil(z * 2) / 2 + 2.5;
72314     let tiler8 = utilTiler().zoomExtent([z2, z2]);
72315     return tiler8.getTiles(projection2).map((tile) => tile.extent);
72316   }
72317   function searchLimited3(limit, projection2, rtree) {
72318     limit = limit || 5;
72319     return partitionViewport3(projection2).reduce((result, extent) => {
72320       let found = rtree.search(extent.bbox()).slice(0, limit).map((d) => d.data);
72321       return found.length ? result.concat(found) : result;
72322     }, []);
72323   }
72324   function loadImage(imgInfo) {
72325     return new Promise((resolve) => {
72326       let img = new Image();
72327       img.onload = () => {
72328         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
72329         let ctx = canvas.getContext("2d");
72330         ctx.drawImage(img, imgInfo.x, imgInfo.y);
72331         resolve({ imgInfo, status: "ok" });
72332       };
72333       img.onerror = () => {
72334         resolve({ data: imgInfo, status: "error" });
72335       };
72336       img.setAttribute("crossorigin", "");
72337       img.src = imgInfo.url;
72338     });
72339   }
72340   function loadCanvas(imageGroup) {
72341     return Promise.all(imageGroup.map(loadImage)).then((data) => {
72342       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
72343       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
72344       let face = data[0].imgInfo.face;
72345       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
72346       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
72347     });
72348   }
72349   function loadFaces(faceGroup) {
72350     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
72351       return { status: "loadFaces done" };
72352     });
72353   }
72354   function setupCanvas(selection2, reset) {
72355     if (reset) {
72356       selection2.selectAll("#ideditor-stitcher-canvases").remove();
72357     }
72358     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", (d) => "ideditor-" + d).attr("width", _resolution).attr("height", _resolution);
72359   }
72360   function qkToXY(qk) {
72361     let x = 0;
72362     let y = 0;
72363     let scale = 256;
72364     for (let i2 = qk.length; i2 > 0; i2--) {
72365       const key = qk[i2 - 1];
72366       x += +(key === "1" || key === "3") * scale;
72367       y += +(key === "2" || key === "3") * scale;
72368       scale *= 2;
72369     }
72370     return [x, y];
72371   }
72372   function getQuadKeys() {
72373     let dim = _resolution / 256;
72374     let quadKeys;
72375     if (dim === 16) {
72376       quadKeys = [
72377         "0000",
72378         "0001",
72379         "0010",
72380         "0011",
72381         "0100",
72382         "0101",
72383         "0110",
72384         "0111",
72385         "1000",
72386         "1001",
72387         "1010",
72388         "1011",
72389         "1100",
72390         "1101",
72391         "1110",
72392         "1111",
72393         "0002",
72394         "0003",
72395         "0012",
72396         "0013",
72397         "0102",
72398         "0103",
72399         "0112",
72400         "0113",
72401         "1002",
72402         "1003",
72403         "1012",
72404         "1013",
72405         "1102",
72406         "1103",
72407         "1112",
72408         "1113",
72409         "0020",
72410         "0021",
72411         "0030",
72412         "0031",
72413         "0120",
72414         "0121",
72415         "0130",
72416         "0131",
72417         "1020",
72418         "1021",
72419         "1030",
72420         "1031",
72421         "1120",
72422         "1121",
72423         "1130",
72424         "1131",
72425         "0022",
72426         "0023",
72427         "0032",
72428         "0033",
72429         "0122",
72430         "0123",
72431         "0132",
72432         "0133",
72433         "1022",
72434         "1023",
72435         "1032",
72436         "1033",
72437         "1122",
72438         "1123",
72439         "1132",
72440         "1133",
72441         "0200",
72442         "0201",
72443         "0210",
72444         "0211",
72445         "0300",
72446         "0301",
72447         "0310",
72448         "0311",
72449         "1200",
72450         "1201",
72451         "1210",
72452         "1211",
72453         "1300",
72454         "1301",
72455         "1310",
72456         "1311",
72457         "0202",
72458         "0203",
72459         "0212",
72460         "0213",
72461         "0302",
72462         "0303",
72463         "0312",
72464         "0313",
72465         "1202",
72466         "1203",
72467         "1212",
72468         "1213",
72469         "1302",
72470         "1303",
72471         "1312",
72472         "1313",
72473         "0220",
72474         "0221",
72475         "0230",
72476         "0231",
72477         "0320",
72478         "0321",
72479         "0330",
72480         "0331",
72481         "1220",
72482         "1221",
72483         "1230",
72484         "1231",
72485         "1320",
72486         "1321",
72487         "1330",
72488         "1331",
72489         "0222",
72490         "0223",
72491         "0232",
72492         "0233",
72493         "0322",
72494         "0323",
72495         "0332",
72496         "0333",
72497         "1222",
72498         "1223",
72499         "1232",
72500         "1233",
72501         "1322",
72502         "1323",
72503         "1332",
72504         "1333",
72505         "2000",
72506         "2001",
72507         "2010",
72508         "2011",
72509         "2100",
72510         "2101",
72511         "2110",
72512         "2111",
72513         "3000",
72514         "3001",
72515         "3010",
72516         "3011",
72517         "3100",
72518         "3101",
72519         "3110",
72520         "3111",
72521         "2002",
72522         "2003",
72523         "2012",
72524         "2013",
72525         "2102",
72526         "2103",
72527         "2112",
72528         "2113",
72529         "3002",
72530         "3003",
72531         "3012",
72532         "3013",
72533         "3102",
72534         "3103",
72535         "3112",
72536         "3113",
72537         "2020",
72538         "2021",
72539         "2030",
72540         "2031",
72541         "2120",
72542         "2121",
72543         "2130",
72544         "2131",
72545         "3020",
72546         "3021",
72547         "3030",
72548         "3031",
72549         "3120",
72550         "3121",
72551         "3130",
72552         "3131",
72553         "2022",
72554         "2023",
72555         "2032",
72556         "2033",
72557         "2122",
72558         "2123",
72559         "2132",
72560         "2133",
72561         "3022",
72562         "3023",
72563         "3032",
72564         "3033",
72565         "3122",
72566         "3123",
72567         "3132",
72568         "3133",
72569         "2200",
72570         "2201",
72571         "2210",
72572         "2211",
72573         "2300",
72574         "2301",
72575         "2310",
72576         "2311",
72577         "3200",
72578         "3201",
72579         "3210",
72580         "3211",
72581         "3300",
72582         "3301",
72583         "3310",
72584         "3311",
72585         "2202",
72586         "2203",
72587         "2212",
72588         "2213",
72589         "2302",
72590         "2303",
72591         "2312",
72592         "2313",
72593         "3202",
72594         "3203",
72595         "3212",
72596         "3213",
72597         "3302",
72598         "3303",
72599         "3312",
72600         "3313",
72601         "2220",
72602         "2221",
72603         "2230",
72604         "2231",
72605         "2320",
72606         "2321",
72607         "2330",
72608         "2331",
72609         "3220",
72610         "3221",
72611         "3230",
72612         "3231",
72613         "3320",
72614         "3321",
72615         "3330",
72616         "3331",
72617         "2222",
72618         "2223",
72619         "2232",
72620         "2233",
72621         "2322",
72622         "2323",
72623         "2332",
72624         "2333",
72625         "3222",
72626         "3223",
72627         "3232",
72628         "3233",
72629         "3322",
72630         "3323",
72631         "3332",
72632         "3333"
72633       ];
72634     } else if (dim === 8) {
72635       quadKeys = [
72636         "000",
72637         "001",
72638         "010",
72639         "011",
72640         "100",
72641         "101",
72642         "110",
72643         "111",
72644         "002",
72645         "003",
72646         "012",
72647         "013",
72648         "102",
72649         "103",
72650         "112",
72651         "113",
72652         "020",
72653         "021",
72654         "030",
72655         "031",
72656         "120",
72657         "121",
72658         "130",
72659         "131",
72660         "022",
72661         "023",
72662         "032",
72663         "033",
72664         "122",
72665         "123",
72666         "132",
72667         "133",
72668         "200",
72669         "201",
72670         "210",
72671         "211",
72672         "300",
72673         "301",
72674         "310",
72675         "311",
72676         "202",
72677         "203",
72678         "212",
72679         "213",
72680         "302",
72681         "303",
72682         "312",
72683         "313",
72684         "220",
72685         "221",
72686         "230",
72687         "231",
72688         "320",
72689         "321",
72690         "330",
72691         "331",
72692         "222",
72693         "223",
72694         "232",
72695         "233",
72696         "322",
72697         "323",
72698         "332",
72699         "333"
72700       ];
72701     } else if (dim === 4) {
72702       quadKeys = [
72703         "00",
72704         "01",
72705         "10",
72706         "11",
72707         "02",
72708         "03",
72709         "12",
72710         "13",
72711         "20",
72712         "21",
72713         "30",
72714         "31",
72715         "22",
72716         "23",
72717         "32",
72718         "33"
72719       ];
72720     } else {
72721       quadKeys = [
72722         "0",
72723         "1",
72724         "2",
72725         "3"
72726       ];
72727     }
72728     return quadKeys;
72729   }
72730   var streetside_default = {
72731     init: function() {
72732       if (!_ssCache) {
72733         this.reset();
72734       }
72735       this.event = utilRebind(this, dispatch8, "on");
72736     },
72737     reset: function() {
72738       if (_ssCache) {
72739         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
72740       }
72741       _ssCache = {
72742         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush10.default(), points: {}, leaders: [] },
72743         sequences: {}
72744       };
72745     },
72746     bubbles: function(projection2) {
72747       const limit = 5;
72748       return searchLimited3(limit, projection2, _ssCache.bubbles.rtree);
72749     },
72750     cachedImage: function(imageKey) {
72751       return _ssCache.bubbles.points[imageKey];
72752     },
72753     sequences: function(projection2) {
72754       const viewport = projection2.clipExtent();
72755       const min3 = [viewport[0][0], viewport[1][1]];
72756       const max3 = [viewport[1][0], viewport[0][1]];
72757       const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
72758       let seen = {};
72759       let results = [];
72760       _ssCache.bubbles.rtree.search(bbox).forEach((d) => {
72761         const key = d.data.sequenceKey;
72762         if (key && !seen[key]) {
72763           seen[key] = true;
72764           results.push(_ssCache.sequences[key].geojson);
72765         }
72766       });
72767       return results;
72768     },
72769     loadBubbles: function(projection2, margin) {
72770       if (margin === void 0)
72771         margin = 2;
72772       loadTiles3("bubbles", bubbleApi, projection2, margin);
72773     },
72774     viewer: function() {
72775       return _pannellumViewer;
72776     },
72777     initViewer: function() {
72778       if (!window.pannellum)
72779         return;
72780       if (_pannellumViewer)
72781         return;
72782       _currScene += 1;
72783       const sceneID = _currScene.toString();
72784       const options2 = {
72785         "default": { firstScene: sceneID },
72786         scenes: {}
72787       };
72788       options2.scenes[sceneID] = _sceneOptions;
72789       _pannellumViewer = window.pannellum.viewer("ideditor-viewer-streetside", options2);
72790     },
72791     ensureViewerLoaded: function(context) {
72792       if (_loadViewerPromise3)
72793         return _loadViewerPromise3;
72794       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
72795       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
72796       let that = this;
72797       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72798       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
72799         select_default2(window).on(pointerPrefix + "move.streetside", () => {
72800           dispatch8.call("viewerChanged");
72801         }, true);
72802       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
72803         select_default2(window).on(pointerPrefix + "move.streetside", null);
72804         let t = timer((elapsed) => {
72805           dispatch8.call("viewerChanged");
72806           if (elapsed > 2e3) {
72807             t.stop();
72808           }
72809         });
72810       }).append("div").attr("class", "photo-attribution fillD");
72811       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
72812       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
72813       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
72814       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
72815       context.ui().photoviewer.on("resize.streetside", () => {
72816         if (_pannellumViewer) {
72817           _pannellumViewer.resize();
72818         }
72819       });
72820       _loadViewerPromise3 = new Promise((resolve, reject) => {
72821         let loadedCount = 0;
72822         function loaded() {
72823           loadedCount += 1;
72824           if (loadedCount === 2)
72825             resolve();
72826         }
72827         const head = select_default2("head");
72828         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(pannellumViewerCSS)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
72829           reject();
72830         });
72831         head.selectAll("#ideditor-streetside-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-streetside-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
72832           reject();
72833         });
72834       }).catch(function() {
72835         _loadViewerPromise3 = null;
72836       });
72837       return _loadViewerPromise3;
72838       function step(stepBy) {
72839         return () => {
72840           let viewer = context.container().select(".photoviewer");
72841           let selected = viewer.empty() ? void 0 : viewer.datum();
72842           if (!selected)
72843             return;
72844           let nextID = stepBy === 1 ? selected.ne : selected.pr;
72845           let yaw = _pannellumViewer.getYaw();
72846           let ca = selected.ca + yaw;
72847           let origin = selected.loc;
72848           const meters = 35;
72849           let p1 = [
72850             origin[0] + geoMetersToLon(meters / 5, origin[1]),
72851             origin[1]
72852           ];
72853           let p2 = [
72854             origin[0] + geoMetersToLon(meters / 2, origin[1]),
72855             origin[1] + geoMetersToLat(meters)
72856           ];
72857           let p3 = [
72858             origin[0] - geoMetersToLon(meters / 2, origin[1]),
72859             origin[1] + geoMetersToLat(meters)
72860           ];
72861           let p4 = [
72862             origin[0] - geoMetersToLon(meters / 5, origin[1]),
72863             origin[1]
72864           ];
72865           let poly = [p1, p2, p3, p4, p1];
72866           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
72867           poly = geoRotate(poly, -angle2, origin);
72868           let extent = poly.reduce((extent2, point) => {
72869             return extent2.extend(geoExtent(point));
72870           }, geoExtent());
72871           let minDist = Infinity;
72872           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d) => {
72873             if (d.data.key === selected.key)
72874               return;
72875             if (!geoPointInPolygon(d.data.loc, poly))
72876               return;
72877             let dist = geoVecLength(d.data.loc, selected.loc);
72878             let theta = selected.ca - d.data.ca;
72879             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
72880             if (minTheta > 20) {
72881               dist += 5;
72882             }
72883             if (dist < minDist) {
72884               nextID = d.data.key;
72885               minDist = dist;
72886             }
72887           });
72888           let nextBubble = nextID && that.cachedImage(nextID);
72889           if (!nextBubble)
72890             return;
72891           context.map().centerEase(nextBubble.loc);
72892           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
72893         };
72894       }
72895     },
72896     yaw: function(yaw) {
72897       if (typeof yaw !== "number")
72898         return yaw;
72899       _sceneOptions.yaw = yaw;
72900       return this;
72901     },
72902     showViewer: function(context) {
72903       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
72904       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
72905       if (isHidden) {
72906         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
72907         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
72908       }
72909       return this;
72910     },
72911     hideViewer: function(context) {
72912       let viewer = context.container().select(".photoviewer");
72913       if (!viewer.empty())
72914         viewer.datum(null);
72915       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
72916       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
72917       this.updateUrlImage(null);
72918       return this.setStyles(context, null, true);
72919     },
72920     selectImage: function(context, key) {
72921       let that = this;
72922       let d = this.cachedImage(key);
72923       let viewer = context.container().select(".photoviewer");
72924       if (!viewer.empty())
72925         viewer.datum(d);
72926       this.setStyles(context, null, true);
72927       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
72928       let attribution = wrap2.selectAll(".photo-attribution").html("");
72929       wrap2.selectAll(".pnlm-load-box").style("display", "block");
72930       if (!d)
72931         return this;
72932       this.updateUrlImage(key);
72933       _sceneOptions.northOffset = d.ca;
72934       let line1 = attribution.append("div").attr("class", "attribution-row");
72935       const hiresDomId = utilUniqueDomId("streetside-hires");
72936       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
72937       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
72938         d3_event.stopPropagation();
72939         _hires = !_hires;
72940         _resolution = _hires ? 1024 : 512;
72941         wrap2.call(setupCanvas, true);
72942         let viewstate = {
72943           yaw: _pannellumViewer.getYaw(),
72944           pitch: _pannellumViewer.getPitch(),
72945           hfov: _pannellumViewer.getHfov()
72946         };
72947         _sceneOptions = Object.assign(_sceneOptions, viewstate);
72948         that.selectImage(context, d.key).showViewer(context);
72949       });
72950       label.append("span").call(_t.append("streetside.hires"));
72951       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
72952       if (d.captured_by) {
72953         const yyyy = new Date().getFullYear();
72954         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
72955         captureInfo.append("span").text("|");
72956       }
72957       if (d.captured_at) {
72958         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp(d.captured_at));
72959       }
72960       let line2 = attribution.append("div").attr("class", "attribution-row");
72961       line2.append("a").attr("class", "image-view-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps?cp=" + d.loc[1] + "~" + d.loc[0] + "&lvl=17&dir=" + d.ca + "&style=x&v=2&sV=1").call(_t.append("streetside.view_on_bing"));
72962       line2.append("a").attr("class", "image-report-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid=" + encodeURIComponent(d.key) + "&focus=photo&lat=" + d.loc[1] + "&lng=" + d.loc[0] + "&z=17").call(_t.append("streetside.report"));
72963       let bubbleIdQuadKey = d.key.toString(4);
72964       const paddingNeeded = 16 - bubbleIdQuadKey.length;
72965       for (let i2 = 0; i2 < paddingNeeded; i2++) {
72966         bubbleIdQuadKey = "0" + bubbleIdQuadKey;
72967       }
72968       const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
72969       const imgUrlSuffix = ".jpg?g=6338&n=z";
72970       const faceKeys = ["01", "02", "03", "10", "11", "12"];
72971       let quadKeys = getQuadKeys();
72972       let faces = faceKeys.map((faceKey) => {
72973         return quadKeys.map((quadKey) => {
72974           const xy = qkToXY(quadKey);
72975           return {
72976             face: faceKey,
72977             url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
72978             x: xy[0],
72979             y: xy[1]
72980           };
72981         });
72982       });
72983       loadFaces(faces).then(function() {
72984         if (!_pannellumViewer) {
72985           that.initViewer();
72986         } else {
72987           _currScene += 1;
72988           let sceneID = _currScene.toString();
72989           _pannellumViewer.addScene(sceneID, _sceneOptions).loadScene(sceneID);
72990           if (_currScene > 2) {
72991             sceneID = (_currScene - 1).toString();
72992             _pannellumViewer.removeScene(sceneID);
72993           }
72994         }
72995       });
72996       return this;
72997     },
72998     getSequenceKeyForBubble: function(d) {
72999       return d && d.sequenceKey;
73000     },
73001     setStyles: function(context, hovered, reset) {
73002       if (reset) {
73003         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
73004         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
73005       }
73006       let hoveredBubbleKey = hovered && hovered.key;
73007       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
73008       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
73009       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d) => d.key) || [];
73010       let viewer = context.container().select(".photoviewer");
73011       let selected = viewer.empty() ? void 0 : viewer.datum();
73012       let selectedBubbleKey = selected && selected.key;
73013       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
73014       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
73015       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d) => d.key) || [];
73016       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
73017       context.container().selectAll(".layer-streetside-images .viewfield-group").classed("highlighted", (d) => highlightedBubbleKeys.indexOf(d.key) !== -1).classed("hovered", (d) => d.key === hoveredBubbleKey).classed("currentView", (d) => d.key === selectedBubbleKey);
73018       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d) => d.properties.key === hoveredSequenceKey).classed("currentView", (d) => d.properties.key === selectedSequenceKey);
73019       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
73020       function viewfieldPath() {
73021         let d = this.parentNode.__data__;
73022         if (d.pano && d.key !== selectedBubbleKey) {
73023           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
73024         } else {
73025           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
73026         }
73027       }
73028       return this;
73029     },
73030     updateUrlImage: function(imageKey) {
73031       if (!window.mocha) {
73032         var hash = utilStringQs(window.location.hash);
73033         if (imageKey) {
73034           hash.photo = "streetside/" + imageKey;
73035         } else {
73036           delete hash.photo;
73037         }
73038         window.location.replace("#" + utilQsString(hash, true));
73039       }
73040     },
73041     cache: function() {
73042       return _ssCache;
73043     }
73044   };
73045
73046   // modules/services/taginfo.js
73047   var apibase4 = "https://taginfo.openstreetmap.org/api/4/";
73048   var _inflight3 = {};
73049   var _popularKeys = {};
73050   var _taginfoCache = {};
73051   var tag_sorts = {
73052     point: "count_nodes",
73053     vertex: "count_nodes",
73054     area: "count_ways",
73055     line: "count_ways"
73056   };
73057   var tag_sort_members = {
73058     point: "count_node_members",
73059     vertex: "count_node_members",
73060     area: "count_way_members",
73061     line: "count_way_members",
73062     relation: "count_relation_members"
73063   };
73064   var tag_filters = {
73065     point: "nodes",
73066     vertex: "nodes",
73067     area: "ways",
73068     line: "ways"
73069   };
73070   var tag_members_fractions = {
73071     point: "count_node_members_fraction",
73072     vertex: "count_node_members_fraction",
73073     area: "count_way_members_fraction",
73074     line: "count_way_members_fraction",
73075     relation: "count_relation_members_fraction"
73076   };
73077   function sets(params, n2, o) {
73078     if (params.geometry && o[params.geometry]) {
73079       params[n2] = o[params.geometry];
73080     }
73081     return params;
73082   }
73083   function setFilter(params) {
73084     return sets(params, "filter", tag_filters);
73085   }
73086   function setSort(params) {
73087     return sets(params, "sortname", tag_sorts);
73088   }
73089   function setSortMembers(params) {
73090     return sets(params, "sortname", tag_sort_members);
73091   }
73092   function clean(params) {
73093     return utilObjectOmit(params, ["geometry", "debounce"]);
73094   }
73095   function filterKeys(type3) {
73096     var count_type = type3 ? "count_" + type3 : "count_all";
73097     return function(d) {
73098       return parseFloat(d[count_type]) > 2500 || d.in_wiki;
73099     };
73100   }
73101   function filterMultikeys(prefix) {
73102     return function(d) {
73103       var re2 = new RegExp("^" + prefix + "(.*)$");
73104       var matches = d.key.match(re2) || [];
73105       return matches.length === 2 && matches[1].indexOf(":") === -1;
73106     };
73107   }
73108   function filterValues(allowUpperCase) {
73109     return function(d) {
73110       if (d.value.match(/[;,]/) !== null)
73111         return false;
73112       if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null)
73113         return false;
73114       return d.count > 100 || d.in_wiki;
73115     };
73116   }
73117   function filterRoles(geometry) {
73118     return function(d) {
73119       if (d.role === "")
73120         return false;
73121       if (d.role.match(/[A-Z*;,]/) !== null)
73122         return false;
73123       return parseFloat(d[tag_members_fractions[geometry]]) > 0;
73124     };
73125   }
73126   function valKey(d) {
73127     return {
73128       value: d.key,
73129       title: d.key
73130     };
73131   }
73132   function valKeyDescription(d) {
73133     var obj = {
73134       value: d.value,
73135       title: d.description || d.value
73136     };
73137     return obj;
73138   }
73139   function roleKey(d) {
73140     return {
73141       value: d.role,
73142       title: d.role
73143     };
73144   }
73145   function sortKeys(a, b) {
73146     return a.key.indexOf(":") === -1 && b.key.indexOf(":") !== -1 ? -1 : a.key.indexOf(":") !== -1 && b.key.indexOf(":") === -1 ? 1 : 0;
73147   }
73148   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
73149   function request2(url, params, exactMatch, callback, loaded) {
73150     if (_inflight3[url])
73151       return;
73152     if (checkCache(url, params, exactMatch, callback))
73153       return;
73154     var controller = new AbortController();
73155     _inflight3[url] = controller;
73156     json_default(url, { signal: controller.signal }).then(function(result) {
73157       delete _inflight3[url];
73158       if (loaded)
73159         loaded(null, result);
73160     }).catch(function(err) {
73161       delete _inflight3[url];
73162       if (err.name === "AbortError")
73163         return;
73164       if (loaded)
73165         loaded(err.message);
73166     });
73167   }
73168   function checkCache(url, params, exactMatch, callback) {
73169     var rp = params.rp || 25;
73170     var testQuery = params.query || "";
73171     var testUrl = url;
73172     do {
73173       var hit = _taginfoCache[testUrl];
73174       if (hit && (url === testUrl || hit.length < rp)) {
73175         callback(null, hit);
73176         return true;
73177       }
73178       if (exactMatch || !testQuery.length)
73179         return false;
73180       testQuery = testQuery.slice(0, -1);
73181       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
73182     } while (testQuery.length >= 0);
73183     return false;
73184   }
73185   var taginfo_default = {
73186     init: function() {
73187       _inflight3 = {};
73188       _taginfoCache = {};
73189       _popularKeys = {
73190         postal_code: true,
73191         full_name: true,
73192         loc_name: true,
73193         reg_name: true,
73194         short_name: true,
73195         sorting_name: true,
73196         artist_name: true,
73197         nat_name: true,
73198         long_name: true,
73199         via: true,
73200         "bridge:name": true
73201       };
73202       var params = {
73203         rp: 100,
73204         sortname: "values_all",
73205         sortorder: "desc",
73206         page: 1,
73207         debounce: false,
73208         lang: _mainLocalizer.languageCode()
73209       };
73210       this.keys(params, function(err, data) {
73211         if (err)
73212           return;
73213         data.forEach(function(d) {
73214           if (d.value === "opening_hours")
73215             return;
73216           _popularKeys[d.value] = true;
73217         });
73218       });
73219     },
73220     reset: function() {
73221       Object.values(_inflight3).forEach(function(controller) {
73222         controller.abort();
73223       });
73224       _inflight3 = {};
73225     },
73226     keys: function(params, callback) {
73227       var doRequest = params.debounce ? debouncedRequest2 : request2;
73228       params = clean(setSort(params));
73229       params = Object.assign({
73230         rp: 10,
73231         sortname: "count_all",
73232         sortorder: "desc",
73233         page: 1,
73234         lang: _mainLocalizer.languageCode()
73235       }, params);
73236       var url = apibase4 + "keys/all?" + utilQsString(params);
73237       doRequest(url, params, false, callback, function(err, d) {
73238         if (err) {
73239           callback(err);
73240         } else {
73241           var f2 = filterKeys(params.filter);
73242           var result = d.data.filter(f2).sort(sortKeys).map(valKey);
73243           _taginfoCache[url] = result;
73244           callback(null, result);
73245         }
73246       });
73247     },
73248     multikeys: function(params, callback) {
73249       var doRequest = params.debounce ? debouncedRequest2 : request2;
73250       params = clean(setSort(params));
73251       params = Object.assign({
73252         rp: 25,
73253         sortname: "count_all",
73254         sortorder: "desc",
73255         page: 1,
73256         lang: _mainLocalizer.languageCode()
73257       }, params);
73258       var prefix = params.query;
73259       var url = apibase4 + "keys/all?" + utilQsString(params);
73260       doRequest(url, params, true, callback, function(err, d) {
73261         if (err) {
73262           callback(err);
73263         } else {
73264           var f2 = filterMultikeys(prefix);
73265           var result = d.data.filter(f2).map(valKey);
73266           _taginfoCache[url] = result;
73267           callback(null, result);
73268         }
73269       });
73270     },
73271     values: function(params, callback) {
73272       var key = params.key;
73273       if (key && _popularKeys[key]) {
73274         callback(null, []);
73275         return;
73276       }
73277       var doRequest = params.debounce ? debouncedRequest2 : request2;
73278       params = clean(setSort(setFilter(params)));
73279       params = Object.assign({
73280         rp: 25,
73281         sortname: "count_all",
73282         sortorder: "desc",
73283         page: 1,
73284         lang: _mainLocalizer.languageCode()
73285       }, params);
73286       var url = apibase4 + "key/values?" + utilQsString(params);
73287       doRequest(url, params, false, callback, function(err, d) {
73288         if (err) {
73289           callback(err);
73290         } else {
73291           var re2 = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale/;
73292           var allowUpperCase = re2.test(params.key);
73293           var f2 = filterValues(allowUpperCase);
73294           var result = d.data.filter(f2).map(valKeyDescription);
73295           _taginfoCache[url] = result;
73296           callback(null, result);
73297         }
73298       });
73299     },
73300     roles: function(params, callback) {
73301       var doRequest = params.debounce ? debouncedRequest2 : request2;
73302       var geometry = params.geometry;
73303       params = clean(setSortMembers(params));
73304       params = Object.assign({
73305         rp: 25,
73306         sortname: "count_all_members",
73307         sortorder: "desc",
73308         page: 1,
73309         lang: _mainLocalizer.languageCode()
73310       }, params);
73311       var url = apibase4 + "relation/roles?" + utilQsString(params);
73312       doRequest(url, params, true, callback, function(err, d) {
73313         if (err) {
73314           callback(err);
73315         } else {
73316           var f2 = filterRoles(geometry);
73317           var result = d.data.filter(f2).map(roleKey);
73318           _taginfoCache[url] = result;
73319           callback(null, result);
73320         }
73321       });
73322     },
73323     docs: function(params, callback) {
73324       var doRequest = params.debounce ? debouncedRequest2 : request2;
73325       params = clean(setSort(params));
73326       var path = "key/wiki_pages?";
73327       if (params.value) {
73328         path = "tag/wiki_pages?";
73329       } else if (params.rtype) {
73330         path = "relation/wiki_pages?";
73331       }
73332       var url = apibase4 + path + utilQsString(params);
73333       doRequest(url, params, true, callback, function(err, d) {
73334         if (err) {
73335           callback(err);
73336         } else {
73337           _taginfoCache[url] = d.data;
73338           callback(null, d.data);
73339         }
73340       });
73341     },
73342     apibase: function(_) {
73343       if (!arguments.length)
73344         return apibase4;
73345       apibase4 = _;
73346       return this;
73347     }
73348   };
73349
73350   // modules/services/vector_tile.js
73351   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
73352
73353   // node_modules/@turf/helpers/dist/es/index.js
73354   var earthRadius = 63710088e-1;
73355   var factors = {
73356     centimeters: earthRadius * 100,
73357     centimetres: earthRadius * 100,
73358     degrees: earthRadius / 111325,
73359     feet: earthRadius * 3.28084,
73360     inches: earthRadius * 39.37,
73361     kilometers: earthRadius / 1e3,
73362     kilometres: earthRadius / 1e3,
73363     meters: earthRadius,
73364     metres: earthRadius,
73365     miles: earthRadius / 1609.344,
73366     millimeters: earthRadius * 1e3,
73367     millimetres: earthRadius * 1e3,
73368     nauticalmiles: earthRadius / 1852,
73369     radians: 1,
73370     yards: earthRadius * 1.0936
73371   };
73372   var unitsFactors = {
73373     centimeters: 100,
73374     centimetres: 100,
73375     degrees: 1 / 111325,
73376     feet: 3.28084,
73377     inches: 39.37,
73378     kilometers: 1 / 1e3,
73379     kilometres: 1 / 1e3,
73380     meters: 1,
73381     metres: 1,
73382     miles: 1 / 1609.344,
73383     millimeters: 1e3,
73384     millimetres: 1e3,
73385     nauticalmiles: 1 / 1852,
73386     radians: 1 / earthRadius,
73387     yards: 1.0936133
73388   };
73389   function feature2(geom, properties, options2) {
73390     if (options2 === void 0) {
73391       options2 = {};
73392     }
73393     var feat = { type: "Feature" };
73394     if (options2.id === 0 || options2.id) {
73395       feat.id = options2.id;
73396     }
73397     if (options2.bbox) {
73398       feat.bbox = options2.bbox;
73399     }
73400     feat.properties = properties || {};
73401     feat.geometry = geom;
73402     return feat;
73403   }
73404   function polygon(coordinates, properties, options2) {
73405     if (options2 === void 0) {
73406       options2 = {};
73407     }
73408     for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
73409       var ring = coordinates_1[_i];
73410       if (ring.length < 4) {
73411         throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
73412       }
73413       for (var j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
73414         if (ring[ring.length - 1][j2] !== ring[0][j2]) {
73415           throw new Error("First and last Position are not equivalent.");
73416         }
73417       }
73418     }
73419     var geom = {
73420       type: "Polygon",
73421       coordinates
73422     };
73423     return feature2(geom, properties, options2);
73424   }
73425   function lineString(coordinates, properties, options2) {
73426     if (options2 === void 0) {
73427       options2 = {};
73428     }
73429     if (coordinates.length < 2) {
73430       throw new Error("coordinates must be an array of two or more positions");
73431     }
73432     var geom = {
73433       type: "LineString",
73434       coordinates
73435     };
73436     return feature2(geom, properties, options2);
73437   }
73438   function multiLineString(coordinates, properties, options2) {
73439     if (options2 === void 0) {
73440       options2 = {};
73441     }
73442     var geom = {
73443       type: "MultiLineString",
73444       coordinates
73445     };
73446     return feature2(geom, properties, options2);
73447   }
73448   function multiPolygon(coordinates, properties, options2) {
73449     if (options2 === void 0) {
73450       options2 = {};
73451     }
73452     var geom = {
73453       type: "MultiPolygon",
73454       coordinates
73455     };
73456     return feature2(geom, properties, options2);
73457   }
73458
73459   // node_modules/@turf/invariant/dist/es/index.js
73460   function getGeom(geojson) {
73461     if (geojson.type === "Feature") {
73462       return geojson.geometry;
73463     }
73464     return geojson;
73465   }
73466
73467   // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
73468   function lineclip(points, bbox, result) {
73469     var len = points.length, codeA = bitCode(points[0], bbox), part = [], i2, codeB, lastCode;
73470     var a;
73471     var b;
73472     if (!result)
73473       result = [];
73474     for (i2 = 1; i2 < len; i2++) {
73475       a = points[i2 - 1];
73476       b = points[i2];
73477       codeB = lastCode = bitCode(b, bbox);
73478       while (true) {
73479         if (!(codeA | codeB)) {
73480           part.push(a);
73481           if (codeB !== lastCode) {
73482             part.push(b);
73483             if (i2 < len - 1) {
73484               result.push(part);
73485               part = [];
73486             }
73487           } else if (i2 === len - 1) {
73488             part.push(b);
73489           }
73490           break;
73491         } else if (codeA & codeB) {
73492           break;
73493         } else if (codeA) {
73494           a = intersect(a, b, codeA, bbox);
73495           codeA = bitCode(a, bbox);
73496         } else {
73497           b = intersect(a, b, codeB, bbox);
73498           codeB = bitCode(b, bbox);
73499         }
73500       }
73501       codeA = lastCode;
73502     }
73503     if (part.length)
73504       result.push(part);
73505     return result;
73506   }
73507   function polygonclip(points, bbox) {
73508     var result, edge, prev, prevInside, i2, p, inside;
73509     for (edge = 1; edge <= 8; edge *= 2) {
73510       result = [];
73511       prev = points[points.length - 1];
73512       prevInside = !(bitCode(prev, bbox) & edge);
73513       for (i2 = 0; i2 < points.length; i2++) {
73514         p = points[i2];
73515         inside = !(bitCode(p, bbox) & edge);
73516         if (inside !== prevInside)
73517           result.push(intersect(prev, p, edge, bbox));
73518         if (inside)
73519           result.push(p);
73520         prev = p;
73521         prevInside = inside;
73522       }
73523       points = result;
73524       if (!points.length)
73525         break;
73526     }
73527     return result;
73528   }
73529   function intersect(a, b, edge, bbox) {
73530     return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox[3] - a[1]) / (b[1] - a[1]), bbox[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox[1] - a[1]) / (b[1] - a[1]), bbox[1]] : edge & 2 ? [bbox[2], a[1] + (b[1] - a[1]) * (bbox[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox[0], a[1] + (b[1] - a[1]) * (bbox[0] - a[0]) / (b[0] - a[0])] : null;
73531   }
73532   function bitCode(p, bbox) {
73533     var code = 0;
73534     if (p[0] < bbox[0])
73535       code |= 1;
73536     else if (p[0] > bbox[2])
73537       code |= 2;
73538     if (p[1] < bbox[1])
73539       code |= 4;
73540     else if (p[1] > bbox[3])
73541       code |= 8;
73542     return code;
73543   }
73544
73545   // node_modules/@turf/bbox-clip/dist/es/index.js
73546   function bboxClip(feature3, bbox) {
73547     var geom = getGeom(feature3);
73548     var type3 = geom.type;
73549     var properties = feature3.type === "Feature" ? feature3.properties : {};
73550     var coords = geom.coordinates;
73551     switch (type3) {
73552       case "LineString":
73553       case "MultiLineString": {
73554         var lines_1 = [];
73555         if (type3 === "LineString") {
73556           coords = [coords];
73557         }
73558         coords.forEach(function(line) {
73559           lineclip(line, bbox, lines_1);
73560         });
73561         if (lines_1.length === 1) {
73562           return lineString(lines_1[0], properties);
73563         }
73564         return multiLineString(lines_1, properties);
73565       }
73566       case "Polygon":
73567         return polygon(clipPolygon(coords, bbox), properties);
73568       case "MultiPolygon":
73569         return multiPolygon(coords.map(function(poly) {
73570           return clipPolygon(poly, bbox);
73571         }), properties);
73572       default:
73573         throw new Error("geometry " + type3 + " not supported");
73574     }
73575   }
73576   function clipPolygon(rings, bbox) {
73577     var outRings = [];
73578     for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
73579       var ring = rings_1[_i];
73580       var clipped = polygonclip(ring, bbox);
73581       if (clipped.length > 0) {
73582         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
73583           clipped.push(clipped[0]);
73584         }
73585         if (clipped.length >= 4) {
73586           outRings.push(clipped);
73587         }
73588       }
73589     }
73590     return outRings;
73591   }
73592
73593   // modules/services/vector_tile.js
73594   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
73595   var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
73596   var import_pbf2 = __toESM(require_pbf());
73597   var import_vector_tile2 = __toESM(require_vector_tile());
73598   var tiler7 = utilTiler().tileSize(512).margin(1);
73599   var dispatch9 = dispatch_default("loadedData");
73600   var _vtCache;
73601   function abortRequest7(controller) {
73602     controller.abort();
73603   }
73604   function vtToGeoJSON(data, tile, mergeCache) {
73605     var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
73606     var layers = Object.keys(vectorTile.layers);
73607     if (!Array.isArray(layers)) {
73608       layers = [layers];
73609     }
73610     var features2 = [];
73611     layers.forEach(function(layerID) {
73612       var layer = vectorTile.layers[layerID];
73613       if (layer) {
73614         for (var i2 = 0; i2 < layer.length; i2++) {
73615           var feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
73616           var geometry = feature3.geometry;
73617           if (geometry.type === "Polygon") {
73618             geometry.type = "MultiPolygon";
73619             geometry.coordinates = [geometry.coordinates];
73620           }
73621           var isClipped = false;
73622           if (geometry.type === "MultiPolygon") {
73623             var featureClip = bboxClip(feature3, tile.extent.rectangle());
73624             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
73625               isClipped = true;
73626             }
73627             if (!feature3.geometry.coordinates.length)
73628               continue;
73629             if (!feature3.geometry.coordinates[0].length)
73630               continue;
73631           }
73632           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
73633           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
73634           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
73635           feature3.__featurehash__ = featurehash;
73636           feature3.__propertyhash__ = propertyhash;
73637           features2.push(feature3);
73638           if (isClipped && geometry.type === "MultiPolygon") {
73639             var merged = mergeCache[propertyhash];
73640             if (merged && merged.length) {
73641               var other = merged[0];
73642               var coords = import_polygon_clipping2.default.union(
73643                 feature3.geometry.coordinates,
73644                 other.geometry.coordinates
73645               );
73646               if (!coords || !coords.length) {
73647                 continue;
73648               }
73649               merged.push(feature3);
73650               for (var j2 = 0; j2 < merged.length; j2++) {
73651                 merged[j2].geometry.coordinates = coords;
73652                 merged[j2].__featurehash__ = featurehash;
73653               }
73654             } else {
73655               mergeCache[propertyhash] = [feature3];
73656             }
73657           }
73658         }
73659       }
73660     });
73661     return features2;
73662   }
73663   function loadTile2(source, tile) {
73664     if (source.loaded[tile.id] || source.inflight[tile.id])
73665       return;
73666     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(s, r) {
73667       var subdomains = r.split(",");
73668       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
73669     });
73670     var controller = new AbortController();
73671     source.inflight[tile.id] = controller;
73672     fetch(url, { signal: controller.signal }).then(function(response) {
73673       if (!response.ok) {
73674         throw new Error(response.status + " " + response.statusText);
73675       }
73676       source.loaded[tile.id] = [];
73677       delete source.inflight[tile.id];
73678       return response.arrayBuffer();
73679     }).then(function(data) {
73680       if (!data) {
73681         throw new Error("No Data");
73682       }
73683       var z = tile.xyz[2];
73684       if (!source.canMerge[z]) {
73685         source.canMerge[z] = {};
73686       }
73687       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z]);
73688       dispatch9.call("loadedData");
73689     }).catch(function() {
73690       source.loaded[tile.id] = [];
73691       delete source.inflight[tile.id];
73692     });
73693   }
73694   var vector_tile_default = {
73695     init: function() {
73696       if (!_vtCache) {
73697         this.reset();
73698       }
73699       this.event = utilRebind(this, dispatch9, "on");
73700     },
73701     reset: function() {
73702       for (var sourceID in _vtCache) {
73703         var source = _vtCache[sourceID];
73704         if (source && source.inflight) {
73705           Object.values(source.inflight).forEach(abortRequest7);
73706         }
73707       }
73708       _vtCache = {};
73709     },
73710     addSource: function(sourceID, template) {
73711       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
73712       return _vtCache[sourceID];
73713     },
73714     data: function(sourceID, projection2) {
73715       var source = _vtCache[sourceID];
73716       if (!source)
73717         return [];
73718       var tiles = tiler7.getTiles(projection2);
73719       var seen = {};
73720       var results = [];
73721       for (var i2 = 0; i2 < tiles.length; i2++) {
73722         var features2 = source.loaded[tiles[i2].id];
73723         if (!features2 || !features2.length)
73724           continue;
73725         for (var j2 = 0; j2 < features2.length; j2++) {
73726           var feature3 = features2[j2];
73727           var hash = feature3.__featurehash__;
73728           if (seen[hash])
73729             continue;
73730           seen[hash] = true;
73731           results.push(Object.assign({}, feature3));
73732         }
73733       }
73734       return results;
73735     },
73736     loadTiles: function(sourceID, template, projection2) {
73737       var source = _vtCache[sourceID];
73738       if (!source) {
73739         source = this.addSource(sourceID, template);
73740       }
73741       var tiles = tiler7.getTiles(projection2);
73742       Object.keys(source.inflight).forEach(function(k) {
73743         var wanted = tiles.find(function(tile) {
73744           return k === tile.id;
73745         });
73746         if (!wanted) {
73747           abortRequest7(source.inflight[k]);
73748           delete source.inflight[k];
73749         }
73750       });
73751       tiles.forEach(function(tile) {
73752         loadTile2(source, tile);
73753       });
73754     },
73755     cache: function() {
73756       return _vtCache;
73757     }
73758   };
73759
73760   // modules/services/wikidata.js
73761   var apibase5 = "https://www.wikidata.org/w/api.php?";
73762   var _wikidataCache = {};
73763   var wikidata_default = {
73764     init: function() {
73765     },
73766     reset: function() {
73767       _wikidataCache = {};
73768     },
73769     itemsForSearchQuery: function(query, callback) {
73770       if (!query) {
73771         if (callback)
73772           callback("No query", {});
73773         return;
73774       }
73775       var lang = this.languagesToQuery()[0];
73776       var url = apibase5 + utilQsString({
73777         action: "wbsearchentities",
73778         format: "json",
73779         formatversion: 2,
73780         search: query,
73781         type: "item",
73782         language: lang,
73783         uselang: lang,
73784         limit: 10,
73785         origin: "*"
73786       });
73787       json_default(url).then(function(result) {
73788         if (result && result.error) {
73789           throw new Error(result.error);
73790         }
73791         if (callback)
73792           callback(null, result.search || {});
73793       }).catch(function(err) {
73794         if (callback)
73795           callback(err.message, {});
73796       });
73797     },
73798     itemsByTitle: function(lang, title, callback) {
73799       if (!title) {
73800         if (callback)
73801           callback("No title", {});
73802         return;
73803       }
73804       lang = lang || "en";
73805       var url = apibase5 + utilQsString({
73806         action: "wbgetentities",
73807         format: "json",
73808         formatversion: 2,
73809         sites: lang.replace(/-/g, "_") + "wiki",
73810         titles: title,
73811         languages: "en",
73812         origin: "*"
73813       });
73814       json_default(url).then(function(result) {
73815         if (result && result.error) {
73816           throw new Error(result.error);
73817         }
73818         if (callback)
73819           callback(null, result.entities || {});
73820       }).catch(function(err) {
73821         if (callback)
73822           callback(err.message, {});
73823       });
73824     },
73825     languagesToQuery: function() {
73826       return _mainLocalizer.localeCodes().map(function(code) {
73827         return code.toLowerCase();
73828       }).filter(function(code) {
73829         return code !== "en-us";
73830       });
73831     },
73832     entityByQID: function(qid, callback) {
73833       if (!qid) {
73834         callback("No qid", {});
73835         return;
73836       }
73837       if (_wikidataCache[qid]) {
73838         if (callback)
73839           callback(null, _wikidataCache[qid]);
73840         return;
73841       }
73842       var langs = this.languagesToQuery();
73843       var url = apibase5 + utilQsString({
73844         action: "wbgetentities",
73845         format: "json",
73846         formatversion: 2,
73847         ids: qid,
73848         props: "labels|descriptions|claims|sitelinks",
73849         sitefilter: langs.map(function(d) {
73850           return d + "wiki";
73851         }).join("|"),
73852         languages: langs.join("|"),
73853         languagefallback: 1,
73854         origin: "*"
73855       });
73856       json_default(url).then(function(result) {
73857         if (result && result.error) {
73858           throw new Error(result.error);
73859         }
73860         if (callback)
73861           callback(null, result.entities[qid] || {});
73862       }).catch(function(err) {
73863         if (callback)
73864           callback(err.message, {});
73865       });
73866     },
73867     getDocs: function(params, callback) {
73868       var langs = this.languagesToQuery();
73869       this.entityByQID(params.qid, function(err, entity) {
73870         if (err || !entity) {
73871           callback(err || "No entity");
73872           return;
73873         }
73874         var i2;
73875         var description;
73876         for (i2 in langs) {
73877           let code = langs[i2];
73878           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
73879             description = entity.descriptions[code];
73880             break;
73881           }
73882         }
73883         if (!description && Object.values(entity.descriptions).length)
73884           description = Object.values(entity.descriptions)[0];
73885         var result = {
73886           title: entity.id,
73887           description: description ? description.value : "",
73888           descriptionLocaleCode: description ? description.language : "",
73889           editURL: "https://www.wikidata.org/wiki/" + entity.id
73890         };
73891         if (entity.claims) {
73892           var imageroot = "https://commons.wikimedia.org/w/index.php";
73893           var props = ["P154", "P18"];
73894           var prop, image;
73895           for (i2 = 0; i2 < props.length; i2++) {
73896             prop = entity.claims[props[i2]];
73897             if (prop && Object.keys(prop).length > 0) {
73898               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
73899               if (image) {
73900                 result.imageURL = imageroot + "?" + utilQsString({
73901                   title: "Special:Redirect/file/" + image,
73902                   width: 400
73903                 });
73904                 break;
73905               }
73906             }
73907           }
73908         }
73909         if (entity.sitelinks) {
73910           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
73911           for (i2 = 0; i2 < langs.length; i2++) {
73912             var w = langs[i2] + "wiki";
73913             if (entity.sitelinks[w]) {
73914               var title = entity.sitelinks[w].title;
73915               var tKey = "inspector.wiki_reference";
73916               if (!englishLocale && langs[i2] === "en") {
73917                 tKey = "inspector.wiki_en_reference";
73918               }
73919               result.wiki = {
73920                 title,
73921                 text: tKey,
73922                 url: "https://" + langs[i2] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
73923               };
73924               break;
73925             }
73926           }
73927         }
73928         callback(null, result);
73929       });
73930     }
73931   };
73932
73933   // modules/services/wikipedia.js
73934   var endpoint = "https://en.wikipedia.org/w/api.php?";
73935   var wikipedia_default = {
73936     init: function() {
73937     },
73938     reset: function() {
73939     },
73940     search: function(lang, query, callback) {
73941       if (!query) {
73942         if (callback)
73943           callback("No Query", []);
73944         return;
73945       }
73946       lang = lang || "en";
73947       var url = endpoint.replace("en", lang) + utilQsString({
73948         action: "query",
73949         list: "search",
73950         srlimit: "10",
73951         srinfo: "suggestion",
73952         format: "json",
73953         origin: "*",
73954         srsearch: query
73955       });
73956       json_default(url).then(function(result) {
73957         if (result && result.error) {
73958           throw new Error(result.error);
73959         } else if (!result || !result.query || !result.query.search) {
73960           throw new Error("No Results");
73961         }
73962         if (callback) {
73963           var titles = result.query.search.map(function(d) {
73964             return d.title;
73965           });
73966           callback(null, titles);
73967         }
73968       }).catch(function(err) {
73969         if (callback)
73970           callback(err, []);
73971       });
73972     },
73973     suggestions: function(lang, query, callback) {
73974       if (!query) {
73975         if (callback)
73976           callback("", []);
73977         return;
73978       }
73979       lang = lang || "en";
73980       var url = endpoint.replace("en", lang) + utilQsString({
73981         action: "opensearch",
73982         namespace: 0,
73983         suggest: "",
73984         format: "json",
73985         origin: "*",
73986         search: query
73987       });
73988       json_default(url).then(function(result) {
73989         if (result && result.error) {
73990           throw new Error(result.error);
73991         } else if (!result || result.length < 2) {
73992           throw new Error("No Results");
73993         }
73994         if (callback)
73995           callback(null, result[1] || []);
73996       }).catch(function(err) {
73997         if (callback)
73998           callback(err.message, []);
73999       });
74000     },
74001     translations: function(lang, title, callback) {
74002       if (!title) {
74003         if (callback)
74004           callback("No Title");
74005         return;
74006       }
74007       var url = endpoint.replace("en", lang) + utilQsString({
74008         action: "query",
74009         prop: "langlinks",
74010         format: "json",
74011         origin: "*",
74012         lllimit: 500,
74013         titles: title
74014       });
74015       json_default(url).then(function(result) {
74016         if (result && result.error) {
74017           throw new Error(result.error);
74018         } else if (!result || !result.query || !result.query.pages) {
74019           throw new Error("No Results");
74020         }
74021         if (callback) {
74022           var list = result.query.pages[Object.keys(result.query.pages)[0]];
74023           var translations = {};
74024           if (list && list.langlinks) {
74025             list.langlinks.forEach(function(d) {
74026               translations[d.lang] = d["*"];
74027             });
74028           }
74029           callback(null, translations);
74030         }
74031       }).catch(function(err) {
74032         if (callback)
74033           callback(err.message);
74034       });
74035     }
74036   };
74037
74038   // modules/services/index.js
74039   var services = {
74040     geocoder: nominatim_default,
74041     keepRight: keepRight_default,
74042     improveOSM: improveOSM_default,
74043     osmose: osmose_default,
74044     mapillary: mapillary_default,
74045     nsi: nsi_default,
74046     kartaview: kartaview_default,
74047     osm: osm_default,
74048     osmWikibase: osm_wikibase_default,
74049     maprules: maprules_default,
74050     streetside: streetside_default,
74051     taginfo: taginfo_default,
74052     vectorTile: vector_tile_default,
74053     wikidata: wikidata_default,
74054     wikipedia: wikipedia_default
74055   };
74056
74057   // modules/modes/drag_note.js
74058   function modeDragNote(context) {
74059     var mode = {
74060       id: "drag-note",
74061       button: "browse"
74062     };
74063     var edit2 = behaviorEdit(context);
74064     var _nudgeInterval;
74065     var _lastLoc;
74066     var _note;
74067     function startNudge(d3_event, nudge) {
74068       if (_nudgeInterval)
74069         window.clearInterval(_nudgeInterval);
74070       _nudgeInterval = window.setInterval(function() {
74071         context.map().pan(nudge);
74072         doMove(d3_event, nudge);
74073       }, 50);
74074     }
74075     function stopNudge() {
74076       if (_nudgeInterval) {
74077         window.clearInterval(_nudgeInterval);
74078         _nudgeInterval = null;
74079       }
74080     }
74081     function origin(note) {
74082       return context.projection(note.loc);
74083     }
74084     function start2(d3_event, note) {
74085       _note = note;
74086       var osm = services.osm;
74087       if (osm) {
74088         _note = osm.getNote(_note.id);
74089       }
74090       context.surface().selectAll(".note-" + _note.id).classed("active", true);
74091       context.perform(actionNoop());
74092       context.enter(mode);
74093       context.selectedNoteID(_note.id);
74094     }
74095     function move(d3_event, entity, point) {
74096       d3_event.stopPropagation();
74097       _lastLoc = context.projection.invert(point);
74098       doMove(d3_event);
74099       var nudge = geoViewportEdge(point, context.map().dimensions());
74100       if (nudge) {
74101         startNudge(d3_event, nudge);
74102       } else {
74103         stopNudge();
74104       }
74105     }
74106     function doMove(d3_event, nudge) {
74107       nudge = nudge || [0, 0];
74108       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
74109       var currMouse = geoVecSubtract(currPoint, nudge);
74110       var loc = context.projection.invert(currMouse);
74111       _note = _note.move(loc);
74112       var osm = services.osm;
74113       if (osm) {
74114         osm.replaceNote(_note);
74115       }
74116       context.replace(actionNoop());
74117     }
74118     function end() {
74119       context.replace(actionNoop());
74120       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
74121     }
74122     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);
74123     mode.enter = function() {
74124       context.install(edit2);
74125     };
74126     mode.exit = function() {
74127       context.ui().sidebar.hover.cancel();
74128       context.uninstall(edit2);
74129       context.surface().selectAll(".active").classed("active", false);
74130       stopNudge();
74131     };
74132     mode.behavior = drag;
74133     return mode;
74134   }
74135
74136   // modules/modes/select_data.js
74137   function modeSelectData(context, selectedDatum) {
74138     var mode = {
74139       id: "select-data",
74140       button: "browse"
74141     };
74142     var keybinding = utilKeybinding("select-data");
74143     var dataEditor = uiDataEditor(context);
74144     var behaviors = [
74145       behaviorBreathe(context),
74146       behaviorHover(context),
74147       behaviorSelect(context),
74148       behaviorLasso(context),
74149       modeDragNode(context).behavior,
74150       modeDragNote(context).behavior
74151     ];
74152     function selectData(d3_event, drawn) {
74153       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
74154       if (selection2.empty()) {
74155         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
74156         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
74157           context.enter(modeBrowse(context));
74158         }
74159       } else {
74160         selection2.classed("selected", true);
74161       }
74162     }
74163     function esc() {
74164       if (context.container().select(".combobox").size())
74165         return;
74166       context.enter(modeBrowse(context));
74167     }
74168     mode.zoomToSelected = function() {
74169       var extent = geoExtent(bounds_default(selectedDatum));
74170       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
74171     };
74172     mode.enter = function() {
74173       behaviors.forEach(context.install);
74174       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
74175       select_default2(document).call(keybinding);
74176       selectData();
74177       var sidebar = context.ui().sidebar;
74178       sidebar.show(dataEditor.datum(selectedDatum));
74179       var extent = geoExtent(bounds_default(selectedDatum));
74180       sidebar.expand(sidebar.intersects(extent));
74181       context.map().on("drawn.select-data", selectData);
74182     };
74183     mode.exit = function() {
74184       behaviors.forEach(context.uninstall);
74185       select_default2(document).call(keybinding.unbind);
74186       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
74187       context.map().on("drawn.select-data", null);
74188       context.ui().sidebar.hide();
74189     };
74190     return mode;
74191   }
74192
74193   // modules/behavior/select.js
74194   function behaviorSelect(context) {
74195     var _tolerancePx = 4;
74196     var _lastMouseEvent = null;
74197     var _showMenu = false;
74198     var _downPointers = {};
74199     var _longPressTimeout = null;
74200     var _lastInteractionType = null;
74201     var _multiselectionPointerId = null;
74202     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
74203     function keydown(d3_event) {
74204       if (d3_event.keyCode === 32) {
74205         var activeNode = document.activeElement;
74206         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
74207           return;
74208       }
74209       if (d3_event.keyCode === 93 || d3_event.keyCode === 32) {
74210         d3_event.preventDefault();
74211       }
74212       if (d3_event.repeat)
74213         return;
74214       cancelLongPress();
74215       if (d3_event.shiftKey) {
74216         context.surface().classed("behavior-multiselect", true);
74217       }
74218       if (d3_event.keyCode === 32) {
74219         if (!_downPointers.spacebar && _lastMouseEvent) {
74220           cancelLongPress();
74221           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
74222           _downPointers.spacebar = {
74223             firstEvent: _lastMouseEvent,
74224             lastEvent: _lastMouseEvent
74225           };
74226         }
74227       }
74228     }
74229     function keyup(d3_event) {
74230       cancelLongPress();
74231       if (!d3_event.shiftKey) {
74232         context.surface().classed("behavior-multiselect", false);
74233       }
74234       if (d3_event.keyCode === 93) {
74235         d3_event.preventDefault();
74236         _lastInteractionType = "menukey";
74237         contextmenu(d3_event);
74238       } else if (d3_event.keyCode === 32) {
74239         var pointer = _downPointers.spacebar;
74240         if (pointer) {
74241           delete _downPointers.spacebar;
74242           if (pointer.done)
74243             return;
74244           d3_event.preventDefault();
74245           _lastInteractionType = "spacebar";
74246           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
74247         }
74248       }
74249     }
74250     function pointerdown(d3_event) {
74251       var id2 = (d3_event.pointerId || "mouse").toString();
74252       cancelLongPress();
74253       if (d3_event.buttons && d3_event.buttons !== 1)
74254         return;
74255       context.ui().closeEditMenu();
74256       _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
74257       _downPointers[id2] = {
74258         firstEvent: d3_event,
74259         lastEvent: d3_event
74260       };
74261     }
74262     function didLongPress(id2, interactionType) {
74263       var pointer = _downPointers[id2];
74264       if (!pointer)
74265         return;
74266       for (var i2 in _downPointers) {
74267         _downPointers[i2].done = true;
74268       }
74269       _longPressTimeout = null;
74270       _lastInteractionType = interactionType;
74271       _showMenu = true;
74272       click(pointer.firstEvent, pointer.lastEvent, id2);
74273     }
74274     function pointermove(d3_event) {
74275       var id2 = (d3_event.pointerId || "mouse").toString();
74276       if (_downPointers[id2]) {
74277         _downPointers[id2].lastEvent = d3_event;
74278       }
74279       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
74280         _lastMouseEvent = d3_event;
74281         if (_downPointers.spacebar) {
74282           _downPointers.spacebar.lastEvent = d3_event;
74283         }
74284       }
74285     }
74286     function pointerup(d3_event) {
74287       var id2 = (d3_event.pointerId || "mouse").toString();
74288       var pointer = _downPointers[id2];
74289       if (!pointer)
74290         return;
74291       delete _downPointers[id2];
74292       if (_multiselectionPointerId === id2) {
74293         _multiselectionPointerId = null;
74294       }
74295       if (pointer.done)
74296         return;
74297       click(pointer.firstEvent, d3_event, id2);
74298     }
74299     function pointercancel(d3_event) {
74300       var id2 = (d3_event.pointerId || "mouse").toString();
74301       if (!_downPointers[id2])
74302         return;
74303       delete _downPointers[id2];
74304       if (_multiselectionPointerId === id2) {
74305         _multiselectionPointerId = null;
74306       }
74307     }
74308     function contextmenu(d3_event) {
74309       d3_event.preventDefault();
74310       if (!+d3_event.clientX && !+d3_event.clientY) {
74311         if (_lastMouseEvent) {
74312           d3_event.sourceEvent = _lastMouseEvent;
74313         } else {
74314           return;
74315         }
74316       } else {
74317         _lastMouseEvent = d3_event;
74318         _lastInteractionType = "rightclick";
74319       }
74320       _showMenu = true;
74321       click(d3_event, d3_event);
74322     }
74323     function click(firstEvent, lastEvent, pointerId) {
74324       cancelLongPress();
74325       var mapNode = context.container().select(".main-map").node();
74326       var pointGetter = utilFastMouse(mapNode);
74327       var p1 = pointGetter(firstEvent);
74328       var p2 = pointGetter(lastEvent);
74329       var dist = geoVecLength(p1, p2);
74330       if (dist > _tolerancePx || !mapContains(lastEvent)) {
74331         resetProperties();
74332         return;
74333       }
74334       var targetDatum = lastEvent.target.__data__;
74335       var multiselectEntityId;
74336       if (!_multiselectionPointerId) {
74337         var selectPointerInfo = pointerDownOnSelection(pointerId);
74338         if (selectPointerInfo) {
74339           _multiselectionPointerId = selectPointerInfo.pointerId;
74340           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
74341           _downPointers[selectPointerInfo.pointerId].done = true;
74342         }
74343       }
74344       var isMultiselect = context.mode().id === "select" && (lastEvent && lastEvent.shiftKey || context.surface().select(".lasso").node() || _multiselectionPointerId && !multiselectEntityId);
74345       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
74346       function mapContains(event) {
74347         var rect = mapNode.getBoundingClientRect();
74348         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
74349       }
74350       function pointerDownOnSelection(skipPointerId) {
74351         var mode = context.mode();
74352         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
74353         for (var pointerId2 in _downPointers) {
74354           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
74355             continue;
74356           var pointerInfo = _downPointers[pointerId2];
74357           var p12 = pointGetter(pointerInfo.firstEvent);
74358           var p22 = pointGetter(pointerInfo.lastEvent);
74359           if (geoVecLength(p12, p22) > _tolerancePx)
74360             continue;
74361           var datum2 = pointerInfo.firstEvent.target.__data__;
74362           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
74363           if (context.graph().hasEntity(entity.id)) {
74364             return {
74365               pointerId: pointerId2,
74366               entityId: entity.id,
74367               selected: selectedIDs.indexOf(entity.id) !== -1
74368             };
74369           }
74370         }
74371         return null;
74372       }
74373     }
74374     function processClick(datum2, isMultiselect, point, alsoSelectId) {
74375       var mode = context.mode();
74376       var showMenu = _showMenu;
74377       var interactionType = _lastInteractionType;
74378       var entity = datum2 && datum2.properties && datum2.properties.entity;
74379       if (entity)
74380         datum2 = entity;
74381       if (datum2 && datum2.type === "midpoint") {
74382         datum2 = datum2.parents[0];
74383       }
74384       var newMode;
74385       if (datum2 instanceof osmEntity) {
74386         var selectedIDs = context.selectedIDs();
74387         context.selectedNoteID(null);
74388         context.selectedErrorID(null);
74389         if (!isMultiselect) {
74390           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
74391             if (alsoSelectId === datum2.id)
74392               alsoSelectId = null;
74393             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
74394             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
74395             context.enter(newMode);
74396           }
74397         } else {
74398           if (selectedIDs.indexOf(datum2.id) !== -1) {
74399             if (!showMenu) {
74400               selectedIDs = selectedIDs.filter(function(id2) {
74401                 return id2 !== datum2.id;
74402               });
74403               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
74404               context.enter(newMode);
74405             }
74406           } else {
74407             selectedIDs = selectedIDs.concat([datum2.id]);
74408             newMode = mode.selectedIDs(selectedIDs);
74409             context.enter(newMode);
74410           }
74411         }
74412       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
74413         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
74414       } else if (datum2 instanceof osmNote && !isMultiselect) {
74415         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
74416       } else if (datum2 instanceof QAItem && !isMultiselect) {
74417         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
74418       } else {
74419         context.selectedNoteID(null);
74420         context.selectedErrorID(null);
74421         if (!isMultiselect && mode.id !== "browse") {
74422           context.enter(modeBrowse(context));
74423         }
74424       }
74425       context.ui().closeEditMenu();
74426       if (showMenu)
74427         context.ui().showEditMenu(point, interactionType);
74428       resetProperties();
74429     }
74430     function cancelLongPress() {
74431       if (_longPressTimeout)
74432         window.clearTimeout(_longPressTimeout);
74433       _longPressTimeout = null;
74434     }
74435     function resetProperties() {
74436       cancelLongPress();
74437       _showMenu = false;
74438       _lastInteractionType = null;
74439     }
74440     function behavior(selection2) {
74441       resetProperties();
74442       _lastMouseEvent = context.map().lastPointerEvent();
74443       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) {
74444         var e = d3_event;
74445         if (+e.clientX === 0 && +e.clientY === 0) {
74446           d3_event.preventDefault();
74447         }
74448       });
74449       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
74450     }
74451     behavior.off = function(selection2) {
74452       cancelLongPress();
74453       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);
74454       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
74455       context.surface().classed("behavior-multiselect", false);
74456     };
74457     return behavior;
74458   }
74459
74460   // modules/operations/index.js
74461   var operations_exports = {};
74462   __export(operations_exports, {
74463     operationCircularize: () => operationCircularize,
74464     operationContinue: () => operationContinue,
74465     operationCopy: () => operationCopy,
74466     operationDelete: () => operationDelete,
74467     operationDisconnect: () => operationDisconnect,
74468     operationDowngrade: () => operationDowngrade,
74469     operationExtract: () => operationExtract,
74470     operationMerge: () => operationMerge,
74471     operationMove: () => operationMove,
74472     operationOrthogonalize: () => operationOrthogonalize,
74473     operationPaste: () => operationPaste,
74474     operationReflectLong: () => operationReflectLong,
74475     operationReflectShort: () => operationReflectShort,
74476     operationReverse: () => operationReverse,
74477     operationRotate: () => operationRotate,
74478     operationSplit: () => operationSplit,
74479     operationStraighten: () => operationStraighten
74480   });
74481
74482   // modules/operations/continue.js
74483   function operationContinue(context, selectedIDs) {
74484     var _entities = selectedIDs.map(function(id2) {
74485       return context.graph().entity(id2);
74486     });
74487     var _geometries = Object.assign(
74488       { line: [], vertex: [] },
74489       utilArrayGroupBy(_entities, function(entity) {
74490         return entity.geometry(context.graph());
74491       })
74492     );
74493     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
74494     function candidateWays() {
74495       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
74496         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
74497       }) : [];
74498     }
74499     var _candidates = candidateWays();
74500     var operation = function() {
74501       var candidate = _candidates[0];
74502       context.enter(
74503         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
74504       );
74505     };
74506     operation.relatedEntityIds = function() {
74507       return _candidates.length ? [_candidates[0].id] : [];
74508     };
74509     operation.available = function() {
74510       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
74511     };
74512     operation.disabled = function() {
74513       if (_candidates.length === 0) {
74514         return "not_eligible";
74515       } else if (_candidates.length > 1) {
74516         return "multiple";
74517       }
74518       return false;
74519     };
74520     operation.tooltip = function() {
74521       var disable = operation.disabled();
74522       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
74523     };
74524     operation.annotation = function() {
74525       return _t("operations.continue.annotation.line");
74526     };
74527     operation.id = "continue";
74528     operation.keys = [_t("operations.continue.key")];
74529     operation.title = _t.append("operations.continue.title");
74530     operation.behavior = behaviorOperation(context).which(operation);
74531     return operation;
74532   }
74533
74534   // modules/operations/copy.js
74535   function operationCopy(context, selectedIDs) {
74536     function getFilteredIdsToCopy() {
74537       return selectedIDs.filter(function(selectedID) {
74538         var entity = context.graph().hasEntity(selectedID);
74539         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
74540       });
74541     }
74542     var operation = function() {
74543       var graph = context.graph();
74544       var selected = groupEntities(getFilteredIdsToCopy(), graph);
74545       var canCopy = [];
74546       var skip = {};
74547       var entity;
74548       var i2;
74549       for (i2 = 0; i2 < selected.relation.length; i2++) {
74550         entity = selected.relation[i2];
74551         if (!skip[entity.id] && entity.isComplete(graph)) {
74552           canCopy.push(entity.id);
74553           skip = getDescendants(entity.id, graph, skip);
74554         }
74555       }
74556       for (i2 = 0; i2 < selected.way.length; i2++) {
74557         entity = selected.way[i2];
74558         if (!skip[entity.id]) {
74559           canCopy.push(entity.id);
74560           skip = getDescendants(entity.id, graph, skip);
74561         }
74562       }
74563       for (i2 = 0; i2 < selected.node.length; i2++) {
74564         entity = selected.node[i2];
74565         if (!skip[entity.id]) {
74566           canCopy.push(entity.id);
74567         }
74568       }
74569       context.copyIDs(canCopy);
74570       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
74571         context.copyLonLat(context.projection.invert(_point));
74572       } else {
74573         context.copyLonLat(null);
74574       }
74575     };
74576     function groupEntities(ids, graph) {
74577       var entities = ids.map(function(id2) {
74578         return graph.entity(id2);
74579       });
74580       return Object.assign(
74581         { relation: [], way: [], node: [] },
74582         utilArrayGroupBy(entities, "type")
74583       );
74584     }
74585     function getDescendants(id2, graph, descendants) {
74586       var entity = graph.entity(id2);
74587       var children2;
74588       descendants = descendants || {};
74589       if (entity.type === "relation") {
74590         children2 = entity.members.map(function(m) {
74591           return m.id;
74592         });
74593       } else if (entity.type === "way") {
74594         children2 = entity.nodes;
74595       } else {
74596         children2 = [];
74597       }
74598       for (var i2 = 0; i2 < children2.length; i2++) {
74599         if (!descendants[children2[i2]]) {
74600           descendants[children2[i2]] = true;
74601           descendants = getDescendants(children2[i2], graph, descendants);
74602         }
74603       }
74604       return descendants;
74605     }
74606     operation.available = function() {
74607       return getFilteredIdsToCopy().length > 0;
74608     };
74609     operation.disabled = function() {
74610       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
74611       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
74612         return "too_large";
74613       }
74614       return false;
74615     };
74616     operation.availableForKeypress = function() {
74617       var selection2 = window.getSelection && window.getSelection();
74618       return !selection2 || !selection2.toString();
74619     };
74620     operation.tooltip = function() {
74621       var disable = operation.disabled();
74622       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
74623     };
74624     operation.annotation = function() {
74625       return _t("operations.copy.annotation", { n: selectedIDs.length });
74626     };
74627     var _point;
74628     operation.point = function(val) {
74629       _point = val;
74630       return operation;
74631     };
74632     operation.id = "copy";
74633     operation.keys = [uiCmd("\u2318C")];
74634     operation.title = _t.append("operations.copy.title");
74635     operation.behavior = behaviorOperation(context).which(operation);
74636     return operation;
74637   }
74638
74639   // modules/operations/disconnect.js
74640   function operationDisconnect(context, selectedIDs) {
74641     var _vertexIDs = [];
74642     var _wayIDs = [];
74643     var _otherIDs = [];
74644     var _actions = [];
74645     selectedIDs.forEach(function(id2) {
74646       var entity = context.entity(id2);
74647       if (entity.type === "way") {
74648         _wayIDs.push(id2);
74649       } else if (entity.geometry(context.graph()) === "vertex") {
74650         _vertexIDs.push(id2);
74651       } else {
74652         _otherIDs.push(id2);
74653       }
74654     });
74655     var _coords, _descriptionID = "", _annotationID = "features";
74656     var _disconnectingVertexIds = [];
74657     var _disconnectingWayIds = [];
74658     if (_vertexIDs.length > 0) {
74659       _disconnectingVertexIds = _vertexIDs;
74660       _vertexIDs.forEach(function(vertexID) {
74661         var action = actionDisconnect(vertexID);
74662         if (_wayIDs.length > 0) {
74663           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
74664             var way = context.entity(wayID);
74665             return way.nodes.indexOf(vertexID) !== -1;
74666           });
74667           action.limitWays(waysIDsForVertex);
74668         }
74669         _actions.push(action);
74670         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d) => d.id));
74671       });
74672       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
74673         return _wayIDs.indexOf(id2) === -1;
74674       });
74675       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
74676       if (_wayIDs.length === 1) {
74677         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
74678       } else {
74679         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
74680       }
74681     } else if (_wayIDs.length > 0) {
74682       var ways = _wayIDs.map(function(id2) {
74683         return context.entity(id2);
74684       });
74685       var nodes = utilGetAllNodes(_wayIDs, context.graph());
74686       _coords = nodes.map(function(n2) {
74687         return n2.loc;
74688       });
74689       var sharedActions = [];
74690       var sharedNodes = [];
74691       var unsharedActions = [];
74692       var unsharedNodes = [];
74693       nodes.forEach(function(node) {
74694         var action = actionDisconnect(node.id).limitWays(_wayIDs);
74695         if (action.disabled(context.graph()) !== "not_connected") {
74696           var count = 0;
74697           for (var i2 in ways) {
74698             var way = ways[i2];
74699             if (way.nodes.indexOf(node.id) !== -1) {
74700               count += 1;
74701             }
74702             if (count > 1)
74703               break;
74704           }
74705           if (count > 1) {
74706             sharedActions.push(action);
74707             sharedNodes.push(node);
74708           } else {
74709             unsharedActions.push(action);
74710             unsharedNodes.push(node);
74711           }
74712         }
74713       });
74714       _descriptionID += "no_points.";
74715       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
74716       if (sharedActions.length) {
74717         _actions = sharedActions;
74718         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
74719         _descriptionID += "conjoined";
74720         _annotationID = "from_each_other";
74721       } else {
74722         _actions = unsharedActions;
74723         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
74724         if (_wayIDs.length === 1) {
74725           _descriptionID += context.graph().geometry(_wayIDs[0]);
74726         } else {
74727           _descriptionID += "separate";
74728         }
74729       }
74730     }
74731     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
74732     var operation = function() {
74733       context.perform(function(graph) {
74734         return _actions.reduce(function(graph2, action) {
74735           return action(graph2);
74736         }, graph);
74737       }, operation.annotation());
74738       context.validator().validate();
74739     };
74740     operation.relatedEntityIds = function() {
74741       if (_vertexIDs.length) {
74742         return _disconnectingWayIds;
74743       }
74744       return _disconnectingVertexIds;
74745     };
74746     operation.available = function() {
74747       if (_actions.length === 0)
74748         return false;
74749       if (_otherIDs.length !== 0)
74750         return false;
74751       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
74752         return _vertexIDs.some(function(vertexID) {
74753           var way = context.entity(wayID);
74754           return way.nodes.indexOf(vertexID) !== -1;
74755         });
74756       }))
74757         return false;
74758       return true;
74759     };
74760     operation.disabled = function() {
74761       var reason;
74762       for (var actionIndex in _actions) {
74763         reason = _actions[actionIndex].disabled(context.graph());
74764         if (reason)
74765           return reason;
74766       }
74767       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
74768         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
74769       } else if (_coords && someMissing()) {
74770         return "not_downloaded";
74771       } else if (selectedIDs.some(context.hasHiddenConnections)) {
74772         return "connected_to_hidden";
74773       }
74774       return false;
74775       function someMissing() {
74776         if (context.inIntro())
74777           return false;
74778         var osm = context.connection();
74779         if (osm) {
74780           var missing = _coords.filter(function(loc) {
74781             return !osm.isDataLoaded(loc);
74782           });
74783           if (missing.length) {
74784             missing.forEach(function(loc) {
74785               context.loadTileAtLoc(loc);
74786             });
74787             return true;
74788           }
74789         }
74790         return false;
74791       }
74792     };
74793     operation.tooltip = function() {
74794       var disable = operation.disabled();
74795       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
74796     };
74797     operation.annotation = function() {
74798       return _t("operations.disconnect.annotation." + _annotationID);
74799     };
74800     operation.id = "disconnect";
74801     operation.keys = [_t("operations.disconnect.key")];
74802     operation.title = _t.append("operations.disconnect.title");
74803     operation.behavior = behaviorOperation(context).which(operation);
74804     return operation;
74805   }
74806
74807   // modules/operations/downgrade.js
74808   function operationDowngrade(context, selectedIDs) {
74809     var _affectedFeatureCount = 0;
74810     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
74811     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
74812     function downgradeTypeForEntityIDs(entityIds) {
74813       var downgradeType;
74814       _affectedFeatureCount = 0;
74815       for (var i2 in entityIds) {
74816         var entityID = entityIds[i2];
74817         var type3 = downgradeTypeForEntityID(entityID);
74818         if (type3) {
74819           _affectedFeatureCount += 1;
74820           if (downgradeType && type3 !== downgradeType) {
74821             if (downgradeType !== "generic" && type3 !== "generic") {
74822               downgradeType = "building_address";
74823             } else {
74824               downgradeType = "generic";
74825             }
74826           } else {
74827             downgradeType = type3;
74828           }
74829         }
74830       }
74831       return downgradeType;
74832     }
74833     function downgradeTypeForEntityID(entityID) {
74834       var graph = context.graph();
74835       var entity = graph.entity(entityID);
74836       var preset = _mainPresetIndex.match(entity, graph);
74837       if (!preset || preset.isFallback())
74838         return null;
74839       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
74840         return key.match(/^addr:.{1,}/);
74841       })) {
74842         return "address";
74843       }
74844       var geometry = entity.geometry(graph);
74845       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
74846         return "building";
74847       }
74848       if (geometry === "vertex" && Object.keys(entity.tags).length) {
74849         return "generic";
74850       }
74851       return null;
74852     }
74853     var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
74854     var addressKeysToKeep = ["source"];
74855     var operation = function() {
74856       context.perform(function(graph) {
74857         for (var i2 in selectedIDs) {
74858           var entityID = selectedIDs[i2];
74859           var type3 = downgradeTypeForEntityID(entityID);
74860           if (!type3)
74861             continue;
74862           var tags = Object.assign({}, graph.entity(entityID).tags);
74863           for (var key in tags) {
74864             if (type3 === "address" && addressKeysToKeep.indexOf(key) !== -1)
74865               continue;
74866             if (type3 === "building") {
74867               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
74868                 continue;
74869             }
74870             if (type3 !== "generic") {
74871               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
74872                 continue;
74873             }
74874             delete tags[key];
74875           }
74876           graph = actionChangeTags(entityID, tags)(graph);
74877         }
74878         return graph;
74879       }, operation.annotation());
74880       context.validator().validate();
74881       context.enter(modeSelect(context, selectedIDs));
74882     };
74883     operation.available = function() {
74884       return _downgradeType;
74885     };
74886     operation.disabled = function() {
74887       if (selectedIDs.some(hasWikidataTag)) {
74888         return "has_wikidata_tag";
74889       }
74890       return false;
74891       function hasWikidataTag(id2) {
74892         var entity = context.entity(id2);
74893         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
74894       }
74895     };
74896     operation.tooltip = function() {
74897       var disable = operation.disabled();
74898       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
74899     };
74900     operation.annotation = function() {
74901       var suffix;
74902       if (_downgradeType === "building_address") {
74903         suffix = "generic";
74904       } else {
74905         suffix = _downgradeType;
74906       }
74907       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
74908     };
74909     operation.id = "downgrade";
74910     operation.keys = [uiCmd("\u232B")];
74911     operation.title = _t.append("operations.downgrade.title");
74912     operation.behavior = behaviorOperation(context).which(operation);
74913     return operation;
74914   }
74915
74916   // modules/operations/extract.js
74917   function operationExtract(context, selectedIDs) {
74918     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
74919     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
74920       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
74921     }).filter(Boolean));
74922     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
74923     var _extent;
74924     var _actions = selectedIDs.map(function(entityID) {
74925       var graph = context.graph();
74926       var entity = graph.hasEntity(entityID);
74927       if (!entity || !entity.hasInterestingTags())
74928         return null;
74929       if (entity.type === "node" && graph.parentWays(entity).length === 0)
74930         return null;
74931       if (entity.type !== "node") {
74932         var preset = _mainPresetIndex.match(entity, graph);
74933         if (preset.geometry.indexOf("point") === -1)
74934           return null;
74935       }
74936       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
74937       return actionExtract(entityID, context.projection);
74938     }).filter(Boolean);
74939     var operation = function() {
74940       var combinedAction = function(graph) {
74941         _actions.forEach(function(action) {
74942           graph = action(graph);
74943         });
74944         return graph;
74945       };
74946       context.perform(combinedAction, operation.annotation());
74947       var extractedNodeIDs = _actions.map(function(action) {
74948         return action.getExtractedNodeID();
74949       });
74950       context.enter(modeSelect(context, extractedNodeIDs));
74951     };
74952     operation.available = function() {
74953       return _actions.length && selectedIDs.length === _actions.length;
74954     };
74955     operation.disabled = function() {
74956       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
74957         return "too_large";
74958       } else if (selectedIDs.some(function(entityID) {
74959         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
74960       })) {
74961         return "connected_to_hidden";
74962       }
74963       return false;
74964     };
74965     operation.tooltip = function() {
74966       var disableReason = operation.disabled();
74967       if (disableReason) {
74968         return _t.append("operations.extract." + disableReason + "." + _amount);
74969       } else {
74970         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
74971       }
74972     };
74973     operation.annotation = function() {
74974       return _t("operations.extract.annotation", { n: selectedIDs.length });
74975     };
74976     operation.id = "extract";
74977     operation.keys = [_t("operations.extract.key")];
74978     operation.title = _t.append("operations.extract.title");
74979     operation.behavior = behaviorOperation(context).which(operation);
74980     return operation;
74981   }
74982
74983   // modules/operations/merge.js
74984   function operationMerge(context, selectedIDs) {
74985     var _action = getAction();
74986     function getAction() {
74987       var join = actionJoin(selectedIDs);
74988       if (!join.disabled(context.graph()))
74989         return join;
74990       var merge3 = actionMerge(selectedIDs);
74991       if (!merge3.disabled(context.graph()))
74992         return merge3;
74993       var mergePolygon = actionMergePolygon(selectedIDs);
74994       if (!mergePolygon.disabled(context.graph()))
74995         return mergePolygon;
74996       var mergeNodes = actionMergeNodes(selectedIDs);
74997       if (!mergeNodes.disabled(context.graph()))
74998         return mergeNodes;
74999       if (join.disabled(context.graph()) !== "not_eligible")
75000         return join;
75001       if (merge3.disabled(context.graph()) !== "not_eligible")
75002         return merge3;
75003       if (mergePolygon.disabled(context.graph()) !== "not_eligible")
75004         return mergePolygon;
75005       return mergeNodes;
75006     }
75007     var operation = function() {
75008       if (operation.disabled())
75009         return;
75010       context.perform(_action, operation.annotation());
75011       context.validator().validate();
75012       var resultIDs = selectedIDs.filter(context.hasEntity);
75013       if (resultIDs.length > 1) {
75014         var interestingIDs = resultIDs.filter(function(id2) {
75015           return context.entity(id2).hasInterestingTags();
75016         });
75017         if (interestingIDs.length)
75018           resultIDs = interestingIDs;
75019       }
75020       context.enter(modeSelect(context, resultIDs));
75021     };
75022     operation.available = function() {
75023       return selectedIDs.length >= 2;
75024     };
75025     operation.disabled = function() {
75026       var actionDisabled = _action.disabled(context.graph());
75027       if (actionDisabled)
75028         return actionDisabled;
75029       var osm = context.connection();
75030       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
75031         return "too_many_vertices";
75032       }
75033       return false;
75034     };
75035     operation.tooltip = function() {
75036       var disabled = operation.disabled();
75037       if (disabled) {
75038         if (disabled === "conflicting_relations") {
75039           return _t.append("operations.merge.conflicting_relations");
75040         }
75041         if (disabled === "restriction" || disabled === "connectivity") {
75042           return _t.append(
75043             "operations.merge.damage_relation",
75044             { relation: _mainPresetIndex.item("type/" + disabled).name() }
75045           );
75046         }
75047         return _t.append("operations.merge." + disabled);
75048       }
75049       return _t.append("operations.merge.description");
75050     };
75051     operation.annotation = function() {
75052       return _t("operations.merge.annotation", { n: selectedIDs.length });
75053     };
75054     operation.id = "merge";
75055     operation.keys = [_t("operations.merge.key")];
75056     operation.title = _t.append("operations.merge.title");
75057     operation.behavior = behaviorOperation(context).which(operation);
75058     return operation;
75059   }
75060
75061   // modules/operations/paste.js
75062   function operationPaste(context) {
75063     var _pastePoint;
75064     var operation = function() {
75065       if (!_pastePoint)
75066         return;
75067       var oldIDs = context.copyIDs();
75068       if (!oldIDs.length)
75069         return;
75070       var projection2 = context.projection;
75071       var extent = geoExtent();
75072       var oldGraph = context.copyGraph();
75073       var newIDs = [];
75074       var action = actionCopyEntities(oldIDs, oldGraph);
75075       context.perform(action);
75076       var copies = action.copies();
75077       var originals = /* @__PURE__ */ new Set();
75078       Object.values(copies).forEach(function(entity) {
75079         originals.add(entity.id);
75080       });
75081       for (var id2 in copies) {
75082         var oldEntity = oldGraph.entity(id2);
75083         var newEntity = copies[id2];
75084         extent._extend(oldEntity.extent(oldGraph));
75085         var parents = context.graph().parentWays(newEntity);
75086         var parentCopied = parents.some(function(parent) {
75087           return originals.has(parent.id);
75088         });
75089         if (!parentCopied) {
75090           newIDs.push(newEntity.id);
75091         }
75092       }
75093       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
75094       var delta = geoVecSubtract(_pastePoint, copyPoint);
75095       context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
75096       context.enter(modeSelect(context, newIDs));
75097     };
75098     operation.point = function(val) {
75099       _pastePoint = val;
75100       return operation;
75101     };
75102     operation.available = function() {
75103       return context.mode().id === "browse";
75104     };
75105     operation.disabled = function() {
75106       return !context.copyIDs().length;
75107     };
75108     operation.tooltip = function() {
75109       var oldGraph = context.copyGraph();
75110       var ids = context.copyIDs();
75111       if (!ids.length) {
75112         return _t.append("operations.paste.nothing_copied");
75113       }
75114       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
75115     };
75116     operation.annotation = function() {
75117       var ids = context.copyIDs();
75118       return _t("operations.paste.annotation", { n: ids.length });
75119     };
75120     operation.id = "paste";
75121     operation.keys = [uiCmd("\u2318V")];
75122     operation.title = _t.append("operations.paste.title");
75123     return operation;
75124   }
75125
75126   // modules/operations/reverse.js
75127   function operationReverse(context, selectedIDs) {
75128     var operation = function() {
75129       context.perform(function combinedReverseAction(graph) {
75130         actions().forEach(function(action) {
75131           graph = action(graph);
75132         });
75133         return graph;
75134       }, operation.annotation());
75135       context.validator().validate();
75136     };
75137     function actions(situation) {
75138       return selectedIDs.map(function(entityID) {
75139         var entity = context.hasEntity(entityID);
75140         if (!entity)
75141           return null;
75142         if (situation === "toolbar") {
75143           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
75144             return null;
75145         }
75146         var geometry = entity.geometry(context.graph());
75147         if (entity.type !== "node" && geometry !== "line")
75148           return null;
75149         var action = actionReverse(entityID);
75150         if (action.disabled(context.graph()))
75151           return null;
75152         return action;
75153       }).filter(Boolean);
75154     }
75155     function reverseTypeID() {
75156       var acts = actions();
75157       var nodeActionCount = acts.filter(function(act) {
75158         var entity = context.hasEntity(act.entityID());
75159         return entity && entity.type === "node";
75160       }).length;
75161       if (nodeActionCount === 0)
75162         return "line";
75163       if (nodeActionCount === acts.length)
75164         return "point";
75165       return "feature";
75166     }
75167     operation.available = function(situation) {
75168       return actions(situation).length > 0;
75169     };
75170     operation.disabled = function() {
75171       return false;
75172     };
75173     operation.tooltip = function() {
75174       return _t.append("operations.reverse.description." + reverseTypeID());
75175     };
75176     operation.annotation = function() {
75177       var acts = actions();
75178       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
75179     };
75180     operation.id = "reverse";
75181     operation.keys = [_t("operations.reverse.key")];
75182     operation.title = _t.append("operations.reverse.title");
75183     operation.behavior = behaviorOperation(context).which(operation);
75184     return operation;
75185   }
75186
75187   // modules/operations/split.js
75188   function operationSplit(context, selectedIDs) {
75189     var _vertexIds = selectedIDs.filter(function(id2) {
75190       return context.graph().geometry(id2) === "vertex";
75191     });
75192     var _selectedWayIds = selectedIDs.filter(function(id2) {
75193       var entity = context.graph().hasEntity(id2);
75194       return entity && entity.type === "way";
75195     });
75196     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
75197     var _action = actionSplit(_vertexIds);
75198     var _ways = [];
75199     var _geometry = "feature";
75200     var _waysAmount = "single";
75201     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
75202     if (_isAvailable) {
75203       if (_selectedWayIds.length)
75204         _action.limitWays(_selectedWayIds);
75205       _ways = _action.ways(context.graph());
75206       var geometries = {};
75207       _ways.forEach(function(way) {
75208         geometries[way.geometry(context.graph())] = true;
75209       });
75210       if (Object.keys(geometries).length === 1) {
75211         _geometry = Object.keys(geometries)[0];
75212       }
75213       _waysAmount = _ways.length === 1 ? "single" : "multiple";
75214     }
75215     var operation = function() {
75216       var difference = context.perform(_action, operation.annotation());
75217       var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
75218         return context.entity(id2).type === "way";
75219       }));
75220       context.enter(modeSelect(context, idsToSelect));
75221     };
75222     operation.relatedEntityIds = function() {
75223       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
75224     };
75225     operation.available = function() {
75226       return _isAvailable;
75227     };
75228     operation.disabled = function() {
75229       var reason = _action.disabled(context.graph());
75230       if (reason) {
75231         return reason;
75232       } else if (selectedIDs.some(context.hasHiddenConnections)) {
75233         return "connected_to_hidden";
75234       }
75235       return false;
75236     };
75237     operation.tooltip = function() {
75238       var disable = operation.disabled();
75239       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
75240     };
75241     operation.annotation = function() {
75242       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
75243     };
75244     operation.icon = function() {
75245       if (_waysAmount === "multiple") {
75246         return "#iD-operation-split-multiple";
75247       } else {
75248         return "#iD-operation-split";
75249       }
75250     };
75251     operation.id = "split";
75252     operation.keys = [_t("operations.split.key")];
75253     operation.title = _t.append("operations.split.title");
75254     operation.behavior = behaviorOperation(context).which(operation);
75255     return operation;
75256   }
75257
75258   // modules/operations/straighten.js
75259   function operationStraighten(context, selectedIDs) {
75260     var _wayIDs = selectedIDs.filter(function(id2) {
75261       return id2.charAt(0) === "w";
75262     });
75263     var _nodeIDs = selectedIDs.filter(function(id2) {
75264       return id2.charAt(0) === "n";
75265     });
75266     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
75267     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
75268     var _coords = _nodes.map(function(n2) {
75269       return n2.loc;
75270     });
75271     var _extent = utilTotalExtent(selectedIDs, context.graph());
75272     var _action = chooseAction();
75273     var _geometry;
75274     function chooseAction() {
75275       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
75276         _geometry = "point";
75277         return actionStraightenNodes(_nodeIDs, context.projection);
75278       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
75279         var startNodeIDs = [];
75280         var endNodeIDs = [];
75281         for (var i2 = 0; i2 < selectedIDs.length; i2++) {
75282           var entity = context.entity(selectedIDs[i2]);
75283           if (entity.type === "node") {
75284             continue;
75285           } else if (entity.type !== "way" || entity.isClosed()) {
75286             return null;
75287           }
75288           startNodeIDs.push(entity.first());
75289           endNodeIDs.push(entity.last());
75290         }
75291         startNodeIDs = startNodeIDs.filter(function(n2) {
75292           return startNodeIDs.indexOf(n2) === startNodeIDs.lastIndexOf(n2);
75293         });
75294         endNodeIDs = endNodeIDs.filter(function(n2) {
75295           return endNodeIDs.indexOf(n2) === endNodeIDs.lastIndexOf(n2);
75296         });
75297         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
75298           return null;
75299         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
75300           return node.id;
75301         });
75302         if (wayNodeIDs.length <= 2)
75303           return null;
75304         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
75305           return null;
75306         if (_nodeIDs.length) {
75307           _extent = utilTotalExtent(_nodeIDs, context.graph());
75308         }
75309         _geometry = "line";
75310         return actionStraightenWay(selectedIDs, context.projection);
75311       }
75312       return null;
75313     }
75314     function operation() {
75315       if (!_action)
75316         return;
75317       context.perform(_action, operation.annotation());
75318       window.setTimeout(function() {
75319         context.validator().validate();
75320       }, 300);
75321     }
75322     operation.available = function() {
75323       return Boolean(_action);
75324     };
75325     operation.disabled = function() {
75326       var reason = _action.disabled(context.graph());
75327       if (reason) {
75328         return reason;
75329       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
75330         return "too_large";
75331       } else if (someMissing()) {
75332         return "not_downloaded";
75333       } else if (selectedIDs.some(context.hasHiddenConnections)) {
75334         return "connected_to_hidden";
75335       }
75336       return false;
75337       function someMissing() {
75338         if (context.inIntro())
75339           return false;
75340         var osm = context.connection();
75341         if (osm) {
75342           var missing = _coords.filter(function(loc) {
75343             return !osm.isDataLoaded(loc);
75344           });
75345           if (missing.length) {
75346             missing.forEach(function(loc) {
75347               context.loadTileAtLoc(loc);
75348             });
75349             return true;
75350           }
75351         }
75352         return false;
75353       }
75354     };
75355     operation.tooltip = function() {
75356       var disable = operation.disabled();
75357       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
75358     };
75359     operation.annotation = function() {
75360       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
75361     };
75362     operation.id = "straighten";
75363     operation.keys = [_t("operations.straighten.key")];
75364     operation.title = _t.append("operations.straighten.title");
75365     operation.behavior = behaviorOperation(context).which(operation);
75366     return operation;
75367   }
75368
75369   // modules/modes/select.js
75370   function modeSelect(context, selectedIDs) {
75371     var mode = {
75372       id: "select",
75373       button: "browse"
75374     };
75375     var keybinding = utilKeybinding("select");
75376     var _breatheBehavior = behaviorBreathe(context);
75377     var _modeDragNode = modeDragNode(context);
75378     var _selectBehavior;
75379     var _behaviors = [];
75380     var _operations = [];
75381     var _newFeature = false;
75382     var _follow = false;
75383     var _focusedParentWayId;
75384     var _focusedVertexIds;
75385     function singular() {
75386       if (selectedIDs && selectedIDs.length === 1) {
75387         return context.hasEntity(selectedIDs[0]);
75388       }
75389     }
75390     function selectedEntities() {
75391       return selectedIDs.map(function(id2) {
75392         return context.hasEntity(id2);
75393       }).filter(Boolean);
75394     }
75395     function checkSelectedIDs() {
75396       var ids = [];
75397       if (Array.isArray(selectedIDs)) {
75398         ids = selectedIDs.filter(function(id2) {
75399           return context.hasEntity(id2);
75400         });
75401       }
75402       if (!ids.length) {
75403         context.enter(modeBrowse(context));
75404         return false;
75405       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
75406         context.enter(modeSelect(context, ids));
75407         return false;
75408       }
75409       selectedIDs = ids;
75410       return true;
75411     }
75412     function parentWaysIdsOfSelection(onlyCommonParents) {
75413       var graph = context.graph();
75414       var parents = [];
75415       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
75416         var entity = context.hasEntity(selectedIDs[i2]);
75417         if (!entity || entity.geometry(graph) !== "vertex") {
75418           return [];
75419         }
75420         var currParents = graph.parentWays(entity).map(function(w) {
75421           return w.id;
75422         });
75423         if (!parents.length) {
75424           parents = currParents;
75425           continue;
75426         }
75427         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
75428         if (!parents.length) {
75429           return [];
75430         }
75431       }
75432       return parents;
75433     }
75434     function childNodeIdsOfSelection(onlyCommon) {
75435       var graph = context.graph();
75436       var childs = [];
75437       for (var i2 = 0; i2 < selectedIDs.length; i2++) {
75438         var entity = context.hasEntity(selectedIDs[i2]);
75439         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
75440           return [];
75441         }
75442         var currChilds = graph.childNodes(entity).map(function(node) {
75443           return node.id;
75444         });
75445         if (!childs.length) {
75446           childs = currChilds;
75447           continue;
75448         }
75449         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
75450         if (!childs.length) {
75451           return [];
75452         }
75453       }
75454       return childs;
75455     }
75456     function checkFocusedParent() {
75457       if (_focusedParentWayId) {
75458         var parents = parentWaysIdsOfSelection(true);
75459         if (parents.indexOf(_focusedParentWayId) === -1)
75460           _focusedParentWayId = null;
75461       }
75462     }
75463     function parentWayIdForVertexNavigation() {
75464       var parentIds = parentWaysIdsOfSelection(true);
75465       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
75466         return _focusedParentWayId;
75467       }
75468       return parentIds.length ? parentIds[0] : null;
75469     }
75470     mode.selectedIDs = function(val) {
75471       if (!arguments.length)
75472         return selectedIDs;
75473       selectedIDs = val;
75474       return mode;
75475     };
75476     mode.zoomToSelected = function() {
75477       context.map().zoomToEase(selectedEntities());
75478     };
75479     mode.newFeature = function(val) {
75480       if (!arguments.length)
75481         return _newFeature;
75482       _newFeature = val;
75483       return mode;
75484     };
75485     mode.selectBehavior = function(val) {
75486       if (!arguments.length)
75487         return _selectBehavior;
75488       _selectBehavior = val;
75489       return mode;
75490     };
75491     mode.follow = function(val) {
75492       if (!arguments.length)
75493         return _follow;
75494       _follow = val;
75495       return mode;
75496     };
75497     function loadOperations() {
75498       _operations.forEach(function(operation) {
75499         if (operation.behavior) {
75500           context.uninstall(operation.behavior);
75501         }
75502       });
75503       _operations = Object.values(operations_exports).map(function(o) {
75504         return o(context, selectedIDs);
75505       }).filter(function(o) {
75506         return o.id !== "delete" && o.id !== "downgrade" && o.id !== "copy";
75507       }).concat([
75508         operationCopy(context, selectedIDs),
75509         operationDowngrade(context, selectedIDs),
75510         operationDelete(context, selectedIDs)
75511       ]).filter(function(operation) {
75512         return operation.available();
75513       });
75514       _operations.forEach(function(operation) {
75515         if (operation.behavior) {
75516           context.install(operation.behavior);
75517         }
75518       });
75519       context.ui().closeEditMenu();
75520     }
75521     mode.operations = function() {
75522       return _operations;
75523     };
75524     mode.enter = function() {
75525       if (!checkSelectedIDs())
75526         return;
75527       context.features().forceVisible(selectedIDs);
75528       _modeDragNode.restoreSelectedIDs(selectedIDs);
75529       loadOperations();
75530       if (!_behaviors.length) {
75531         if (!_selectBehavior)
75532           _selectBehavior = behaviorSelect(context);
75533         _behaviors = [
75534           behaviorPaste(context),
75535           _breatheBehavior,
75536           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
75537           _selectBehavior,
75538           behaviorLasso(context),
75539           _modeDragNode.behavior,
75540           modeDragNote(context).behavior
75541         ];
75542       }
75543       _behaviors.forEach(context.install);
75544       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);
75545       select_default2(document).call(keybinding);
75546       context.ui().sidebar.select(selectedIDs, _newFeature);
75547       context.history().on("change.select", function() {
75548         loadOperations();
75549         selectElements();
75550       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
75551       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
75552         selectElements();
75553         _breatheBehavior.restartIfNeeded(context.surface());
75554       });
75555       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
75556       selectElements();
75557       if (_follow) {
75558         var extent = geoExtent();
75559         var graph = context.graph();
75560         selectedIDs.forEach(function(id2) {
75561           var entity = context.entity(id2);
75562           extent._extend(entity.extent(graph));
75563         });
75564         var loc = extent.center();
75565         context.map().centerEase(loc);
75566         _follow = false;
75567       }
75568       function nudgeSelection(delta) {
75569         return function() {
75570           if (!context.map().withinEditableZoom())
75571             return;
75572           var moveOp = operationMove(context, selectedIDs);
75573           if (moveOp.disabled()) {
75574             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
75575           } else {
75576             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
75577             context.validator().validate();
75578           }
75579         };
75580       }
75581       function scaleSelection(factor) {
75582         return function() {
75583           if (!context.map().withinEditableZoom())
75584             return;
75585           let nodes = utilGetAllNodes(selectedIDs, context.graph());
75586           let isUp = factor > 1;
75587           if (nodes.length <= 1)
75588             return;
75589           let extent2 = utilTotalExtent(selectedIDs, context.graph());
75590           function scalingDisabled() {
75591             if (tooSmall()) {
75592               return "too_small";
75593             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
75594               return "too_large";
75595             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
75596               return "not_downloaded";
75597             } else if (selectedIDs.some(context.hasHiddenConnections)) {
75598               return "connected_to_hidden";
75599             }
75600             return false;
75601             function tooSmall() {
75602               if (isUp)
75603                 return false;
75604               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
75605               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
75606               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
75607             }
75608             function someMissing() {
75609               if (context.inIntro())
75610                 return false;
75611               let osm = context.connection();
75612               if (osm) {
75613                 let missing = nodes.filter(function(n2) {
75614                   return !osm.isDataLoaded(n2.loc);
75615                 });
75616                 if (missing.length) {
75617                   missing.forEach(function(loc2) {
75618                     context.loadTileAtLoc(loc2);
75619                   });
75620                   return true;
75621                 }
75622               }
75623               return false;
75624             }
75625             function incompleteRelation(id2) {
75626               let entity = context.entity(id2);
75627               return entity.type === "relation" && !entity.isComplete(context.graph());
75628             }
75629           }
75630           const disabled = scalingDisabled();
75631           if (disabled) {
75632             let multi = selectedIDs.length === 1 ? "single" : "multiple";
75633             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
75634           } else {
75635             const pivot = context.projection(extent2.center());
75636             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
75637             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
75638             context.validator().validate();
75639           }
75640         };
75641       }
75642       function didDoubleUp(d3_event, loc2) {
75643         if (!context.map().withinEditableZoom())
75644           return;
75645         var target = select_default2(d3_event.target);
75646         var datum2 = target.datum();
75647         var entity = datum2 && datum2.properties && datum2.properties.entity;
75648         if (!entity)
75649           return;
75650         if (entity instanceof osmWay && target.classed("target")) {
75651           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
75652           var prev = entity.nodes[choice.index - 1];
75653           var next = entity.nodes[choice.index];
75654           context.perform(
75655             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
75656             _t("operations.add.annotation.vertex")
75657           );
75658           context.validator().validate();
75659         } else if (entity.type === "midpoint") {
75660           context.perform(
75661             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
75662             _t("operations.add.annotation.vertex")
75663           );
75664           context.validator().validate();
75665         }
75666       }
75667       function selectElements() {
75668         if (!checkSelectedIDs())
75669           return;
75670         var surface = context.surface();
75671         surface.selectAll(".selected-member").classed("selected-member", false);
75672         surface.selectAll(".selected").classed("selected", false);
75673         surface.selectAll(".related").classed("related", false);
75674         checkFocusedParent();
75675         if (_focusedParentWayId) {
75676           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
75677         }
75678         if (context.map().withinEditableZoom()) {
75679           surface.selectAll(utilDeepMemberSelector(selectedIDs, context.graph(), true)).classed("selected-member", true);
75680           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
75681         }
75682       }
75683       function esc() {
75684         if (context.container().select(".combobox").size())
75685           return;
75686         context.enter(modeBrowse(context));
75687       }
75688       function firstVertex(d3_event) {
75689         d3_event.preventDefault();
75690         var entity = singular();
75691         var parentId = parentWayIdForVertexNavigation();
75692         var way;
75693         if (entity && entity.type === "way") {
75694           way = entity;
75695         } else if (parentId) {
75696           way = context.entity(parentId);
75697         }
75698         _focusedParentWayId = way && way.id;
75699         if (way) {
75700           context.enter(
75701             mode.selectedIDs([way.first()]).follow(true)
75702           );
75703         }
75704       }
75705       function lastVertex(d3_event) {
75706         d3_event.preventDefault();
75707         var entity = singular();
75708         var parentId = parentWayIdForVertexNavigation();
75709         var way;
75710         if (entity && entity.type === "way") {
75711           way = entity;
75712         } else if (parentId) {
75713           way = context.entity(parentId);
75714         }
75715         _focusedParentWayId = way && way.id;
75716         if (way) {
75717           context.enter(
75718             mode.selectedIDs([way.last()]).follow(true)
75719           );
75720         }
75721       }
75722       function previousVertex(d3_event) {
75723         d3_event.preventDefault();
75724         var parentId = parentWayIdForVertexNavigation();
75725         _focusedParentWayId = parentId;
75726         if (!parentId)
75727           return;
75728         var way = context.entity(parentId);
75729         var length = way.nodes.length;
75730         var curr = way.nodes.indexOf(selectedIDs[0]);
75731         var index = -1;
75732         if (curr > 0) {
75733           index = curr - 1;
75734         } else if (way.isClosed()) {
75735           index = length - 2;
75736         }
75737         if (index !== -1) {
75738           context.enter(
75739             mode.selectedIDs([way.nodes[index]]).follow(true)
75740           );
75741         }
75742       }
75743       function nextVertex(d3_event) {
75744         d3_event.preventDefault();
75745         var parentId = parentWayIdForVertexNavigation();
75746         _focusedParentWayId = parentId;
75747         if (!parentId)
75748           return;
75749         var way = context.entity(parentId);
75750         var length = way.nodes.length;
75751         var curr = way.nodes.indexOf(selectedIDs[0]);
75752         var index = -1;
75753         if (curr < length - 1) {
75754           index = curr + 1;
75755         } else if (way.isClosed()) {
75756           index = 0;
75757         }
75758         if (index !== -1) {
75759           context.enter(
75760             mode.selectedIDs([way.nodes[index]]).follow(true)
75761           );
75762         }
75763       }
75764       function focusNextParent(d3_event) {
75765         d3_event.preventDefault();
75766         var parents = parentWaysIdsOfSelection(true);
75767         if (!parents || parents.length < 2)
75768           return;
75769         var index = parents.indexOf(_focusedParentWayId);
75770         if (index < 0 || index > parents.length - 2) {
75771           _focusedParentWayId = parents[0];
75772         } else {
75773           _focusedParentWayId = parents[index + 1];
75774         }
75775         var surface = context.surface();
75776         surface.selectAll(".related").classed("related", false);
75777         if (_focusedParentWayId) {
75778           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
75779         }
75780       }
75781       function selectParent(d3_event) {
75782         d3_event.preventDefault();
75783         var currentSelectedIds = mode.selectedIDs();
75784         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
75785         if (!parentIds.length)
75786           return;
75787         context.enter(
75788           mode.selectedIDs(parentIds)
75789         );
75790         _focusedVertexIds = currentSelectedIds;
75791       }
75792       function selectChild(d3_event) {
75793         d3_event.preventDefault();
75794         var currentSelectedIds = mode.selectedIDs();
75795         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
75796         if (!childIds || !childIds.length)
75797           return;
75798         if (currentSelectedIds.length === 1)
75799           _focusedParentWayId = currentSelectedIds[0];
75800         context.enter(
75801           mode.selectedIDs(childIds)
75802         );
75803       }
75804     };
75805     mode.exit = function() {
75806       _newFeature = false;
75807       _focusedVertexIds = null;
75808       _operations.forEach(function(operation) {
75809         if (operation.behavior) {
75810           context.uninstall(operation.behavior);
75811         }
75812       });
75813       _operations = [];
75814       _behaviors.forEach(context.uninstall);
75815       select_default2(document).call(keybinding.unbind);
75816       context.ui().closeEditMenu();
75817       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
75818       var surface = context.surface();
75819       surface.selectAll(".selected-member").classed("selected-member", false);
75820       surface.selectAll(".selected").classed("selected", false);
75821       surface.selectAll(".highlighted").classed("highlighted", false);
75822       surface.selectAll(".related").classed("related", false);
75823       context.map().on("drawn.select", null);
75824       context.ui().sidebar.hide();
75825       context.features().forceVisible([]);
75826       var entity = singular();
75827       if (_newFeature && entity && entity.type === "relation" && Object.keys(entity.tags).length === 0 && context.graph().parentRelations(entity).length === 0 && (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
75828         var deleteAction = actionDeleteRelation(entity.id, true);
75829         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
75830         context.validator().validate();
75831       }
75832     };
75833     return mode;
75834   }
75835
75836   // modules/behavior/lasso.js
75837   function behaviorLasso(context) {
75838     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
75839     var behavior = function(selection2) {
75840       var lasso;
75841       function pointerdown(d3_event) {
75842         var button = 0;
75843         if (d3_event.button === button && d3_event.shiftKey === true) {
75844           lasso = null;
75845           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
75846           d3_event.stopPropagation();
75847         }
75848       }
75849       function pointermove() {
75850         if (!lasso) {
75851           lasso = uiLasso(context);
75852           context.surface().call(lasso);
75853         }
75854         lasso.p(context.map().mouse());
75855       }
75856       function normalize2(a, b) {
75857         return [
75858           [Math.min(a[0], b[0]), Math.min(a[1], b[1])],
75859           [Math.max(a[0], b[0]), Math.max(a[1], b[1])]
75860         ];
75861       }
75862       function lassoed() {
75863         if (!lasso)
75864           return [];
75865         var graph = context.graph();
75866         var limitToNodes;
75867         if (context.map().editableDataEnabled(true) && context.map().isInWideSelection()) {
75868           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
75869         } else if (!context.map().editableDataEnabled()) {
75870           return [];
75871         }
75872         var bounds = lasso.extent().map(context.projection.invert);
75873         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
75874         var intersects = context.history().intersects(extent).filter(function(entity) {
75875           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
75876         });
75877         intersects.sort(function(node1, node2) {
75878           var parents1 = graph.parentWays(node1);
75879           var parents2 = graph.parentWays(node2);
75880           if (parents1.length && parents2.length) {
75881             var sharedParents = utilArrayIntersection(parents1, parents2);
75882             if (sharedParents.length) {
75883               var sharedParentNodes = sharedParents[0].nodes;
75884               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
75885             } else {
75886               return parseFloat(parents1[0].id.slice(1)) - parseFloat(parents2[0].id.slice(1));
75887             }
75888           } else if (parents1.length || parents2.length) {
75889             return parents1.length - parents2.length;
75890           }
75891           return node1.loc[0] - node2.loc[0];
75892         });
75893         return intersects.map(function(entity) {
75894           return entity.id;
75895         });
75896       }
75897       function pointerup() {
75898         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
75899         if (!lasso)
75900           return;
75901         var ids = lassoed();
75902         lasso.close();
75903         if (ids.length) {
75904           context.enter(modeSelect(context, ids));
75905         }
75906       }
75907       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
75908     };
75909     behavior.off = function(selection2) {
75910       selection2.on(_pointerPrefix + "down.lasso", null);
75911     };
75912     return behavior;
75913   }
75914
75915   // modules/modes/browse.js
75916   function modeBrowse(context) {
75917     var mode = {
75918       button: "browse",
75919       id: "browse",
75920       title: _t.append("modes.browse.title"),
75921       description: _t.append("modes.browse.description")
75922     };
75923     var sidebar;
75924     var _selectBehavior;
75925     var _behaviors = [];
75926     mode.selectBehavior = function(val) {
75927       if (!arguments.length)
75928         return _selectBehavior;
75929       _selectBehavior = val;
75930       return mode;
75931     };
75932     mode.enter = function() {
75933       if (!_behaviors.length) {
75934         if (!_selectBehavior)
75935           _selectBehavior = behaviorSelect(context);
75936         _behaviors = [
75937           behaviorPaste(context),
75938           behaviorHover(context).on("hover", context.ui().sidebar.hover),
75939           _selectBehavior,
75940           behaviorLasso(context),
75941           modeDragNode(context).behavior,
75942           modeDragNote(context).behavior
75943         ];
75944       }
75945       _behaviors.forEach(context.install);
75946       if (document.activeElement && document.activeElement.blur) {
75947         document.activeElement.blur();
75948       }
75949       if (sidebar) {
75950         context.ui().sidebar.show(sidebar);
75951       } else {
75952         context.ui().sidebar.select(null);
75953       }
75954     };
75955     mode.exit = function() {
75956       context.ui().sidebar.hover.cancel();
75957       _behaviors.forEach(context.uninstall);
75958       if (sidebar) {
75959         context.ui().sidebar.hide();
75960       }
75961     };
75962     mode.sidebar = function(_) {
75963       if (!arguments.length)
75964         return sidebar;
75965       sidebar = _;
75966       return mode;
75967     };
75968     mode.operations = function() {
75969       return [operationPaste(context)];
75970     };
75971     return mode;
75972   }
75973
75974   // modules/behavior/add_way.js
75975   function behaviorAddWay(context) {
75976     var dispatch10 = dispatch_default("start", "startFromWay", "startFromNode");
75977     var draw = behaviorDraw(context);
75978     function behavior(surface) {
75979       draw.on("click", function() {
75980         dispatch10.apply("start", this, arguments);
75981       }).on("clickWay", function() {
75982         dispatch10.apply("startFromWay", this, arguments);
75983       }).on("clickNode", function() {
75984         dispatch10.apply("startFromNode", this, arguments);
75985       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
75986       context.map().dblclickZoomEnable(false);
75987       surface.call(draw);
75988     }
75989     behavior.off = function(surface) {
75990       surface.call(draw.off);
75991     };
75992     behavior.cancel = function() {
75993       window.setTimeout(function() {
75994         context.map().dblclickZoomEnable(true);
75995       }, 1e3);
75996       context.enter(modeBrowse(context));
75997     };
75998     return utilRebind(behavior, dispatch10, "on");
75999   }
76000
76001   // modules/behavior/hash.js
76002   function behaviorHash(context) {
76003     var _cachedHash = null;
76004     var _latitudeLimit = 90 - 1e-8;
76005     function computedHashParameters() {
76006       var map2 = context.map();
76007       var center = map2.center();
76008       var zoom = map2.zoom();
76009       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
76010       var oldParams = utilObjectOmit(
76011         utilStringQs(window.location.hash),
76012         ["comment", "source", "hashtags", "walkthrough"]
76013       );
76014       var newParams = {};
76015       delete oldParams.id;
76016       var selected = context.selectedIDs().filter(function(id2) {
76017         return context.hasEntity(id2);
76018       });
76019       if (selected.length) {
76020         newParams.id = selected.join(",");
76021       }
76022       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
76023       return Object.assign(oldParams, newParams);
76024     }
76025     function computedHash() {
76026       return "#" + utilQsString(computedHashParameters(), true);
76027     }
76028     function computedTitle(includeChangeCount) {
76029       var baseTitle = context.documentTitleBase() || "iD";
76030       var contextual;
76031       var changeCount;
76032       var titleID;
76033       var selected = context.selectedIDs().filter(function(id2) {
76034         return context.hasEntity(id2);
76035       });
76036       if (selected.length) {
76037         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
76038         if (selected.length > 1) {
76039           contextual = _t("title.labeled_and_more", {
76040             labeled: firstLabel,
76041             count: selected.length - 1
76042           });
76043         } else {
76044           contextual = firstLabel;
76045         }
76046         titleID = "context";
76047       }
76048       if (includeChangeCount) {
76049         changeCount = context.history().difference().summary().length;
76050         if (changeCount > 0) {
76051           titleID = contextual ? "changes_context" : "changes";
76052         }
76053       }
76054       if (titleID) {
76055         return _t("title.format." + titleID, {
76056           changes: changeCount,
76057           base: baseTitle,
76058           context: contextual
76059         });
76060       }
76061       return baseTitle;
76062     }
76063     function updateTitle(includeChangeCount) {
76064       if (!context.setsDocumentTitle())
76065         return;
76066       var newTitle = computedTitle(includeChangeCount);
76067       if (document.title !== newTitle) {
76068         document.title = newTitle;
76069       }
76070     }
76071     function updateHashIfNeeded() {
76072       if (context.inIntro())
76073         return;
76074       var latestHash = computedHash();
76075       if (_cachedHash !== latestHash) {
76076         _cachedHash = latestHash;
76077         window.history.replaceState(null, computedTitle(false), latestHash);
76078         updateTitle(true);
76079         const q = utilStringQs(latestHash);
76080         if (q.map) {
76081           corePreferences("map-location", q.map);
76082         }
76083       }
76084     }
76085     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
76086     var _throttledUpdateTitle = throttle_default(function() {
76087       updateTitle(true);
76088     }, 500);
76089     function hashchange() {
76090       if (window.location.hash === _cachedHash)
76091         return;
76092       _cachedHash = window.location.hash;
76093       var q = utilStringQs(_cachedHash);
76094       var mapArgs = (q.map || "").split("/").map(Number);
76095       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
76096         updateHashIfNeeded();
76097       } else {
76098         if (_cachedHash === computedHash())
76099           return;
76100         var mode = context.mode();
76101         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
76102         if (q.id && mode) {
76103           var ids = q.id.split(",").filter(function(id2) {
76104             return context.hasEntity(id2);
76105           });
76106           if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
76107             context.enter(modeSelect(context, ids));
76108             return;
76109           }
76110         }
76111         var center = context.map().center();
76112         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
76113         var maxdist = 500;
76114         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
76115           context.enter(modeBrowse(context));
76116           return;
76117         }
76118       }
76119     }
76120     function behavior() {
76121       context.map().on("move.behaviorHash", _throttledUpdate);
76122       context.history().on("change.behaviorHash", _throttledUpdateTitle);
76123       context.on("enter.behaviorHash", _throttledUpdate);
76124       select_default2(window).on("hashchange.behaviorHash", hashchange);
76125       var q = utilStringQs(window.location.hash);
76126       if (q.id) {
76127         context.zoomToEntity(q.id.split(",")[0], !q.map);
76128       }
76129       if (q.walkthrough === "true") {
76130         behavior.startWalkthrough = true;
76131       }
76132       if (q.map) {
76133         behavior.hadLocation = true;
76134       } else if (!q.id && corePreferences("map-location")) {
76135         const mapArgs = corePreferences("map-location").split("/").map(Number);
76136         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
76137         updateHashIfNeeded();
76138         behavior.hadLocation = true;
76139       }
76140       hashchange();
76141       updateTitle(false);
76142     }
76143     behavior.off = function() {
76144       _throttledUpdate.cancel();
76145       _throttledUpdateTitle.cancel();
76146       context.map().on("move.behaviorHash", null);
76147       context.on("enter.behaviorHash", null);
76148       select_default2(window).on("hashchange.behaviorHash", null);
76149       window.location.hash = "";
76150     };
76151     return behavior;
76152   }
76153
76154   // node_modules/d3-brush/src/brush.js
76155   var { abs: abs2, max: max2, min: min2 } = Math;
76156   function number1(e) {
76157     return [+e[0], +e[1]];
76158   }
76159   function number22(e) {
76160     return [number1(e[0]), number1(e[1])];
76161   }
76162   var X = {
76163     name: "x",
76164     handles: ["w", "e"].map(type2),
76165     input: function(x, e) {
76166       return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
76167     },
76168     output: function(xy) {
76169       return xy && [xy[0][0], xy[1][0]];
76170     }
76171   };
76172   var Y = {
76173     name: "y",
76174     handles: ["n", "s"].map(type2),
76175     input: function(y, e) {
76176       return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
76177     },
76178     output: function(xy) {
76179       return xy && [xy[0][1], xy[1][1]];
76180     }
76181   };
76182   var XY = {
76183     name: "xy",
76184     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type2),
76185     input: function(xy) {
76186       return xy == null ? null : number22(xy);
76187     },
76188     output: function(xy) {
76189       return xy;
76190     }
76191   };
76192   function type2(t) {
76193     return { type: t };
76194   }
76195
76196   // modules/index.js
76197   var debug = false;
76198   var d3 = {
76199     dispatch: dispatch_default,
76200     geoMercator: mercator_default,
76201     geoProjection: projection,
76202     polygonArea: area_default3,
76203     polygonCentroid: centroid_default2,
76204     select: select_default2,
76205     selectAll: selectAll_default2,
76206     timerFlush
76207   };
76208
76209   // modules/id.js
76210   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
76211     var start2 = Date.now();
76212     return window.requestAnimationFrame(function() {
76213       cb({
76214         didTimeout: false,
76215         timeRemaining: function() {
76216           return Math.max(0, 50 - (Date.now() - start2));
76217         }
76218       });
76219     });
76220   };
76221   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
76222     window.cancelAnimationFrame(id2);
76223   };
76224   window.iD = modules_exports;
76225 })();
76226 //# sourceMappingURL=iD.js.map