]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Update to iD v2.27.1
[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 __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
9     get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
10   }) : x2)(function(x2) {
11     if (typeof require !== "undefined")
12       return require.apply(this, arguments);
13     throw Error('Dynamic require of "' + x2 + '" is not supported');
14   });
15   var __commonJS = (cb, mod) => function __require2() {
16     return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17   };
18   var __export = (target, all) => {
19     for (var name in all)
20       __defProp(target, name, { get: all[name], enumerable: true });
21   };
22   var __copyProps = (to, from, except, desc) => {
23     if (from && typeof from === "object" || typeof from === "function") {
24       for (let key of __getOwnPropNames(from))
25         if (!__hasOwnProp.call(to, key) && key !== except)
26           __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27     }
28     return to;
29   };
30   var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31     // If the importer is in node compatibility mode or this is not an ESM
32     // file that has been converted to a CommonJS file using a Babel-
33     // compatible transform (i.e. "__esModule" has not been set), then set
34     // "default" to the CommonJS "module.exports" for node compatibility.
35     isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36     mod
37   ));
38
39   // node_modules/diacritics/index.js
40   var require_diacritics = __commonJS({
41     "node_modules/diacritics/index.js"(exports2) {
42       exports2.remove = removeDiacritics2;
43       var replacementList = [
44         {
45           base: " ",
46           chars: "\xA0"
47         },
48         {
49           base: "0",
50           chars: "\u07C0"
51         },
52         {
53           base: "A",
54           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"
55         },
56         {
57           base: "AA",
58           chars: "\uA732"
59         },
60         {
61           base: "AE",
62           chars: "\xC6\u01FC\u01E2"
63         },
64         {
65           base: "AO",
66           chars: "\uA734"
67         },
68         {
69           base: "AU",
70           chars: "\uA736"
71         },
72         {
73           base: "AV",
74           chars: "\uA738\uA73A"
75         },
76         {
77           base: "AY",
78           chars: "\uA73C"
79         },
80         {
81           base: "B",
82           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
83         },
84         {
85           base: "C",
86           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
87         },
88         {
89           base: "D",
90           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
91         },
92         {
93           base: "Dh",
94           chars: "\xD0"
95         },
96         {
97           base: "DZ",
98           chars: "\u01F1\u01C4"
99         },
100         {
101           base: "Dz",
102           chars: "\u01F2\u01C5"
103         },
104         {
105           base: "E",
106           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"
107         },
108         {
109           base: "F",
110           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
111         },
112         {
113           base: "G",
114           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
115         },
116         {
117           base: "H",
118           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
119         },
120         {
121           base: "I",
122           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
123         },
124         {
125           base: "J",
126           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
127         },
128         {
129           base: "K",
130           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
131         },
132         {
133           base: "L",
134           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
135         },
136         {
137           base: "LJ",
138           chars: "\u01C7"
139         },
140         {
141           base: "Lj",
142           chars: "\u01C8"
143         },
144         {
145           base: "M",
146           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
147         },
148         {
149           base: "N",
150           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
151         },
152         {
153           base: "NJ",
154           chars: "\u01CA"
155         },
156         {
157           base: "Nj",
158           chars: "\u01CB"
159         },
160         {
161           base: "O",
162           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"
163         },
164         {
165           base: "OE",
166           chars: "\u0152"
167         },
168         {
169           base: "OI",
170           chars: "\u01A2"
171         },
172         {
173           base: "OO",
174           chars: "\uA74E"
175         },
176         {
177           base: "OU",
178           chars: "\u0222"
179         },
180         {
181           base: "P",
182           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
183         },
184         {
185           base: "Q",
186           chars: "\u24C6\uFF31\uA756\uA758\u024A"
187         },
188         {
189           base: "R",
190           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
191         },
192         {
193           base: "S",
194           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
195         },
196         {
197           base: "T",
198           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
199         },
200         {
201           base: "Th",
202           chars: "\xDE"
203         },
204         {
205           base: "TZ",
206           chars: "\uA728"
207         },
208         {
209           base: "U",
210           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"
211         },
212         {
213           base: "V",
214           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
215         },
216         {
217           base: "VY",
218           chars: "\uA760"
219         },
220         {
221           base: "W",
222           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
223         },
224         {
225           base: "X",
226           chars: "\u24CD\uFF38\u1E8A\u1E8C"
227         },
228         {
229           base: "Y",
230           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
231         },
232         {
233           base: "Z",
234           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
235         },
236         {
237           base: "a",
238           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"
239         },
240         {
241           base: "aa",
242           chars: "\uA733"
243         },
244         {
245           base: "ae",
246           chars: "\xE6\u01FD\u01E3"
247         },
248         {
249           base: "ao",
250           chars: "\uA735"
251         },
252         {
253           base: "au",
254           chars: "\uA737"
255         },
256         {
257           base: "av",
258           chars: "\uA739\uA73B"
259         },
260         {
261           base: "ay",
262           chars: "\uA73D"
263         },
264         {
265           base: "b",
266           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
267         },
268         {
269           base: "c",
270           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
271         },
272         {
273           base: "d",
274           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
275         },
276         {
277           base: "dh",
278           chars: "\xF0"
279         },
280         {
281           base: "dz",
282           chars: "\u01F3\u01C6"
283         },
284         {
285           base: "e",
286           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"
287         },
288         {
289           base: "f",
290           chars: "\u24D5\uFF46\u1E1F\u0192"
291         },
292         {
293           base: "ff",
294           chars: "\uFB00"
295         },
296         {
297           base: "fi",
298           chars: "\uFB01"
299         },
300         {
301           base: "fl",
302           chars: "\uFB02"
303         },
304         {
305           base: "ffi",
306           chars: "\uFB03"
307         },
308         {
309           base: "ffl",
310           chars: "\uFB04"
311         },
312         {
313           base: "g",
314           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
315         },
316         {
317           base: "h",
318           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
319         },
320         {
321           base: "hv",
322           chars: "\u0195"
323         },
324         {
325           base: "i",
326           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
327         },
328         {
329           base: "j",
330           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
331         },
332         {
333           base: "k",
334           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
335         },
336         {
337           base: "l",
338           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
339         },
340         {
341           base: "lj",
342           chars: "\u01C9"
343         },
344         {
345           base: "m",
346           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
347         },
348         {
349           base: "n",
350           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
351         },
352         {
353           base: "nj",
354           chars: "\u01CC"
355         },
356         {
357           base: "o",
358           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"
359         },
360         {
361           base: "oe",
362           chars: "\u0153"
363         },
364         {
365           base: "oi",
366           chars: "\u01A3"
367         },
368         {
369           base: "oo",
370           chars: "\uA74F"
371         },
372         {
373           base: "ou",
374           chars: "\u0223"
375         },
376         {
377           base: "p",
378           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
379         },
380         {
381           base: "q",
382           chars: "\u24E0\uFF51\u024B\uA757\uA759"
383         },
384         {
385           base: "r",
386           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
387         },
388         {
389           base: "s",
390           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
391         },
392         {
393           base: "ss",
394           chars: "\xDF"
395         },
396         {
397           base: "t",
398           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
399         },
400         {
401           base: "th",
402           chars: "\xFE"
403         },
404         {
405           base: "tz",
406           chars: "\uA729"
407         },
408         {
409           base: "u",
410           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"
411         },
412         {
413           base: "v",
414           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
415         },
416         {
417           base: "vy",
418           chars: "\uA761"
419         },
420         {
421           base: "w",
422           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
423         },
424         {
425           base: "x",
426           chars: "\u24E7\uFF58\u1E8B\u1E8D"
427         },
428         {
429           base: "y",
430           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
431         },
432         {
433           base: "z",
434           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
435         }
436       ];
437       var diacriticsMap = {};
438       for (i3 = 0; i3 < replacementList.length; i3 += 1) {
439         chars = replacementList[i3].chars;
440         for (j3 = 0; j3 < chars.length; j3 += 1) {
441           diacriticsMap[chars[j3]] = replacementList[i3].base;
442         }
443       }
444       var chars;
445       var j3;
446       var i3;
447       function removeDiacritics2(str2) {
448         return str2.replace(/[^\u0000-\u007e]/g, function(c2) {
449           return diacriticsMap[c2] || c2;
450         });
451       }
452       exports2.replacementList = replacementList;
453       exports2.diacriticsMap = diacriticsMap;
454     }
455   });
456
457   // node_modules/alif-toolkit/lib/isArabic.js
458   var require_isArabic = __commonJS({
459     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
460       "use strict";
461       Object.defineProperty(exports2, "__esModule", { value: true });
462       var arabicBlocks = [
463         [1536, 1791],
464         [1872, 1919],
465         [2208, 2303],
466         [64336, 65023],
467         [65136, 65279],
468         [69216, 69247],
469         [126064, 126143],
470         [126464, 126719]
471         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
472       ];
473       function isArabic(char) {
474         if (char.length > 1) {
475           throw new Error("isArabic works on only one-character strings");
476         }
477         let code = char.charCodeAt(0);
478         for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
479           let block2 = arabicBlocks[i3];
480           if (code >= block2[0] && code <= block2[1]) {
481             return true;
482           }
483         }
484         return false;
485       }
486       exports2.isArabic = isArabic;
487       function isMath(char) {
488         if (char.length > 2) {
489           throw new Error("isMath works on only one-character strings");
490         }
491         let code = char.charCodeAt(0);
492         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
493       }
494       exports2.isMath = isMath;
495     }
496   });
497
498   // node_modules/alif-toolkit/lib/unicode-arabic.js
499   var require_unicode_arabic = __commonJS({
500     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
501       "use strict";
502       Object.defineProperty(exports2, "__esModule", { value: true });
503       var arabicReference = {
504         "alef": {
505           "normal": [
506             "\u0627"
507           ],
508           "madda_above": {
509             "normal": [
510               "\u0627\u0653",
511               "\u0622"
512             ],
513             "isolated": "\uFE81",
514             "final": "\uFE82"
515           },
516           "hamza_above": {
517             "normal": [
518               "\u0627\u0654",
519               "\u0623"
520             ],
521             "isolated": "\uFE83",
522             "final": "\uFE84"
523           },
524           "hamza_below": {
525             "normal": [
526               "\u0627\u0655",
527               "\u0625"
528             ],
529             "isolated": "\uFE87",
530             "final": "\uFE88"
531           },
532           "wasla": {
533             "normal": "\u0671",
534             "isolated": "\uFB50",
535             "final": "\uFB51"
536           },
537           "wavy_hamza_above": [
538             "\u0672"
539           ],
540           "wavy_hamza_below": [
541             "\u0627\u065F",
542             "\u0673"
543           ],
544           "high_hamza": [
545             "\u0675",
546             "\u0627\u0674"
547           ],
548           "indic_two_above": [
549             "\u0773"
550           ],
551           "indic_three_above": [
552             "\u0774"
553           ],
554           "fathatan": {
555             "normal": [
556               "\u0627\u064B"
557             ],
558             "final": "\uFD3C",
559             "isolated": "\uFD3D"
560           },
561           "isolated": "\uFE8D",
562           "final": "\uFE8E"
563         },
564         "beh": {
565           "normal": [
566             "\u0628"
567           ],
568           "dotless": [
569             "\u066E"
570           ],
571           "three_dots_horizontally_below": [
572             "\u0750"
573           ],
574           "dot_below_three_dots_above": [
575             "\u0751"
576           ],
577           "three_dots_pointing_upwards_below": [
578             "\u0752"
579           ],
580           "three_dots_pointing_upwards_below_two_dots_above": [
581             "\u0753"
582           ],
583           "two_dots_below_dot_above": [
584             "\u0754"
585           ],
586           "inverted_small_v_below": [
587             "\u0755"
588           ],
589           "small_v": [
590             "\u0756"
591           ],
592           "small_v_below": [
593             "\u08A0"
594           ],
595           "hamza_above": [
596             "\u08A1"
597           ],
598           "small_meem_above": [
599             "\u08B6"
600           ],
601           "isolated": "\uFE8F",
602           "final": "\uFE90",
603           "initial": "\uFE91",
604           "medial": "\uFE92"
605         },
606         "teh marbuta": {
607           "normal": [
608             "\u0629"
609           ],
610           "isolated": "\uFE93",
611           "final": "\uFE94"
612         },
613         "teh": {
614           "normal": [
615             "\u062A"
616           ],
617           "ring": [
618             "\u067C"
619           ],
620           "three_dots_above_downwards": [
621             "\u067D"
622           ],
623           "small_teh_above": [
624             "\u08B8"
625           ],
626           "isolated": "\uFE95",
627           "final": "\uFE96",
628           "initial": "\uFE97",
629           "medial": "\uFE98"
630         },
631         "theh": {
632           "normal": [
633             "\u062B"
634           ],
635           "isolated": "\uFE99",
636           "final": "\uFE9A",
637           "initial": "\uFE9B",
638           "medial": "\uFE9C"
639         },
640         "jeem": {
641           "normal": [
642             "\u062C"
643           ],
644           "two_dots_above": [
645             "\u08A2"
646           ],
647           "isolated": "\uFE9D",
648           "final": "\uFE9E",
649           "initial": "\uFE9F",
650           "medial": "\uFEA0"
651         },
652         "hah": {
653           "normal": [
654             "\u062D"
655           ],
656           "hamza_above": [
657             "\u0681"
658           ],
659           "two_dots_vertical_above": [
660             "\u0682"
661           ],
662           "three_dots_above": [
663             "\u0685"
664           ],
665           "two_dots_above": [
666             "\u0757"
667           ],
668           "three_dots_pointing_upwards_below": [
669             "\u0758"
670           ],
671           "small_tah_below": [
672             "\u076E"
673           ],
674           "small_tah_two_dots": [
675             "\u076F"
676           ],
677           "small_tah_above": [
678             "\u0772"
679           ],
680           "indic_four_below": [
681             "\u077C"
682           ],
683           "isolated": "\uFEA1",
684           "final": "\uFEA2",
685           "initial": "\uFEA3",
686           "medial": "\uFEA4"
687         },
688         "khah": {
689           "normal": [
690             "\u062E"
691           ],
692           "isolated": "\uFEA5",
693           "final": "\uFEA6",
694           "initial": "\uFEA7",
695           "medial": "\uFEA8"
696         },
697         "dal": {
698           "normal": [
699             "\u062F"
700           ],
701           "ring": [
702             "\u0689"
703           ],
704           "dot_below": [
705             "\u068A"
706           ],
707           "dot_below_small_tah": [
708             "\u068B"
709           ],
710           "three_dots_above_downwards": [
711             "\u068F"
712           ],
713           "four_dots_above": [
714             "\u0690"
715           ],
716           "inverted_v": [
717             "\u06EE"
718           ],
719           "two_dots_vertically_below_small_tah": [
720             "\u0759"
721           ],
722           "inverted_small_v_below": [
723             "\u075A"
724           ],
725           "three_dots_below": [
726             "\u08AE"
727           ],
728           "isolated": "\uFEA9",
729           "final": "\uFEAA"
730         },
731         "thal": {
732           "normal": [
733             "\u0630"
734           ],
735           "isolated": "\uFEAB",
736           "final": "\uFEAC"
737         },
738         "reh": {
739           "normal": [
740             "\u0631"
741           ],
742           "small_v": [
743             "\u0692"
744           ],
745           "ring": [
746             "\u0693"
747           ],
748           "dot_below": [
749             "\u0694"
750           ],
751           "small_v_below": [
752             "\u0695"
753           ],
754           "dot_below_dot_above": [
755             "\u0696"
756           ],
757           "two_dots_above": [
758             "\u0697"
759           ],
760           "four_dots_above": [
761             "\u0699"
762           ],
763           "inverted_v": [
764             "\u06EF"
765           ],
766           "stroke": [
767             "\u075B"
768           ],
769           "two_dots_vertically_above": [
770             "\u076B"
771           ],
772           "hamza_above": [
773             "\u076C"
774           ],
775           "small_tah_two_dots": [
776             "\u0771"
777           ],
778           "loop": [
779             "\u08AA"
780           ],
781           "small_noon_above": [
782             "\u08B9"
783           ],
784           "isolated": "\uFEAD",
785           "final": "\uFEAE"
786         },
787         "zain": {
788           "normal": [
789             "\u0632"
790           ],
791           "inverted_v_above": [
792             "\u08B2"
793           ],
794           "isolated": "\uFEAF",
795           "final": "\uFEB0"
796         },
797         "seen": {
798           "normal": [
799             "\u0633"
800           ],
801           "dot_below_dot_above": [
802             "\u069A"
803           ],
804           "three_dots_below": [
805             "\u069B"
806           ],
807           "three_dots_below_three_dots_above": [
808             "\u069C"
809           ],
810           "four_dots_above": [
811             "\u075C"
812           ],
813           "two_dots_vertically_above": [
814             "\u076D"
815           ],
816           "small_tah_two_dots": [
817             "\u0770"
818           ],
819           "indic_four_above": [
820             "\u077D"
821           ],
822           "inverted_v": [
823             "\u077E"
824           ],
825           "isolated": "\uFEB1",
826           "final": "\uFEB2",
827           "initial": "\uFEB3",
828           "medial": "\uFEB4"
829         },
830         "sheen": {
831           "normal": [
832             "\u0634"
833           ],
834           "dot_below": [
835             "\u06FA"
836           ],
837           "isolated": "\uFEB5",
838           "final": "\uFEB6",
839           "initial": "\uFEB7",
840           "medial": "\uFEB8"
841         },
842         "sad": {
843           "normal": [
844             "\u0635"
845           ],
846           "two_dots_below": [
847             "\u069D"
848           ],
849           "three_dots_above": [
850             "\u069E"
851           ],
852           "three_dots_below": [
853             "\u08AF"
854           ],
855           "isolated": "\uFEB9",
856           "final": "\uFEBA",
857           "initial": "\uFEBB",
858           "medial": "\uFEBC"
859         },
860         "dad": {
861           "normal": [
862             "\u0636"
863           ],
864           "dot_below": [
865             "\u06FB"
866           ],
867           "isolated": "\uFEBD",
868           "final": "\uFEBE",
869           "initial": "\uFEBF",
870           "medial": "\uFEC0"
871         },
872         "tah": {
873           "normal": [
874             "\u0637"
875           ],
876           "three_dots_above": [
877             "\u069F"
878           ],
879           "two_dots_above": [
880             "\u08A3"
881           ],
882           "isolated": "\uFEC1",
883           "final": "\uFEC2",
884           "initial": "\uFEC3",
885           "medial": "\uFEC4"
886         },
887         "zah": {
888           "normal": [
889             "\u0638"
890           ],
891           "isolated": "\uFEC5",
892           "final": "\uFEC6",
893           "initial": "\uFEC7",
894           "medial": "\uFEC8"
895         },
896         "ain": {
897           "normal": [
898             "\u0639"
899           ],
900           "three_dots_above": [
901             "\u06A0"
902           ],
903           "two_dots_above": [
904             "\u075D"
905           ],
906           "three_dots_pointing_downwards_above": [
907             "\u075E"
908           ],
909           "two_dots_vertically_above": [
910             "\u075F"
911           ],
912           "three_dots_below": [
913             "\u08B3"
914           ],
915           "isolated": "\uFEC9",
916           "final": "\uFECA",
917           "initial": "\uFECB",
918           "medial": "\uFECC"
919         },
920         "ghain": {
921           "normal": [
922             "\u063A"
923           ],
924           "dot_below": [
925             "\u06FC"
926           ],
927           "isolated": "\uFECD",
928           "final": "\uFECE",
929           "initial": "\uFECF",
930           "medial": "\uFED0"
931         },
932         "feh": {
933           "normal": [
934             "\u0641"
935           ],
936           "dotless": [
937             "\u06A1"
938           ],
939           "dot_moved_below": [
940             "\u06A2"
941           ],
942           "dot_below": [
943             "\u06A3"
944           ],
945           "three_dots_below": [
946             "\u06A5"
947           ],
948           "two_dots_below": [
949             "\u0760"
950           ],
951           "three_dots_pointing_upwards_below": [
952             "\u0761"
953           ],
954           "dot_below_three_dots_above": [
955             "\u08A4"
956           ],
957           "isolated": "\uFED1",
958           "final": "\uFED2",
959           "initial": "\uFED3",
960           "medial": "\uFED4"
961         },
962         "qaf": {
963           "normal": [
964             "\u0642"
965           ],
966           "dotless": [
967             "\u066F"
968           ],
969           "dot_above": [
970             "\u06A7"
971           ],
972           "three_dots_above": [
973             "\u06A8"
974           ],
975           "dot_below": [
976             "\u08A5"
977           ],
978           "isolated": "\uFED5",
979           "final": "\uFED6",
980           "initial": "\uFED7",
981           "medial": "\uFED8"
982         },
983         "kaf": {
984           "normal": [
985             "\u0643"
986           ],
987           "swash": [
988             "\u06AA"
989           ],
990           "ring": [
991             "\u06AB"
992           ],
993           "dot_above": [
994             "\u06AC"
995           ],
996           "three_dots_below": [
997             "\u06AE"
998           ],
999           "two_dots_above": [
1000             "\u077F"
1001           ],
1002           "dot_below": [
1003             "\u08B4"
1004           ],
1005           "isolated": "\uFED9",
1006           "final": "\uFEDA",
1007           "initial": "\uFEDB",
1008           "medial": "\uFEDC"
1009         },
1010         "lam": {
1011           "normal": [
1012             "\u0644"
1013           ],
1014           "small_v": [
1015             "\u06B5"
1016           ],
1017           "dot_above": [
1018             "\u06B6"
1019           ],
1020           "three_dots_above": [
1021             "\u06B7"
1022           ],
1023           "three_dots_below": [
1024             "\u06B8"
1025           ],
1026           "bar": [
1027             "\u076A"
1028           ],
1029           "double_bar": [
1030             "\u08A6"
1031           ],
1032           "isolated": "\uFEDD",
1033           "final": "\uFEDE",
1034           "initial": "\uFEDF",
1035           "medial": "\uFEE0"
1036         },
1037         "meem": {
1038           "normal": [
1039             "\u0645"
1040           ],
1041           "dot_above": [
1042             "\u0765"
1043           ],
1044           "dot_below": [
1045             "\u0766"
1046           ],
1047           "three_dots_above": [
1048             "\u08A7"
1049           ],
1050           "isolated": "\uFEE1",
1051           "final": "\uFEE2",
1052           "initial": "\uFEE3",
1053           "medial": "\uFEE4"
1054         },
1055         "noon": {
1056           "normal": [
1057             "\u0646"
1058           ],
1059           "dot_below": [
1060             "\u06B9"
1061           ],
1062           "ring": [
1063             "\u06BC"
1064           ],
1065           "three_dots_above": [
1066             "\u06BD"
1067           ],
1068           "two_dots_below": [
1069             "\u0767"
1070           ],
1071           "small_tah": [
1072             "\u0768"
1073           ],
1074           "small_v": [
1075             "\u0769"
1076           ],
1077           "isolated": "\uFEE5",
1078           "final": "\uFEE6",
1079           "initial": "\uFEE7",
1080           "medial": "\uFEE8"
1081         },
1082         "heh": {
1083           "normal": [
1084             "\u0647"
1085           ],
1086           "isolated": "\uFEE9",
1087           "final": "\uFEEA",
1088           "initial": "\uFEEB",
1089           "medial": "\uFEEC"
1090         },
1091         "waw": {
1092           "normal": [
1093             "\u0648"
1094           ],
1095           "hamza_above": {
1096             "normal": [
1097               "\u0624",
1098               "\u0648\u0654"
1099             ],
1100             "isolated": "\uFE85",
1101             "final": "\uFE86"
1102           },
1103           "high_hamza": [
1104             "\u0676",
1105             "\u0648\u0674"
1106           ],
1107           "ring": [
1108             "\u06C4"
1109           ],
1110           "two_dots_above": [
1111             "\u06CA"
1112           ],
1113           "dot_above": [
1114             "\u06CF"
1115           ],
1116           "indic_two_above": [
1117             "\u0778"
1118           ],
1119           "indic_three_above": [
1120             "\u0779"
1121           ],
1122           "dot_within": [
1123             "\u08AB"
1124           ],
1125           "isolated": "\uFEED",
1126           "final": "\uFEEE"
1127         },
1128         "alef_maksura": {
1129           "normal": [
1130             "\u0649"
1131           ],
1132           "hamza_above": [
1133             "\u0626",
1134             "\u064A\u0654"
1135           ],
1136           "initial": "\uFBE8",
1137           "medial": "\uFBE9",
1138           "isolated": "\uFEEF",
1139           "final": "\uFEF0"
1140         },
1141         "yeh": {
1142           "normal": [
1143             "\u064A"
1144           ],
1145           "hamza_above": {
1146             "normal": [
1147               "\u0626",
1148               "\u0649\u0654"
1149             ],
1150             "isolated": "\uFE89",
1151             "final": "\uFE8A",
1152             "initial": "\uFE8B",
1153             "medial": "\uFE8C"
1154           },
1155           "two_dots_below_hamza_above": [
1156             "\u08A8"
1157           ],
1158           "high_hamza": [
1159             "\u0678",
1160             "\u064A\u0674"
1161           ],
1162           "tail": [
1163             "\u06CD"
1164           ],
1165           "small_v": [
1166             "\u06CE"
1167           ],
1168           "three_dots_below": [
1169             "\u06D1"
1170           ],
1171           "two_dots_below_dot_above": [
1172             "\u08A9"
1173           ],
1174           "two_dots_below_small_noon_above": [
1175             "\u08BA"
1176           ],
1177           "isolated": "\uFEF1",
1178           "final": "\uFEF2",
1179           "initial": "\uFEF3",
1180           "medial": "\uFEF4"
1181         },
1182         "tteh": {
1183           "normal": [
1184             "\u0679"
1185           ],
1186           "isolated": "\uFB66",
1187           "final": "\uFB67",
1188           "initial": "\uFB68",
1189           "medial": "\uFB69"
1190         },
1191         "tteheh": {
1192           "normal": [
1193             "\u067A"
1194           ],
1195           "isolated": "\uFB5E",
1196           "final": "\uFB5F",
1197           "initial": "\uFB60",
1198           "medial": "\uFB61"
1199         },
1200         "beeh": {
1201           "normal": [
1202             "\u067B"
1203           ],
1204           "isolated": "\uFB52",
1205           "final": "\uFB53",
1206           "initial": "\uFB54",
1207           "medial": "\uFB55"
1208         },
1209         "peh": {
1210           "normal": [
1211             "\u067E"
1212           ],
1213           "small_meem_above": [
1214             "\u08B7"
1215           ],
1216           "isolated": "\uFB56",
1217           "final": "\uFB57",
1218           "initial": "\uFB58",
1219           "medial": "\uFB59"
1220         },
1221         "teheh": {
1222           "normal": [
1223             "\u067F"
1224           ],
1225           "isolated": "\uFB62",
1226           "final": "\uFB63",
1227           "initial": "\uFB64",
1228           "medial": "\uFB65"
1229         },
1230         "beheh": {
1231           "normal": [
1232             "\u0680"
1233           ],
1234           "isolated": "\uFB5A",
1235           "final": "\uFB5B",
1236           "initial": "\uFB5C",
1237           "medial": "\uFB5D"
1238         },
1239         "nyeh": {
1240           "normal": [
1241             "\u0683"
1242           ],
1243           "isolated": "\uFB76",
1244           "final": "\uFB77",
1245           "initial": "\uFB78",
1246           "medial": "\uFB79"
1247         },
1248         "dyeh": {
1249           "normal": [
1250             "\u0684"
1251           ],
1252           "isolated": "\uFB72",
1253           "final": "\uFB73",
1254           "initial": "\uFB74",
1255           "medial": "\uFB75"
1256         },
1257         "tcheh": {
1258           "normal": [
1259             "\u0686"
1260           ],
1261           "dot_above": [
1262             "\u06BF"
1263           ],
1264           "isolated": "\uFB7A",
1265           "final": "\uFB7B",
1266           "initial": "\uFB7C",
1267           "medial": "\uFB7D"
1268         },
1269         "tcheheh": {
1270           "normal": [
1271             "\u0687"
1272           ],
1273           "isolated": "\uFB7E",
1274           "final": "\uFB7F",
1275           "initial": "\uFB80",
1276           "medial": "\uFB81"
1277         },
1278         "ddal": {
1279           "normal": [
1280             "\u0688"
1281           ],
1282           "isolated": "\uFB88",
1283           "final": "\uFB89"
1284         },
1285         "dahal": {
1286           "normal": [
1287             "\u068C"
1288           ],
1289           "isolated": "\uFB84",
1290           "final": "\uFB85"
1291         },
1292         "ddahal": {
1293           "normal": [
1294             "\u068D"
1295           ],
1296           "isolated": "\uFB82",
1297           "final": "\uFB83"
1298         },
1299         "dul": {
1300           "normal": [
1301             "\u068F",
1302             "\u068E"
1303           ],
1304           "isolated": "\uFB86",
1305           "final": "\uFB87"
1306         },
1307         "rreh": {
1308           "normal": [
1309             "\u0691"
1310           ],
1311           "isolated": "\uFB8C",
1312           "final": "\uFB8D"
1313         },
1314         "jeh": {
1315           "normal": [
1316             "\u0698"
1317           ],
1318           "isolated": "\uFB8A",
1319           "final": "\uFB8B"
1320         },
1321         "veh": {
1322           "normal": [
1323             "\u06A4"
1324           ],
1325           "isolated": "\uFB6A",
1326           "final": "\uFB6B",
1327           "initial": "\uFB6C",
1328           "medial": "\uFB6D"
1329         },
1330         "peheh": {
1331           "normal": [
1332             "\u06A6"
1333           ],
1334           "isolated": "\uFB6E",
1335           "final": "\uFB6F",
1336           "initial": "\uFB70",
1337           "medial": "\uFB71"
1338         },
1339         "keheh": {
1340           "normal": [
1341             "\u06A9"
1342           ],
1343           "dot_above": [
1344             "\u0762"
1345           ],
1346           "three_dots_above": [
1347             "\u0763"
1348           ],
1349           "three_dots_pointing_upwards_below": [
1350             "\u0764"
1351           ],
1352           "isolated": "\uFB8E",
1353           "final": "\uFB8F",
1354           "initial": "\uFB90",
1355           "medial": "\uFB91"
1356         },
1357         "ng": {
1358           "normal": [
1359             "\u06AD"
1360           ],
1361           "isolated": "\uFBD3",
1362           "final": "\uFBD4",
1363           "initial": "\uFBD5",
1364           "medial": "\uFBD6"
1365         },
1366         "gaf": {
1367           "normal": [
1368             "\u06AF"
1369           ],
1370           "ring": [
1371             "\u06B0"
1372           ],
1373           "two_dots_below": [
1374             "\u06B2"
1375           ],
1376           "three_dots_above": [
1377             "\u06B4"
1378           ],
1379           "inverted_stroke": [
1380             "\u08B0"
1381           ],
1382           "isolated": "\uFB92",
1383           "final": "\uFB93",
1384           "initial": "\uFB94",
1385           "medial": "\uFB95"
1386         },
1387         "ngoeh": {
1388           "normal": [
1389             "\u06B1"
1390           ],
1391           "isolated": "\uFB9A",
1392           "final": "\uFB9B",
1393           "initial": "\uFB9C",
1394           "medial": "\uFB9D"
1395         },
1396         "gueh": {
1397           "normal": [
1398             "\u06B3"
1399           ],
1400           "isolated": "\uFB96",
1401           "final": "\uFB97",
1402           "initial": "\uFB98",
1403           "medial": "\uFB99"
1404         },
1405         "noon ghunna": {
1406           "normal": [
1407             "\u06BA"
1408           ],
1409           "isolated": "\uFB9E",
1410           "final": "\uFB9F"
1411         },
1412         "rnoon": {
1413           "normal": [
1414             "\u06BB"
1415           ],
1416           "isolated": "\uFBA0",
1417           "final": "\uFBA1",
1418           "initial": "\uFBA2",
1419           "medial": "\uFBA3"
1420         },
1421         "heh doachashmee": {
1422           "normal": [
1423             "\u06BE"
1424           ],
1425           "isolated": "\uFBAA",
1426           "final": "\uFBAB",
1427           "initial": "\uFBAC",
1428           "medial": "\uFBAD"
1429         },
1430         "heh goal": {
1431           "normal": [
1432             "\u06C1"
1433           ],
1434           "hamza_above": [
1435             "\u06C1\u0654",
1436             "\u06C2"
1437           ],
1438           "isolated": "\uFBA6",
1439           "final": "\uFBA7",
1440           "initial": "\uFBA8",
1441           "medial": "\uFBA9"
1442         },
1443         "teh marbuta goal": {
1444           "normal": [
1445             "\u06C3"
1446           ]
1447         },
1448         "kirghiz oe": {
1449           "normal": [
1450             "\u06C5"
1451           ],
1452           "isolated": "\uFBE0",
1453           "final": "\uFBE1"
1454         },
1455         "oe": {
1456           "normal": [
1457             "\u06C6"
1458           ],
1459           "isolated": "\uFBD9",
1460           "final": "\uFBDA"
1461         },
1462         "u": {
1463           "normal": [
1464             "\u06C7"
1465           ],
1466           "hamza_above": {
1467             "normal": [
1468               "\u0677",
1469               "\u06C7\u0674"
1470             ],
1471             "isolated": "\uFBDD"
1472           },
1473           "isolated": "\uFBD7",
1474           "final": "\uFBD8"
1475         },
1476         "yu": {
1477           "normal": [
1478             "\u06C8"
1479           ],
1480           "isolated": "\uFBDB",
1481           "final": "\uFBDC"
1482         },
1483         "kirghiz yu": {
1484           "normal": [
1485             "\u06C9"
1486           ],
1487           "isolated": "\uFBE2",
1488           "final": "\uFBE3"
1489         },
1490         "ve": {
1491           "normal": [
1492             "\u06CB"
1493           ],
1494           "isolated": "\uFBDE",
1495           "final": "\uFBDF"
1496         },
1497         "farsi yeh": {
1498           "normal": [
1499             "\u06CC"
1500           ],
1501           "indic_two_above": [
1502             "\u0775"
1503           ],
1504           "indic_three_above": [
1505             "\u0776"
1506           ],
1507           "indic_four_above": [
1508             "\u0777"
1509           ],
1510           "isolated": "\uFBFC",
1511           "final": "\uFBFD",
1512           "initial": "\uFBFE",
1513           "medial": "\uFBFF"
1514         },
1515         "e": {
1516           "normal": [
1517             "\u06D0"
1518           ],
1519           "isolated": "\uFBE4",
1520           "final": "\uFBE5",
1521           "initial": "\uFBE6",
1522           "medial": "\uFBE7"
1523         },
1524         "yeh barree": {
1525           "normal": [
1526             "\u06D2"
1527           ],
1528           "hamza_above": {
1529             "normal": [
1530               "\u06D2\u0654",
1531               "\u06D3"
1532             ],
1533             "isolated": "\uFBB0",
1534             "final": "\uFBB1"
1535           },
1536           "indic_two_above": [
1537             "\u077A"
1538           ],
1539           "indic_three_above": [
1540             "\u077B"
1541           ],
1542           "isolated": "\uFBAE",
1543           "final": "\uFBAF"
1544         },
1545         "ae": {
1546           "normal": [
1547             "\u06D5"
1548           ],
1549           "isolated": "\u06D5",
1550           "final": "\uFEEA",
1551           "yeh_above": {
1552             "normal": [
1553               "\u06C0",
1554               "\u06D5\u0654"
1555             ],
1556             "isolated": "\uFBA4",
1557             "final": "\uFBA5"
1558           }
1559         },
1560         "rohingya yeh": {
1561           "normal": [
1562             "\u08AC"
1563           ]
1564         },
1565         "low alef": {
1566           "normal": [
1567             "\u08AD"
1568           ]
1569         },
1570         "straight waw": {
1571           "normal": [
1572             "\u08B1"
1573           ]
1574         },
1575         "african feh": {
1576           "normal": [
1577             "\u08BB"
1578           ]
1579         },
1580         "african qaf": {
1581           "normal": [
1582             "\u08BC"
1583           ]
1584         },
1585         "african noon": {
1586           "normal": [
1587             "\u08BD"
1588           ]
1589         }
1590       };
1591       exports2.default = arabicReference;
1592     }
1593   });
1594
1595   // node_modules/alif-toolkit/lib/unicode-ligatures.js
1596   var require_unicode_ligatures = __commonJS({
1597     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1598       "use strict";
1599       Object.defineProperty(exports2, "__esModule", { value: true });
1600       var ligatureReference = {
1601         "\u0626\u0627": {
1602           "isolated": "\uFBEA",
1603           "final": "\uFBEB"
1604         },
1605         "\u0626\u06D5": {
1606           "isolated": "\uFBEC",
1607           "final": "\uFBED"
1608         },
1609         "\u0626\u0648": {
1610           "isolated": "\uFBEE",
1611           "final": "\uFBEF"
1612         },
1613         "\u0626\u06C7": {
1614           "isolated": "\uFBF0",
1615           "final": "\uFBF1"
1616         },
1617         "\u0626\u06C6": {
1618           "isolated": "\uFBF2",
1619           "final": "\uFBF3"
1620         },
1621         "\u0626\u06C8": {
1622           "isolated": "\uFBF4",
1623           "final": "\uFBF5"
1624         },
1625         "\u0626\u06D0": {
1626           "isolated": "\uFBF6",
1627           "final": "\uFBF7",
1628           "initial": "\uFBF8"
1629         },
1630         "\u0626\u0649": {
1631           "uighur_kirghiz": {
1632             "isolated": "\uFBF9",
1633             "final": "\uFBFA",
1634             "initial": "\uFBFB"
1635           },
1636           "isolated": "\uFC03",
1637           "final": "\uFC68"
1638         },
1639         "\u0626\u062C": {
1640           "isolated": "\uFC00",
1641           "initial": "\uFC97"
1642         },
1643         "\u0626\u062D": {
1644           "isolated": "\uFC01",
1645           "initial": "\uFC98"
1646         },
1647         "\u0626\u0645": {
1648           "isolated": "\uFC02",
1649           "final": "\uFC66",
1650           "initial": "\uFC9A",
1651           "medial": "\uFCDF"
1652         },
1653         "\u0626\u064A": {
1654           "isolated": "\uFC04",
1655           "final": "\uFC69"
1656         },
1657         "\u0628\u062C": {
1658           "isolated": "\uFC05",
1659           "initial": "\uFC9C"
1660         },
1661         "\u0628\u062D": {
1662           "isolated": "\uFC06",
1663           "initial": "\uFC9D"
1664         },
1665         "\u0628\u062E": {
1666           "isolated": "\uFC07",
1667           "initial": "\uFC9E"
1668         },
1669         "\u0628\u0645": {
1670           "isolated": "\uFC08",
1671           "final": "\uFC6C",
1672           "initial": "\uFC9F",
1673           "medial": "\uFCE1"
1674         },
1675         "\u0628\u0649": {
1676           "isolated": "\uFC09",
1677           "final": "\uFC6E"
1678         },
1679         "\u0628\u064A": {
1680           "isolated": "\uFC0A",
1681           "final": "\uFC6F"
1682         },
1683         "\u062A\u062C": {
1684           "isolated": "\uFC0B",
1685           "initial": "\uFCA1"
1686         },
1687         "\u062A\u062D": {
1688           "isolated": "\uFC0C",
1689           "initial": "\uFCA2"
1690         },
1691         "\u062A\u062E": {
1692           "isolated": "\uFC0D",
1693           "initial": "\uFCA3"
1694         },
1695         "\u062A\u0645": {
1696           "isolated": "\uFC0E",
1697           "final": "\uFC72",
1698           "initial": "\uFCA4",
1699           "medial": "\uFCE3"
1700         },
1701         "\u062A\u0649": {
1702           "isolated": "\uFC0F",
1703           "final": "\uFC74"
1704         },
1705         "\u062A\u064A": {
1706           "isolated": "\uFC10",
1707           "final": "\uFC75"
1708         },
1709         "\u062B\u062C": {
1710           "isolated": "\uFC11"
1711         },
1712         "\u062B\u0645": {
1713           "isolated": "\uFC12",
1714           "final": "\uFC78",
1715           "initial": "\uFCA6",
1716           "medial": "\uFCE5"
1717         },
1718         "\u062B\u0649": {
1719           "isolated": "\uFC13",
1720           "final": "\uFC7A"
1721         },
1722         "\u062B\u0648": {
1723           "isolated": "\uFC14"
1724         },
1725         "\u062C\u062D": {
1726           "isolated": "\uFC15",
1727           "initial": "\uFCA7"
1728         },
1729         "\u062C\u0645": {
1730           "isolated": "\uFC16",
1731           "initial": "\uFCA8"
1732         },
1733         "\u062D\u062C": {
1734           "isolated": "\uFC17",
1735           "initial": "\uFCA9"
1736         },
1737         "\u062D\u0645": {
1738           "isolated": "\uFC18",
1739           "initial": "\uFCAA"
1740         },
1741         "\u062E\u062C": {
1742           "isolated": "\uFC19",
1743           "initial": "\uFCAB"
1744         },
1745         "\u062E\u062D": {
1746           "isolated": "\uFC1A"
1747         },
1748         "\u062E\u0645": {
1749           "isolated": "\uFC1B",
1750           "initial": "\uFCAC"
1751         },
1752         "\u0633\u062C": {
1753           "isolated": "\uFC1C",
1754           "initial": "\uFCAD",
1755           "medial": "\uFD34"
1756         },
1757         "\u0633\u062D": {
1758           "isolated": "\uFC1D",
1759           "initial": "\uFCAE",
1760           "medial": "\uFD35"
1761         },
1762         "\u0633\u062E": {
1763           "isolated": "\uFC1E",
1764           "initial": "\uFCAF",
1765           "medial": "\uFD36"
1766         },
1767         "\u0633\u0645": {
1768           "isolated": "\uFC1F",
1769           "initial": "\uFCB0",
1770           "medial": "\uFCE7"
1771         },
1772         "\u0635\u062D": {
1773           "isolated": "\uFC20",
1774           "initial": "\uFCB1"
1775         },
1776         "\u0635\u0645": {
1777           "isolated": "\uFC21",
1778           "initial": "\uFCB3"
1779         },
1780         "\u0636\u062C": {
1781           "isolated": "\uFC22",
1782           "initial": "\uFCB4"
1783         },
1784         "\u0636\u062D": {
1785           "isolated": "\uFC23",
1786           "initial": "\uFCB5"
1787         },
1788         "\u0636\u062E": {
1789           "isolated": "\uFC24",
1790           "initial": "\uFCB6"
1791         },
1792         "\u0636\u0645": {
1793           "isolated": "\uFC25",
1794           "initial": "\uFCB7"
1795         },
1796         "\u0637\u062D": {
1797           "isolated": "\uFC26",
1798           "initial": "\uFCB8"
1799         },
1800         "\u0637\u0645": {
1801           "isolated": "\uFC27",
1802           "initial": "\uFD33",
1803           "medial": "\uFD3A"
1804         },
1805         "\u0638\u0645": {
1806           "isolated": "\uFC28",
1807           "initial": "\uFCB9",
1808           "medial": "\uFD3B"
1809         },
1810         "\u0639\u062C": {
1811           "isolated": "\uFC29",
1812           "initial": "\uFCBA"
1813         },
1814         "\u0639\u0645": {
1815           "isolated": "\uFC2A",
1816           "initial": "\uFCBB"
1817         },
1818         "\u063A\u062C": {
1819           "isolated": "\uFC2B",
1820           "initial": "\uFCBC"
1821         },
1822         "\u063A\u0645": {
1823           "isolated": "\uFC2C",
1824           "initial": "\uFCBD"
1825         },
1826         "\u0641\u062C": {
1827           "isolated": "\uFC2D",
1828           "initial": "\uFCBE"
1829         },
1830         "\u0641\u062D": {
1831           "isolated": "\uFC2E",
1832           "initial": "\uFCBF"
1833         },
1834         "\u0641\u062E": {
1835           "isolated": "\uFC2F",
1836           "initial": "\uFCC0"
1837         },
1838         "\u0641\u0645": {
1839           "isolated": "\uFC30",
1840           "initial": "\uFCC1"
1841         },
1842         "\u0641\u0649": {
1843           "isolated": "\uFC31",
1844           "final": "\uFC7C"
1845         },
1846         "\u0641\u064A": {
1847           "isolated": "\uFC32",
1848           "final": "\uFC7D"
1849         },
1850         "\u0642\u062D": {
1851           "isolated": "\uFC33",
1852           "initial": "\uFCC2"
1853         },
1854         "\u0642\u0645": {
1855           "isolated": "\uFC34",
1856           "initial": "\uFCC3"
1857         },
1858         "\u0642\u0649": {
1859           "isolated": "\uFC35",
1860           "final": "\uFC7E"
1861         },
1862         "\u0642\u064A": {
1863           "isolated": "\uFC36",
1864           "final": "\uFC7F"
1865         },
1866         "\u0643\u0627": {
1867           "isolated": "\uFC37",
1868           "final": "\uFC80"
1869         },
1870         "\u0643\u062C": {
1871           "isolated": "\uFC38",
1872           "initial": "\uFCC4"
1873         },
1874         "\u0643\u062D": {
1875           "isolated": "\uFC39",
1876           "initial": "\uFCC5"
1877         },
1878         "\u0643\u062E": {
1879           "isolated": "\uFC3A",
1880           "initial": "\uFCC6"
1881         },
1882         "\u0643\u0644": {
1883           "isolated": "\uFC3B",
1884           "final": "\uFC81",
1885           "initial": "\uFCC7",
1886           "medial": "\uFCEB"
1887         },
1888         "\u0643\u0645": {
1889           "isolated": "\uFC3C",
1890           "final": "\uFC82",
1891           "initial": "\uFCC8",
1892           "medial": "\uFCEC"
1893         },
1894         "\u0643\u0649": {
1895           "isolated": "\uFC3D",
1896           "final": "\uFC83"
1897         },
1898         "\u0643\u064A": {
1899           "isolated": "\uFC3E",
1900           "final": "\uFC84"
1901         },
1902         "\u0644\u062C": {
1903           "isolated": "\uFC3F",
1904           "initial": "\uFCC9"
1905         },
1906         "\u0644\u062D": {
1907           "isolated": "\uFC40",
1908           "initial": "\uFCCA"
1909         },
1910         "\u0644\u062E": {
1911           "isolated": "\uFC41",
1912           "initial": "\uFCCB"
1913         },
1914         "\u0644\u0645": {
1915           "isolated": "\uFC42",
1916           "final": "\uFC85",
1917           "initial": "\uFCCC",
1918           "medial": "\uFCED"
1919         },
1920         "\u0644\u0649": {
1921           "isolated": "\uFC43",
1922           "final": "\uFC86"
1923         },
1924         "\u0644\u064A": {
1925           "isolated": "\uFC44",
1926           "final": "\uFC87"
1927         },
1928         "\u0645\u062C": {
1929           "isolated": "\uFC45",
1930           "initial": "\uFCCE"
1931         },
1932         "\u0645\u062D": {
1933           "isolated": "\uFC46",
1934           "initial": "\uFCCF"
1935         },
1936         "\u0645\u062E": {
1937           "isolated": "\uFC47",
1938           "initial": "\uFCD0"
1939         },
1940         "\u0645\u0645": {
1941           "isolated": "\uFC48",
1942           "final": "\uFC89",
1943           "initial": "\uFCD1"
1944         },
1945         "\u0645\u0649": {
1946           "isolated": "\uFC49"
1947         },
1948         "\u0645\u064A": {
1949           "isolated": "\uFC4A"
1950         },
1951         "\u0646\u062C": {
1952           "isolated": "\uFC4B",
1953           "initial": "\uFCD2"
1954         },
1955         "\u0646\u062D": {
1956           "isolated": "\uFC4C",
1957           "initial": "\uFCD3"
1958         },
1959         "\u0646\u062E": {
1960           "isolated": "\uFC4D",
1961           "initial": "\uFCD4"
1962         },
1963         "\u0646\u0645": {
1964           "isolated": "\uFC4E",
1965           "final": "\uFC8C",
1966           "initial": "\uFCD5",
1967           "medial": "\uFCEE"
1968         },
1969         "\u0646\u0649": {
1970           "isolated": "\uFC4F",
1971           "final": "\uFC8E"
1972         },
1973         "\u0646\u064A": {
1974           "isolated": "\uFC50",
1975           "final": "\uFC8F"
1976         },
1977         "\u0647\u062C": {
1978           "isolated": "\uFC51",
1979           "initial": "\uFCD7"
1980         },
1981         "\u0647\u0645": {
1982           "isolated": "\uFC52",
1983           "initial": "\uFCD8"
1984         },
1985         "\u0647\u0649": {
1986           "isolated": "\uFC53"
1987         },
1988         "\u0647\u064A": {
1989           "isolated": "\uFC54"
1990         },
1991         "\u064A\u062C": {
1992           "isolated": "\uFC55",
1993           "initial": "\uFCDA"
1994         },
1995         "\u064A\u062D": {
1996           "isolated": "\uFC56",
1997           "initial": "\uFCDB"
1998         },
1999         "\u064A\u062E": {
2000           "isolated": "\uFC57",
2001           "initial": "\uFCDC"
2002         },
2003         "\u064A\u0645": {
2004           "isolated": "\uFC58",
2005           "final": "\uFC93",
2006           "initial": "\uFCDD",
2007           "medial": "\uFCF0"
2008         },
2009         "\u064A\u0649": {
2010           "isolated": "\uFC59",
2011           "final": "\uFC95"
2012         },
2013         "\u064A\u064A": {
2014           "isolated": "\uFC5A",
2015           "final": "\uFC96"
2016         },
2017         "\u0630\u0670": {
2018           "isolated": "\uFC5B"
2019         },
2020         "\u0631\u0670": {
2021           "isolated": "\uFC5C"
2022         },
2023         "\u0649\u0670": {
2024           "isolated": "\uFC5D",
2025           "final": "\uFC90"
2026         },
2027         "\u064C\u0651": {
2028           "isolated": "\uFC5E"
2029         },
2030         "\u064D\u0651": {
2031           "isolated": "\uFC5F"
2032         },
2033         "\u064E\u0651": {
2034           "isolated": "\uFC60"
2035         },
2036         "\u064F\u0651": {
2037           "isolated": "\uFC61"
2038         },
2039         "\u0650\u0651": {
2040           "isolated": "\uFC62"
2041         },
2042         "\u0651\u0670": {
2043           "isolated": "\uFC63"
2044         },
2045         "\u0626\u0631": {
2046           "final": "\uFC64"
2047         },
2048         "\u0626\u0632": {
2049           "final": "\uFC65"
2050         },
2051         "\u0626\u0646": {
2052           "final": "\uFC67"
2053         },
2054         "\u0628\u0631": {
2055           "final": "\uFC6A"
2056         },
2057         "\u0628\u0632": {
2058           "final": "\uFC6B"
2059         },
2060         "\u0628\u0646": {
2061           "final": "\uFC6D"
2062         },
2063         "\u062A\u0631": {
2064           "final": "\uFC70"
2065         },
2066         "\u062A\u0632": {
2067           "final": "\uFC71"
2068         },
2069         "\u062A\u0646": {
2070           "final": "\uFC73"
2071         },
2072         "\u062B\u0631": {
2073           "final": "\uFC76"
2074         },
2075         "\u062B\u0632": {
2076           "final": "\uFC77"
2077         },
2078         "\u062B\u0646": {
2079           "final": "\uFC79"
2080         },
2081         "\u062B\u064A": {
2082           "final": "\uFC7B"
2083         },
2084         "\u0645\u0627": {
2085           "final": "\uFC88"
2086         },
2087         "\u0646\u0631": {
2088           "final": "\uFC8A"
2089         },
2090         "\u0646\u0632": {
2091           "final": "\uFC8B"
2092         },
2093         "\u0646\u0646": {
2094           "final": "\uFC8D"
2095         },
2096         "\u064A\u0631": {
2097           "final": "\uFC91"
2098         },
2099         "\u064A\u0632": {
2100           "final": "\uFC92"
2101         },
2102         "\u064A\u0646": {
2103           "final": "\uFC94"
2104         },
2105         "\u0626\u062E": {
2106           "initial": "\uFC99"
2107         },
2108         "\u0626\u0647": {
2109           "initial": "\uFC9B",
2110           "medial": "\uFCE0"
2111         },
2112         "\u0628\u0647": {
2113           "initial": "\uFCA0",
2114           "medial": "\uFCE2"
2115         },
2116         "\u062A\u0647": {
2117           "initial": "\uFCA5",
2118           "medial": "\uFCE4"
2119         },
2120         "\u0635\u062E": {
2121           "initial": "\uFCB2"
2122         },
2123         "\u0644\u0647": {
2124           "initial": "\uFCCD"
2125         },
2126         "\u0646\u0647": {
2127           "initial": "\uFCD6",
2128           "medial": "\uFCEF"
2129         },
2130         "\u0647\u0670": {
2131           "initial": "\uFCD9"
2132         },
2133         "\u064A\u0647": {
2134           "initial": "\uFCDE",
2135           "medial": "\uFCF1"
2136         },
2137         "\u062B\u0647": {
2138           "medial": "\uFCE6"
2139         },
2140         "\u0633\u0647": {
2141           "medial": "\uFCE8",
2142           "initial": "\uFD31"
2143         },
2144         "\u0634\u0645": {
2145           "medial": "\uFCE9",
2146           "isolated": "\uFD0C",
2147           "final": "\uFD28",
2148           "initial": "\uFD30"
2149         },
2150         "\u0634\u0647": {
2151           "medial": "\uFCEA",
2152           "initial": "\uFD32"
2153         },
2154         "\u0640\u064E\u0651": {
2155           "medial": "\uFCF2"
2156         },
2157         "\u0640\u064F\u0651": {
2158           "medial": "\uFCF3"
2159         },
2160         "\u0640\u0650\u0651": {
2161           "medial": "\uFCF4"
2162         },
2163         "\u0637\u0649": {
2164           "isolated": "\uFCF5",
2165           "final": "\uFD11"
2166         },
2167         "\u0637\u064A": {
2168           "isolated": "\uFCF6",
2169           "final": "\uFD12"
2170         },
2171         "\u0639\u0649": {
2172           "isolated": "\uFCF7",
2173           "final": "\uFD13"
2174         },
2175         "\u0639\u064A": {
2176           "isolated": "\uFCF8",
2177           "final": "\uFD14"
2178         },
2179         "\u063A\u0649": {
2180           "isolated": "\uFCF9",
2181           "final": "\uFD15"
2182         },
2183         "\u063A\u064A": {
2184           "isolated": "\uFCFA",
2185           "final": "\uFD16"
2186         },
2187         "\u0633\u0649": {
2188           "isolated": "\uFCFB"
2189         },
2190         "\u0633\u064A": {
2191           "isolated": "\uFCFC",
2192           "final": "\uFD18"
2193         },
2194         "\u0634\u0649": {
2195           "isolated": "\uFCFD",
2196           "final": "\uFD19"
2197         },
2198         "\u0634\u064A": {
2199           "isolated": "\uFCFE",
2200           "final": "\uFD1A"
2201         },
2202         "\u062D\u0649": {
2203           "isolated": "\uFCFF",
2204           "final": "\uFD1B"
2205         },
2206         "\u062D\u064A": {
2207           "isolated": "\uFD00",
2208           "final": "\uFD1C"
2209         },
2210         "\u062C\u0649": {
2211           "isolated": "\uFD01",
2212           "final": "\uFD1D"
2213         },
2214         "\u062C\u064A": {
2215           "isolated": "\uFD02",
2216           "final": "\uFD1E"
2217         },
2218         "\u062E\u0649": {
2219           "isolated": "\uFD03",
2220           "final": "\uFD1F"
2221         },
2222         "\u062E\u064A": {
2223           "isolated": "\uFD04",
2224           "final": "\uFD20"
2225         },
2226         "\u0635\u0649": {
2227           "isolated": "\uFD05",
2228           "final": "\uFD21"
2229         },
2230         "\u0635\u064A": {
2231           "isolated": "\uFD06",
2232           "final": "\uFD22"
2233         },
2234         "\u0636\u0649": {
2235           "isolated": "\uFD07",
2236           "final": "\uFD23"
2237         },
2238         "\u0636\u064A": {
2239           "isolated": "\uFD08",
2240           "final": "\uFD24"
2241         },
2242         "\u0634\u062C": {
2243           "isolated": "\uFD09",
2244           "final": "\uFD25",
2245           "initial": "\uFD2D",
2246           "medial": "\uFD37"
2247         },
2248         "\u0634\u062D": {
2249           "isolated": "\uFD0A",
2250           "final": "\uFD26",
2251           "initial": "\uFD2E",
2252           "medial": "\uFD38"
2253         },
2254         "\u0634\u062E": {
2255           "isolated": "\uFD0B",
2256           "final": "\uFD27",
2257           "initial": "\uFD2F",
2258           "medial": "\uFD39"
2259         },
2260         "\u0634\u0631": {
2261           "isolated": "\uFD0D",
2262           "final": "\uFD29"
2263         },
2264         "\u0633\u0631": {
2265           "isolated": "\uFD0E",
2266           "final": "\uFD2A"
2267         },
2268         "\u0635\u0631": {
2269           "isolated": "\uFD0F",
2270           "final": "\uFD2B"
2271         },
2272         "\u0636\u0631": {
2273           "isolated": "\uFD10",
2274           "final": "\uFD2C"
2275         },
2276         "\u0633\u0639": {
2277           "final": "\uFD17"
2278         },
2279         "\u062A\u062C\u0645": {
2280           "initial": "\uFD50"
2281         },
2282         "\u062A\u062D\u062C": {
2283           "final": "\uFD51",
2284           "initial": "\uFD52"
2285         },
2286         "\u062A\u062D\u0645": {
2287           "initial": "\uFD53"
2288         },
2289         "\u062A\u062E\u0645": {
2290           "initial": "\uFD54"
2291         },
2292         "\u062A\u0645\u062C": {
2293           "initial": "\uFD55"
2294         },
2295         "\u062A\u0645\u062D": {
2296           "initial": "\uFD56"
2297         },
2298         "\u062A\u0645\u062E": {
2299           "initial": "\uFD57"
2300         },
2301         "\u062C\u0645\u062D": {
2302           "final": "\uFD58",
2303           "initial": "\uFD59"
2304         },
2305         "\u062D\u0645\u064A": {
2306           "final": "\uFD5A"
2307         },
2308         "\u062D\u0645\u0649": {
2309           "final": "\uFD5B"
2310         },
2311         "\u0633\u062D\u062C": {
2312           "initial": "\uFD5C"
2313         },
2314         "\u0633\u062C\u062D": {
2315           "initial": "\uFD5D"
2316         },
2317         "\u0633\u062C\u0649": {
2318           "final": "\uFD5E"
2319         },
2320         "\u0633\u0645\u062D": {
2321           "final": "\uFD5F",
2322           "initial": "\uFD60"
2323         },
2324         "\u0633\u0645\u062C": {
2325           "initial": "\uFD61"
2326         },
2327         "\u0633\u0645\u0645": {
2328           "final": "\uFD62",
2329           "initial": "\uFD63"
2330         },
2331         "\u0635\u062D\u062D": {
2332           "final": "\uFD64",
2333           "initial": "\uFD65"
2334         },
2335         "\u0635\u0645\u0645": {
2336           "final": "\uFD66",
2337           "initial": "\uFDC5"
2338         },
2339         "\u0634\u062D\u0645": {
2340           "final": "\uFD67",
2341           "initial": "\uFD68"
2342         },
2343         "\u0634\u062C\u064A": {
2344           "final": "\uFD69"
2345         },
2346         "\u0634\u0645\u062E": {
2347           "final": "\uFD6A",
2348           "initial": "\uFD6B"
2349         },
2350         "\u0634\u0645\u0645": {
2351           "final": "\uFD6C",
2352           "initial": "\uFD6D"
2353         },
2354         "\u0636\u062D\u0649": {
2355           "final": "\uFD6E"
2356         },
2357         "\u0636\u062E\u0645": {
2358           "final": "\uFD6F",
2359           "initial": "\uFD70"
2360         },
2361         "\u0636\u0645\u062D": {
2362           "final": "\uFD71"
2363         },
2364         "\u0637\u0645\u062D": {
2365           "initial": "\uFD72"
2366         },
2367         "\u0637\u0645\u0645": {
2368           "initial": "\uFD73"
2369         },
2370         "\u0637\u0645\u064A": {
2371           "final": "\uFD74"
2372         },
2373         "\u0639\u062C\u0645": {
2374           "final": "\uFD75",
2375           "initial": "\uFDC4"
2376         },
2377         "\u0639\u0645\u0645": {
2378           "final": "\uFD76",
2379           "initial": "\uFD77"
2380         },
2381         "\u0639\u0645\u0649": {
2382           "final": "\uFD78"
2383         },
2384         "\u063A\u0645\u0645": {
2385           "final": "\uFD79"
2386         },
2387         "\u063A\u0645\u064A": {
2388           "final": "\uFD7A"
2389         },
2390         "\u063A\u0645\u0649": {
2391           "final": "\uFD7B"
2392         },
2393         "\u0641\u062E\u0645": {
2394           "final": "\uFD7C",
2395           "initial": "\uFD7D"
2396         },
2397         "\u0642\u0645\u062D": {
2398           "final": "\uFD7E",
2399           "initial": "\uFDB4"
2400         },
2401         "\u0642\u0645\u0645": {
2402           "final": "\uFD7F"
2403         },
2404         "\u0644\u062D\u0645": {
2405           "final": "\uFD80",
2406           "initial": "\uFDB5"
2407         },
2408         "\u0644\u062D\u064A": {
2409           "final": "\uFD81"
2410         },
2411         "\u0644\u062D\u0649": {
2412           "final": "\uFD82"
2413         },
2414         "\u0644\u062C\u062C": {
2415           "initial": "\uFD83",
2416           "final": "\uFD84"
2417         },
2418         "\u0644\u062E\u0645": {
2419           "final": "\uFD85",
2420           "initial": "\uFD86"
2421         },
2422         "\u0644\u0645\u062D": {
2423           "final": "\uFD87",
2424           "initial": "\uFD88"
2425         },
2426         "\u0645\u062D\u062C": {
2427           "initial": "\uFD89"
2428         },
2429         "\u0645\u062D\u0645": {
2430           "initial": "\uFD8A"
2431         },
2432         "\u0645\u062D\u064A": {
2433           "final": "\uFD8B"
2434         },
2435         "\u0645\u062C\u062D": {
2436           "initial": "\uFD8C"
2437         },
2438         "\u0645\u062C\u0645": {
2439           "initial": "\uFD8D"
2440         },
2441         "\u0645\u062E\u062C": {
2442           "initial": "\uFD8E"
2443         },
2444         "\u0645\u062E\u0645": {
2445           "initial": "\uFD8F"
2446         },
2447         "\u0645\u062C\u062E": {
2448           "initial": "\uFD92"
2449         },
2450         "\u0647\u0645\u062C": {
2451           "initial": "\uFD93"
2452         },
2453         "\u0647\u0645\u0645": {
2454           "initial": "\uFD94"
2455         },
2456         "\u0646\u062D\u0645": {
2457           "initial": "\uFD95"
2458         },
2459         "\u0646\u062D\u0649": {
2460           "final": "\uFD96"
2461         },
2462         "\u0646\u062C\u0645": {
2463           "final": "\uFD97",
2464           "initial": "\uFD98"
2465         },
2466         "\u0646\u062C\u0649": {
2467           "final": "\uFD99"
2468         },
2469         "\u0646\u0645\u064A": {
2470           "final": "\uFD9A"
2471         },
2472         "\u0646\u0645\u0649": {
2473           "final": "\uFD9B"
2474         },
2475         "\u064A\u0645\u0645": {
2476           "final": "\uFD9C",
2477           "initial": "\uFD9D"
2478         },
2479         "\u0628\u062E\u064A": {
2480           "final": "\uFD9E"
2481         },
2482         "\u062A\u062C\u064A": {
2483           "final": "\uFD9F"
2484         },
2485         "\u062A\u062C\u0649": {
2486           "final": "\uFDA0"
2487         },
2488         "\u062A\u062E\u064A": {
2489           "final": "\uFDA1"
2490         },
2491         "\u062A\u062E\u0649": {
2492           "final": "\uFDA2"
2493         },
2494         "\u062A\u0645\u064A": {
2495           "final": "\uFDA3"
2496         },
2497         "\u062A\u0645\u0649": {
2498           "final": "\uFDA4"
2499         },
2500         "\u062C\u0645\u064A": {
2501           "final": "\uFDA5"
2502         },
2503         "\u062C\u062D\u0649": {
2504           "final": "\uFDA6"
2505         },
2506         "\u062C\u0645\u0649": {
2507           "final": "\uFDA7"
2508         },
2509         "\u0633\u062E\u0649": {
2510           "final": "\uFDA8"
2511         },
2512         "\u0635\u062D\u064A": {
2513           "final": "\uFDA9"
2514         },
2515         "\u0634\u062D\u064A": {
2516           "final": "\uFDAA"
2517         },
2518         "\u0636\u062D\u064A": {
2519           "final": "\uFDAB"
2520         },
2521         "\u0644\u062C\u064A": {
2522           "final": "\uFDAC"
2523         },
2524         "\u0644\u0645\u064A": {
2525           "final": "\uFDAD"
2526         },
2527         "\u064A\u062D\u064A": {
2528           "final": "\uFDAE"
2529         },
2530         "\u064A\u062C\u064A": {
2531           "final": "\uFDAF"
2532         },
2533         "\u064A\u0645\u064A": {
2534           "final": "\uFDB0"
2535         },
2536         "\u0645\u0645\u064A": {
2537           "final": "\uFDB1"
2538         },
2539         "\u0642\u0645\u064A": {
2540           "final": "\uFDB2"
2541         },
2542         "\u0646\u062D\u064A": {
2543           "final": "\uFDB3"
2544         },
2545         "\u0639\u0645\u064A": {
2546           "final": "\uFDB6"
2547         },
2548         "\u0643\u0645\u064A": {
2549           "final": "\uFDB7"
2550         },
2551         "\u0646\u062C\u062D": {
2552           "initial": "\uFDB8",
2553           "final": "\uFDBD"
2554         },
2555         "\u0645\u062E\u064A": {
2556           "final": "\uFDB9"
2557         },
2558         "\u0644\u062C\u0645": {
2559           "initial": "\uFDBA",
2560           "final": "\uFDBC"
2561         },
2562         "\u0643\u0645\u0645": {
2563           "final": "\uFDBB",
2564           "initial": "\uFDC3"
2565         },
2566         "\u062C\u062D\u064A": {
2567           "final": "\uFDBE"
2568         },
2569         "\u062D\u062C\u064A": {
2570           "final": "\uFDBF"
2571         },
2572         "\u0645\u062C\u064A": {
2573           "final": "\uFDC0"
2574         },
2575         "\u0641\u0645\u064A": {
2576           "final": "\uFDC1"
2577         },
2578         "\u0628\u062D\u064A": {
2579           "final": "\uFDC2"
2580         },
2581         "\u0633\u062E\u064A": {
2582           "final": "\uFDC6"
2583         },
2584         "\u0646\u062C\u064A": {
2585           "final": "\uFDC7"
2586         },
2587         "\u0644\u0622": {
2588           "isolated": "\uFEF5",
2589           "final": "\uFEF6"
2590         },
2591         "\u0644\u0623": {
2592           "isolated": "\uFEF7",
2593           "final": "\uFEF8"
2594         },
2595         "\u0644\u0625": {
2596           "isolated": "\uFEF9",
2597           "final": "\uFEFA"
2598         },
2599         "\u0644\u0627": {
2600           "isolated": "\uFEFB",
2601           "final": "\uFEFC"
2602         },
2603         "words": {
2604           "\u0635\u0644\u06D2": "\uFDF0",
2605           "\u0642\u0644\u06D2": "\uFDF1",
2606           "\u0627\u0644\u0644\u0647": "\uFDF2",
2607           "\u0627\u0643\u0628\u0631": "\uFDF3",
2608           "\u0645\u062D\u0645\u062F": "\uFDF4",
2609           "\u0635\u0644\u0639\u0645": "\uFDF5",
2610           "\u0631\u0633\u0648\u0644": "\uFDF6",
2611           "\u0639\u0644\u064A\u0647": "\uFDF7",
2612           "\u0648\u0633\u0644\u0645": "\uFDF8",
2613           "\u0635\u0644\u0649": "\uFDF9",
2614           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2615           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2616           "\u0631\u06CC\u0627\u0644": "\uFDFC"
2617         }
2618       };
2619       exports2.default = ligatureReference;
2620     }
2621   });
2622
2623   // node_modules/alif-toolkit/lib/reference.js
2624   var require_reference = __commonJS({
2625     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2626       "use strict";
2627       Object.defineProperty(exports2, "__esModule", { value: true });
2628       var unicode_arabic_1 = require_unicode_arabic();
2629       var unicode_ligatures_1 = require_unicode_ligatures();
2630       var letterList = Object.keys(unicode_arabic_1.default);
2631       exports2.letterList = letterList;
2632       var ligatureList = Object.keys(unicode_ligatures_1.default);
2633       exports2.ligatureList = ligatureList;
2634       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2635       exports2.ligatureWordList = ligatureWordList;
2636       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2637       exports2.lams = lams;
2638       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2639       exports2.alefs = alefs;
2640       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2641       exports2.tashkeel = tashkeel;
2642       function addToTashkeel(start2, finish) {
2643         for (var i3 = start2; i3 <= finish; i3++) {
2644           exports2.tashkeel = tashkeel += String.fromCharCode(i3);
2645         }
2646       }
2647       addToTashkeel(1552, 1562);
2648       addToTashkeel(1611, 1631);
2649       addToTashkeel(1750, 1756);
2650       addToTashkeel(1760, 1764);
2651       addToTashkeel(1770, 1773);
2652       addToTashkeel(2259, 2273);
2653       addToTashkeel(2275, 2303);
2654       addToTashkeel(65136, 65151);
2655       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2656       exports2.lineBreakers = lineBreakers;
2657       function addToLineBreakers(start2, finish) {
2658         for (var i3 = start2; i3 <= finish; i3++) {
2659           exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
2660         }
2661       }
2662       addToLineBreakers(1536, 1567);
2663       addToLineBreakers(1569, 1573);
2664       addToLineBreakers(1583, 1586);
2665       addToLineBreakers(1632, 1645);
2666       addToLineBreakers(1649, 1655);
2667       addToLineBreakers(1672, 1689);
2668       addToLineBreakers(1731, 1739);
2669       addToLineBreakers(1746, 1785);
2670       addToLineBreakers(1881, 1883);
2671       addToLineBreakers(2218, 2222);
2672       addToLineBreakers(64336, 65021);
2673       addToLineBreakers(65152, 65276);
2674       addToLineBreakers(69216, 69247);
2675       addToLineBreakers(126064, 126143);
2676       addToLineBreakers(126464, 126719);
2677     }
2678   });
2679
2680   // node_modules/alif-toolkit/lib/GlyphSplitter.js
2681   var require_GlyphSplitter = __commonJS({
2682     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2683       "use strict";
2684       Object.defineProperty(exports2, "__esModule", { value: true });
2685       var isArabic_1 = require_isArabic();
2686       var reference_1 = require_reference();
2687       function GlyphSplitter(word) {
2688         let letters = [];
2689         let lastLetter = "";
2690         word.split("").forEach((letter) => {
2691           if (isArabic_1.isArabic(letter)) {
2692             if (reference_1.tashkeel.indexOf(letter) > -1) {
2693               letters[letters.length - 1] += letter;
2694             } 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)) {
2695               letters[letters.length - 1] += letter;
2696             } else {
2697               letters.push(letter);
2698             }
2699           } else {
2700             letters.push(letter);
2701           }
2702           if (reference_1.tashkeel.indexOf(letter) === -1) {
2703             lastLetter = letter;
2704           }
2705         });
2706         return letters;
2707       }
2708       exports2.GlyphSplitter = GlyphSplitter;
2709     }
2710   });
2711
2712   // node_modules/alif-toolkit/lib/BaselineSplitter.js
2713   var require_BaselineSplitter = __commonJS({
2714     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2715       "use strict";
2716       Object.defineProperty(exports2, "__esModule", { value: true });
2717       var isArabic_1 = require_isArabic();
2718       var reference_1 = require_reference();
2719       function BaselineSplitter(word) {
2720         let letters = [];
2721         let lastLetter = "";
2722         word.split("").forEach((letter) => {
2723           if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) {
2724             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2725               letters[letters.length - 1] += letter;
2726             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2727               letters.push(letter);
2728             } else {
2729               letters[letters.length - 1] += letter;
2730             }
2731           } else {
2732             letters.push(letter);
2733           }
2734           if (reference_1.tashkeel.indexOf(letter) === -1) {
2735             lastLetter = letter;
2736           }
2737         });
2738         return letters;
2739       }
2740       exports2.BaselineSplitter = BaselineSplitter;
2741     }
2742   });
2743
2744   // node_modules/alif-toolkit/lib/Normalization.js
2745   var require_Normalization = __commonJS({
2746     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2747       "use strict";
2748       Object.defineProperty(exports2, "__esModule", { value: true });
2749       var unicode_arabic_1 = require_unicode_arabic();
2750       var unicode_ligatures_1 = require_unicode_ligatures();
2751       var isArabic_1 = require_isArabic();
2752       var reference_1 = require_reference();
2753       function Normal(word, breakPresentationForm) {
2754         if (typeof breakPresentationForm === "undefined") {
2755           breakPresentationForm = true;
2756         }
2757         let returnable = "";
2758         word.split("").forEach((letter) => {
2759           if (!isArabic_1.isArabic(letter)) {
2760             returnable += letter;
2761             return;
2762           }
2763           for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2764             let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2765             let versions = Object.keys(letterForms);
2766             for (let v2 = 0; v2 < versions.length; v2++) {
2767               let localVersion = letterForms[versions[v2]];
2768               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2769                 let embeddedForms = Object.keys(localVersion);
2770                 for (let ef = 0; ef < embeddedForms.length; ef++) {
2771                   let form = localVersion[embeddedForms[ef]];
2772                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2773                     if (form === letter) {
2774                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2775                         if (typeof localVersion["normal"] === "object") {
2776                           returnable += localVersion["normal"][0];
2777                         } else {
2778                           returnable += localVersion["normal"];
2779                         }
2780                         return;
2781                       }
2782                       returnable += letter;
2783                       return;
2784                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2785                       returnable += form[0];
2786                       return;
2787                     }
2788                   }
2789                 }
2790               } else if (localVersion === letter) {
2791                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v2]) > -1) {
2792                   if (typeof letterForms["normal"] === "object") {
2793                     returnable += letterForms["normal"][0];
2794                   } else {
2795                     returnable += letterForms["normal"];
2796                   }
2797                   return;
2798                 }
2799                 returnable += letter;
2800                 return;
2801               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2802                 returnable += localVersion[0];
2803                 return;
2804               }
2805             }
2806           }
2807           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2808             let normalForm = reference_1.ligatureList[v2];
2809             if (normalForm !== "words") {
2810               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2811               for (let f3 = 0; f3 < ligForms.length; f3++) {
2812                 if (unicode_ligatures_1.default[normalForm][ligForms[f3]] === letter) {
2813                   returnable += normalForm;
2814                   return;
2815                 }
2816               }
2817             }
2818           }
2819           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2820             let normalForm = reference_1.ligatureWordList[v3];
2821             if (unicode_ligatures_1.default.words[normalForm] === letter) {
2822               returnable += normalForm;
2823               return;
2824             }
2825           }
2826           returnable += letter;
2827         });
2828         return returnable;
2829       }
2830       exports2.Normal = Normal;
2831     }
2832   });
2833
2834   // node_modules/alif-toolkit/lib/CharShaper.js
2835   var require_CharShaper = __commonJS({
2836     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2837       "use strict";
2838       Object.defineProperty(exports2, "__esModule", { value: true });
2839       var unicode_arabic_1 = require_unicode_arabic();
2840       var isArabic_1 = require_isArabic();
2841       var reference_1 = require_reference();
2842       function CharShaper(letter, form) {
2843         if (!isArabic_1.isArabic(letter)) {
2844           throw new Error("Not Arabic");
2845         }
2846         if (letter === "\u0621") {
2847           return "\u0621";
2848         }
2849         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2850           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2851           let versions = Object.keys(letterForms);
2852           for (let v2 = 0; v2 < versions.length; v2++) {
2853             let localVersion = letterForms[versions[v2]];
2854             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2855               if (versions.indexOf(form) > -1) {
2856                 return letterForms[form];
2857               }
2858             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2859               let embeddedVersions = Object.keys(localVersion);
2860               for (let ev = 0; ev < embeddedVersions.length; ev++) {
2861                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2862                   if (embeddedVersions.indexOf(form) > -1) {
2863                     return localVersion[form];
2864                   }
2865                 }
2866               }
2867             }
2868           }
2869         }
2870       }
2871       exports2.CharShaper = CharShaper;
2872     }
2873   });
2874
2875   // node_modules/alif-toolkit/lib/WordShaper.js
2876   var require_WordShaper = __commonJS({
2877     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2878       "use strict";
2879       Object.defineProperty(exports2, "__esModule", { value: true });
2880       var isArabic_1 = require_isArabic();
2881       var reference_1 = require_reference();
2882       var CharShaper_1 = require_CharShaper();
2883       var unicode_ligatures_1 = require_unicode_ligatures();
2884       function WordShaper2(word) {
2885         let state = "initial";
2886         let output = "";
2887         for (let w2 = 0; w2 < word.length; w2++) {
2888           let nextLetter = " ";
2889           for (let nxw = w2 + 1; nxw < word.length; nxw++) {
2890             if (!isArabic_1.isArabic(word[nxw])) {
2891               break;
2892             }
2893             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2894               nextLetter = word[nxw];
2895               break;
2896             }
2897           }
2898           if (!isArabic_1.isArabic(word[w2]) || isArabic_1.isMath(word[w2])) {
2899             output += word[w2];
2900             state = "initial";
2901           } else if (reference_1.tashkeel.indexOf(word[w2]) > -1) {
2902             output += word[w2];
2903           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w2]) > -1) {
2904             output += CharShaper_1.CharShaper(word[w2], state === "initial" ? "isolated" : "final");
2905             state = "initial";
2906           } else if (reference_1.lams.indexOf(word[w2]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2907             output += unicode_ligatures_1.default[word[w2] + nextLetter][state === "initial" ? "isolated" : "final"];
2908             while (word[w2] !== nextLetter) {
2909               w2++;
2910             }
2911             state = "initial";
2912           } else {
2913             output += CharShaper_1.CharShaper(word[w2], state);
2914             state = "medial";
2915           }
2916         }
2917         return output;
2918       }
2919       exports2.WordShaper = WordShaper2;
2920     }
2921   });
2922
2923   // node_modules/alif-toolkit/lib/ParentLetter.js
2924   var require_ParentLetter = __commonJS({
2925     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2926       "use strict";
2927       Object.defineProperty(exports2, "__esModule", { value: true });
2928       var unicode_arabic_1 = require_unicode_arabic();
2929       var isArabic_1 = require_isArabic();
2930       var reference_1 = require_reference();
2931       function ParentLetter(letter) {
2932         if (!isArabic_1.isArabic(letter)) {
2933           throw new Error("Not an Arabic letter");
2934         }
2935         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2936           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2937           let versions = Object.keys(letterForms);
2938           for (let v2 = 0; v2 < versions.length; v2++) {
2939             let localVersion = letterForms[versions[v2]];
2940             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2941               let embeddedForms = Object.keys(localVersion);
2942               for (let ef = 0; ef < embeddedForms.length; ef++) {
2943                 let form = localVersion[embeddedForms[ef]];
2944                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2945                   return localVersion;
2946                 }
2947               }
2948             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2949               return letterForms;
2950             }
2951           }
2952           return null;
2953         }
2954       }
2955       exports2.ParentLetter = ParentLetter;
2956       function GrandparentLetter(letter) {
2957         if (!isArabic_1.isArabic(letter)) {
2958           throw new Error("Not an Arabic letter");
2959         }
2960         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2961           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2962           let versions = Object.keys(letterForms);
2963           for (let v2 = 0; v2 < versions.length; v2++) {
2964             let localVersion = letterForms[versions[v2]];
2965             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2966               let embeddedForms = Object.keys(localVersion);
2967               for (let ef = 0; ef < embeddedForms.length; ef++) {
2968                 let form = localVersion[embeddedForms[ef]];
2969                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2970                   return letterForms;
2971                 }
2972               }
2973             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2974               return letterForms;
2975             }
2976           }
2977           return null;
2978         }
2979       }
2980       exports2.GrandparentLetter = GrandparentLetter;
2981     }
2982   });
2983
2984   // node_modules/alif-toolkit/lib/index.js
2985   var require_lib = __commonJS({
2986     "node_modules/alif-toolkit/lib/index.js"(exports2) {
2987       "use strict";
2988       Object.defineProperty(exports2, "__esModule", { value: true });
2989       var isArabic_1 = require_isArabic();
2990       exports2.isArabic = isArabic_1.isArabic;
2991       var GlyphSplitter_1 = require_GlyphSplitter();
2992       exports2.GlyphSplitter = GlyphSplitter_1.GlyphSplitter;
2993       var BaselineSplitter_1 = require_BaselineSplitter();
2994       exports2.BaselineSplitter = BaselineSplitter_1.BaselineSplitter;
2995       var Normalization_1 = require_Normalization();
2996       exports2.Normal = Normalization_1.Normal;
2997       var CharShaper_1 = require_CharShaper();
2998       exports2.CharShaper = CharShaper_1.CharShaper;
2999       var WordShaper_1 = require_WordShaper();
3000       exports2.WordShaper = WordShaper_1.WordShaper;
3001       var ParentLetter_1 = require_ParentLetter();
3002       exports2.ParentLetter = ParentLetter_1.ParentLetter;
3003       exports2.GrandparentLetter = ParentLetter_1.GrandparentLetter;
3004     }
3005   });
3006
3007   // node_modules/vparse/index.js
3008   var require_vparse = __commonJS({
3009     "node_modules/vparse/index.js"(exports2, module2) {
3010       (function(window2) {
3011         "use strict";
3012         function parseVersion3(v2) {
3013           var m2 = v2.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3014           v2 = {
3015             major: +m2[0] || 0,
3016             minor: +m2[1] || 0,
3017             patch: +m2[2] || 0,
3018             build: +m2[3] || 0
3019           };
3020           v2.isEmpty = !v2.major && !v2.minor && !v2.patch && !v2.build;
3021           v2.parsed = [v2.major, v2.minor, v2.patch, v2.build];
3022           v2.text = v2.parsed.join(".");
3023           v2.compare = compare;
3024           return v2;
3025         }
3026         function compare(v2) {
3027           if (typeof v2 === "string") {
3028             v2 = parseVersion3(v2);
3029           }
3030           for (var i3 = 0; i3 < 4; i3++) {
3031             if (this.parsed[i3] !== v2.parsed[i3]) {
3032               return this.parsed[i3] > v2.parsed[i3] ? 1 : -1;
3033             }
3034           }
3035           return 0;
3036         }
3037         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3038           module2.exports = parseVersion3;
3039         } else {
3040           window2.parseVersion = parseVersion3;
3041         }
3042       })(exports2);
3043     }
3044   });
3045
3046   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3047   var require_quickselect = __commonJS({
3048     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3049       (function(global2, factory) {
3050         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
3051       })(exports2, function() {
3052         "use strict";
3053         function quickselect2(arr, k2, left, right, compare) {
3054           quickselectStep(arr, k2, left || 0, right || arr.length - 1, compare || defaultCompare);
3055         }
3056         function quickselectStep(arr, k2, left, right, compare) {
3057           while (right > left) {
3058             if (right - left > 600) {
3059               var n3 = right - left + 1;
3060               var m2 = k2 - left + 1;
3061               var z2 = Math.log(n3);
3062               var s2 = 0.5 * Math.exp(2 * z2 / 3);
3063               var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
3064               var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
3065               var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
3066               quickselectStep(arr, k2, newLeft, newRight, compare);
3067             }
3068             var t2 = arr[k2];
3069             var i3 = left;
3070             var j3 = right;
3071             swap2(arr, left, k2);
3072             if (compare(arr[right], t2) > 0)
3073               swap2(arr, left, right);
3074             while (i3 < j3) {
3075               swap2(arr, i3, j3);
3076               i3++;
3077               j3--;
3078               while (compare(arr[i3], t2) < 0)
3079                 i3++;
3080               while (compare(arr[j3], t2) > 0)
3081                 j3--;
3082             }
3083             if (compare(arr[left], t2) === 0)
3084               swap2(arr, left, j3);
3085             else {
3086               j3++;
3087               swap2(arr, j3, right);
3088             }
3089             if (j3 <= k2)
3090               left = j3 + 1;
3091             if (k2 <= j3)
3092               right = j3 - 1;
3093           }
3094         }
3095         function swap2(arr, i3, j3) {
3096           var tmp = arr[i3];
3097           arr[i3] = arr[j3];
3098           arr[j3] = tmp;
3099         }
3100         function defaultCompare(a2, b2) {
3101           return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
3102         }
3103         return quickselect2;
3104       });
3105     }
3106   });
3107
3108   // node_modules/which-polygon/node_modules/rbush/index.js
3109   var require_rbush = __commonJS({
3110     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3111       "use strict";
3112       module2.exports = rbush;
3113       module2.exports.default = rbush;
3114       var quickselect2 = require_quickselect();
3115       function rbush(maxEntries, format2) {
3116         if (!(this instanceof rbush))
3117           return new rbush(maxEntries, format2);
3118         this._maxEntries = Math.max(4, maxEntries || 9);
3119         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3120         if (format2) {
3121           this._initFormat(format2);
3122         }
3123         this.clear();
3124       }
3125       rbush.prototype = {
3126         all: function() {
3127           return this._all(this.data, []);
3128         },
3129         search: function(bbox2) {
3130           var node = this.data, result = [], toBBox = this.toBBox;
3131           if (!intersects(bbox2, node))
3132             return result;
3133           var nodesToSearch = [], i3, len, child, childBBox;
3134           while (node) {
3135             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3136               child = node.children[i3];
3137               childBBox = node.leaf ? toBBox(child) : child;
3138               if (intersects(bbox2, childBBox)) {
3139                 if (node.leaf)
3140                   result.push(child);
3141                 else if (contains(bbox2, childBBox))
3142                   this._all(child, result);
3143                 else
3144                   nodesToSearch.push(child);
3145               }
3146             }
3147             node = nodesToSearch.pop();
3148           }
3149           return result;
3150         },
3151         collides: function(bbox2) {
3152           var node = this.data, toBBox = this.toBBox;
3153           if (!intersects(bbox2, node))
3154             return false;
3155           var nodesToSearch = [], i3, len, child, childBBox;
3156           while (node) {
3157             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3158               child = node.children[i3];
3159               childBBox = node.leaf ? toBBox(child) : child;
3160               if (intersects(bbox2, childBBox)) {
3161                 if (node.leaf || contains(bbox2, childBBox))
3162                   return true;
3163                 nodesToSearch.push(child);
3164               }
3165             }
3166             node = nodesToSearch.pop();
3167           }
3168           return false;
3169         },
3170         load: function(data) {
3171           if (!(data && data.length))
3172             return this;
3173           if (data.length < this._minEntries) {
3174             for (var i3 = 0, len = data.length; i3 < len; i3++) {
3175               this.insert(data[i3]);
3176             }
3177             return this;
3178           }
3179           var node = this._build(data.slice(), 0, data.length - 1, 0);
3180           if (!this.data.children.length) {
3181             this.data = node;
3182           } else if (this.data.height === node.height) {
3183             this._splitRoot(this.data, node);
3184           } else {
3185             if (this.data.height < node.height) {
3186               var tmpNode = this.data;
3187               this.data = node;
3188               node = tmpNode;
3189             }
3190             this._insert(node, this.data.height - node.height - 1, true);
3191           }
3192           return this;
3193         },
3194         insert: function(item) {
3195           if (item)
3196             this._insert(item, this.data.height - 1);
3197           return this;
3198         },
3199         clear: function() {
3200           this.data = createNode([]);
3201           return this;
3202         },
3203         remove: function(item, equalsFn) {
3204           if (!item)
3205             return this;
3206           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent, index, goingUp;
3207           while (node || path.length) {
3208             if (!node) {
3209               node = path.pop();
3210               parent = path[path.length - 1];
3211               i3 = indexes.pop();
3212               goingUp = true;
3213             }
3214             if (node.leaf) {
3215               index = findItem(item, node.children, equalsFn);
3216               if (index !== -1) {
3217                 node.children.splice(index, 1);
3218                 path.push(node);
3219                 this._condense(path);
3220                 return this;
3221               }
3222             }
3223             if (!goingUp && !node.leaf && contains(node, bbox2)) {
3224               path.push(node);
3225               indexes.push(i3);
3226               i3 = 0;
3227               parent = node;
3228               node = node.children[0];
3229             } else if (parent) {
3230               i3++;
3231               node = parent.children[i3];
3232               goingUp = false;
3233             } else
3234               node = null;
3235           }
3236           return this;
3237         },
3238         toBBox: function(item) {
3239           return item;
3240         },
3241         compareMinX: compareNodeMinX,
3242         compareMinY: compareNodeMinY,
3243         toJSON: function() {
3244           return this.data;
3245         },
3246         fromJSON: function(data) {
3247           this.data = data;
3248           return this;
3249         },
3250         _all: function(node, result) {
3251           var nodesToSearch = [];
3252           while (node) {
3253             if (node.leaf)
3254               result.push.apply(result, node.children);
3255             else
3256               nodesToSearch.push.apply(nodesToSearch, node.children);
3257             node = nodesToSearch.pop();
3258           }
3259           return result;
3260         },
3261         _build: function(items, left, right, height) {
3262           var N2 = right - left + 1, M2 = this._maxEntries, node;
3263           if (N2 <= M2) {
3264             node = createNode(items.slice(left, right + 1));
3265             calcBBox(node, this.toBBox);
3266             return node;
3267           }
3268           if (!height) {
3269             height = Math.ceil(Math.log(N2) / Math.log(M2));
3270             M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
3271           }
3272           node = createNode([]);
3273           node.leaf = false;
3274           node.height = height;
3275           var N22 = Math.ceil(N2 / M2), N1 = N22 * Math.ceil(Math.sqrt(M2)), i3, j3, right2, right3;
3276           multiSelect(items, left, right, N1, this.compareMinX);
3277           for (i3 = left; i3 <= right; i3 += N1) {
3278             right2 = Math.min(i3 + N1 - 1, right);
3279             multiSelect(items, i3, right2, N22, this.compareMinY);
3280             for (j3 = i3; j3 <= right2; j3 += N22) {
3281               right3 = Math.min(j3 + N22 - 1, right2);
3282               node.children.push(this._build(items, j3, right3, height - 1));
3283             }
3284           }
3285           calcBBox(node, this.toBBox);
3286           return node;
3287         },
3288         _chooseSubtree: function(bbox2, node, level, path) {
3289           var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3290           while (true) {
3291             path.push(node);
3292             if (node.leaf || path.length - 1 === level)
3293               break;
3294             minArea = minEnlargement = Infinity;
3295             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3296               child = node.children[i3];
3297               area = bboxArea(child);
3298               enlargement = enlargedArea(bbox2, child) - area;
3299               if (enlargement < minEnlargement) {
3300                 minEnlargement = enlargement;
3301                 minArea = area < minArea ? area : minArea;
3302                 targetNode = child;
3303               } else if (enlargement === minEnlargement) {
3304                 if (area < minArea) {
3305                   minArea = area;
3306                   targetNode = child;
3307                 }
3308               }
3309             }
3310             node = targetNode || node.children[0];
3311           }
3312           return node;
3313         },
3314         _insert: function(item, level, isNode) {
3315           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
3316           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
3317           node.children.push(item);
3318           extend2(node, bbox2);
3319           while (level >= 0) {
3320             if (insertPath[level].children.length > this._maxEntries) {
3321               this._split(insertPath, level);
3322               level--;
3323             } else
3324               break;
3325           }
3326           this._adjustParentBBoxes(bbox2, insertPath, level);
3327         },
3328         // split overflowed node into two
3329         _split: function(insertPath, level) {
3330           var node = insertPath[level], M2 = node.children.length, m2 = this._minEntries;
3331           this._chooseSplitAxis(node, m2, M2);
3332           var splitIndex = this._chooseSplitIndex(node, m2, M2);
3333           var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
3334           newNode.height = node.height;
3335           newNode.leaf = node.leaf;
3336           calcBBox(node, this.toBBox);
3337           calcBBox(newNode, this.toBBox);
3338           if (level)
3339             insertPath[level - 1].children.push(newNode);
3340           else
3341             this._splitRoot(node, newNode);
3342         },
3343         _splitRoot: function(node, newNode) {
3344           this.data = createNode([node, newNode]);
3345           this.data.height = node.height + 1;
3346           this.data.leaf = false;
3347           calcBBox(this.data, this.toBBox);
3348         },
3349         _chooseSplitIndex: function(node, m2, M2) {
3350           var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3351           minOverlap = minArea = Infinity;
3352           for (i3 = m2; i3 <= M2 - m2; i3++) {
3353             bbox1 = distBBox(node, 0, i3, this.toBBox);
3354             bbox2 = distBBox(node, i3, M2, this.toBBox);
3355             overlap = intersectionArea(bbox1, bbox2);
3356             area = bboxArea(bbox1) + bboxArea(bbox2);
3357             if (overlap < minOverlap) {
3358               minOverlap = overlap;
3359               index = i3;
3360               minArea = area < minArea ? area : minArea;
3361             } else if (overlap === minOverlap) {
3362               if (area < minArea) {
3363                 minArea = area;
3364                 index = i3;
3365               }
3366             }
3367           }
3368           return index;
3369         },
3370         // sorts node children by the best axis for split
3371         _chooseSplitAxis: function(node, m2, M2) {
3372           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m2, M2, compareMinX), yMargin = this._allDistMargin(node, m2, M2, compareMinY);
3373           if (xMargin < yMargin)
3374             node.children.sort(compareMinX);
3375         },
3376         // total margin of all possible split distributions where each node is at least m full
3377         _allDistMargin: function(node, m2, M2, compare) {
3378           node.children.sort(compare);
3379           var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m2, toBBox), rightBBox = distBBox(node, M2 - m2, M2, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i3, child;
3380           for (i3 = m2; i3 < M2 - m2; i3++) {
3381             child = node.children[i3];
3382             extend2(leftBBox, node.leaf ? toBBox(child) : child);
3383             margin += bboxMargin(leftBBox);
3384           }
3385           for (i3 = M2 - m2 - 1; i3 >= m2; i3--) {
3386             child = node.children[i3];
3387             extend2(rightBBox, node.leaf ? toBBox(child) : child);
3388             margin += bboxMargin(rightBBox);
3389           }
3390           return margin;
3391         },
3392         _adjustParentBBoxes: function(bbox2, path, level) {
3393           for (var i3 = level; i3 >= 0; i3--) {
3394             extend2(path[i3], bbox2);
3395           }
3396         },
3397         _condense: function(path) {
3398           for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
3399             if (path[i3].children.length === 0) {
3400               if (i3 > 0) {
3401                 siblings = path[i3 - 1].children;
3402                 siblings.splice(siblings.indexOf(path[i3]), 1);
3403               } else
3404                 this.clear();
3405             } else
3406               calcBBox(path[i3], this.toBBox);
3407           }
3408         },
3409         _initFormat: function(format2) {
3410           var compareArr = ["return a", " - b", ";"];
3411           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3412           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3413           this.toBBox = new Function(
3414             "a",
3415             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
3416           );
3417         }
3418       };
3419       function findItem(item, items, equalsFn) {
3420         if (!equalsFn)
3421           return items.indexOf(item);
3422         for (var i3 = 0; i3 < items.length; i3++) {
3423           if (equalsFn(item, items[i3]))
3424             return i3;
3425         }
3426         return -1;
3427       }
3428       function calcBBox(node, toBBox) {
3429         distBBox(node, 0, node.children.length, toBBox, node);
3430       }
3431       function distBBox(node, k2, p2, toBBox, destNode) {
3432         if (!destNode)
3433           destNode = createNode(null);
3434         destNode.minX = Infinity;
3435         destNode.minY = Infinity;
3436         destNode.maxX = -Infinity;
3437         destNode.maxY = -Infinity;
3438         for (var i3 = k2, child; i3 < p2; i3++) {
3439           child = node.children[i3];
3440           extend2(destNode, node.leaf ? toBBox(child) : child);
3441         }
3442         return destNode;
3443       }
3444       function extend2(a2, b2) {
3445         a2.minX = Math.min(a2.minX, b2.minX);
3446         a2.minY = Math.min(a2.minY, b2.minY);
3447         a2.maxX = Math.max(a2.maxX, b2.maxX);
3448         a2.maxY = Math.max(a2.maxY, b2.maxY);
3449         return a2;
3450       }
3451       function compareNodeMinX(a2, b2) {
3452         return a2.minX - b2.minX;
3453       }
3454       function compareNodeMinY(a2, b2) {
3455         return a2.minY - b2.minY;
3456       }
3457       function bboxArea(a2) {
3458         return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
3459       }
3460       function bboxMargin(a2) {
3461         return a2.maxX - a2.minX + (a2.maxY - a2.minY);
3462       }
3463       function enlargedArea(a2, b2) {
3464         return (Math.max(b2.maxX, a2.maxX) - Math.min(b2.minX, a2.minX)) * (Math.max(b2.maxY, a2.maxY) - Math.min(b2.minY, a2.minY));
3465       }
3466       function intersectionArea(a2, b2) {
3467         var minX = Math.max(a2.minX, b2.minX), minY = Math.max(a2.minY, b2.minY), maxX = Math.min(a2.maxX, b2.maxX), maxY = Math.min(a2.maxY, b2.maxY);
3468         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3469       }
3470       function contains(a2, b2) {
3471         return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
3472       }
3473       function intersects(a2, b2) {
3474         return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
3475       }
3476       function createNode(children2) {
3477         return {
3478           children: children2,
3479           height: 1,
3480           leaf: true,
3481           minX: Infinity,
3482           minY: Infinity,
3483           maxX: -Infinity,
3484           maxY: -Infinity
3485         };
3486       }
3487       function multiSelect(arr, left, right, n3, compare) {
3488         var stack = [left, right], mid;
3489         while (stack.length) {
3490           right = stack.pop();
3491           left = stack.pop();
3492           if (right - left <= n3)
3493             continue;
3494           mid = left + Math.ceil((right - left) / n3 / 2) * n3;
3495           quickselect2(arr, mid, left, right, compare);
3496           stack.push(left, mid, mid, right);
3497         }
3498       }
3499     }
3500   });
3501
3502   // node_modules/lineclip/index.js
3503   var require_lineclip = __commonJS({
3504     "node_modules/lineclip/index.js"(exports2, module2) {
3505       "use strict";
3506       module2.exports = lineclip2;
3507       lineclip2.polyline = lineclip2;
3508       lineclip2.polygon = polygonclip2;
3509       function lineclip2(points, bbox2, result) {
3510         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a2, b2, codeB, lastCode;
3511         if (!result)
3512           result = [];
3513         for (i3 = 1; i3 < len; i3++) {
3514           a2 = points[i3 - 1];
3515           b2 = points[i3];
3516           codeB = lastCode = bitCode2(b2, bbox2);
3517           while (true) {
3518             if (!(codeA | codeB)) {
3519               part.push(a2);
3520               if (codeB !== lastCode) {
3521                 part.push(b2);
3522                 if (i3 < len - 1) {
3523                   result.push(part);
3524                   part = [];
3525                 }
3526               } else if (i3 === len - 1) {
3527                 part.push(b2);
3528               }
3529               break;
3530             } else if (codeA & codeB) {
3531               break;
3532             } else if (codeA) {
3533               a2 = intersect2(a2, b2, codeA, bbox2);
3534               codeA = bitCode2(a2, bbox2);
3535             } else {
3536               b2 = intersect2(a2, b2, codeB, bbox2);
3537               codeB = bitCode2(b2, bbox2);
3538             }
3539           }
3540           codeA = lastCode;
3541         }
3542         if (part.length)
3543           result.push(part);
3544         return result;
3545       }
3546       function polygonclip2(points, bbox2) {
3547         var result, edge, prev, prevInside, i3, p2, inside;
3548         for (edge = 1; edge <= 8; edge *= 2) {
3549           result = [];
3550           prev = points[points.length - 1];
3551           prevInside = !(bitCode2(prev, bbox2) & edge);
3552           for (i3 = 0; i3 < points.length; i3++) {
3553             p2 = points[i3];
3554             inside = !(bitCode2(p2, bbox2) & edge);
3555             if (inside !== prevInside)
3556               result.push(intersect2(prev, p2, edge, bbox2));
3557             if (inside)
3558               result.push(p2);
3559             prev = p2;
3560             prevInside = inside;
3561           }
3562           points = result;
3563           if (!points.length)
3564             break;
3565         }
3566         return result;
3567       }
3568       function intersect2(a2, b2, edge, bbox2) {
3569         return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : (
3570           // top
3571           edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : (
3572             // bottom
3573             edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : (
3574               // right
3575               edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : (
3576                 // left
3577                 null
3578               )
3579             )
3580           )
3581         );
3582       }
3583       function bitCode2(p2, bbox2) {
3584         var code = 0;
3585         if (p2[0] < bbox2[0])
3586           code |= 1;
3587         else if (p2[0] > bbox2[2])
3588           code |= 2;
3589         if (p2[1] < bbox2[1])
3590           code |= 4;
3591         else if (p2[1] > bbox2[3])
3592           code |= 8;
3593         return code;
3594       }
3595     }
3596   });
3597
3598   // node_modules/which-polygon/index.js
3599   var require_which_polygon = __commonJS({
3600     "node_modules/which-polygon/index.js"(exports2, module2) {
3601       "use strict";
3602       var rbush = require_rbush();
3603       var lineclip2 = require_lineclip();
3604       module2.exports = whichPolygon5;
3605       function whichPolygon5(data) {
3606         var bboxes = [];
3607         for (var i3 = 0; i3 < data.features.length; i3++) {
3608           var feature3 = data.features[i3];
3609           if (!feature3.geometry)
3610             continue;
3611           var coords = feature3.geometry.coordinates;
3612           if (feature3.geometry.type === "Polygon") {
3613             bboxes.push(treeItem(coords, feature3.properties));
3614           } else if (feature3.geometry.type === "MultiPolygon") {
3615             for (var j3 = 0; j3 < coords.length; j3++) {
3616               bboxes.push(treeItem(coords[j3], feature3.properties));
3617             }
3618           }
3619         }
3620         var tree = rbush().load(bboxes);
3621         function query(p2, multi) {
3622           var output = [], result = tree.search({
3623             minX: p2[0],
3624             minY: p2[1],
3625             maxX: p2[0],
3626             maxY: p2[1]
3627           });
3628           for (var i4 = 0; i4 < result.length; i4++) {
3629             if (insidePolygon(result[i4].coords, p2)) {
3630               if (multi)
3631                 output.push(result[i4].props);
3632               else
3633                 return result[i4].props;
3634             }
3635           }
3636           return multi && output.length ? output : null;
3637         }
3638         query.tree = tree;
3639         query.bbox = function queryBBox(bbox2) {
3640           var output = [];
3641           var result = tree.search({
3642             minX: bbox2[0],
3643             minY: bbox2[1],
3644             maxX: bbox2[2],
3645             maxY: bbox2[3]
3646           });
3647           for (var i4 = 0; i4 < result.length; i4++) {
3648             if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
3649               output.push(result[i4].props);
3650             }
3651           }
3652           return output;
3653         };
3654         return query;
3655       }
3656       function polygonIntersectsBBox(polygon2, bbox2) {
3657         var bboxCenter = [
3658           (bbox2[0] + bbox2[2]) / 2,
3659           (bbox2[1] + bbox2[3]) / 2
3660         ];
3661         if (insidePolygon(polygon2, bboxCenter))
3662           return true;
3663         for (var i3 = 0; i3 < polygon2.length; i3++) {
3664           if (lineclip2(polygon2[i3], bbox2).length > 0)
3665             return true;
3666         }
3667         return false;
3668       }
3669       function insidePolygon(rings, p2) {
3670         var inside = false;
3671         for (var i3 = 0, len = rings.length; i3 < len; i3++) {
3672           var ring = rings[i3];
3673           for (var j3 = 0, len2 = ring.length, k2 = len2 - 1; j3 < len2; k2 = j3++) {
3674             if (rayIntersect(p2, ring[j3], ring[k2]))
3675               inside = !inside;
3676           }
3677         }
3678         return inside;
3679       }
3680       function rayIntersect(p2, p1, p22) {
3681         return p1[1] > p2[1] !== p22[1] > p2[1] && p2[0] < (p22[0] - p1[0]) * (p2[1] - p1[1]) / (p22[1] - p1[1]) + p1[0];
3682       }
3683       function treeItem(coords, props) {
3684         var item = {
3685           minX: Infinity,
3686           minY: Infinity,
3687           maxX: -Infinity,
3688           maxY: -Infinity,
3689           coords,
3690           props
3691         };
3692         for (var i3 = 0; i3 < coords[0].length; i3++) {
3693           var p2 = coords[0][i3];
3694           item.minX = Math.min(item.minX, p2[0]);
3695           item.minY = Math.min(item.minY, p2[1]);
3696           item.maxX = Math.max(item.maxX, p2[0]);
3697           item.maxY = Math.max(item.maxY, p2[1]);
3698         }
3699         return item;
3700       }
3701     }
3702   });
3703
3704   // node_modules/wgs84/index.js
3705   var require_wgs84 = __commonJS({
3706     "node_modules/wgs84/index.js"(exports2, module2) {
3707       module2.exports.RADIUS = 6378137;
3708       module2.exports.FLATTENING = 1 / 298.257223563;
3709       module2.exports.POLAR_RADIUS = 63567523142e-4;
3710     }
3711   });
3712
3713   // node_modules/@mapbox/geojson-area/index.js
3714   var require_geojson_area = __commonJS({
3715     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3716       var wgs84 = require_wgs84();
3717       module2.exports.geometry = geometry;
3718       module2.exports.ring = ringArea;
3719       function geometry(_2) {
3720         var area = 0, i3;
3721         switch (_2.type) {
3722           case "Polygon":
3723             return polygonArea(_2.coordinates);
3724           case "MultiPolygon":
3725             for (i3 = 0; i3 < _2.coordinates.length; i3++) {
3726               area += polygonArea(_2.coordinates[i3]);
3727             }
3728             return area;
3729           case "Point":
3730           case "MultiPoint":
3731           case "LineString":
3732           case "MultiLineString":
3733             return 0;
3734           case "GeometryCollection":
3735             for (i3 = 0; i3 < _2.geometries.length; i3++) {
3736               area += geometry(_2.geometries[i3]);
3737             }
3738             return area;
3739         }
3740       }
3741       function polygonArea(coords) {
3742         var area = 0;
3743         if (coords && coords.length > 0) {
3744           area += Math.abs(ringArea(coords[0]));
3745           for (var i3 = 1; i3 < coords.length; i3++) {
3746             area -= Math.abs(ringArea(coords[i3]));
3747           }
3748         }
3749         return area;
3750       }
3751       function ringArea(coords) {
3752         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
3753         if (coordsLength > 2) {
3754           for (i3 = 0; i3 < coordsLength; i3++) {
3755             if (i3 === coordsLength - 2) {
3756               lowerIndex = coordsLength - 2;
3757               middleIndex = coordsLength - 1;
3758               upperIndex = 0;
3759             } else if (i3 === coordsLength - 1) {
3760               lowerIndex = coordsLength - 1;
3761               middleIndex = 0;
3762               upperIndex = 1;
3763             } else {
3764               lowerIndex = i3;
3765               middleIndex = i3 + 1;
3766               upperIndex = i3 + 2;
3767             }
3768             p1 = coords[lowerIndex];
3769             p2 = coords[middleIndex];
3770             p3 = coords[upperIndex];
3771             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3772           }
3773           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3774         }
3775         return area;
3776       }
3777       function rad(_2) {
3778         return _2 * Math.PI / 180;
3779       }
3780     }
3781   });
3782
3783   // node_modules/circle-to-polygon/input-validation/validateCenter.js
3784   var require_validateCenter = __commonJS({
3785     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3786       exports2.validateCenter = function validateCenter(center) {
3787         var validCenterLengths = [2, 3];
3788         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3789           throw new Error("ERROR! Center has to be an array of length two or three");
3790         }
3791         var [lng, lat] = center;
3792         if (typeof lng !== "number" || typeof lat !== "number") {
3793           throw new Error(
3794             `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
3795           );
3796         }
3797         if (lng > 180 || lng < -180) {
3798           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
3799         }
3800         if (lat > 90 || lat < -90) {
3801           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
3802         }
3803       };
3804     }
3805   });
3806
3807   // node_modules/circle-to-polygon/input-validation/validateRadius.js
3808   var require_validateRadius = __commonJS({
3809     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3810       exports2.validateRadius = function validateRadius(radius) {
3811         if (typeof radius !== "number") {
3812           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
3813         }
3814         if (radius <= 0) {
3815           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
3816         }
3817       };
3818     }
3819   });
3820
3821   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3822   var require_validateNumberOfEdges = __commonJS({
3823     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3824       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3825         if (typeof numberOfEdges !== "number") {
3826           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3827           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
3828         }
3829         if (numberOfEdges < 3) {
3830           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
3831         }
3832       };
3833     }
3834   });
3835
3836   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3837   var require_validateEarthRadius = __commonJS({
3838     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3839       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3840         if (typeof earthRadius2 !== "number") {
3841           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3842           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
3843         }
3844         if (earthRadius2 <= 0) {
3845           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
3846         }
3847       };
3848     }
3849   });
3850
3851   // node_modules/circle-to-polygon/input-validation/validateBearing.js
3852   var require_validateBearing = __commonJS({
3853     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3854       exports2.validateBearing = function validateBearing(bearing) {
3855         if (typeof bearing !== "number") {
3856           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3857           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
3858         }
3859       };
3860     }
3861   });
3862
3863   // node_modules/circle-to-polygon/input-validation/index.js
3864   var require_input_validation = __commonJS({
3865     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3866       var validateCenter = require_validateCenter().validateCenter;
3867       var validateRadius = require_validateRadius().validateRadius;
3868       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3869       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3870       var validateBearing = require_validateBearing().validateBearing;
3871       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3872         validateCenter(center);
3873         validateRadius(radius);
3874         validateNumberOfEdges(numberOfEdges);
3875         validateEarthRadius(earthRadius2);
3876         validateBearing(bearing);
3877       }
3878       exports2.validateCenter = validateCenter;
3879       exports2.validateRadius = validateRadius;
3880       exports2.validateNumberOfEdges = validateNumberOfEdges;
3881       exports2.validateEarthRadius = validateEarthRadius;
3882       exports2.validateBearing = validateBearing;
3883       exports2.validateInput = validateInput;
3884     }
3885   });
3886
3887   // node_modules/circle-to-polygon/index.js
3888   var require_circle_to_polygon = __commonJS({
3889     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3890       "use strict";
3891       var { validateInput } = require_input_validation();
3892       var defaultEarthRadius = 6378137;
3893       function toRadians(angleInDegrees) {
3894         return angleInDegrees * Math.PI / 180;
3895       }
3896       function toDegrees(angleInRadians) {
3897         return angleInRadians * 180 / Math.PI;
3898       }
3899       function offset(c1, distance, earthRadius2, bearing) {
3900         var lat1 = toRadians(c1[1]);
3901         var lon1 = toRadians(c1[0]);
3902         var dByR = distance / earthRadius2;
3903         var lat = Math.asin(
3904           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3905         );
3906         var lon = lon1 + Math.atan2(
3907           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3908           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3909         );
3910         return [toDegrees(lon), toDegrees(lat)];
3911       }
3912       module2.exports = function circleToPolygon2(center, radius, options2) {
3913         var n3 = getNumberOfEdges(options2);
3914         var earthRadius2 = getEarthRadius(options2);
3915         var bearing = getBearing(options2);
3916         var direction = getDirection(options2);
3917         validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
3918         var start2 = toRadians(bearing);
3919         var coordinates = [];
3920         for (var i3 = 0; i3 < n3; ++i3) {
3921           coordinates.push(
3922             offset(
3923               center,
3924               radius,
3925               earthRadius2,
3926               start2 + direction * 2 * Math.PI * -i3 / n3
3927             )
3928           );
3929         }
3930         coordinates.push(coordinates[0]);
3931         return {
3932           type: "Polygon",
3933           coordinates: [coordinates]
3934         };
3935       };
3936       function getNumberOfEdges(options2) {
3937         if (isUndefinedOrNull(options2)) {
3938           return 32;
3939         } else if (isObjectNotArray(options2)) {
3940           var numberOfEdges = options2.numberOfEdges;
3941           return numberOfEdges === void 0 ? 32 : numberOfEdges;
3942         }
3943         return options2;
3944       }
3945       function getEarthRadius(options2) {
3946         if (isUndefinedOrNull(options2)) {
3947           return defaultEarthRadius;
3948         } else if (isObjectNotArray(options2)) {
3949           var earthRadius2 = options2.earthRadius;
3950           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3951         }
3952         return defaultEarthRadius;
3953       }
3954       function getDirection(options2) {
3955         if (isObjectNotArray(options2) && options2.rightHandRule) {
3956           return -1;
3957         }
3958         return 1;
3959       }
3960       function getBearing(options2) {
3961         if (isUndefinedOrNull(options2)) {
3962           return 0;
3963         } else if (isObjectNotArray(options2)) {
3964           var bearing = options2.bearing;
3965           return bearing === void 0 ? 0 : bearing;
3966         }
3967         return 0;
3968       }
3969       function isObjectNotArray(argument) {
3970         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3971       }
3972       function isUndefinedOrNull(argument) {
3973         return argument === null || argument === void 0;
3974       }
3975     }
3976   });
3977
3978   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
3979   var require_polygon_clipping_umd = __commonJS({
3980     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
3981       (function(global2, factory) {
3982         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.polygonClipping = factory());
3983       })(exports2, function() {
3984         "use strict";
3985         function _classCallCheck(instance, Constructor) {
3986           if (!(instance instanceof Constructor)) {
3987             throw new TypeError("Cannot call a class as a function");
3988           }
3989         }
3990         function _defineProperties(target, props) {
3991           for (var i3 = 0; i3 < props.length; i3++) {
3992             var descriptor = props[i3];
3993             descriptor.enumerable = descriptor.enumerable || false;
3994             descriptor.configurable = true;
3995             if ("value" in descriptor)
3996               descriptor.writable = true;
3997             Object.defineProperty(target, descriptor.key, descriptor);
3998           }
3999         }
4000         function _createClass(Constructor, protoProps, staticProps) {
4001           if (protoProps)
4002             _defineProperties(Constructor.prototype, protoProps);
4003           if (staticProps)
4004             _defineProperties(Constructor, staticProps);
4005           return Constructor;
4006         }
4007         var Node = (
4008           /** @class */
4009           function() {
4010             function Node2(key, data) {
4011               this.next = null;
4012               this.key = key;
4013               this.data = data;
4014               this.left = null;
4015               this.right = null;
4016             }
4017             return Node2;
4018           }()
4019         );
4020         function DEFAULT_COMPARE(a2, b2) {
4021           return a2 > b2 ? 1 : a2 < b2 ? -1 : 0;
4022         }
4023         function splay(i3, t2, comparator) {
4024           var N2 = new Node(null, null);
4025           var l2 = N2;
4026           var r2 = N2;
4027           while (true) {
4028             var cmp2 = comparator(i3, t2.key);
4029             if (cmp2 < 0) {
4030               if (t2.left === null)
4031                 break;
4032               if (comparator(i3, t2.left.key) < 0) {
4033                 var y2 = t2.left;
4034                 t2.left = y2.right;
4035                 y2.right = t2;
4036                 t2 = y2;
4037                 if (t2.left === null)
4038                   break;
4039               }
4040               r2.left = t2;
4041               r2 = t2;
4042               t2 = t2.left;
4043             } else if (cmp2 > 0) {
4044               if (t2.right === null)
4045                 break;
4046               if (comparator(i3, t2.right.key) > 0) {
4047                 var y2 = t2.right;
4048                 t2.right = y2.left;
4049                 y2.left = t2;
4050                 t2 = y2;
4051                 if (t2.right === null)
4052                   break;
4053               }
4054               l2.right = t2;
4055               l2 = t2;
4056               t2 = t2.right;
4057             } else
4058               break;
4059           }
4060           l2.right = t2.left;
4061           r2.left = t2.right;
4062           t2.left = N2.right;
4063           t2.right = N2.left;
4064           return t2;
4065         }
4066         function insert(i3, data, t2, comparator) {
4067           var node = new Node(i3, data);
4068           if (t2 === null) {
4069             node.left = node.right = null;
4070             return node;
4071           }
4072           t2 = splay(i3, t2, comparator);
4073           var cmp2 = comparator(i3, t2.key);
4074           if (cmp2 < 0) {
4075             node.left = t2.left;
4076             node.right = t2;
4077             t2.left = null;
4078           } else if (cmp2 >= 0) {
4079             node.right = t2.right;
4080             node.left = t2;
4081             t2.right = null;
4082           }
4083           return node;
4084         }
4085         function split(key, v2, comparator) {
4086           var left = null;
4087           var right = null;
4088           if (v2) {
4089             v2 = splay(key, v2, comparator);
4090             var cmp2 = comparator(v2.key, key);
4091             if (cmp2 === 0) {
4092               left = v2.left;
4093               right = v2.right;
4094             } else if (cmp2 < 0) {
4095               right = v2.right;
4096               v2.right = null;
4097               left = v2;
4098             } else {
4099               left = v2.left;
4100               v2.left = null;
4101               right = v2;
4102             }
4103           }
4104           return {
4105             left,
4106             right
4107           };
4108         }
4109         function merge2(left, right, comparator) {
4110           if (right === null)
4111             return left;
4112           if (left === null)
4113             return right;
4114           right = splay(left.key, right, comparator);
4115           right.left = left;
4116           return right;
4117         }
4118         function printRow(root3, prefix, isTail, out, printNode) {
4119           if (root3) {
4120             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
4121             var indent2 = prefix + (isTail ? "    " : "\u2502   ");
4122             if (root3.left)
4123               printRow(root3.left, indent2, false, out, printNode);
4124             if (root3.right)
4125               printRow(root3.right, indent2, true, out, printNode);
4126           }
4127         }
4128         var Tree = (
4129           /** @class */
4130           function() {
4131             function Tree2(comparator) {
4132               if (comparator === void 0) {
4133                 comparator = DEFAULT_COMPARE;
4134               }
4135               this._root = null;
4136               this._size = 0;
4137               this._comparator = comparator;
4138             }
4139             Tree2.prototype.insert = function(key, data) {
4140               this._size++;
4141               return this._root = insert(key, data, this._root, this._comparator);
4142             };
4143             Tree2.prototype.add = function(key, data) {
4144               var node = new Node(key, data);
4145               if (this._root === null) {
4146                 node.left = node.right = null;
4147                 this._size++;
4148                 this._root = node;
4149               }
4150               var comparator = this._comparator;
4151               var t2 = splay(key, this._root, comparator);
4152               var cmp2 = comparator(key, t2.key);
4153               if (cmp2 === 0)
4154                 this._root = t2;
4155               else {
4156                 if (cmp2 < 0) {
4157                   node.left = t2.left;
4158                   node.right = t2;
4159                   t2.left = null;
4160                 } else if (cmp2 > 0) {
4161                   node.right = t2.right;
4162                   node.left = t2;
4163                   t2.right = null;
4164                 }
4165                 this._size++;
4166                 this._root = node;
4167               }
4168               return this._root;
4169             };
4170             Tree2.prototype.remove = function(key) {
4171               this._root = this._remove(key, this._root, this._comparator);
4172             };
4173             Tree2.prototype._remove = function(i3, t2, comparator) {
4174               var x2;
4175               if (t2 === null)
4176                 return null;
4177               t2 = splay(i3, t2, comparator);
4178               var cmp2 = comparator(i3, t2.key);
4179               if (cmp2 === 0) {
4180                 if (t2.left === null) {
4181                   x2 = t2.right;
4182                 } else {
4183                   x2 = splay(i3, t2.left, comparator);
4184                   x2.right = t2.right;
4185                 }
4186                 this._size--;
4187                 return x2;
4188               }
4189               return t2;
4190             };
4191             Tree2.prototype.pop = function() {
4192               var node = this._root;
4193               if (node) {
4194                 while (node.left) {
4195                   node = node.left;
4196                 }
4197                 this._root = splay(node.key, this._root, this._comparator);
4198                 this._root = this._remove(node.key, this._root, this._comparator);
4199                 return {
4200                   key: node.key,
4201                   data: node.data
4202                 };
4203               }
4204               return null;
4205             };
4206             Tree2.prototype.findStatic = function(key) {
4207               var current = this._root;
4208               var compare = this._comparator;
4209               while (current) {
4210                 var cmp2 = compare(key, current.key);
4211                 if (cmp2 === 0)
4212                   return current;
4213                 else if (cmp2 < 0)
4214                   current = current.left;
4215                 else
4216                   current = current.right;
4217               }
4218               return null;
4219             };
4220             Tree2.prototype.find = function(key) {
4221               if (this._root) {
4222                 this._root = splay(key, this._root, this._comparator);
4223                 if (this._comparator(key, this._root.key) !== 0)
4224                   return null;
4225               }
4226               return this._root;
4227             };
4228             Tree2.prototype.contains = function(key) {
4229               var current = this._root;
4230               var compare = this._comparator;
4231               while (current) {
4232                 var cmp2 = compare(key, current.key);
4233                 if (cmp2 === 0)
4234                   return true;
4235                 else if (cmp2 < 0)
4236                   current = current.left;
4237                 else
4238                   current = current.right;
4239               }
4240               return false;
4241             };
4242             Tree2.prototype.forEach = function(visitor, ctx) {
4243               var current = this._root;
4244               var Q2 = [];
4245               var done = false;
4246               while (!done) {
4247                 if (current !== null) {
4248                   Q2.push(current);
4249                   current = current.left;
4250                 } else {
4251                   if (Q2.length !== 0) {
4252                     current = Q2.pop();
4253                     visitor.call(ctx, current);
4254                     current = current.right;
4255                   } else
4256                     done = true;
4257                 }
4258               }
4259               return this;
4260             };
4261             Tree2.prototype.range = function(low, high, fn, ctx) {
4262               var Q2 = [];
4263               var compare = this._comparator;
4264               var node = this._root;
4265               var cmp2;
4266               while (Q2.length !== 0 || node) {
4267                 if (node) {
4268                   Q2.push(node);
4269                   node = node.left;
4270                 } else {
4271                   node = Q2.pop();
4272                   cmp2 = compare(node.key, high);
4273                   if (cmp2 > 0) {
4274                     break;
4275                   } else if (compare(node.key, low) >= 0) {
4276                     if (fn.call(ctx, node))
4277                       return this;
4278                   }
4279                   node = node.right;
4280                 }
4281               }
4282               return this;
4283             };
4284             Tree2.prototype.keys = function() {
4285               var keys2 = [];
4286               this.forEach(function(_a) {
4287                 var key = _a.key;
4288                 return keys2.push(key);
4289               });
4290               return keys2;
4291             };
4292             Tree2.prototype.values = function() {
4293               var values = [];
4294               this.forEach(function(_a) {
4295                 var data = _a.data;
4296                 return values.push(data);
4297               });
4298               return values;
4299             };
4300             Tree2.prototype.min = function() {
4301               if (this._root)
4302                 return this.minNode(this._root).key;
4303               return null;
4304             };
4305             Tree2.prototype.max = function() {
4306               if (this._root)
4307                 return this.maxNode(this._root).key;
4308               return null;
4309             };
4310             Tree2.prototype.minNode = function(t2) {
4311               if (t2 === void 0) {
4312                 t2 = this._root;
4313               }
4314               if (t2)
4315                 while (t2.left) {
4316                   t2 = t2.left;
4317                 }
4318               return t2;
4319             };
4320             Tree2.prototype.maxNode = function(t2) {
4321               if (t2 === void 0) {
4322                 t2 = this._root;
4323               }
4324               if (t2)
4325                 while (t2.right) {
4326                   t2 = t2.right;
4327                 }
4328               return t2;
4329             };
4330             Tree2.prototype.at = function(index2) {
4331               var current = this._root;
4332               var done = false;
4333               var i3 = 0;
4334               var Q2 = [];
4335               while (!done) {
4336                 if (current) {
4337                   Q2.push(current);
4338                   current = current.left;
4339                 } else {
4340                   if (Q2.length > 0) {
4341                     current = Q2.pop();
4342                     if (i3 === index2)
4343                       return current;
4344                     i3++;
4345                     current = current.right;
4346                   } else
4347                     done = true;
4348                 }
4349               }
4350               return null;
4351             };
4352             Tree2.prototype.next = function(d2) {
4353               var root3 = this._root;
4354               var successor = null;
4355               if (d2.right) {
4356                 successor = d2.right;
4357                 while (successor.left) {
4358                   successor = successor.left;
4359                 }
4360                 return successor;
4361               }
4362               var comparator = this._comparator;
4363               while (root3) {
4364                 var cmp2 = comparator(d2.key, root3.key);
4365                 if (cmp2 === 0)
4366                   break;
4367                 else if (cmp2 < 0) {
4368                   successor = root3;
4369                   root3 = root3.left;
4370                 } else
4371                   root3 = root3.right;
4372               }
4373               return successor;
4374             };
4375             Tree2.prototype.prev = function(d2) {
4376               var root3 = this._root;
4377               var predecessor = null;
4378               if (d2.left !== null) {
4379                 predecessor = d2.left;
4380                 while (predecessor.right) {
4381                   predecessor = predecessor.right;
4382                 }
4383                 return predecessor;
4384               }
4385               var comparator = this._comparator;
4386               while (root3) {
4387                 var cmp2 = comparator(d2.key, root3.key);
4388                 if (cmp2 === 0)
4389                   break;
4390                 else if (cmp2 < 0)
4391                   root3 = root3.left;
4392                 else {
4393                   predecessor = root3;
4394                   root3 = root3.right;
4395                 }
4396               }
4397               return predecessor;
4398             };
4399             Tree2.prototype.clear = function() {
4400               this._root = null;
4401               this._size = 0;
4402               return this;
4403             };
4404             Tree2.prototype.toList = function() {
4405               return toList(this._root);
4406             };
4407             Tree2.prototype.load = function(keys2, values, presort) {
4408               if (values === void 0) {
4409                 values = [];
4410               }
4411               if (presort === void 0) {
4412                 presort = false;
4413               }
4414               var size = keys2.length;
4415               var comparator = this._comparator;
4416               if (presort)
4417                 sort(keys2, values, 0, size - 1, comparator);
4418               if (this._root === null) {
4419                 this._root = loadRecursive(keys2, values, 0, size);
4420                 this._size = size;
4421               } else {
4422                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
4423                 size = this._size + size;
4424                 this._root = sortedListToBST({
4425                   head: mergedList
4426                 }, 0, size);
4427               }
4428               return this;
4429             };
4430             Tree2.prototype.isEmpty = function() {
4431               return this._root === null;
4432             };
4433             Object.defineProperty(Tree2.prototype, "size", {
4434               get: function get4() {
4435                 return this._size;
4436               },
4437               enumerable: true,
4438               configurable: true
4439             });
4440             Object.defineProperty(Tree2.prototype, "root", {
4441               get: function get4() {
4442                 return this._root;
4443               },
4444               enumerable: true,
4445               configurable: true
4446             });
4447             Tree2.prototype.toString = function(printNode) {
4448               if (printNode === void 0) {
4449                 printNode = function printNode2(n3) {
4450                   return String(n3.key);
4451                 };
4452               }
4453               var out = [];
4454               printRow(this._root, "", true, function(v2) {
4455                 return out.push(v2);
4456               }, printNode);
4457               return out.join("");
4458             };
4459             Tree2.prototype.update = function(key, newKey, newData) {
4460               var comparator = this._comparator;
4461               var _a = split(key, this._root, comparator), left = _a.left, right = _a.right;
4462               if (comparator(key, newKey) < 0) {
4463                 right = insert(newKey, newData, right, comparator);
4464               } else {
4465                 left = insert(newKey, newData, left, comparator);
4466               }
4467               this._root = merge2(left, right, comparator);
4468             };
4469             Tree2.prototype.split = function(key) {
4470               return split(key, this._root, this._comparator);
4471             };
4472             return Tree2;
4473           }()
4474         );
4475         function loadRecursive(keys2, values, start2, end) {
4476           var size = end - start2;
4477           if (size > 0) {
4478             var middle = start2 + Math.floor(size / 2);
4479             var key = keys2[middle];
4480             var data = values[middle];
4481             var node = new Node(key, data);
4482             node.left = loadRecursive(keys2, values, start2, middle);
4483             node.right = loadRecursive(keys2, values, middle + 1, end);
4484             return node;
4485           }
4486           return null;
4487         }
4488         function createList(keys2, values) {
4489           var head = new Node(null, null);
4490           var p2 = head;
4491           for (var i3 = 0; i3 < keys2.length; i3++) {
4492             p2 = p2.next = new Node(keys2[i3], values[i3]);
4493           }
4494           p2.next = null;
4495           return head.next;
4496         }
4497         function toList(root3) {
4498           var current = root3;
4499           var Q2 = [];
4500           var done = false;
4501           var head = new Node(null, null);
4502           var p2 = head;
4503           while (!done) {
4504             if (current) {
4505               Q2.push(current);
4506               current = current.left;
4507             } else {
4508               if (Q2.length > 0) {
4509                 current = p2 = p2.next = Q2.pop();
4510                 current = current.right;
4511               } else
4512                 done = true;
4513             }
4514           }
4515           p2.next = null;
4516           return head.next;
4517         }
4518         function sortedListToBST(list, start2, end) {
4519           var size = end - start2;
4520           if (size > 0) {
4521             var middle = start2 + Math.floor(size / 2);
4522             var left = sortedListToBST(list, start2, middle);
4523             var root3 = list.head;
4524             root3.left = left;
4525             list.head = list.head.next;
4526             root3.right = sortedListToBST(list, middle + 1, end);
4527             return root3;
4528           }
4529           return null;
4530         }
4531         function mergeLists(l1, l2, compare) {
4532           var head = new Node(null, null);
4533           var p2 = head;
4534           var p1 = l1;
4535           var p22 = l2;
4536           while (p1 !== null && p22 !== null) {
4537             if (compare(p1.key, p22.key) < 0) {
4538               p2.next = p1;
4539               p1 = p1.next;
4540             } else {
4541               p2.next = p22;
4542               p22 = p22.next;
4543             }
4544             p2 = p2.next;
4545           }
4546           if (p1 !== null) {
4547             p2.next = p1;
4548           } else if (p22 !== null) {
4549             p2.next = p22;
4550           }
4551           return head.next;
4552         }
4553         function sort(keys2, values, left, right, compare) {
4554           if (left >= right)
4555             return;
4556           var pivot = keys2[left + right >> 1];
4557           var i3 = left - 1;
4558           var j3 = right + 1;
4559           while (true) {
4560             do {
4561               i3++;
4562             } while (compare(keys2[i3], pivot) < 0);
4563             do {
4564               j3--;
4565             } while (compare(keys2[j3], pivot) > 0);
4566             if (i3 >= j3)
4567               break;
4568             var tmp = keys2[i3];
4569             keys2[i3] = keys2[j3];
4570             keys2[j3] = tmp;
4571             tmp = values[i3];
4572             values[i3] = values[j3];
4573             values[j3] = tmp;
4574           }
4575           sort(keys2, values, left, j3, compare);
4576           sort(keys2, values, j3 + 1, right, compare);
4577         }
4578         var isInBbox = function isInBbox2(bbox2, point2) {
4579           return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
4580         };
4581         var getBboxOverlap = function getBboxOverlap2(b1, b2) {
4582           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)
4583             return null;
4584           var lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
4585           var upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
4586           var lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
4587           var upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
4588           return {
4589             ll: {
4590               x: lowerX,
4591               y: lowerY
4592             },
4593             ur: {
4594               x: upperX,
4595               y: upperY
4596             }
4597           };
4598         };
4599         var epsilon3 = Number.EPSILON;
4600         if (epsilon3 === void 0)
4601           epsilon3 = Math.pow(2, -52);
4602         var EPSILON_SQ = epsilon3 * epsilon3;
4603         var cmp = function cmp2(a2, b2) {
4604           if (-epsilon3 < a2 && a2 < epsilon3) {
4605             if (-epsilon3 < b2 && b2 < epsilon3) {
4606               return 0;
4607             }
4608           }
4609           var ab = a2 - b2;
4610           if (ab * ab < EPSILON_SQ * a2 * b2) {
4611             return 0;
4612           }
4613           return a2 < b2 ? -1 : 1;
4614         };
4615         var PtRounder = /* @__PURE__ */ function() {
4616           function PtRounder2() {
4617             _classCallCheck(this, PtRounder2);
4618             this.reset();
4619           }
4620           _createClass(PtRounder2, [{
4621             key: "reset",
4622             value: function reset() {
4623               this.xRounder = new CoordRounder();
4624               this.yRounder = new CoordRounder();
4625             }
4626           }, {
4627             key: "round",
4628             value: function round(x2, y2) {
4629               return {
4630                 x: this.xRounder.round(x2),
4631                 y: this.yRounder.round(y2)
4632               };
4633             }
4634           }]);
4635           return PtRounder2;
4636         }();
4637         var CoordRounder = /* @__PURE__ */ function() {
4638           function CoordRounder2() {
4639             _classCallCheck(this, CoordRounder2);
4640             this.tree = new Tree();
4641             this.round(0);
4642           }
4643           _createClass(CoordRounder2, [{
4644             key: "round",
4645             value: function round(coord2) {
4646               var node = this.tree.add(coord2);
4647               var prevNode = this.tree.prev(node);
4648               if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
4649                 this.tree.remove(coord2);
4650                 return prevNode.key;
4651               }
4652               var nextNode = this.tree.next(node);
4653               if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
4654                 this.tree.remove(coord2);
4655                 return nextNode.key;
4656               }
4657               return coord2;
4658             }
4659           }]);
4660           return CoordRounder2;
4661         }();
4662         var rounder = new PtRounder();
4663         var crossProduct = function crossProduct2(a2, b2) {
4664           return a2.x * b2.y - a2.y * b2.x;
4665         };
4666         var dotProduct = function dotProduct2(a2, b2) {
4667           return a2.x * b2.x + a2.y * b2.y;
4668         };
4669         var compareVectorAngles = function compareVectorAngles2(basePt, endPt1, endPt2) {
4670           var v1 = {
4671             x: endPt1.x - basePt.x,
4672             y: endPt1.y - basePt.y
4673           };
4674           var v2 = {
4675             x: endPt2.x - basePt.x,
4676             y: endPt2.y - basePt.y
4677           };
4678           var kross = crossProduct(v1, v2);
4679           return cmp(kross, 0);
4680         };
4681         var length = function length2(v2) {
4682           return Math.sqrt(dotProduct(v2, v2));
4683         };
4684         var sineOfAngle = function sineOfAngle2(pShared, pBase, pAngle) {
4685           var vBase = {
4686             x: pBase.x - pShared.x,
4687             y: pBase.y - pShared.y
4688           };
4689           var vAngle = {
4690             x: pAngle.x - pShared.x,
4691             y: pAngle.y - pShared.y
4692           };
4693           return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4694         };
4695         var cosineOfAngle = function cosineOfAngle2(pShared, pBase, pAngle) {
4696           var vBase = {
4697             x: pBase.x - pShared.x,
4698             y: pBase.y - pShared.y
4699           };
4700           var vAngle = {
4701             x: pAngle.x - pShared.x,
4702             y: pAngle.y - pShared.y
4703           };
4704           return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4705         };
4706         var horizontalIntersection = function horizontalIntersection2(pt2, v2, y2) {
4707           if (v2.y === 0)
4708             return null;
4709           return {
4710             x: pt2.x + v2.x / v2.y * (y2 - pt2.y),
4711             y: y2
4712           };
4713         };
4714         var verticalIntersection = function verticalIntersection2(pt2, v2, x2) {
4715           if (v2.x === 0)
4716             return null;
4717           return {
4718             x: x2,
4719             y: pt2.y + v2.y / v2.x * (x2 - pt2.x)
4720           };
4721         };
4722         var intersection = function intersection2(pt1, v1, pt2, v2) {
4723           if (v1.x === 0)
4724             return verticalIntersection(pt2, v2, pt1.x);
4725           if (v2.x === 0)
4726             return verticalIntersection(pt1, v1, pt2.x);
4727           if (v1.y === 0)
4728             return horizontalIntersection(pt2, v2, pt1.y);
4729           if (v2.y === 0)
4730             return horizontalIntersection(pt1, v1, pt2.y);
4731           var kross = crossProduct(v1, v2);
4732           if (kross == 0)
4733             return null;
4734           var ve2 = {
4735             x: pt2.x - pt1.x,
4736             y: pt2.y - pt1.y
4737           };
4738           var d1 = crossProduct(ve2, v1) / kross;
4739           var d2 = crossProduct(ve2, v2) / kross;
4740           var x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
4741           var y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
4742           var x3 = (x12 + x2) / 2;
4743           var y3 = (y12 + y2) / 2;
4744           return {
4745             x: x3,
4746             y: y3
4747           };
4748         };
4749         var SweepEvent = /* @__PURE__ */ function() {
4750           _createClass(SweepEvent2, null, [{
4751             key: "compare",
4752             // for ordering sweep events in the sweep event queue
4753             value: function compare(a2, b2) {
4754               var ptCmp = SweepEvent2.comparePoints(a2.point, b2.point);
4755               if (ptCmp !== 0)
4756                 return ptCmp;
4757               if (a2.point !== b2.point)
4758                 a2.link(b2);
4759               if (a2.isLeft !== b2.isLeft)
4760                 return a2.isLeft ? 1 : -1;
4761               return Segment.compare(a2.segment, b2.segment);
4762             }
4763             // for ordering points in sweep line order
4764           }, {
4765             key: "comparePoints",
4766             value: function comparePoints(aPt, bPt) {
4767               if (aPt.x < bPt.x)
4768                 return -1;
4769               if (aPt.x > bPt.x)
4770                 return 1;
4771               if (aPt.y < bPt.y)
4772                 return -1;
4773               if (aPt.y > bPt.y)
4774                 return 1;
4775               return 0;
4776             }
4777             // Warning: 'point' input will be modified and re-used (for performance)
4778           }]);
4779           function SweepEvent2(point2, isLeft) {
4780             _classCallCheck(this, SweepEvent2);
4781             if (point2.events === void 0)
4782               point2.events = [this];
4783             else
4784               point2.events.push(this);
4785             this.point = point2;
4786             this.isLeft = isLeft;
4787           }
4788           _createClass(SweepEvent2, [{
4789             key: "link",
4790             value: function link2(other) {
4791               if (other.point === this.point) {
4792                 throw new Error("Tried to link already linked events");
4793               }
4794               var otherEvents = other.point.events;
4795               for (var i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
4796                 var evt = otherEvents[i3];
4797                 this.point.events.push(evt);
4798                 evt.point = this.point;
4799               }
4800               this.checkForConsuming();
4801             }
4802             /* Do a pass over our linked events and check to see if any pair
4803              * of segments match, and should be consumed. */
4804           }, {
4805             key: "checkForConsuming",
4806             value: function checkForConsuming() {
4807               var numEvents = this.point.events.length;
4808               for (var i3 = 0; i3 < numEvents; i3++) {
4809                 var evt1 = this.point.events[i3];
4810                 if (evt1.segment.consumedBy !== void 0)
4811                   continue;
4812                 for (var j3 = i3 + 1; j3 < numEvents; j3++) {
4813                   var evt2 = this.point.events[j3];
4814                   if (evt2.consumedBy !== void 0)
4815                     continue;
4816                   if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
4817                     continue;
4818                   evt1.segment.consume(evt2.segment);
4819                 }
4820               }
4821             }
4822           }, {
4823             key: "getAvailableLinkedEvents",
4824             value: function getAvailableLinkedEvents() {
4825               var events = [];
4826               for (var i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
4827                 var evt = this.point.events[i3];
4828                 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
4829                   events.push(evt);
4830                 }
4831               }
4832               return events;
4833             }
4834             /**
4835              * Returns a comparator function for sorting linked events that will
4836              * favor the event that will give us the smallest left-side angle.
4837              * All ring construction starts as low as possible heading to the right,
4838              * so by always turning left as sharp as possible we'll get polygons
4839              * without uncessary loops & holes.
4840              *
4841              * The comparator function has a compute cache such that it avoids
4842              * re-computing already-computed values.
4843              */
4844           }, {
4845             key: "getLeftmostComparator",
4846             value: function getLeftmostComparator(baseEvent) {
4847               var _this = this;
4848               var cache = /* @__PURE__ */ new Map();
4849               var fillCache = function fillCache2(linkedEvent) {
4850                 var nextEvent = linkedEvent.otherSE;
4851                 cache.set(linkedEvent, {
4852                   sine: sineOfAngle(_this.point, baseEvent.point, nextEvent.point),
4853                   cosine: cosineOfAngle(_this.point, baseEvent.point, nextEvent.point)
4854                 });
4855               };
4856               return function(a2, b2) {
4857                 if (!cache.has(a2))
4858                   fillCache(a2);
4859                 if (!cache.has(b2))
4860                   fillCache(b2);
4861                 var _cache$get = cache.get(a2), asine = _cache$get.sine, acosine = _cache$get.cosine;
4862                 var _cache$get2 = cache.get(b2), bsine = _cache$get2.sine, bcosine = _cache$get2.cosine;
4863                 if (asine >= 0 && bsine >= 0) {
4864                   if (acosine < bcosine)
4865                     return 1;
4866                   if (acosine > bcosine)
4867                     return -1;
4868                   return 0;
4869                 }
4870                 if (asine < 0 && bsine < 0) {
4871                   if (acosine < bcosine)
4872                     return -1;
4873                   if (acosine > bcosine)
4874                     return 1;
4875                   return 0;
4876                 }
4877                 if (bsine < asine)
4878                   return -1;
4879                 if (bsine > asine)
4880                   return 1;
4881                 return 0;
4882               };
4883             }
4884           }]);
4885           return SweepEvent2;
4886         }();
4887         var segmentId = 0;
4888         var Segment = /* @__PURE__ */ function() {
4889           _createClass(Segment2, null, [{
4890             key: "compare",
4891             /* This compare() function is for ordering segments in the sweep
4892              * line tree, and does so according to the following criteria:
4893              *
4894              * Consider the vertical line that lies an infinestimal step to the
4895              * right of the right-more of the two left endpoints of the input
4896              * segments. Imagine slowly moving a point up from negative infinity
4897              * in the increasing y direction. Which of the two segments will that
4898              * point intersect first? That segment comes 'before' the other one.
4899              *
4900              * If neither segment would be intersected by such a line, (if one
4901              * or more of the segments are vertical) then the line to be considered
4902              * is directly on the right-more of the two left inputs.
4903              */
4904             value: function compare(a2, b2) {
4905               var alx = a2.leftSE.point.x;
4906               var blx = b2.leftSE.point.x;
4907               var arx = a2.rightSE.point.x;
4908               var brx = b2.rightSE.point.x;
4909               if (brx < alx)
4910                 return 1;
4911               if (arx < blx)
4912                 return -1;
4913               var aly = a2.leftSE.point.y;
4914               var bly = b2.leftSE.point.y;
4915               var ary = a2.rightSE.point.y;
4916               var bry = b2.rightSE.point.y;
4917               if (alx < blx) {
4918                 if (bly < aly && bly < ary)
4919                   return 1;
4920                 if (bly > aly && bly > ary)
4921                   return -1;
4922                 var aCmpBLeft = a2.comparePoint(b2.leftSE.point);
4923                 if (aCmpBLeft < 0)
4924                   return 1;
4925                 if (aCmpBLeft > 0)
4926                   return -1;
4927                 var bCmpARight = b2.comparePoint(a2.rightSE.point);
4928                 if (bCmpARight !== 0)
4929                   return bCmpARight;
4930                 return -1;
4931               }
4932               if (alx > blx) {
4933                 if (aly < bly && aly < bry)
4934                   return -1;
4935                 if (aly > bly && aly > bry)
4936                   return 1;
4937                 var bCmpALeft = b2.comparePoint(a2.leftSE.point);
4938                 if (bCmpALeft !== 0)
4939                   return bCmpALeft;
4940                 var aCmpBRight = a2.comparePoint(b2.rightSE.point);
4941                 if (aCmpBRight < 0)
4942                   return 1;
4943                 if (aCmpBRight > 0)
4944                   return -1;
4945                 return 1;
4946               }
4947               if (aly < bly)
4948                 return -1;
4949               if (aly > bly)
4950                 return 1;
4951               if (arx < brx) {
4952                 var _bCmpARight = b2.comparePoint(a2.rightSE.point);
4953                 if (_bCmpARight !== 0)
4954                   return _bCmpARight;
4955               }
4956               if (arx > brx) {
4957                 var _aCmpBRight = a2.comparePoint(b2.rightSE.point);
4958                 if (_aCmpBRight < 0)
4959                   return 1;
4960                 if (_aCmpBRight > 0)
4961                   return -1;
4962               }
4963               if (arx !== brx) {
4964                 var ay = ary - aly;
4965                 var ax = arx - alx;
4966                 var by = bry - bly;
4967                 var bx = brx - blx;
4968                 if (ay > ax && by < bx)
4969                   return 1;
4970                 if (ay < ax && by > bx)
4971                   return -1;
4972               }
4973               if (arx > brx)
4974                 return 1;
4975               if (arx < brx)
4976                 return -1;
4977               if (ary < bry)
4978                 return -1;
4979               if (ary > bry)
4980                 return 1;
4981               if (a2.id < b2.id)
4982                 return -1;
4983               if (a2.id > b2.id)
4984                 return 1;
4985               return 0;
4986             }
4987             /* Warning: a reference to ringWindings input will be stored,
4988              *  and possibly will be later modified */
4989           }]);
4990           function Segment2(leftSE, rightSE, rings, windings) {
4991             _classCallCheck(this, Segment2);
4992             this.id = ++segmentId;
4993             this.leftSE = leftSE;
4994             leftSE.segment = this;
4995             leftSE.otherSE = rightSE;
4996             this.rightSE = rightSE;
4997             rightSE.segment = this;
4998             rightSE.otherSE = leftSE;
4999             this.rings = rings;
5000             this.windings = windings;
5001           }
5002           _createClass(Segment2, [{
5003             key: "replaceRightSE",
5004             /* When a segment is split, the rightSE is replaced with a new sweep event */
5005             value: function replaceRightSE(newRightSE) {
5006               this.rightSE = newRightSE;
5007               this.rightSE.segment = this;
5008               this.rightSE.otherSE = this.leftSE;
5009               this.leftSE.otherSE = this.rightSE;
5010             }
5011           }, {
5012             key: "bbox",
5013             value: function bbox2() {
5014               var y12 = this.leftSE.point.y;
5015               var y2 = this.rightSE.point.y;
5016               return {
5017                 ll: {
5018                   x: this.leftSE.point.x,
5019                   y: y12 < y2 ? y12 : y2
5020                 },
5021                 ur: {
5022                   x: this.rightSE.point.x,
5023                   y: y12 > y2 ? y12 : y2
5024                 }
5025               };
5026             }
5027             /* A vector from the left point to the right */
5028           }, {
5029             key: "vector",
5030             value: function vector() {
5031               return {
5032                 x: this.rightSE.point.x - this.leftSE.point.x,
5033                 y: this.rightSE.point.y - this.leftSE.point.y
5034               };
5035             }
5036           }, {
5037             key: "isAnEndpoint",
5038             value: function isAnEndpoint(pt2) {
5039               return pt2.x === this.leftSE.point.x && pt2.y === this.leftSE.point.y || pt2.x === this.rightSE.point.x && pt2.y === this.rightSE.point.y;
5040             }
5041             /* Compare this segment with a point.
5042              *
5043              * A point P is considered to be colinear to a segment if there
5044              * exists a distance D such that if we travel along the segment
5045              * from one * endpoint towards the other a distance D, we find
5046              * ourselves at point P.
5047              *
5048              * Return value indicates:
5049              *
5050              *   1: point lies above the segment (to the left of vertical)
5051              *   0: point is colinear to segment
5052              *  -1: point lies below the segment (to the right of vertical)
5053              */
5054           }, {
5055             key: "comparePoint",
5056             value: function comparePoint(point2) {
5057               if (this.isAnEndpoint(point2))
5058                 return 0;
5059               var lPt = this.leftSE.point;
5060               var rPt = this.rightSE.point;
5061               var v2 = this.vector();
5062               if (lPt.x === rPt.x) {
5063                 if (point2.x === lPt.x)
5064                   return 0;
5065                 return point2.x < lPt.x ? 1 : -1;
5066               }
5067               var yDist = (point2.y - lPt.y) / v2.y;
5068               var xFromYDist = lPt.x + yDist * v2.x;
5069               if (point2.x === xFromYDist)
5070                 return 0;
5071               var xDist = (point2.x - lPt.x) / v2.x;
5072               var yFromXDist = lPt.y + xDist * v2.y;
5073               if (point2.y === yFromXDist)
5074                 return 0;
5075               return point2.y < yFromXDist ? -1 : 1;
5076             }
5077             /**
5078              * Given another segment, returns the first non-trivial intersection
5079              * between the two segments (in terms of sweep line ordering), if it exists.
5080              *
5081              * A 'non-trivial' intersection is one that will cause one or both of the
5082              * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
5083              *
5084              *   * endpoint of segA with endpoint of segB --> trivial
5085              *   * endpoint of segA with point along segB --> non-trivial
5086              *   * endpoint of segB with point along segA --> non-trivial
5087              *   * point along segA with point along segB --> non-trivial
5088              *
5089              * If no non-trivial intersection exists, return null
5090              * Else, return null.
5091              */
5092           }, {
5093             key: "getIntersection",
5094             value: function getIntersection(other) {
5095               var tBbox = this.bbox();
5096               var oBbox = other.bbox();
5097               var bboxOverlap = getBboxOverlap(tBbox, oBbox);
5098               if (bboxOverlap === null)
5099                 return null;
5100               var tlp = this.leftSE.point;
5101               var trp = this.rightSE.point;
5102               var olp = other.leftSE.point;
5103               var orp = other.rightSE.point;
5104               var touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
5105               var touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
5106               var touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
5107               var touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
5108               if (touchesThisLSE && touchesOtherLSE) {
5109                 if (touchesThisRSE && !touchesOtherRSE)
5110                   return trp;
5111                 if (!touchesThisRSE && touchesOtherRSE)
5112                   return orp;
5113                 return null;
5114               }
5115               if (touchesThisLSE) {
5116                 if (touchesOtherRSE) {
5117                   if (tlp.x === orp.x && tlp.y === orp.y)
5118                     return null;
5119                 }
5120                 return tlp;
5121               }
5122               if (touchesOtherLSE) {
5123                 if (touchesThisRSE) {
5124                   if (trp.x === olp.x && trp.y === olp.y)
5125                     return null;
5126                 }
5127                 return olp;
5128               }
5129               if (touchesThisRSE && touchesOtherRSE)
5130                 return null;
5131               if (touchesThisRSE)
5132                 return trp;
5133               if (touchesOtherRSE)
5134                 return orp;
5135               var pt2 = intersection(tlp, this.vector(), olp, other.vector());
5136               if (pt2 === null)
5137                 return null;
5138               if (!isInBbox(bboxOverlap, pt2))
5139                 return null;
5140               return rounder.round(pt2.x, pt2.y);
5141             }
5142             /**
5143              * Split the given segment into multiple segments on the given points.
5144              *  * Each existing segment will retain its leftSE and a new rightSE will be
5145              *    generated for it.
5146              *  * A new segment will be generated which will adopt the original segment's
5147              *    rightSE, and a new leftSE will be generated for it.
5148              *  * If there are more than two points given to split on, new segments
5149              *    in the middle will be generated with new leftSE and rightSE's.
5150              *  * An array of the newly generated SweepEvents will be returned.
5151              *
5152              * Warning: input array of points is modified
5153              */
5154           }, {
5155             key: "split",
5156             value: function split2(point2) {
5157               var newEvents = [];
5158               var alreadyLinked = point2.events !== void 0;
5159               var newLeftSE = new SweepEvent(point2, true);
5160               var newRightSE = new SweepEvent(point2, false);
5161               var oldRightSE = this.rightSE;
5162               this.replaceRightSE(newRightSE);
5163               newEvents.push(newRightSE);
5164               newEvents.push(newLeftSE);
5165               var newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
5166               if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
5167                 newSeg.swapEvents();
5168               }
5169               if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
5170                 this.swapEvents();
5171               }
5172               if (alreadyLinked) {
5173                 newLeftSE.checkForConsuming();
5174                 newRightSE.checkForConsuming();
5175               }
5176               return newEvents;
5177             }
5178             /* Swap which event is left and right */
5179           }, {
5180             key: "swapEvents",
5181             value: function swapEvents() {
5182               var tmpEvt = this.rightSE;
5183               this.rightSE = this.leftSE;
5184               this.leftSE = tmpEvt;
5185               this.leftSE.isLeft = true;
5186               this.rightSE.isLeft = false;
5187               for (var i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
5188                 this.windings[i3] *= -1;
5189               }
5190             }
5191             /* Consume another segment. We take their rings under our wing
5192              * and mark them as consumed. Use for perfectly overlapping segments */
5193           }, {
5194             key: "consume",
5195             value: function consume(other) {
5196               var consumer = this;
5197               var consumee = other;
5198               while (consumer.consumedBy) {
5199                 consumer = consumer.consumedBy;
5200               }
5201               while (consumee.consumedBy) {
5202                 consumee = consumee.consumedBy;
5203               }
5204               var cmp2 = Segment2.compare(consumer, consumee);
5205               if (cmp2 === 0)
5206                 return;
5207               if (cmp2 > 0) {
5208                 var tmp = consumer;
5209                 consumer = consumee;
5210                 consumee = tmp;
5211               }
5212               if (consumer.prev === consumee) {
5213                 var _tmp = consumer;
5214                 consumer = consumee;
5215                 consumee = _tmp;
5216               }
5217               for (var i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
5218                 var ring = consumee.rings[i3];
5219                 var winding = consumee.windings[i3];
5220                 var index2 = consumer.rings.indexOf(ring);
5221                 if (index2 === -1) {
5222                   consumer.rings.push(ring);
5223                   consumer.windings.push(winding);
5224                 } else
5225                   consumer.windings[index2] += winding;
5226               }
5227               consumee.rings = null;
5228               consumee.windings = null;
5229               consumee.consumedBy = consumer;
5230               consumee.leftSE.consumedBy = consumer.leftSE;
5231               consumee.rightSE.consumedBy = consumer.rightSE;
5232             }
5233             /* The first segment previous segment chain that is in the result */
5234           }, {
5235             key: "prevInResult",
5236             value: function prevInResult() {
5237               if (this._prevInResult !== void 0)
5238                 return this._prevInResult;
5239               if (!this.prev)
5240                 this._prevInResult = null;
5241               else if (this.prev.isInResult())
5242                 this._prevInResult = this.prev;
5243               else
5244                 this._prevInResult = this.prev.prevInResult();
5245               return this._prevInResult;
5246             }
5247           }, {
5248             key: "beforeState",
5249             value: function beforeState() {
5250               if (this._beforeState !== void 0)
5251                 return this._beforeState;
5252               if (!this.prev)
5253                 this._beforeState = {
5254                   rings: [],
5255                   windings: [],
5256                   multiPolys: []
5257                 };
5258               else {
5259                 var seg = this.prev.consumedBy || this.prev;
5260                 this._beforeState = seg.afterState();
5261               }
5262               return this._beforeState;
5263             }
5264           }, {
5265             key: "afterState",
5266             value: function afterState() {
5267               if (this._afterState !== void 0)
5268                 return this._afterState;
5269               var beforeState = this.beforeState();
5270               this._afterState = {
5271                 rings: beforeState.rings.slice(0),
5272                 windings: beforeState.windings.slice(0),
5273                 multiPolys: []
5274               };
5275               var ringsAfter = this._afterState.rings;
5276               var windingsAfter = this._afterState.windings;
5277               var mpsAfter = this._afterState.multiPolys;
5278               for (var i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
5279                 var ring = this.rings[i3];
5280                 var winding = this.windings[i3];
5281                 var index2 = ringsAfter.indexOf(ring);
5282                 if (index2 === -1) {
5283                   ringsAfter.push(ring);
5284                   windingsAfter.push(winding);
5285                 } else
5286                   windingsAfter[index2] += winding;
5287               }
5288               var polysAfter = [];
5289               var polysExclude = [];
5290               for (var _i = 0, _iMax = ringsAfter.length; _i < _iMax; _i++) {
5291                 if (windingsAfter[_i] === 0)
5292                   continue;
5293                 var _ring = ringsAfter[_i];
5294                 var poly = _ring.poly;
5295                 if (polysExclude.indexOf(poly) !== -1)
5296                   continue;
5297                 if (_ring.isExterior)
5298                   polysAfter.push(poly);
5299                 else {
5300                   if (polysExclude.indexOf(poly) === -1)
5301                     polysExclude.push(poly);
5302                   var _index = polysAfter.indexOf(_ring.poly);
5303                   if (_index !== -1)
5304                     polysAfter.splice(_index, 1);
5305                 }
5306               }
5307               for (var _i2 = 0, _iMax2 = polysAfter.length; _i2 < _iMax2; _i2++) {
5308                 var mp = polysAfter[_i2].multiPoly;
5309                 if (mpsAfter.indexOf(mp) === -1)
5310                   mpsAfter.push(mp);
5311               }
5312               return this._afterState;
5313             }
5314             /* Is this segment part of the final result? */
5315           }, {
5316             key: "isInResult",
5317             value: function isInResult() {
5318               if (this.consumedBy)
5319                 return false;
5320               if (this._isInResult !== void 0)
5321                 return this._isInResult;
5322               var mpsBefore = this.beforeState().multiPolys;
5323               var mpsAfter = this.afterState().multiPolys;
5324               switch (operation.type) {
5325                 case "union": {
5326                   var noBefores = mpsBefore.length === 0;
5327                   var noAfters = mpsAfter.length === 0;
5328                   this._isInResult = noBefores !== noAfters;
5329                   break;
5330                 }
5331                 case "intersection": {
5332                   var least;
5333                   var most;
5334                   if (mpsBefore.length < mpsAfter.length) {
5335                     least = mpsBefore.length;
5336                     most = mpsAfter.length;
5337                   } else {
5338                     least = mpsAfter.length;
5339                     most = mpsBefore.length;
5340                   }
5341                   this._isInResult = most === operation.numMultiPolys && least < most;
5342                   break;
5343                 }
5344                 case "xor": {
5345                   var diff = Math.abs(mpsBefore.length - mpsAfter.length);
5346                   this._isInResult = diff % 2 === 1;
5347                   break;
5348                 }
5349                 case "difference": {
5350                   var isJustSubject = function isJustSubject2(mps) {
5351                     return mps.length === 1 && mps[0].isSubject;
5352                   };
5353                   this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
5354                   break;
5355                 }
5356                 default:
5357                   throw new Error("Unrecognized operation type found ".concat(operation.type));
5358               }
5359               return this._isInResult;
5360             }
5361           }], [{
5362             key: "fromRing",
5363             value: function fromRing(pt1, pt2, ring) {
5364               var leftPt, rightPt, winding;
5365               var cmpPts = SweepEvent.comparePoints(pt1, pt2);
5366               if (cmpPts < 0) {
5367                 leftPt = pt1;
5368                 rightPt = pt2;
5369                 winding = 1;
5370               } else if (cmpPts > 0) {
5371                 leftPt = pt2;
5372                 rightPt = pt1;
5373                 winding = -1;
5374               } else
5375                 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
5376               var leftSE = new SweepEvent(leftPt, true);
5377               var rightSE = new SweepEvent(rightPt, false);
5378               return new Segment2(leftSE, rightSE, [ring], [winding]);
5379             }
5380           }]);
5381           return Segment2;
5382         }();
5383         var RingIn = /* @__PURE__ */ function() {
5384           function RingIn2(geomRing, poly, isExterior) {
5385             _classCallCheck(this, RingIn2);
5386             if (!Array.isArray(geomRing) || geomRing.length === 0) {
5387               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5388             }
5389             this.poly = poly;
5390             this.isExterior = isExterior;
5391             this.segments = [];
5392             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
5393               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5394             }
5395             var firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
5396             this.bbox = {
5397               ll: {
5398                 x: firstPoint.x,
5399                 y: firstPoint.y
5400               },
5401               ur: {
5402                 x: firstPoint.x,
5403                 y: firstPoint.y
5404               }
5405             };
5406             var prevPoint = firstPoint;
5407             for (var i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
5408               if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
5409                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5410               }
5411               var point2 = rounder.round(geomRing[i3][0], geomRing[i3][1]);
5412               if (point2.x === prevPoint.x && point2.y === prevPoint.y)
5413                 continue;
5414               this.segments.push(Segment.fromRing(prevPoint, point2, this));
5415               if (point2.x < this.bbox.ll.x)
5416                 this.bbox.ll.x = point2.x;
5417               if (point2.y < this.bbox.ll.y)
5418                 this.bbox.ll.y = point2.y;
5419               if (point2.x > this.bbox.ur.x)
5420                 this.bbox.ur.x = point2.x;
5421               if (point2.y > this.bbox.ur.y)
5422                 this.bbox.ur.y = point2.y;
5423               prevPoint = point2;
5424             }
5425             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
5426               this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
5427             }
5428           }
5429           _createClass(RingIn2, [{
5430             key: "getSweepEvents",
5431             value: function getSweepEvents() {
5432               var sweepEvents = [];
5433               for (var i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
5434                 var segment = this.segments[i3];
5435                 sweepEvents.push(segment.leftSE);
5436                 sweepEvents.push(segment.rightSE);
5437               }
5438               return sweepEvents;
5439             }
5440           }]);
5441           return RingIn2;
5442         }();
5443         var PolyIn = /* @__PURE__ */ function() {
5444           function PolyIn2(geomPoly, multiPoly) {
5445             _classCallCheck(this, PolyIn2);
5446             if (!Array.isArray(geomPoly)) {
5447               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5448             }
5449             this.exteriorRing = new RingIn(geomPoly[0], this, true);
5450             this.bbox = {
5451               ll: {
5452                 x: this.exteriorRing.bbox.ll.x,
5453                 y: this.exteriorRing.bbox.ll.y
5454               },
5455               ur: {
5456                 x: this.exteriorRing.bbox.ur.x,
5457                 y: this.exteriorRing.bbox.ur.y
5458               }
5459             };
5460             this.interiorRings = [];
5461             for (var i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
5462               var ring = new RingIn(geomPoly[i3], this, false);
5463               if (ring.bbox.ll.x < this.bbox.ll.x)
5464                 this.bbox.ll.x = ring.bbox.ll.x;
5465               if (ring.bbox.ll.y < this.bbox.ll.y)
5466                 this.bbox.ll.y = ring.bbox.ll.y;
5467               if (ring.bbox.ur.x > this.bbox.ur.x)
5468                 this.bbox.ur.x = ring.bbox.ur.x;
5469               if (ring.bbox.ur.y > this.bbox.ur.y)
5470                 this.bbox.ur.y = ring.bbox.ur.y;
5471               this.interiorRings.push(ring);
5472             }
5473             this.multiPoly = multiPoly;
5474           }
5475           _createClass(PolyIn2, [{
5476             key: "getSweepEvents",
5477             value: function getSweepEvents() {
5478               var sweepEvents = this.exteriorRing.getSweepEvents();
5479               for (var i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
5480                 var ringSweepEvents = this.interiorRings[i3].getSweepEvents();
5481                 for (var j3 = 0, jMax = ringSweepEvents.length; j3 < jMax; j3++) {
5482                   sweepEvents.push(ringSweepEvents[j3]);
5483                 }
5484               }
5485               return sweepEvents;
5486             }
5487           }]);
5488           return PolyIn2;
5489         }();
5490         var MultiPolyIn = /* @__PURE__ */ function() {
5491           function MultiPolyIn2(geom, isSubject) {
5492             _classCallCheck(this, MultiPolyIn2);
5493             if (!Array.isArray(geom)) {
5494               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5495             }
5496             try {
5497               if (typeof geom[0][0][0] === "number")
5498                 geom = [geom];
5499             } catch (ex) {
5500             }
5501             this.polys = [];
5502             this.bbox = {
5503               ll: {
5504                 x: Number.POSITIVE_INFINITY,
5505                 y: Number.POSITIVE_INFINITY
5506               },
5507               ur: {
5508                 x: Number.NEGATIVE_INFINITY,
5509                 y: Number.NEGATIVE_INFINITY
5510               }
5511             };
5512             for (var i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
5513               var poly = new PolyIn(geom[i3], this);
5514               if (poly.bbox.ll.x < this.bbox.ll.x)
5515                 this.bbox.ll.x = poly.bbox.ll.x;
5516               if (poly.bbox.ll.y < this.bbox.ll.y)
5517                 this.bbox.ll.y = poly.bbox.ll.y;
5518               if (poly.bbox.ur.x > this.bbox.ur.x)
5519                 this.bbox.ur.x = poly.bbox.ur.x;
5520               if (poly.bbox.ur.y > this.bbox.ur.y)
5521                 this.bbox.ur.y = poly.bbox.ur.y;
5522               this.polys.push(poly);
5523             }
5524             this.isSubject = isSubject;
5525           }
5526           _createClass(MultiPolyIn2, [{
5527             key: "getSweepEvents",
5528             value: function getSweepEvents() {
5529               var sweepEvents = [];
5530               for (var i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
5531                 var polySweepEvents = this.polys[i3].getSweepEvents();
5532                 for (var j3 = 0, jMax = polySweepEvents.length; j3 < jMax; j3++) {
5533                   sweepEvents.push(polySweepEvents[j3]);
5534                 }
5535               }
5536               return sweepEvents;
5537             }
5538           }]);
5539           return MultiPolyIn2;
5540         }();
5541         var RingOut = /* @__PURE__ */ function() {
5542           _createClass(RingOut2, null, [{
5543             key: "factory",
5544             /* Given the segments from the sweep line pass, compute & return a series
5545              * of closed rings from all the segments marked to be part of the result */
5546             value: function factory(allSegments) {
5547               var ringsOut = [];
5548               for (var i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
5549                 var segment = allSegments[i3];
5550                 if (!segment.isInResult() || segment.ringOut)
5551                   continue;
5552                 var prevEvent = null;
5553                 var event = segment.leftSE;
5554                 var nextEvent = segment.rightSE;
5555                 var events = [event];
5556                 var startingPoint = event.point;
5557                 var intersectionLEs = [];
5558                 while (true) {
5559                   prevEvent = event;
5560                   event = nextEvent;
5561                   events.push(event);
5562                   if (event.point === startingPoint)
5563                     break;
5564                   while (true) {
5565                     var availableLEs = event.getAvailableLinkedEvents();
5566                     if (availableLEs.length === 0) {
5567                       var firstPt = events[0].point;
5568                       var lastPt = events[events.length - 1].point;
5569                       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, "]."));
5570                     }
5571                     if (availableLEs.length === 1) {
5572                       nextEvent = availableLEs[0].otherSE;
5573                       break;
5574                     }
5575                     var indexLE = null;
5576                     for (var j3 = 0, jMax = intersectionLEs.length; j3 < jMax; j3++) {
5577                       if (intersectionLEs[j3].point === event.point) {
5578                         indexLE = j3;
5579                         break;
5580                       }
5581                     }
5582                     if (indexLE !== null) {
5583                       var intersectionLE = intersectionLEs.splice(indexLE)[0];
5584                       var ringEvents = events.splice(intersectionLE.index);
5585                       ringEvents.unshift(ringEvents[0].otherSE);
5586                       ringsOut.push(new RingOut2(ringEvents.reverse()));
5587                       continue;
5588                     }
5589                     intersectionLEs.push({
5590                       index: events.length,
5591                       point: event.point
5592                     });
5593                     var comparator = event.getLeftmostComparator(prevEvent);
5594                     nextEvent = availableLEs.sort(comparator)[0].otherSE;
5595                     break;
5596                   }
5597                 }
5598                 ringsOut.push(new RingOut2(events));
5599               }
5600               return ringsOut;
5601             }
5602           }]);
5603           function RingOut2(events) {
5604             _classCallCheck(this, RingOut2);
5605             this.events = events;
5606             for (var i3 = 0, iMax = events.length; i3 < iMax; i3++) {
5607               events[i3].segment.ringOut = this;
5608             }
5609             this.poly = null;
5610           }
5611           _createClass(RingOut2, [{
5612             key: "getGeom",
5613             value: function getGeom2() {
5614               var prevPt = this.events[0].point;
5615               var points = [prevPt];
5616               for (var i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
5617                 var _pt = this.events[i3].point;
5618                 var _nextPt = this.events[i3 + 1].point;
5619                 if (compareVectorAngles(_pt, prevPt, _nextPt) === 0)
5620                   continue;
5621                 points.push(_pt);
5622                 prevPt = _pt;
5623               }
5624               if (points.length === 1)
5625                 return null;
5626               var pt2 = points[0];
5627               var nextPt = points[1];
5628               if (compareVectorAngles(pt2, prevPt, nextPt) === 0)
5629                 points.shift();
5630               points.push(points[0]);
5631               var step = this.isExteriorRing() ? 1 : -1;
5632               var iStart = this.isExteriorRing() ? 0 : points.length - 1;
5633               var iEnd = this.isExteriorRing() ? points.length : -1;
5634               var orderedPoints = [];
5635               for (var _i = iStart; _i != iEnd; _i += step) {
5636                 orderedPoints.push([points[_i].x, points[_i].y]);
5637               }
5638               return orderedPoints;
5639             }
5640           }, {
5641             key: "isExteriorRing",
5642             value: function isExteriorRing() {
5643               if (this._isExteriorRing === void 0) {
5644                 var enclosing = this.enclosingRing();
5645                 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
5646               }
5647               return this._isExteriorRing;
5648             }
5649           }, {
5650             key: "enclosingRing",
5651             value: function enclosingRing() {
5652               if (this._enclosingRing === void 0) {
5653                 this._enclosingRing = this._calcEnclosingRing();
5654               }
5655               return this._enclosingRing;
5656             }
5657             /* Returns the ring that encloses this one, if any */
5658           }, {
5659             key: "_calcEnclosingRing",
5660             value: function _calcEnclosingRing() {
5661               var leftMostEvt = this.events[0];
5662               for (var i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
5663                 var evt = this.events[i3];
5664                 if (SweepEvent.compare(leftMostEvt, evt) > 0)
5665                   leftMostEvt = evt;
5666               }
5667               var prevSeg = leftMostEvt.segment.prevInResult();
5668               var prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5669               while (true) {
5670                 if (!prevSeg)
5671                   return null;
5672                 if (!prevPrevSeg)
5673                   return prevSeg.ringOut;
5674                 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
5675                   if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
5676                     return prevSeg.ringOut;
5677                   } else
5678                     return prevSeg.ringOut.enclosingRing();
5679                 }
5680                 prevSeg = prevPrevSeg.prevInResult();
5681                 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5682               }
5683             }
5684           }]);
5685           return RingOut2;
5686         }();
5687         var PolyOut = /* @__PURE__ */ function() {
5688           function PolyOut2(exteriorRing) {
5689             _classCallCheck(this, PolyOut2);
5690             this.exteriorRing = exteriorRing;
5691             exteriorRing.poly = this;
5692             this.interiorRings = [];
5693           }
5694           _createClass(PolyOut2, [{
5695             key: "addInterior",
5696             value: function addInterior(ring) {
5697               this.interiorRings.push(ring);
5698               ring.poly = this;
5699             }
5700           }, {
5701             key: "getGeom",
5702             value: function getGeom2() {
5703               var geom = [this.exteriorRing.getGeom()];
5704               if (geom[0] === null)
5705                 return null;
5706               for (var i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
5707                 var ringGeom = this.interiorRings[i3].getGeom();
5708                 if (ringGeom === null)
5709                   continue;
5710                 geom.push(ringGeom);
5711               }
5712               return geom;
5713             }
5714           }]);
5715           return PolyOut2;
5716         }();
5717         var MultiPolyOut = /* @__PURE__ */ function() {
5718           function MultiPolyOut2(rings) {
5719             _classCallCheck(this, MultiPolyOut2);
5720             this.rings = rings;
5721             this.polys = this._composePolys(rings);
5722           }
5723           _createClass(MultiPolyOut2, [{
5724             key: "getGeom",
5725             value: function getGeom2() {
5726               var geom = [];
5727               for (var i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
5728                 var polyGeom = this.polys[i3].getGeom();
5729                 if (polyGeom === null)
5730                   continue;
5731                 geom.push(polyGeom);
5732               }
5733               return geom;
5734             }
5735           }, {
5736             key: "_composePolys",
5737             value: function _composePolys(rings) {
5738               var polys = [];
5739               for (var i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
5740                 var ring = rings[i3];
5741                 if (ring.poly)
5742                   continue;
5743                 if (ring.isExteriorRing())
5744                   polys.push(new PolyOut(ring));
5745                 else {
5746                   var enclosingRing = ring.enclosingRing();
5747                   if (!enclosingRing.poly)
5748                     polys.push(new PolyOut(enclosingRing));
5749                   enclosingRing.poly.addInterior(ring);
5750                 }
5751               }
5752               return polys;
5753             }
5754           }]);
5755           return MultiPolyOut2;
5756         }();
5757         var SweepLine = /* @__PURE__ */ function() {
5758           function SweepLine2(queue) {
5759             var comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment.compare;
5760             _classCallCheck(this, SweepLine2);
5761             this.queue = queue;
5762             this.tree = new Tree(comparator);
5763             this.segments = [];
5764           }
5765           _createClass(SweepLine2, [{
5766             key: "process",
5767             value: function process2(event) {
5768               var segment = event.segment;
5769               var newEvents = [];
5770               if (event.consumedBy) {
5771                 if (event.isLeft)
5772                   this.queue.remove(event.otherSE);
5773                 else
5774                   this.tree.remove(segment);
5775                 return newEvents;
5776               }
5777               var node = event.isLeft ? this.tree.insert(segment) : this.tree.find(segment);
5778               if (!node)
5779                 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.");
5780               var prevNode = node;
5781               var nextNode = node;
5782               var prevSeg = void 0;
5783               var nextSeg = void 0;
5784               while (prevSeg === void 0) {
5785                 prevNode = this.tree.prev(prevNode);
5786                 if (prevNode === null)
5787                   prevSeg = null;
5788                 else if (prevNode.key.consumedBy === void 0)
5789                   prevSeg = prevNode.key;
5790               }
5791               while (nextSeg === void 0) {
5792                 nextNode = this.tree.next(nextNode);
5793                 if (nextNode === null)
5794                   nextSeg = null;
5795                 else if (nextNode.key.consumedBy === void 0)
5796                   nextSeg = nextNode.key;
5797               }
5798               if (event.isLeft) {
5799                 var prevMySplitter = null;
5800                 if (prevSeg) {
5801                   var prevInter = prevSeg.getIntersection(segment);
5802                   if (prevInter !== null) {
5803                     if (!segment.isAnEndpoint(prevInter))
5804                       prevMySplitter = prevInter;
5805                     if (!prevSeg.isAnEndpoint(prevInter)) {
5806                       var newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
5807                       for (var i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
5808                         newEvents.push(newEventsFromSplit[i3]);
5809                       }
5810                     }
5811                   }
5812                 }
5813                 var nextMySplitter = null;
5814                 if (nextSeg) {
5815                   var nextInter = nextSeg.getIntersection(segment);
5816                   if (nextInter !== null) {
5817                     if (!segment.isAnEndpoint(nextInter))
5818                       nextMySplitter = nextInter;
5819                     if (!nextSeg.isAnEndpoint(nextInter)) {
5820                       var _newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
5821                       for (var _i = 0, _iMax = _newEventsFromSplit.length; _i < _iMax; _i++) {
5822                         newEvents.push(_newEventsFromSplit[_i]);
5823                       }
5824                     }
5825                   }
5826                 }
5827                 if (prevMySplitter !== null || nextMySplitter !== null) {
5828                   var mySplitter = null;
5829                   if (prevMySplitter === null)
5830                     mySplitter = nextMySplitter;
5831                   else if (nextMySplitter === null)
5832                     mySplitter = prevMySplitter;
5833                   else {
5834                     var cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
5835                     mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
5836                   }
5837                   this.queue.remove(segment.rightSE);
5838                   newEvents.push(segment.rightSE);
5839                   var _newEventsFromSplit2 = segment.split(mySplitter);
5840                   for (var _i2 = 0, _iMax2 = _newEventsFromSplit2.length; _i2 < _iMax2; _i2++) {
5841                     newEvents.push(_newEventsFromSplit2[_i2]);
5842                   }
5843                 }
5844                 if (newEvents.length > 0) {
5845                   this.tree.remove(segment);
5846                   newEvents.push(event);
5847                 } else {
5848                   this.segments.push(segment);
5849                   segment.prev = prevSeg;
5850                 }
5851               } else {
5852                 if (prevSeg && nextSeg) {
5853                   var inter = prevSeg.getIntersection(nextSeg);
5854                   if (inter !== null) {
5855                     if (!prevSeg.isAnEndpoint(inter)) {
5856                       var _newEventsFromSplit3 = this._splitSafely(prevSeg, inter);
5857                       for (var _i3 = 0, _iMax3 = _newEventsFromSplit3.length; _i3 < _iMax3; _i3++) {
5858                         newEvents.push(_newEventsFromSplit3[_i3]);
5859                       }
5860                     }
5861                     if (!nextSeg.isAnEndpoint(inter)) {
5862                       var _newEventsFromSplit4 = this._splitSafely(nextSeg, inter);
5863                       for (var _i4 = 0, _iMax4 = _newEventsFromSplit4.length; _i4 < _iMax4; _i4++) {
5864                         newEvents.push(_newEventsFromSplit4[_i4]);
5865                       }
5866                     }
5867                   }
5868                 }
5869                 this.tree.remove(segment);
5870               }
5871               return newEvents;
5872             }
5873             /* Safely split a segment that is currently in the datastructures
5874              * IE - a segment other than the one that is currently being processed. */
5875           }, {
5876             key: "_splitSafely",
5877             value: function _splitSafely(seg, pt2) {
5878               this.tree.remove(seg);
5879               var rightSE = seg.rightSE;
5880               this.queue.remove(rightSE);
5881               var newEvents = seg.split(pt2);
5882               newEvents.push(rightSE);
5883               if (seg.consumedBy === void 0)
5884                 this.tree.insert(seg);
5885               return newEvents;
5886             }
5887           }]);
5888           return SweepLine2;
5889         }();
5890         var POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
5891         var POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
5892         var Operation = /* @__PURE__ */ function() {
5893           function Operation2() {
5894             _classCallCheck(this, Operation2);
5895           }
5896           _createClass(Operation2, [{
5897             key: "run",
5898             value: function run(type2, geom, moreGeoms) {
5899               operation.type = type2;
5900               rounder.reset();
5901               var multipolys = [new MultiPolyIn(geom, true)];
5902               for (var i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
5903                 multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
5904               }
5905               operation.numMultiPolys = multipolys.length;
5906               if (operation.type === "difference") {
5907                 var subject = multipolys[0];
5908                 var _i = 1;
5909                 while (_i < multipolys.length) {
5910                   if (getBboxOverlap(multipolys[_i].bbox, subject.bbox) !== null)
5911                     _i++;
5912                   else
5913                     multipolys.splice(_i, 1);
5914                 }
5915               }
5916               if (operation.type === "intersection") {
5917                 for (var _i2 = 0, _iMax = multipolys.length; _i2 < _iMax; _i2++) {
5918                   var mpA = multipolys[_i2];
5919                   for (var j3 = _i2 + 1, jMax = multipolys.length; j3 < jMax; j3++) {
5920                     if (getBboxOverlap(mpA.bbox, multipolys[j3].bbox) === null)
5921                       return [];
5922                   }
5923                 }
5924               }
5925               var queue = new Tree(SweepEvent.compare);
5926               for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) {
5927                 var sweepEvents = multipolys[_i3].getSweepEvents();
5928                 for (var _j = 0, _jMax = sweepEvents.length; _j < _jMax; _j++) {
5929                   queue.insert(sweepEvents[_j]);
5930                   if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5931                     throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");
5932                   }
5933                 }
5934               }
5935               var sweepLine = new SweepLine(queue);
5936               var prevQueueSize = queue.size;
5937               var node = queue.pop();
5938               while (node) {
5939                 var evt = node.key;
5940                 if (queue.size === prevQueueSize) {
5941                   var seg = evt.segment;
5942                   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.");
5943                 }
5944                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
5945                   throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");
5946                 }
5947                 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
5948                   throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");
5949                 }
5950                 var newEvents = sweepLine.process(evt);
5951                 for (var _i4 = 0, _iMax3 = newEvents.length; _i4 < _iMax3; _i4++) {
5952                   var _evt = newEvents[_i4];
5953                   if (_evt.consumedBy === void 0)
5954                     queue.insert(_evt);
5955                 }
5956                 prevQueueSize = queue.size;
5957                 node = queue.pop();
5958               }
5959               rounder.reset();
5960               var ringsOut = RingOut.factory(sweepLine.segments);
5961               var result = new MultiPolyOut(ringsOut);
5962               return result.getGeom();
5963             }
5964           }]);
5965           return Operation2;
5966         }();
5967         var operation = new Operation();
5968         var union = function union2(geom) {
5969           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5970             moreGeoms[_key - 1] = arguments[_key];
5971           }
5972           return operation.run("union", geom, moreGeoms);
5973         };
5974         var intersection$1 = function intersection2(geom) {
5975           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
5976             moreGeoms[_key2 - 1] = arguments[_key2];
5977           }
5978           return operation.run("intersection", geom, moreGeoms);
5979         };
5980         var xor = function xor2(geom) {
5981           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
5982             moreGeoms[_key3 - 1] = arguments[_key3];
5983           }
5984           return operation.run("xor", geom, moreGeoms);
5985         };
5986         var difference = function difference2(subjectGeom) {
5987           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
5988             clippingGeoms[_key4 - 1] = arguments[_key4];
5989           }
5990           return operation.run("difference", subjectGeom, clippingGeoms);
5991         };
5992         var index = {
5993           union,
5994           intersection: intersection$1,
5995           xor,
5996           difference
5997         };
5998         return index;
5999       });
6000     }
6001   });
6002
6003   // node_modules/geojson-precision/index.js
6004   var require_geojson_precision = __commonJS({
6005     "node_modules/geojson-precision/index.js"(exports2, module2) {
6006       (function() {
6007         function parse(t2, coordinatePrecision, extrasPrecision) {
6008           function point2(p2) {
6009             return p2.map(function(e3, index) {
6010               if (index < 2) {
6011                 return 1 * e3.toFixed(coordinatePrecision);
6012               } else {
6013                 return 1 * e3.toFixed(extrasPrecision);
6014               }
6015             });
6016           }
6017           function multi(l2) {
6018             return l2.map(point2);
6019           }
6020           function poly(p2) {
6021             return p2.map(multi);
6022           }
6023           function multiPoly(m2) {
6024             return m2.map(poly);
6025           }
6026           function geometry(obj) {
6027             if (!obj) {
6028               return {};
6029             }
6030             switch (obj.type) {
6031               case "Point":
6032                 obj.coordinates = point2(obj.coordinates);
6033                 return obj;
6034               case "LineString":
6035               case "MultiPoint":
6036                 obj.coordinates = multi(obj.coordinates);
6037                 return obj;
6038               case "Polygon":
6039               case "MultiLineString":
6040                 obj.coordinates = poly(obj.coordinates);
6041                 return obj;
6042               case "MultiPolygon":
6043                 obj.coordinates = multiPoly(obj.coordinates);
6044                 return obj;
6045               case "GeometryCollection":
6046                 obj.geometries = obj.geometries.map(geometry);
6047                 return obj;
6048               default:
6049                 return {};
6050             }
6051           }
6052           function feature3(obj) {
6053             obj.geometry = geometry(obj.geometry);
6054             return obj;
6055           }
6056           function featureCollection(f3) {
6057             f3.features = f3.features.map(feature3);
6058             return f3;
6059           }
6060           function geometryCollection(g3) {
6061             g3.geometries = g3.geometries.map(geometry);
6062             return g3;
6063           }
6064           if (!t2) {
6065             return t2;
6066           }
6067           switch (t2.type) {
6068             case "Feature":
6069               return feature3(t2);
6070             case "GeometryCollection":
6071               return geometryCollection(t2);
6072             case "FeatureCollection":
6073               return featureCollection(t2);
6074             case "Point":
6075             case "LineString":
6076             case "Polygon":
6077             case "MultiPoint":
6078             case "MultiPolygon":
6079             case "MultiLineString":
6080               return geometry(t2);
6081             default:
6082               return t2;
6083           }
6084         }
6085         module2.exports = parse;
6086         module2.exports.parse = parse;
6087       })();
6088     }
6089   });
6090
6091   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
6092   var require_json_stringify_pretty_compact = __commonJS({
6093     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
6094       function isObject3(obj) {
6095         return typeof obj === "object" && obj !== null;
6096       }
6097       function forEach(obj, cb) {
6098         if (Array.isArray(obj)) {
6099           obj.forEach(cb);
6100         } else if (isObject3(obj)) {
6101           Object.keys(obj).forEach(function(key) {
6102             var val = obj[key];
6103             cb(val, key);
6104           });
6105         }
6106       }
6107       function getTreeDepth(obj) {
6108         var depth = 0;
6109         if (Array.isArray(obj) || isObject3(obj)) {
6110           forEach(obj, function(val) {
6111             if (Array.isArray(val) || isObject3(val)) {
6112               var tmpDepth = getTreeDepth(val);
6113               if (tmpDepth > depth) {
6114                 depth = tmpDepth;
6115               }
6116             }
6117           });
6118           return depth + 1;
6119         }
6120         return depth;
6121       }
6122       function stringify3(obj, options2) {
6123         options2 = options2 || {};
6124         var indent2 = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
6125         var addMargin = get4(options2, "margins", false);
6126         var addArrayMargin = get4(options2, "arrayMargins", false);
6127         var addObjectMargin = get4(options2, "objectMargins", false);
6128         var maxLength = indent2 === "" ? Infinity : get4(options2, "maxLength", 80);
6129         var maxNesting = get4(options2, "maxNesting", Infinity);
6130         return function _stringify(obj2, currentIndent, reserved) {
6131           if (obj2 && typeof obj2.toJSON === "function") {
6132             obj2 = obj2.toJSON();
6133           }
6134           var string = JSON.stringify(obj2);
6135           if (string === void 0) {
6136             return string;
6137           }
6138           var length = maxLength - currentIndent.length - reserved;
6139           var treeDepth = getTreeDepth(obj2);
6140           if (treeDepth <= maxNesting && string.length <= length) {
6141             var prettified = prettify(string, {
6142               addMargin,
6143               addArrayMargin,
6144               addObjectMargin
6145             });
6146             if (prettified.length <= length) {
6147               return prettified;
6148             }
6149           }
6150           if (isObject3(obj2)) {
6151             var nextIndent = currentIndent + indent2;
6152             var items = [];
6153             var delimiters;
6154             var comma = function(array2, index2) {
6155               return index2 === array2.length - 1 ? 0 : 1;
6156             };
6157             if (Array.isArray(obj2)) {
6158               for (var index = 0; index < obj2.length; index++) {
6159                 items.push(
6160                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
6161                 );
6162               }
6163               delimiters = "[]";
6164             } else {
6165               Object.keys(obj2).forEach(function(key, index2, array2) {
6166                 var keyPart = JSON.stringify(key) + ": ";
6167                 var value = _stringify(
6168                   obj2[key],
6169                   nextIndent,
6170                   keyPart.length + comma(array2, index2)
6171                 );
6172                 if (value !== void 0) {
6173                   items.push(keyPart + value);
6174                 }
6175               });
6176               delimiters = "{}";
6177             }
6178             if (items.length > 0) {
6179               return [
6180                 delimiters[0],
6181                 indent2 + items.join(",\n" + nextIndent),
6182                 delimiters[1]
6183               ].join("\n" + currentIndent);
6184             }
6185           }
6186           return string;
6187         }(obj, "", 0);
6188       }
6189       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
6190       function prettify(string, options2) {
6191         options2 = options2 || {};
6192         var tokens = {
6193           "{": "{",
6194           "}": "}",
6195           "[": "[",
6196           "]": "]",
6197           ",": ", ",
6198           ":": ": "
6199         };
6200         if (options2.addMargin || options2.addObjectMargin) {
6201           tokens["{"] = "{ ";
6202           tokens["}"] = " }";
6203         }
6204         if (options2.addMargin || options2.addArrayMargin) {
6205           tokens["["] = "[ ";
6206           tokens["]"] = " ]";
6207         }
6208         return string.replace(stringOrChar, function(match, string2) {
6209           return string2 ? match : tokens[match];
6210         });
6211       }
6212       function get4(options2, name, defaultValue) {
6213         return name in options2 ? options2[name] : defaultValue;
6214       }
6215       module2.exports = stringify3;
6216     }
6217   });
6218
6219   // node_modules/aes-js/index.js
6220   var require_aes_js = __commonJS({
6221     "node_modules/aes-js/index.js"(exports2, module2) {
6222       (function(root3) {
6223         "use strict";
6224         function checkInt(value) {
6225           return parseInt(value) === value;
6226         }
6227         function checkInts(arrayish) {
6228           if (!checkInt(arrayish.length)) {
6229             return false;
6230           }
6231           for (var i3 = 0; i3 < arrayish.length; i3++) {
6232             if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
6233               return false;
6234             }
6235           }
6236           return true;
6237         }
6238         function coerceArray(arg, copy2) {
6239           if (arg.buffer && arg.name === "Uint8Array") {
6240             if (copy2) {
6241               if (arg.slice) {
6242                 arg = arg.slice();
6243               } else {
6244                 arg = Array.prototype.slice.call(arg);
6245               }
6246             }
6247             return arg;
6248           }
6249           if (Array.isArray(arg)) {
6250             if (!checkInts(arg)) {
6251               throw new Error("Array contains invalid value: " + arg);
6252             }
6253             return new Uint8Array(arg);
6254           }
6255           if (checkInt(arg.length) && checkInts(arg)) {
6256             return new Uint8Array(arg);
6257           }
6258           throw new Error("unsupported array-like object");
6259         }
6260         function createArray(length) {
6261           return new Uint8Array(length);
6262         }
6263         function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
6264           if (sourceStart != null || sourceEnd != null) {
6265             if (sourceArray.slice) {
6266               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
6267             } else {
6268               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
6269             }
6270           }
6271           targetArray.set(sourceArray, targetStart);
6272         }
6273         var convertUtf8 = function() {
6274           function toBytes(text2) {
6275             var result = [], i3 = 0;
6276             text2 = encodeURI(text2);
6277             while (i3 < text2.length) {
6278               var c2 = text2.charCodeAt(i3++);
6279               if (c2 === 37) {
6280                 result.push(parseInt(text2.substr(i3, 2), 16));
6281                 i3 += 2;
6282               } else {
6283                 result.push(c2);
6284               }
6285             }
6286             return coerceArray(result);
6287           }
6288           function fromBytes(bytes) {
6289             var result = [], i3 = 0;
6290             while (i3 < bytes.length) {
6291               var c2 = bytes[i3];
6292               if (c2 < 128) {
6293                 result.push(String.fromCharCode(c2));
6294                 i3++;
6295               } else if (c2 > 191 && c2 < 224) {
6296                 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
6297                 i3 += 2;
6298               } else {
6299                 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
6300                 i3 += 3;
6301               }
6302             }
6303             return result.join("");
6304           }
6305           return {
6306             toBytes,
6307             fromBytes
6308           };
6309         }();
6310         var convertHex = function() {
6311           function toBytes(text2) {
6312             var result = [];
6313             for (var i3 = 0; i3 < text2.length; i3 += 2) {
6314               result.push(parseInt(text2.substr(i3, 2), 16));
6315             }
6316             return result;
6317           }
6318           var Hex = "0123456789abcdef";
6319           function fromBytes(bytes) {
6320             var result = [];
6321             for (var i3 = 0; i3 < bytes.length; i3++) {
6322               var v2 = bytes[i3];
6323               result.push(Hex[(v2 & 240) >> 4] + Hex[v2 & 15]);
6324             }
6325             return result.join("");
6326           }
6327           return {
6328             toBytes,
6329             fromBytes
6330           };
6331         }();
6332         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
6333         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];
6334         var S2 = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22];
6335         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];
6336         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];
6337         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];
6338         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];
6339         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];
6340         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];
6341         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];
6342         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];
6343         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];
6344         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];
6345         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];
6346         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];
6347         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];
6348         function convertToInt32(bytes) {
6349           var result = [];
6350           for (var i3 = 0; i3 < bytes.length; i3 += 4) {
6351             result.push(
6352               bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
6353             );
6354           }
6355           return result;
6356         }
6357         var AES = function(key) {
6358           if (!(this instanceof AES)) {
6359             throw Error("AES must be instanitated with `new`");
6360           }
6361           Object.defineProperty(this, "key", {
6362             value: coerceArray(key, true)
6363           });
6364           this._prepare();
6365         };
6366         AES.prototype._prepare = function() {
6367           var rounds = numberOfRounds[this.key.length];
6368           if (rounds == null) {
6369             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
6370           }
6371           this._Ke = [];
6372           this._Kd = [];
6373           for (var i3 = 0; i3 <= rounds; i3++) {
6374             this._Ke.push([0, 0, 0, 0]);
6375             this._Kd.push([0, 0, 0, 0]);
6376           }
6377           var roundKeyCount = (rounds + 1) * 4;
6378           var KC = this.key.length / 4;
6379           var tk = convertToInt32(this.key);
6380           var index;
6381           for (var i3 = 0; i3 < KC; i3++) {
6382             index = i3 >> 2;
6383             this._Ke[index][i3 % 4] = tk[i3];
6384             this._Kd[rounds - index][i3 % 4] = tk[i3];
6385           }
6386           var rconpointer = 0;
6387           var t2 = KC, tt2;
6388           while (t2 < roundKeyCount) {
6389             tt2 = tk[KC - 1];
6390             tk[0] ^= S2[tt2 >> 16 & 255] << 24 ^ S2[tt2 >> 8 & 255] << 16 ^ S2[tt2 & 255] << 8 ^ S2[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
6391             rconpointer += 1;
6392             if (KC != 8) {
6393               for (var i3 = 1; i3 < KC; i3++) {
6394                 tk[i3] ^= tk[i3 - 1];
6395               }
6396             } else {
6397               for (var i3 = 1; i3 < KC / 2; i3++) {
6398                 tk[i3] ^= tk[i3 - 1];
6399               }
6400               tt2 = tk[KC / 2 - 1];
6401               tk[KC / 2] ^= S2[tt2 & 255] ^ S2[tt2 >> 8 & 255] << 8 ^ S2[tt2 >> 16 & 255] << 16 ^ S2[tt2 >> 24 & 255] << 24;
6402               for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
6403                 tk[i3] ^= tk[i3 - 1];
6404               }
6405             }
6406             var i3 = 0, r2, c2;
6407             while (i3 < KC && t2 < roundKeyCount) {
6408               r2 = t2 >> 2;
6409               c2 = t2 % 4;
6410               this._Ke[r2][c2] = tk[i3];
6411               this._Kd[rounds - r2][c2] = tk[i3++];
6412               t2++;
6413             }
6414           }
6415           for (var r2 = 1; r2 < rounds; r2++) {
6416             for (var c2 = 0; c2 < 4; c2++) {
6417               tt2 = this._Kd[r2][c2];
6418               this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U2[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
6419             }
6420           }
6421         };
6422         AES.prototype.encrypt = function(plaintext) {
6423           if (plaintext.length != 16) {
6424             throw new Error("invalid plaintext size (must be 16 bytes)");
6425           }
6426           var rounds = this._Ke.length - 1;
6427           var a2 = [0, 0, 0, 0];
6428           var t2 = convertToInt32(plaintext);
6429           for (var i3 = 0; i3 < 4; i3++) {
6430             t2[i3] ^= this._Ke[0][i3];
6431           }
6432           for (var r2 = 1; r2 < rounds; r2++) {
6433             for (var i3 = 0; i3 < 4; i3++) {
6434               a2[i3] = T1[t2[i3] >> 24 & 255] ^ T2[t2[(i3 + 1) % 4] >> 16 & 255] ^ T3[t2[(i3 + 2) % 4] >> 8 & 255] ^ T4[t2[(i3 + 3) % 4] & 255] ^ this._Ke[r2][i3];
6435             }
6436             t2 = a2.slice();
6437           }
6438           var result = createArray(16), tt2;
6439           for (var i3 = 0; i3 < 4; i3++) {
6440             tt2 = this._Ke[rounds][i3];
6441             result[4 * i3] = (S2[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
6442             result[4 * i3 + 1] = (S2[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
6443             result[4 * i3 + 2] = (S2[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
6444             result[4 * i3 + 3] = (S2[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
6445           }
6446           return result;
6447         };
6448         AES.prototype.decrypt = function(ciphertext) {
6449           if (ciphertext.length != 16) {
6450             throw new Error("invalid ciphertext size (must be 16 bytes)");
6451           }
6452           var rounds = this._Kd.length - 1;
6453           var a2 = [0, 0, 0, 0];
6454           var t2 = convertToInt32(ciphertext);
6455           for (var i3 = 0; i3 < 4; i3++) {
6456             t2[i3] ^= this._Kd[0][i3];
6457           }
6458           for (var r2 = 1; r2 < rounds; r2++) {
6459             for (var i3 = 0; i3 < 4; i3++) {
6460               a2[i3] = T5[t2[i3] >> 24 & 255] ^ T6[t2[(i3 + 3) % 4] >> 16 & 255] ^ T7[t2[(i3 + 2) % 4] >> 8 & 255] ^ T8[t2[(i3 + 1) % 4] & 255] ^ this._Kd[r2][i3];
6461             }
6462             t2 = a2.slice();
6463           }
6464           var result = createArray(16), tt2;
6465           for (var i3 = 0; i3 < 4; i3++) {
6466             tt2 = this._Kd[rounds][i3];
6467             result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
6468             result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
6469             result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
6470             result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
6471           }
6472           return result;
6473         };
6474         var ModeOfOperationECB = function(key) {
6475           if (!(this instanceof ModeOfOperationECB)) {
6476             throw Error("AES must be instanitated with `new`");
6477           }
6478           this.description = "Electronic Code Block";
6479           this.name = "ecb";
6480           this._aes = new AES(key);
6481         };
6482         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
6483           plaintext = coerceArray(plaintext);
6484           if (plaintext.length % 16 !== 0) {
6485             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6486           }
6487           var ciphertext = createArray(plaintext.length);
6488           var block2 = createArray(16);
6489           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
6490             copyArray(plaintext, block2, 0, i3, i3 + 16);
6491             block2 = this._aes.encrypt(block2);
6492             copyArray(block2, ciphertext, i3);
6493           }
6494           return ciphertext;
6495         };
6496         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
6497           ciphertext = coerceArray(ciphertext);
6498           if (ciphertext.length % 16 !== 0) {
6499             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6500           }
6501           var plaintext = createArray(ciphertext.length);
6502           var block2 = createArray(16);
6503           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
6504             copyArray(ciphertext, block2, 0, i3, i3 + 16);
6505             block2 = this._aes.decrypt(block2);
6506             copyArray(block2, plaintext, i3);
6507           }
6508           return plaintext;
6509         };
6510         var ModeOfOperationCBC = function(key, iv) {
6511           if (!(this instanceof ModeOfOperationCBC)) {
6512             throw Error("AES must be instanitated with `new`");
6513           }
6514           this.description = "Cipher Block Chaining";
6515           this.name = "cbc";
6516           if (!iv) {
6517             iv = createArray(16);
6518           } else if (iv.length != 16) {
6519             throw new Error("invalid initialation vector size (must be 16 bytes)");
6520           }
6521           this._lastCipherblock = coerceArray(iv, true);
6522           this._aes = new AES(key);
6523         };
6524         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
6525           plaintext = coerceArray(plaintext);
6526           if (plaintext.length % 16 !== 0) {
6527             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6528           }
6529           var ciphertext = createArray(plaintext.length);
6530           var block2 = createArray(16);
6531           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
6532             copyArray(plaintext, block2, 0, i3, i3 + 16);
6533             for (var j3 = 0; j3 < 16; j3++) {
6534               block2[j3] ^= this._lastCipherblock[j3];
6535             }
6536             this._lastCipherblock = this._aes.encrypt(block2);
6537             copyArray(this._lastCipherblock, ciphertext, i3);
6538           }
6539           return ciphertext;
6540         };
6541         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
6542           ciphertext = coerceArray(ciphertext);
6543           if (ciphertext.length % 16 !== 0) {
6544             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6545           }
6546           var plaintext = createArray(ciphertext.length);
6547           var block2 = createArray(16);
6548           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
6549             copyArray(ciphertext, block2, 0, i3, i3 + 16);
6550             block2 = this._aes.decrypt(block2);
6551             for (var j3 = 0; j3 < 16; j3++) {
6552               plaintext[i3 + j3] = block2[j3] ^ this._lastCipherblock[j3];
6553             }
6554             copyArray(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
6555           }
6556           return plaintext;
6557         };
6558         var ModeOfOperationCFB = function(key, iv, segmentSize) {
6559           if (!(this instanceof ModeOfOperationCFB)) {
6560             throw Error("AES must be instanitated with `new`");
6561           }
6562           this.description = "Cipher Feedback";
6563           this.name = "cfb";
6564           if (!iv) {
6565             iv = createArray(16);
6566           } else if (iv.length != 16) {
6567             throw new Error("invalid initialation vector size (must be 16 size)");
6568           }
6569           if (!segmentSize) {
6570             segmentSize = 1;
6571           }
6572           this.segmentSize = segmentSize;
6573           this._shiftRegister = coerceArray(iv, true);
6574           this._aes = new AES(key);
6575         };
6576         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
6577           if (plaintext.length % this.segmentSize != 0) {
6578             throw new Error("invalid plaintext size (must be segmentSize bytes)");
6579           }
6580           var encrypted = coerceArray(plaintext, true);
6581           var xorSegment;
6582           for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
6583             xorSegment = this._aes.encrypt(this._shiftRegister);
6584             for (var j3 = 0; j3 < this.segmentSize; j3++) {
6585               encrypted[i3 + j3] ^= xorSegment[j3];
6586             }
6587             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6588             copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
6589           }
6590           return encrypted;
6591         };
6592         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
6593           if (ciphertext.length % this.segmentSize != 0) {
6594             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
6595           }
6596           var plaintext = coerceArray(ciphertext, true);
6597           var xorSegment;
6598           for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
6599             xorSegment = this._aes.encrypt(this._shiftRegister);
6600             for (var j3 = 0; j3 < this.segmentSize; j3++) {
6601               plaintext[i3 + j3] ^= xorSegment[j3];
6602             }
6603             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6604             copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
6605           }
6606           return plaintext;
6607         };
6608         var ModeOfOperationOFB = function(key, iv) {
6609           if (!(this instanceof ModeOfOperationOFB)) {
6610             throw Error("AES must be instanitated with `new`");
6611           }
6612           this.description = "Output Feedback";
6613           this.name = "ofb";
6614           if (!iv) {
6615             iv = createArray(16);
6616           } else if (iv.length != 16) {
6617             throw new Error("invalid initialation vector size (must be 16 bytes)");
6618           }
6619           this._lastPrecipher = coerceArray(iv, true);
6620           this._lastPrecipherIndex = 16;
6621           this._aes = new AES(key);
6622         };
6623         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
6624           var encrypted = coerceArray(plaintext, true);
6625           for (var i3 = 0; i3 < encrypted.length; i3++) {
6626             if (this._lastPrecipherIndex === 16) {
6627               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
6628               this._lastPrecipherIndex = 0;
6629             }
6630             encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
6631           }
6632           return encrypted;
6633         };
6634         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
6635         var Counter = function(initialValue) {
6636           if (!(this instanceof Counter)) {
6637             throw Error("Counter must be instanitated with `new`");
6638           }
6639           if (initialValue !== 0 && !initialValue) {
6640             initialValue = 1;
6641           }
6642           if (typeof initialValue === "number") {
6643             this._counter = createArray(16);
6644             this.setValue(initialValue);
6645           } else {
6646             this.setBytes(initialValue);
6647           }
6648         };
6649         Counter.prototype.setValue = function(value) {
6650           if (typeof value !== "number" || parseInt(value) != value) {
6651             throw new Error("invalid counter value (must be an integer)");
6652           }
6653           if (value > Number.MAX_SAFE_INTEGER) {
6654             throw new Error("integer value out of safe range");
6655           }
6656           for (var index = 15; index >= 0; --index) {
6657             this._counter[index] = value % 256;
6658             value = parseInt(value / 256);
6659           }
6660         };
6661         Counter.prototype.setBytes = function(bytes) {
6662           bytes = coerceArray(bytes, true);
6663           if (bytes.length != 16) {
6664             throw new Error("invalid counter bytes size (must be 16 bytes)");
6665           }
6666           this._counter = bytes;
6667         };
6668         Counter.prototype.increment = function() {
6669           for (var i3 = 15; i3 >= 0; i3--) {
6670             if (this._counter[i3] === 255) {
6671               this._counter[i3] = 0;
6672             } else {
6673               this._counter[i3]++;
6674               break;
6675             }
6676           }
6677         };
6678         var ModeOfOperationCTR = function(key, counter) {
6679           if (!(this instanceof ModeOfOperationCTR)) {
6680             throw Error("AES must be instanitated with `new`");
6681           }
6682           this.description = "Counter";
6683           this.name = "ctr";
6684           if (!(counter instanceof Counter)) {
6685             counter = new Counter(counter);
6686           }
6687           this._counter = counter;
6688           this._remainingCounter = null;
6689           this._remainingCounterIndex = 16;
6690           this._aes = new AES(key);
6691         };
6692         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
6693           var encrypted = coerceArray(plaintext, true);
6694           for (var i3 = 0; i3 < encrypted.length; i3++) {
6695             if (this._remainingCounterIndex === 16) {
6696               this._remainingCounter = this._aes.encrypt(this._counter._counter);
6697               this._remainingCounterIndex = 0;
6698               this._counter.increment();
6699             }
6700             encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
6701           }
6702           return encrypted;
6703         };
6704         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
6705         function pkcs7pad(data) {
6706           data = coerceArray(data, true);
6707           var padder = 16 - data.length % 16;
6708           var result = createArray(data.length + padder);
6709           copyArray(data, result);
6710           for (var i3 = data.length; i3 < result.length; i3++) {
6711             result[i3] = padder;
6712           }
6713           return result;
6714         }
6715         function pkcs7strip(data) {
6716           data = coerceArray(data, true);
6717           if (data.length < 16) {
6718             throw new Error("PKCS#7 invalid length");
6719           }
6720           var padder = data[data.length - 1];
6721           if (padder > 16) {
6722             throw new Error("PKCS#7 padding byte out of range");
6723           }
6724           var length = data.length - padder;
6725           for (var i3 = 0; i3 < padder; i3++) {
6726             if (data[length + i3] !== padder) {
6727               throw new Error("PKCS#7 invalid padding byte");
6728             }
6729           }
6730           var result = createArray(length);
6731           copyArray(data, result, 0, 0, length);
6732           return result;
6733         }
6734         var aesjs2 = {
6735           AES,
6736           Counter,
6737           ModeOfOperation: {
6738             ecb: ModeOfOperationECB,
6739             cbc: ModeOfOperationCBC,
6740             cfb: ModeOfOperationCFB,
6741             ofb: ModeOfOperationOFB,
6742             ctr: ModeOfOperationCTR
6743           },
6744           utils: {
6745             hex: convertHex,
6746             utf8: convertUtf8
6747           },
6748           padding: {
6749             pkcs7: {
6750               pad: pkcs7pad,
6751               strip: pkcs7strip
6752             }
6753           },
6754           _arrayTest: {
6755             coerceArray,
6756             createArray,
6757             copyArray
6758           }
6759         };
6760         if (typeof exports2 !== "undefined") {
6761           module2.exports = aesjs2;
6762         } else if (typeof define === "function" && define.amd) {
6763           define([], function() {
6764             return aesjs2;
6765           });
6766         } else {
6767           if (root3.aesjs) {
6768             aesjs2._aesjs = root3.aesjs;
6769           }
6770           root3.aesjs = aesjs2;
6771         }
6772       })(exports2);
6773     }
6774   });
6775
6776   // node_modules/lodash/lodash.js
6777   var require_lodash = __commonJS({
6778     "node_modules/lodash/lodash.js"(exports2, module2) {
6779       (function() {
6780         var undefined2;
6781         var VERSION = "4.17.21";
6782         var LARGE_ARRAY_SIZE2 = 200;
6783         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`";
6784         var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
6785         var MAX_MEMOIZE_SIZE = 500;
6786         var PLACEHOLDER = "__lodash_placeholder__";
6787         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
6788         var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
6789         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;
6790         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
6791         var HOT_COUNT = 800, HOT_SPAN = 16;
6792         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
6793         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER3 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
6794         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
6795         var wrapFlags = [
6796           ["ary", WRAP_ARY_FLAG],
6797           ["bind", WRAP_BIND_FLAG],
6798           ["bindKey", WRAP_BIND_KEY_FLAG],
6799           ["curry", WRAP_CURRY_FLAG],
6800           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
6801           ["flip", WRAP_FLIP_FLAG],
6802           ["partial", WRAP_PARTIAL_FLAG],
6803           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
6804           ["rearg", WRAP_REARG_FLAG]
6805         ];
6806         var argsTag4 = "[object Arguments]", arrayTag3 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag3 = "[object Boolean]", dateTag3 = "[object Date]", domExcTag = "[object DOMException]", errorTag3 = "[object Error]", funcTag3 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag4 = "[object Map]", numberTag4 = "[object Number]", nullTag2 = "[object Null]", objectTag4 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag3 = "[object RegExp]", setTag4 = "[object Set]", stringTag3 = "[object String]", symbolTag3 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag3 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
6807         var arrayBufferTag3 = "[object ArrayBuffer]", dataViewTag4 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
6808         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
6809         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
6810         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
6811         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
6812         var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
6813         var reTrimStart2 = /^\s+/;
6814         var reWhitespace2 = /\s/;
6815         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
6816         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
6817         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
6818         var reEscapeChar = /\\(\\)?/g;
6819         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
6820         var reFlags = /\w*$/;
6821         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
6822         var reIsBinary2 = /^0b[01]+$/i;
6823         var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
6824         var reIsOctal2 = /^0o[0-7]+$/i;
6825         var reIsUint2 = /^(?:0|[1-9]\d*)$/;
6826         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
6827         var reNoMatch = /($^)/;
6828         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
6829         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;
6830         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";
6831         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("|") + ")";
6832         var reApos = RegExp(rsApos, "g");
6833         var reComboMark = RegExp(rsCombo, "g");
6834         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
6835         var reUnicodeWord = RegExp([
6836           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
6837           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
6838           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
6839           rsUpper + "+" + rsOptContrUpper,
6840           rsOrdUpper,
6841           rsOrdLower,
6842           rsDigits,
6843           rsEmoji
6844         ].join("|"), "g");
6845         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
6846         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 ]/;
6847         var contextProps = [
6848           "Array",
6849           "Buffer",
6850           "DataView",
6851           "Date",
6852           "Error",
6853           "Float32Array",
6854           "Float64Array",
6855           "Function",
6856           "Int8Array",
6857           "Int16Array",
6858           "Int32Array",
6859           "Map",
6860           "Math",
6861           "Object",
6862           "Promise",
6863           "RegExp",
6864           "Set",
6865           "String",
6866           "Symbol",
6867           "TypeError",
6868           "Uint8Array",
6869           "Uint8ClampedArray",
6870           "Uint16Array",
6871           "Uint32Array",
6872           "WeakMap",
6873           "_",
6874           "clearTimeout",
6875           "isFinite",
6876           "parseInt",
6877           "setTimeout"
6878         ];
6879         var templateCounter = -1;
6880         var typedArrayTags2 = {};
6881         typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
6882         typedArrayTags2[argsTag4] = typedArrayTags2[arrayTag3] = typedArrayTags2[arrayBufferTag3] = typedArrayTags2[boolTag3] = typedArrayTags2[dataViewTag4] = typedArrayTags2[dateTag3] = typedArrayTags2[errorTag3] = typedArrayTags2[funcTag3] = typedArrayTags2[mapTag4] = typedArrayTags2[numberTag4] = typedArrayTags2[objectTag4] = typedArrayTags2[regexpTag3] = typedArrayTags2[setTag4] = typedArrayTags2[stringTag3] = typedArrayTags2[weakMapTag3] = false;
6883         var cloneableTags = {};
6884         cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag2] = cloneableTags[float64Tag2] = cloneableTags[int8Tag2] = cloneableTags[int16Tag2] = cloneableTags[int32Tag2] = cloneableTags[mapTag4] = cloneableTags[numberTag4] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag4] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag2] = cloneableTags[uint8ClampedTag2] = cloneableTags[uint16Tag2] = cloneableTags[uint32Tag2] = true;
6885         cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
6886         var deburredLetters = {
6887           // Latin-1 Supplement block.
6888           "\xC0": "A",
6889           "\xC1": "A",
6890           "\xC2": "A",
6891           "\xC3": "A",
6892           "\xC4": "A",
6893           "\xC5": "A",
6894           "\xE0": "a",
6895           "\xE1": "a",
6896           "\xE2": "a",
6897           "\xE3": "a",
6898           "\xE4": "a",
6899           "\xE5": "a",
6900           "\xC7": "C",
6901           "\xE7": "c",
6902           "\xD0": "D",
6903           "\xF0": "d",
6904           "\xC8": "E",
6905           "\xC9": "E",
6906           "\xCA": "E",
6907           "\xCB": "E",
6908           "\xE8": "e",
6909           "\xE9": "e",
6910           "\xEA": "e",
6911           "\xEB": "e",
6912           "\xCC": "I",
6913           "\xCD": "I",
6914           "\xCE": "I",
6915           "\xCF": "I",
6916           "\xEC": "i",
6917           "\xED": "i",
6918           "\xEE": "i",
6919           "\xEF": "i",
6920           "\xD1": "N",
6921           "\xF1": "n",
6922           "\xD2": "O",
6923           "\xD3": "O",
6924           "\xD4": "O",
6925           "\xD5": "O",
6926           "\xD6": "O",
6927           "\xD8": "O",
6928           "\xF2": "o",
6929           "\xF3": "o",
6930           "\xF4": "o",
6931           "\xF5": "o",
6932           "\xF6": "o",
6933           "\xF8": "o",
6934           "\xD9": "U",
6935           "\xDA": "U",
6936           "\xDB": "U",
6937           "\xDC": "U",
6938           "\xF9": "u",
6939           "\xFA": "u",
6940           "\xFB": "u",
6941           "\xFC": "u",
6942           "\xDD": "Y",
6943           "\xFD": "y",
6944           "\xFF": "y",
6945           "\xC6": "Ae",
6946           "\xE6": "ae",
6947           "\xDE": "Th",
6948           "\xFE": "th",
6949           "\xDF": "ss",
6950           // Latin Extended-A block.
6951           "\u0100": "A",
6952           "\u0102": "A",
6953           "\u0104": "A",
6954           "\u0101": "a",
6955           "\u0103": "a",
6956           "\u0105": "a",
6957           "\u0106": "C",
6958           "\u0108": "C",
6959           "\u010A": "C",
6960           "\u010C": "C",
6961           "\u0107": "c",
6962           "\u0109": "c",
6963           "\u010B": "c",
6964           "\u010D": "c",
6965           "\u010E": "D",
6966           "\u0110": "D",
6967           "\u010F": "d",
6968           "\u0111": "d",
6969           "\u0112": "E",
6970           "\u0114": "E",
6971           "\u0116": "E",
6972           "\u0118": "E",
6973           "\u011A": "E",
6974           "\u0113": "e",
6975           "\u0115": "e",
6976           "\u0117": "e",
6977           "\u0119": "e",
6978           "\u011B": "e",
6979           "\u011C": "G",
6980           "\u011E": "G",
6981           "\u0120": "G",
6982           "\u0122": "G",
6983           "\u011D": "g",
6984           "\u011F": "g",
6985           "\u0121": "g",
6986           "\u0123": "g",
6987           "\u0124": "H",
6988           "\u0126": "H",
6989           "\u0125": "h",
6990           "\u0127": "h",
6991           "\u0128": "I",
6992           "\u012A": "I",
6993           "\u012C": "I",
6994           "\u012E": "I",
6995           "\u0130": "I",
6996           "\u0129": "i",
6997           "\u012B": "i",
6998           "\u012D": "i",
6999           "\u012F": "i",
7000           "\u0131": "i",
7001           "\u0134": "J",
7002           "\u0135": "j",
7003           "\u0136": "K",
7004           "\u0137": "k",
7005           "\u0138": "k",
7006           "\u0139": "L",
7007           "\u013B": "L",
7008           "\u013D": "L",
7009           "\u013F": "L",
7010           "\u0141": "L",
7011           "\u013A": "l",
7012           "\u013C": "l",
7013           "\u013E": "l",
7014           "\u0140": "l",
7015           "\u0142": "l",
7016           "\u0143": "N",
7017           "\u0145": "N",
7018           "\u0147": "N",
7019           "\u014A": "N",
7020           "\u0144": "n",
7021           "\u0146": "n",
7022           "\u0148": "n",
7023           "\u014B": "n",
7024           "\u014C": "O",
7025           "\u014E": "O",
7026           "\u0150": "O",
7027           "\u014D": "o",
7028           "\u014F": "o",
7029           "\u0151": "o",
7030           "\u0154": "R",
7031           "\u0156": "R",
7032           "\u0158": "R",
7033           "\u0155": "r",
7034           "\u0157": "r",
7035           "\u0159": "r",
7036           "\u015A": "S",
7037           "\u015C": "S",
7038           "\u015E": "S",
7039           "\u0160": "S",
7040           "\u015B": "s",
7041           "\u015D": "s",
7042           "\u015F": "s",
7043           "\u0161": "s",
7044           "\u0162": "T",
7045           "\u0164": "T",
7046           "\u0166": "T",
7047           "\u0163": "t",
7048           "\u0165": "t",
7049           "\u0167": "t",
7050           "\u0168": "U",
7051           "\u016A": "U",
7052           "\u016C": "U",
7053           "\u016E": "U",
7054           "\u0170": "U",
7055           "\u0172": "U",
7056           "\u0169": "u",
7057           "\u016B": "u",
7058           "\u016D": "u",
7059           "\u016F": "u",
7060           "\u0171": "u",
7061           "\u0173": "u",
7062           "\u0174": "W",
7063           "\u0175": "w",
7064           "\u0176": "Y",
7065           "\u0177": "y",
7066           "\u0178": "Y",
7067           "\u0179": "Z",
7068           "\u017B": "Z",
7069           "\u017D": "Z",
7070           "\u017A": "z",
7071           "\u017C": "z",
7072           "\u017E": "z",
7073           "\u0132": "IJ",
7074           "\u0133": "ij",
7075           "\u0152": "Oe",
7076           "\u0153": "oe",
7077           "\u0149": "'n",
7078           "\u017F": "s"
7079         };
7080         var htmlEscapes2 = {
7081           "&": "&amp;",
7082           "<": "&lt;",
7083           ">": "&gt;",
7084           '"': "&quot;",
7085           "'": "&#39;"
7086         };
7087         var htmlUnescapes2 = {
7088           "&amp;": "&",
7089           "&lt;": "<",
7090           "&gt;": ">",
7091           "&quot;": '"',
7092           "&#39;": "'"
7093         };
7094         var stringEscapes = {
7095           "\\": "\\",
7096           "'": "'",
7097           "\n": "n",
7098           "\r": "r",
7099           "\u2028": "u2028",
7100           "\u2029": "u2029"
7101         };
7102         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
7103         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
7104         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
7105         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
7106         var freeExports3 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
7107         var freeModule3 = freeExports3 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
7108         var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
7109         var freeProcess2 = moduleExports3 && freeGlobal2.process;
7110         var nodeUtil2 = function() {
7111           try {
7112             var types = freeModule3 && freeModule3.require && freeModule3.require("util").types;
7113             if (types) {
7114               return types;
7115             }
7116             return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
7117           } catch (e3) {
7118           }
7119         }();
7120         var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
7121         function apply(func, thisArg, args) {
7122           switch (args.length) {
7123             case 0:
7124               return func.call(thisArg);
7125             case 1:
7126               return func.call(thisArg, args[0]);
7127             case 2:
7128               return func.call(thisArg, args[0], args[1]);
7129             case 3:
7130               return func.call(thisArg, args[0], args[1], args[2]);
7131           }
7132           return func.apply(thisArg, args);
7133         }
7134         function arrayAggregator(array2, setter, iteratee, accumulator) {
7135           var index = -1, length = array2 == null ? 0 : array2.length;
7136           while (++index < length) {
7137             var value = array2[index];
7138             setter(accumulator, value, iteratee(value), array2);
7139           }
7140           return accumulator;
7141         }
7142         function arrayEach(array2, iteratee) {
7143           var index = -1, length = array2 == null ? 0 : array2.length;
7144           while (++index < length) {
7145             if (iteratee(array2[index], index, array2) === false) {
7146               break;
7147             }
7148           }
7149           return array2;
7150         }
7151         function arrayEachRight(array2, iteratee) {
7152           var length = array2 == null ? 0 : array2.length;
7153           while (length--) {
7154             if (iteratee(array2[length], length, array2) === false) {
7155               break;
7156             }
7157           }
7158           return array2;
7159         }
7160         function arrayEvery(array2, predicate) {
7161           var index = -1, length = array2 == null ? 0 : array2.length;
7162           while (++index < length) {
7163             if (!predicate(array2[index], index, array2)) {
7164               return false;
7165             }
7166           }
7167           return true;
7168         }
7169         function arrayFilter2(array2, predicate) {
7170           var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
7171           while (++index < length) {
7172             var value = array2[index];
7173             if (predicate(value, index, array2)) {
7174               result[resIndex++] = value;
7175             }
7176           }
7177           return result;
7178         }
7179         function arrayIncludes(array2, value) {
7180           var length = array2 == null ? 0 : array2.length;
7181           return !!length && baseIndexOf(array2, value, 0) > -1;
7182         }
7183         function arrayIncludesWith(array2, value, comparator) {
7184           var index = -1, length = array2 == null ? 0 : array2.length;
7185           while (++index < length) {
7186             if (comparator(value, array2[index])) {
7187               return true;
7188             }
7189           }
7190           return false;
7191         }
7192         function arrayMap2(array2, iteratee) {
7193           var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
7194           while (++index < length) {
7195             result[index] = iteratee(array2[index], index, array2);
7196           }
7197           return result;
7198         }
7199         function arrayPush2(array2, values) {
7200           var index = -1, length = values.length, offset = array2.length;
7201           while (++index < length) {
7202             array2[offset + index] = values[index];
7203           }
7204           return array2;
7205         }
7206         function arrayReduce(array2, iteratee, accumulator, initAccum) {
7207           var index = -1, length = array2 == null ? 0 : array2.length;
7208           if (initAccum && length) {
7209             accumulator = array2[++index];
7210           }
7211           while (++index < length) {
7212             accumulator = iteratee(accumulator, array2[index], index, array2);
7213           }
7214           return accumulator;
7215         }
7216         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
7217           var length = array2 == null ? 0 : array2.length;
7218           if (initAccum && length) {
7219             accumulator = array2[--length];
7220           }
7221           while (length--) {
7222             accumulator = iteratee(accumulator, array2[length], length, array2);
7223           }
7224           return accumulator;
7225         }
7226         function arraySome2(array2, predicate) {
7227           var index = -1, length = array2 == null ? 0 : array2.length;
7228           while (++index < length) {
7229             if (predicate(array2[index], index, array2)) {
7230               return true;
7231             }
7232           }
7233           return false;
7234         }
7235         var asciiSize = baseProperty("length");
7236         function asciiToArray(string) {
7237           return string.split("");
7238         }
7239         function asciiWords(string) {
7240           return string.match(reAsciiWord) || [];
7241         }
7242         function baseFindKey(collection, predicate, eachFunc) {
7243           var result;
7244           eachFunc(collection, function(value, key, collection2) {
7245             if (predicate(value, key, collection2)) {
7246               result = key;
7247               return false;
7248             }
7249           });
7250           return result;
7251         }
7252         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
7253           var length = array2.length, index = fromIndex + (fromRight ? 1 : -1);
7254           while (fromRight ? index-- : ++index < length) {
7255             if (predicate(array2[index], index, array2)) {
7256               return index;
7257             }
7258           }
7259           return -1;
7260         }
7261         function baseIndexOf(array2, value, fromIndex) {
7262           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
7263         }
7264         function baseIndexOfWith(array2, value, fromIndex, comparator) {
7265           var index = fromIndex - 1, length = array2.length;
7266           while (++index < length) {
7267             if (comparator(array2[index], value)) {
7268               return index;
7269             }
7270           }
7271           return -1;
7272         }
7273         function baseIsNaN(value) {
7274           return value !== value;
7275         }
7276         function baseMean(array2, iteratee) {
7277           var length = array2 == null ? 0 : array2.length;
7278           return length ? baseSum(array2, iteratee) / length : NAN2;
7279         }
7280         function baseProperty(key) {
7281           return function(object) {
7282             return object == null ? undefined2 : object[key];
7283           };
7284         }
7285         function basePropertyOf2(object) {
7286           return function(key) {
7287             return object == null ? undefined2 : object[key];
7288           };
7289         }
7290         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
7291           eachFunc(collection, function(value, index, collection2) {
7292             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
7293           });
7294           return accumulator;
7295         }
7296         function baseSortBy(array2, comparer) {
7297           var length = array2.length;
7298           array2.sort(comparer);
7299           while (length--) {
7300             array2[length] = array2[length].value;
7301           }
7302           return array2;
7303         }
7304         function baseSum(array2, iteratee) {
7305           var result, index = -1, length = array2.length;
7306           while (++index < length) {
7307             var current = iteratee(array2[index]);
7308             if (current !== undefined2) {
7309               result = result === undefined2 ? current : result + current;
7310             }
7311           }
7312           return result;
7313         }
7314         function baseTimes2(n3, iteratee) {
7315           var index = -1, result = Array(n3);
7316           while (++index < n3) {
7317             result[index] = iteratee(index);
7318           }
7319           return result;
7320         }
7321         function baseToPairs(object, props) {
7322           return arrayMap2(props, function(key) {
7323             return [key, object[key]];
7324           });
7325         }
7326         function baseTrim2(string) {
7327           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
7328         }
7329         function baseUnary2(func) {
7330           return function(value) {
7331             return func(value);
7332           };
7333         }
7334         function baseValues(object, props) {
7335           return arrayMap2(props, function(key) {
7336             return object[key];
7337           });
7338         }
7339         function cacheHas2(cache, key) {
7340           return cache.has(key);
7341         }
7342         function charsStartIndex(strSymbols, chrSymbols) {
7343           var index = -1, length = strSymbols.length;
7344           while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7345           }
7346           return index;
7347         }
7348         function charsEndIndex(strSymbols, chrSymbols) {
7349           var index = strSymbols.length;
7350           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7351           }
7352           return index;
7353         }
7354         function countHolders(array2, placeholder) {
7355           var length = array2.length, result = 0;
7356           while (length--) {
7357             if (array2[length] === placeholder) {
7358               ++result;
7359             }
7360           }
7361           return result;
7362         }
7363         var deburrLetter = basePropertyOf2(deburredLetters);
7364         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
7365         function escapeStringChar(chr) {
7366           return "\\" + stringEscapes[chr];
7367         }
7368         function getValue2(object, key) {
7369           return object == null ? undefined2 : object[key];
7370         }
7371         function hasUnicode(string) {
7372           return reHasUnicode.test(string);
7373         }
7374         function hasUnicodeWord(string) {
7375           return reHasUnicodeWord.test(string);
7376         }
7377         function iteratorToArray(iterator) {
7378           var data, result = [];
7379           while (!(data = iterator.next()).done) {
7380             result.push(data.value);
7381           }
7382           return result;
7383         }
7384         function mapToArray2(map2) {
7385           var index = -1, result = Array(map2.size);
7386           map2.forEach(function(value, key) {
7387             result[++index] = [key, value];
7388           });
7389           return result;
7390         }
7391         function overArg2(func, transform2) {
7392           return function(arg) {
7393             return func(transform2(arg));
7394           };
7395         }
7396         function replaceHolders(array2, placeholder) {
7397           var index = -1, length = array2.length, resIndex = 0, result = [];
7398           while (++index < length) {
7399             var value = array2[index];
7400             if (value === placeholder || value === PLACEHOLDER) {
7401               array2[index] = PLACEHOLDER;
7402               result[resIndex++] = index;
7403             }
7404           }
7405           return result;
7406         }
7407         function setToArray2(set3) {
7408           var index = -1, result = Array(set3.size);
7409           set3.forEach(function(value) {
7410             result[++index] = value;
7411           });
7412           return result;
7413         }
7414         function setToPairs(set3) {
7415           var index = -1, result = Array(set3.size);
7416           set3.forEach(function(value) {
7417             result[++index] = [value, value];
7418           });
7419           return result;
7420         }
7421         function strictIndexOf(array2, value, fromIndex) {
7422           var index = fromIndex - 1, length = array2.length;
7423           while (++index < length) {
7424             if (array2[index] === value) {
7425               return index;
7426             }
7427           }
7428           return -1;
7429         }
7430         function strictLastIndexOf(array2, value, fromIndex) {
7431           var index = fromIndex + 1;
7432           while (index--) {
7433             if (array2[index] === value) {
7434               return index;
7435             }
7436           }
7437           return index;
7438         }
7439         function stringSize(string) {
7440           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
7441         }
7442         function stringToArray(string) {
7443           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
7444         }
7445         function trimmedEndIndex2(string) {
7446           var index = string.length;
7447           while (index-- && reWhitespace2.test(string.charAt(index))) {
7448           }
7449           return index;
7450         }
7451         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
7452         function unicodeSize(string) {
7453           var result = reUnicode.lastIndex = 0;
7454           while (reUnicode.test(string)) {
7455             ++result;
7456           }
7457           return result;
7458         }
7459         function unicodeToArray(string) {
7460           return string.match(reUnicode) || [];
7461         }
7462         function unicodeWords(string) {
7463           return string.match(reUnicodeWord) || [];
7464         }
7465         var runInContext = function runInContext2(context) {
7466           context = context == null ? root3 : _2.defaults(root3.Object(), context, _2.pick(root3, contextProps));
7467           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;
7468           var arrayProto2 = Array2.prototype, funcProto3 = Function2.prototype, objectProto13 = Object2.prototype;
7469           var coreJsData2 = context["__core-js_shared__"];
7470           var funcToString3 = funcProto3.toString;
7471           var hasOwnProperty10 = objectProto13.hasOwnProperty;
7472           var idCounter = 0;
7473           var maskSrcKey2 = function() {
7474             var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
7475             return uid ? "Symbol(src)_1." + uid : "";
7476           }();
7477           var nativeObjectToString3 = objectProto13.toString;
7478           var objectCtorString = funcToString3.call(Object2);
7479           var oldDash = root3._;
7480           var reIsNative2 = RegExp2(
7481             "^" + funcToString3.call(hasOwnProperty10).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
7482           );
7483           var Buffer3 = moduleExports3 ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array3 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined2, getPrototype = overArg2(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable3 = objectProto13.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
7484           var defineProperty = function() {
7485             try {
7486               var func = getNative2(Object2, "defineProperty");
7487               func({}, "", {});
7488               return func;
7489             } catch (e3) {
7490             }
7491           }();
7492           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
7493           var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer3 ? Buffer3.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
7494           var DataView3 = getNative2(context, "DataView"), Map3 = getNative2(context, "Map"), Promise3 = getNative2(context, "Promise"), Set3 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create");
7495           var metaMap = WeakMap2 && new WeakMap2();
7496           var realNames = {};
7497           var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
7498           var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
7499           function lodash(value) {
7500             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
7501               if (value instanceof LodashWrapper) {
7502                 return value;
7503               }
7504               if (hasOwnProperty10.call(value, "__wrapped__")) {
7505                 return wrapperClone(value);
7506               }
7507             }
7508             return new LodashWrapper(value);
7509           }
7510           var baseCreate = function() {
7511             function object() {
7512             }
7513             return function(proto) {
7514               if (!isObject3(proto)) {
7515                 return {};
7516               }
7517               if (objectCreate) {
7518                 return objectCreate(proto);
7519               }
7520               object.prototype = proto;
7521               var result2 = new object();
7522               object.prototype = undefined2;
7523               return result2;
7524             };
7525           }();
7526           function baseLodash() {
7527           }
7528           function LodashWrapper(value, chainAll) {
7529             this.__wrapped__ = value;
7530             this.__actions__ = [];
7531             this.__chain__ = !!chainAll;
7532             this.__index__ = 0;
7533             this.__values__ = undefined2;
7534           }
7535           lodash.templateSettings = {
7536             /**
7537              * Used to detect `data` property values to be HTML-escaped.
7538              *
7539              * @memberOf _.templateSettings
7540              * @type {RegExp}
7541              */
7542             "escape": reEscape,
7543             /**
7544              * Used to detect code to be evaluated.
7545              *
7546              * @memberOf _.templateSettings
7547              * @type {RegExp}
7548              */
7549             "evaluate": reEvaluate,
7550             /**
7551              * Used to detect `data` property values to inject.
7552              *
7553              * @memberOf _.templateSettings
7554              * @type {RegExp}
7555              */
7556             "interpolate": reInterpolate,
7557             /**
7558              * Used to reference the data object in the template text.
7559              *
7560              * @memberOf _.templateSettings
7561              * @type {string}
7562              */
7563             "variable": "",
7564             /**
7565              * Used to import variables into the compiled template.
7566              *
7567              * @memberOf _.templateSettings
7568              * @type {Object}
7569              */
7570             "imports": {
7571               /**
7572                * A reference to the `lodash` function.
7573                *
7574                * @memberOf _.templateSettings.imports
7575                * @type {Function}
7576                */
7577               "_": lodash
7578             }
7579           };
7580           lodash.prototype = baseLodash.prototype;
7581           lodash.prototype.constructor = lodash;
7582           LodashWrapper.prototype = baseCreate(baseLodash.prototype);
7583           LodashWrapper.prototype.constructor = LodashWrapper;
7584           function LazyWrapper(value) {
7585             this.__wrapped__ = value;
7586             this.__actions__ = [];
7587             this.__dir__ = 1;
7588             this.__filtered__ = false;
7589             this.__iteratees__ = [];
7590             this.__takeCount__ = MAX_ARRAY_LENGTH;
7591             this.__views__ = [];
7592           }
7593           function lazyClone() {
7594             var result2 = new LazyWrapper(this.__wrapped__);
7595             result2.__actions__ = copyArray(this.__actions__);
7596             result2.__dir__ = this.__dir__;
7597             result2.__filtered__ = this.__filtered__;
7598             result2.__iteratees__ = copyArray(this.__iteratees__);
7599             result2.__takeCount__ = this.__takeCount__;
7600             result2.__views__ = copyArray(this.__views__);
7601             return result2;
7602           }
7603           function lazyReverse() {
7604             if (this.__filtered__) {
7605               var result2 = new LazyWrapper(this);
7606               result2.__dir__ = -1;
7607               result2.__filtered__ = true;
7608             } else {
7609               result2 = this.clone();
7610               result2.__dir__ *= -1;
7611             }
7612             return result2;
7613           }
7614           function lazyValue() {
7615             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__);
7616             if (!isArr || !isRight && arrLength == length && takeCount == length) {
7617               return baseWrapperValue(array2, this.__actions__);
7618             }
7619             var result2 = [];
7620             outer:
7621               while (length-- && resIndex < takeCount) {
7622                 index += dir;
7623                 var iterIndex = -1, value = array2[index];
7624                 while (++iterIndex < iterLength) {
7625                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
7626                   if (type2 == LAZY_MAP_FLAG) {
7627                     value = computed;
7628                   } else if (!computed) {
7629                     if (type2 == LAZY_FILTER_FLAG) {
7630                       continue outer;
7631                     } else {
7632                       break outer;
7633                     }
7634                   }
7635                 }
7636                 result2[resIndex++] = value;
7637               }
7638             return result2;
7639           }
7640           LazyWrapper.prototype = baseCreate(baseLodash.prototype);
7641           LazyWrapper.prototype.constructor = LazyWrapper;
7642           function Hash2(entries) {
7643             var index = -1, length = entries == null ? 0 : entries.length;
7644             this.clear();
7645             while (++index < length) {
7646               var entry = entries[index];
7647               this.set(entry[0], entry[1]);
7648             }
7649           }
7650           function hashClear2() {
7651             this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
7652             this.size = 0;
7653           }
7654           function hashDelete2(key) {
7655             var result2 = this.has(key) && delete this.__data__[key];
7656             this.size -= result2 ? 1 : 0;
7657             return result2;
7658           }
7659           function hashGet2(key) {
7660             var data = this.__data__;
7661             if (nativeCreate2) {
7662               var result2 = data[key];
7663               return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
7664             }
7665             return hasOwnProperty10.call(data, key) ? data[key] : undefined2;
7666           }
7667           function hashHas2(key) {
7668             var data = this.__data__;
7669             return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty10.call(data, key);
7670           }
7671           function hashSet2(key, value) {
7672             var data = this.__data__;
7673             this.size += this.has(key) ? 0 : 1;
7674             data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
7675             return this;
7676           }
7677           Hash2.prototype.clear = hashClear2;
7678           Hash2.prototype["delete"] = hashDelete2;
7679           Hash2.prototype.get = hashGet2;
7680           Hash2.prototype.has = hashHas2;
7681           Hash2.prototype.set = hashSet2;
7682           function ListCache2(entries) {
7683             var index = -1, length = entries == null ? 0 : entries.length;
7684             this.clear();
7685             while (++index < length) {
7686               var entry = entries[index];
7687               this.set(entry[0], entry[1]);
7688             }
7689           }
7690           function listCacheClear2() {
7691             this.__data__ = [];
7692             this.size = 0;
7693           }
7694           function listCacheDelete2(key) {
7695             var data = this.__data__, index = assocIndexOf2(data, key);
7696             if (index < 0) {
7697               return false;
7698             }
7699             var lastIndex = data.length - 1;
7700             if (index == lastIndex) {
7701               data.pop();
7702             } else {
7703               splice2.call(data, index, 1);
7704             }
7705             --this.size;
7706             return true;
7707           }
7708           function listCacheGet2(key) {
7709             var data = this.__data__, index = assocIndexOf2(data, key);
7710             return index < 0 ? undefined2 : data[index][1];
7711           }
7712           function listCacheHas2(key) {
7713             return assocIndexOf2(this.__data__, key) > -1;
7714           }
7715           function listCacheSet2(key, value) {
7716             var data = this.__data__, index = assocIndexOf2(data, key);
7717             if (index < 0) {
7718               ++this.size;
7719               data.push([key, value]);
7720             } else {
7721               data[index][1] = value;
7722             }
7723             return this;
7724           }
7725           ListCache2.prototype.clear = listCacheClear2;
7726           ListCache2.prototype["delete"] = listCacheDelete2;
7727           ListCache2.prototype.get = listCacheGet2;
7728           ListCache2.prototype.has = listCacheHas2;
7729           ListCache2.prototype.set = listCacheSet2;
7730           function MapCache2(entries) {
7731             var index = -1, length = entries == null ? 0 : entries.length;
7732             this.clear();
7733             while (++index < length) {
7734               var entry = entries[index];
7735               this.set(entry[0], entry[1]);
7736             }
7737           }
7738           function mapCacheClear2() {
7739             this.size = 0;
7740             this.__data__ = {
7741               "hash": new Hash2(),
7742               "map": new (Map3 || ListCache2)(),
7743               "string": new Hash2()
7744             };
7745           }
7746           function mapCacheDelete2(key) {
7747             var result2 = getMapData2(this, key)["delete"](key);
7748             this.size -= result2 ? 1 : 0;
7749             return result2;
7750           }
7751           function mapCacheGet2(key) {
7752             return getMapData2(this, key).get(key);
7753           }
7754           function mapCacheHas2(key) {
7755             return getMapData2(this, key).has(key);
7756           }
7757           function mapCacheSet2(key, value) {
7758             var data = getMapData2(this, key), size2 = data.size;
7759             data.set(key, value);
7760             this.size += data.size == size2 ? 0 : 1;
7761             return this;
7762           }
7763           MapCache2.prototype.clear = mapCacheClear2;
7764           MapCache2.prototype["delete"] = mapCacheDelete2;
7765           MapCache2.prototype.get = mapCacheGet2;
7766           MapCache2.prototype.has = mapCacheHas2;
7767           MapCache2.prototype.set = mapCacheSet2;
7768           function SetCache2(values2) {
7769             var index = -1, length = values2 == null ? 0 : values2.length;
7770             this.__data__ = new MapCache2();
7771             while (++index < length) {
7772               this.add(values2[index]);
7773             }
7774           }
7775           function setCacheAdd2(value) {
7776             this.__data__.set(value, HASH_UNDEFINED4);
7777             return this;
7778           }
7779           function setCacheHas2(value) {
7780             return this.__data__.has(value);
7781           }
7782           SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
7783           SetCache2.prototype.has = setCacheHas2;
7784           function Stack2(entries) {
7785             var data = this.__data__ = new ListCache2(entries);
7786             this.size = data.size;
7787           }
7788           function stackClear2() {
7789             this.__data__ = new ListCache2();
7790             this.size = 0;
7791           }
7792           function stackDelete2(key) {
7793             var data = this.__data__, result2 = data["delete"](key);
7794             this.size = data.size;
7795             return result2;
7796           }
7797           function stackGet2(key) {
7798             return this.__data__.get(key);
7799           }
7800           function stackHas2(key) {
7801             return this.__data__.has(key);
7802           }
7803           function stackSet2(key, value) {
7804             var data = this.__data__;
7805             if (data instanceof ListCache2) {
7806               var pairs2 = data.__data__;
7807               if (!Map3 || pairs2.length < LARGE_ARRAY_SIZE2 - 1) {
7808                 pairs2.push([key, value]);
7809                 this.size = ++data.size;
7810                 return this;
7811               }
7812               data = this.__data__ = new MapCache2(pairs2);
7813             }
7814             data.set(key, value);
7815             this.size = data.size;
7816             return this;
7817           }
7818           Stack2.prototype.clear = stackClear2;
7819           Stack2.prototype["delete"] = stackDelete2;
7820           Stack2.prototype.get = stackGet2;
7821           Stack2.prototype.has = stackHas2;
7822           Stack2.prototype.set = stackSet2;
7823           function arrayLikeKeys2(value, inherited) {
7824             var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length = result2.length;
7825             for (var key in value) {
7826               if ((inherited || hasOwnProperty10.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
7827               (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
7828               isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
7829               isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
7830               isIndex2(key, length)))) {
7831                 result2.push(key);
7832               }
7833             }
7834             return result2;
7835           }
7836           function arraySample(array2) {
7837             var length = array2.length;
7838             return length ? array2[baseRandom(0, length - 1)] : undefined2;
7839           }
7840           function arraySampleSize(array2, n3) {
7841             return shuffleSelf(copyArray(array2), baseClamp(n3, 0, array2.length));
7842           }
7843           function arrayShuffle(array2) {
7844             return shuffleSelf(copyArray(array2));
7845           }
7846           function assignMergeValue(object, key, value) {
7847             if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
7848               baseAssignValue(object, key, value);
7849             }
7850           }
7851           function assignValue(object, key, value) {
7852             var objValue = object[key];
7853             if (!(hasOwnProperty10.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
7854               baseAssignValue(object, key, value);
7855             }
7856           }
7857           function assocIndexOf2(array2, key) {
7858             var length = array2.length;
7859             while (length--) {
7860               if (eq2(array2[length][0], key)) {
7861                 return length;
7862               }
7863             }
7864             return -1;
7865           }
7866           function baseAggregator(collection, setter, iteratee2, accumulator) {
7867             baseEach(collection, function(value, key, collection2) {
7868               setter(accumulator, value, iteratee2(value), collection2);
7869             });
7870             return accumulator;
7871           }
7872           function baseAssign(object, source) {
7873             return object && copyObject(source, keys2(source), object);
7874           }
7875           function baseAssignIn(object, source) {
7876             return object && copyObject(source, keysIn(source), object);
7877           }
7878           function baseAssignValue(object, key, value) {
7879             if (key == "__proto__" && defineProperty) {
7880               defineProperty(object, key, {
7881                 "configurable": true,
7882                 "enumerable": true,
7883                 "value": value,
7884                 "writable": true
7885               });
7886             } else {
7887               object[key] = value;
7888             }
7889           }
7890           function baseAt(object, paths) {
7891             var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
7892             while (++index < length) {
7893               result2[index] = skip ? undefined2 : get4(object, paths[index]);
7894             }
7895             return result2;
7896           }
7897           function baseClamp(number3, lower2, upper) {
7898             if (number3 === number3) {
7899               if (upper !== undefined2) {
7900                 number3 = number3 <= upper ? number3 : upper;
7901               }
7902               if (lower2 !== undefined2) {
7903                 number3 = number3 >= lower2 ? number3 : lower2;
7904               }
7905             }
7906             return number3;
7907           }
7908           function baseClone(value, bitmask, customizer, key, object, stack) {
7909             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
7910             if (customizer) {
7911               result2 = object ? customizer(value, key, object, stack) : customizer(value);
7912             }
7913             if (result2 !== undefined2) {
7914               return result2;
7915             }
7916             if (!isObject3(value)) {
7917               return value;
7918             }
7919             var isArr = isArray2(value);
7920             if (isArr) {
7921               result2 = initCloneArray(value);
7922               if (!isDeep) {
7923                 return copyArray(value, result2);
7924               }
7925             } else {
7926               var tag = getTag2(value), isFunc = tag == funcTag3 || tag == genTag2;
7927               if (isBuffer2(value)) {
7928                 return cloneBuffer(value, isDeep);
7929               }
7930               if (tag == objectTag4 || tag == argsTag4 || isFunc && !object) {
7931                 result2 = isFlat || isFunc ? {} : initCloneObject(value);
7932                 if (!isDeep) {
7933                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
7934                 }
7935               } else {
7936                 if (!cloneableTags[tag]) {
7937                   return object ? value : {};
7938                 }
7939                 result2 = initCloneByTag(value, tag, isDeep);
7940               }
7941             }
7942             stack || (stack = new Stack2());
7943             var stacked = stack.get(value);
7944             if (stacked) {
7945               return stacked;
7946             }
7947             stack.set(value, result2);
7948             if (isSet(value)) {
7949               value.forEach(function(subValue) {
7950                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
7951               });
7952             } else if (isMap(value)) {
7953               value.forEach(function(subValue, key2) {
7954                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7955               });
7956             }
7957             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn : keys2;
7958             var props = isArr ? undefined2 : keysFunc(value);
7959             arrayEach(props || value, function(subValue, key2) {
7960               if (props) {
7961                 key2 = subValue;
7962                 subValue = value[key2];
7963               }
7964               assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
7965             });
7966             return result2;
7967           }
7968           function baseConforms(source) {
7969             var props = keys2(source);
7970             return function(object) {
7971               return baseConformsTo(object, source, props);
7972             };
7973           }
7974           function baseConformsTo(object, source, props) {
7975             var length = props.length;
7976             if (object == null) {
7977               return !length;
7978             }
7979             object = Object2(object);
7980             while (length--) {
7981               var key = props[length], predicate = source[key], value = object[key];
7982               if (value === undefined2 && !(key in object) || !predicate(value)) {
7983                 return false;
7984               }
7985             }
7986             return true;
7987           }
7988           function baseDelay(func, wait, args) {
7989             if (typeof func != "function") {
7990               throw new TypeError2(FUNC_ERROR_TEXT3);
7991             }
7992             return setTimeout2(function() {
7993               func.apply(undefined2, args);
7994             }, wait);
7995           }
7996           function baseDifference(array2, values2, iteratee2, comparator) {
7997             var index = -1, includes2 = arrayIncludes, isCommon = true, length = array2.length, result2 = [], valuesLength = values2.length;
7998             if (!length) {
7999               return result2;
8000             }
8001             if (iteratee2) {
8002               values2 = arrayMap2(values2, baseUnary2(iteratee2));
8003             }
8004             if (comparator) {
8005               includes2 = arrayIncludesWith;
8006               isCommon = false;
8007             } else if (values2.length >= LARGE_ARRAY_SIZE2) {
8008               includes2 = cacheHas2;
8009               isCommon = false;
8010               values2 = new SetCache2(values2);
8011             }
8012             outer:
8013               while (++index < length) {
8014                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
8015                 value = comparator || value !== 0 ? value : 0;
8016                 if (isCommon && computed === computed) {
8017                   var valuesIndex = valuesLength;
8018                   while (valuesIndex--) {
8019                     if (values2[valuesIndex] === computed) {
8020                       continue outer;
8021                     }
8022                   }
8023                   result2.push(value);
8024                 } else if (!includes2(values2, computed, comparator)) {
8025                   result2.push(value);
8026                 }
8027               }
8028             return result2;
8029           }
8030           var baseEach = createBaseEach(baseForOwn);
8031           var baseEachRight = createBaseEach(baseForOwnRight, true);
8032           function baseEvery(collection, predicate) {
8033             var result2 = true;
8034             baseEach(collection, function(value, index, collection2) {
8035               result2 = !!predicate(value, index, collection2);
8036               return result2;
8037             });
8038             return result2;
8039           }
8040           function baseExtremum(array2, iteratee2, comparator) {
8041             var index = -1, length = array2.length;
8042             while (++index < length) {
8043               var value = array2[index], current = iteratee2(value);
8044               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
8045                 var computed = current, result2 = value;
8046               }
8047             }
8048             return result2;
8049           }
8050           function baseFill(array2, value, start2, end) {
8051             var length = array2.length;
8052             start2 = toInteger(start2);
8053             if (start2 < 0) {
8054               start2 = -start2 > length ? 0 : length + start2;
8055             }
8056             end = end === undefined2 || end > length ? length : toInteger(end);
8057             if (end < 0) {
8058               end += length;
8059             }
8060             end = start2 > end ? 0 : toLength(end);
8061             while (start2 < end) {
8062               array2[start2++] = value;
8063             }
8064             return array2;
8065           }
8066           function baseFilter(collection, predicate) {
8067             var result2 = [];
8068             baseEach(collection, function(value, index, collection2) {
8069               if (predicate(value, index, collection2)) {
8070                 result2.push(value);
8071               }
8072             });
8073             return result2;
8074           }
8075           function baseFlatten(array2, depth, predicate, isStrict, result2) {
8076             var index = -1, length = array2.length;
8077             predicate || (predicate = isFlattenable);
8078             result2 || (result2 = []);
8079             while (++index < length) {
8080               var value = array2[index];
8081               if (depth > 0 && predicate(value)) {
8082                 if (depth > 1) {
8083                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
8084                 } else {
8085                   arrayPush2(result2, value);
8086                 }
8087               } else if (!isStrict) {
8088                 result2[result2.length] = value;
8089               }
8090             }
8091             return result2;
8092           }
8093           var baseFor = createBaseFor();
8094           var baseForRight = createBaseFor(true);
8095           function baseForOwn(object, iteratee2) {
8096             return object && baseFor(object, iteratee2, keys2);
8097           }
8098           function baseForOwnRight(object, iteratee2) {
8099             return object && baseForRight(object, iteratee2, keys2);
8100           }
8101           function baseFunctions(object, props) {
8102             return arrayFilter2(props, function(key) {
8103               return isFunction2(object[key]);
8104             });
8105           }
8106           function baseGet(object, path) {
8107             path = castPath(path, object);
8108             var index = 0, length = path.length;
8109             while (object != null && index < length) {
8110               object = object[toKey(path[index++])];
8111             }
8112             return index && index == length ? object : undefined2;
8113           }
8114           function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
8115             var result2 = keysFunc(object);
8116             return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
8117           }
8118           function baseGetTag2(value) {
8119             if (value == null) {
8120               return value === undefined2 ? undefinedTag2 : nullTag2;
8121             }
8122             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
8123           }
8124           function baseGt(value, other) {
8125             return value > other;
8126           }
8127           function baseHas(object, key) {
8128             return object != null && hasOwnProperty10.call(object, key);
8129           }
8130           function baseHasIn(object, key) {
8131             return object != null && key in Object2(object);
8132           }
8133           function baseInRange(number3, start2, end) {
8134             return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
8135           }
8136           function baseIntersection(arrays, iteratee2, comparator) {
8137             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
8138             while (othIndex--) {
8139               var array2 = arrays[othIndex];
8140               if (othIndex && iteratee2) {
8141                 array2 = arrayMap2(array2, baseUnary2(iteratee2));
8142               }
8143               maxLength = nativeMin2(array2.length, maxLength);
8144               caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
8145             }
8146             array2 = arrays[0];
8147             var index = -1, seen = caches[0];
8148             outer:
8149               while (++index < length && result2.length < maxLength) {
8150                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8151                 value = comparator || value !== 0 ? value : 0;
8152                 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
8153                   othIndex = othLength;
8154                   while (--othIndex) {
8155                     var cache = caches[othIndex];
8156                     if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
8157                       continue outer;
8158                     }
8159                   }
8160                   if (seen) {
8161                     seen.push(computed);
8162                   }
8163                   result2.push(value);
8164                 }
8165               }
8166             return result2;
8167           }
8168           function baseInverter(object, setter, iteratee2, accumulator) {
8169             baseForOwn(object, function(value, key, object2) {
8170               setter(accumulator, iteratee2(value), key, object2);
8171             });
8172             return accumulator;
8173           }
8174           function baseInvoke(object, path, args) {
8175             path = castPath(path, object);
8176             object = parent(object, path);
8177             var func = object == null ? object : object[toKey(last(path))];
8178             return func == null ? undefined2 : apply(func, object, args);
8179           }
8180           function baseIsArguments2(value) {
8181             return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
8182           }
8183           function baseIsArrayBuffer(value) {
8184             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
8185           }
8186           function baseIsDate(value) {
8187             return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
8188           }
8189           function baseIsEqual2(value, other, bitmask, customizer, stack) {
8190             if (value === other) {
8191               return true;
8192             }
8193             if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
8194               return value !== value && other !== other;
8195             }
8196             return baseIsEqualDeep2(value, other, bitmask, customizer, baseIsEqual2, stack);
8197           }
8198           function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) {
8199             var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other);
8200             objTag = objTag == argsTag4 ? objectTag4 : objTag;
8201             othTag = othTag == argsTag4 ? objectTag4 : othTag;
8202             var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
8203             if (isSameTag && isBuffer2(object)) {
8204               if (!isBuffer2(other)) {
8205                 return false;
8206               }
8207               objIsArr = true;
8208               objIsObj = false;
8209             }
8210             if (isSameTag && !objIsObj) {
8211               stack || (stack = new Stack2());
8212               return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack);
8213             }
8214             if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
8215               var objIsWrapped = objIsObj && hasOwnProperty10.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty10.call(other, "__wrapped__");
8216               if (objIsWrapped || othIsWrapped) {
8217                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
8218                 stack || (stack = new Stack2());
8219                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
8220               }
8221             }
8222             if (!isSameTag) {
8223               return false;
8224             }
8225             stack || (stack = new Stack2());
8226             return equalObjects2(object, other, bitmask, customizer, equalFunc, stack);
8227           }
8228           function baseIsMap(value) {
8229             return isObjectLike2(value) && getTag2(value) == mapTag4;
8230           }
8231           function baseIsMatch(object, source, matchData, customizer) {
8232             var index = matchData.length, length = index, noCustomizer = !customizer;
8233             if (object == null) {
8234               return !length;
8235             }
8236             object = Object2(object);
8237             while (index--) {
8238               var data = matchData[index];
8239               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
8240                 return false;
8241               }
8242             }
8243             while (++index < length) {
8244               data = matchData[index];
8245               var key = data[0], objValue = object[key], srcValue = data[1];
8246               if (noCustomizer && data[2]) {
8247                 if (objValue === undefined2 && !(key in object)) {
8248                   return false;
8249                 }
8250               } else {
8251                 var stack = new Stack2();
8252                 if (customizer) {
8253                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
8254                 }
8255                 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
8256                   return false;
8257                 }
8258               }
8259             }
8260             return true;
8261           }
8262           function baseIsNative2(value) {
8263             if (!isObject3(value) || isMasked2(value)) {
8264               return false;
8265             }
8266             var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
8267             return pattern.test(toSource2(value));
8268           }
8269           function baseIsRegExp(value) {
8270             return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
8271           }
8272           function baseIsSet(value) {
8273             return isObjectLike2(value) && getTag2(value) == setTag4;
8274           }
8275           function baseIsTypedArray2(value) {
8276             return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
8277           }
8278           function baseIteratee(value) {
8279             if (typeof value == "function") {
8280               return value;
8281             }
8282             if (value == null) {
8283               return identity4;
8284             }
8285             if (typeof value == "object") {
8286               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
8287             }
8288             return property(value);
8289           }
8290           function baseKeys2(object) {
8291             if (!isPrototype2(object)) {
8292               return nativeKeys2(object);
8293             }
8294             var result2 = [];
8295             for (var key in Object2(object)) {
8296               if (hasOwnProperty10.call(object, key) && key != "constructor") {
8297                 result2.push(key);
8298               }
8299             }
8300             return result2;
8301           }
8302           function baseKeysIn(object) {
8303             if (!isObject3(object)) {
8304               return nativeKeysIn(object);
8305             }
8306             var isProto = isPrototype2(object), result2 = [];
8307             for (var key in object) {
8308               if (!(key == "constructor" && (isProto || !hasOwnProperty10.call(object, key)))) {
8309                 result2.push(key);
8310               }
8311             }
8312             return result2;
8313           }
8314           function baseLt(value, other) {
8315             return value < other;
8316           }
8317           function baseMap(collection, iteratee2) {
8318             var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
8319             baseEach(collection, function(value, key, collection2) {
8320               result2[++index] = iteratee2(value, key, collection2);
8321             });
8322             return result2;
8323           }
8324           function baseMatches(source) {
8325             var matchData = getMatchData(source);
8326             if (matchData.length == 1 && matchData[0][2]) {
8327               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
8328             }
8329             return function(object) {
8330               return object === source || baseIsMatch(object, source, matchData);
8331             };
8332           }
8333           function baseMatchesProperty(path, srcValue) {
8334             if (isKey(path) && isStrictComparable(srcValue)) {
8335               return matchesStrictComparable(toKey(path), srcValue);
8336             }
8337             return function(object) {
8338               var objValue = get4(object, path);
8339               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
8340             };
8341           }
8342           function baseMerge(object, source, srcIndex, customizer, stack) {
8343             if (object === source) {
8344               return;
8345             }
8346             baseFor(source, function(srcValue, key) {
8347               stack || (stack = new Stack2());
8348               if (isObject3(srcValue)) {
8349                 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
8350               } else {
8351                 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
8352                 if (newValue === undefined2) {
8353                   newValue = srcValue;
8354                 }
8355                 assignMergeValue(object, key, newValue);
8356               }
8357             }, keysIn);
8358           }
8359           function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
8360             var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
8361             if (stacked) {
8362               assignMergeValue(object, key, stacked);
8363               return;
8364             }
8365             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
8366             var isCommon = newValue === undefined2;
8367             if (isCommon) {
8368               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
8369               newValue = srcValue;
8370               if (isArr || isBuff || isTyped) {
8371                 if (isArray2(objValue)) {
8372                   newValue = objValue;
8373                 } else if (isArrayLikeObject(objValue)) {
8374                   newValue = copyArray(objValue);
8375                 } else if (isBuff) {
8376                   isCommon = false;
8377                   newValue = cloneBuffer(srcValue, true);
8378                 } else if (isTyped) {
8379                   isCommon = false;
8380                   newValue = cloneTypedArray(srcValue, true);
8381                 } else {
8382                   newValue = [];
8383                 }
8384               } else if (isPlainObject(srcValue) || isArguments2(srcValue)) {
8385                 newValue = objValue;
8386                 if (isArguments2(objValue)) {
8387                   newValue = toPlainObject(objValue);
8388                 } else if (!isObject3(objValue) || isFunction2(objValue)) {
8389                   newValue = initCloneObject(srcValue);
8390                 }
8391               } else {
8392                 isCommon = false;
8393               }
8394             }
8395             if (isCommon) {
8396               stack.set(srcValue, newValue);
8397               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
8398               stack["delete"](srcValue);
8399             }
8400             assignMergeValue(object, key, newValue);
8401           }
8402           function baseNth(array2, n3) {
8403             var length = array2.length;
8404             if (!length) {
8405               return;
8406             }
8407             n3 += n3 < 0 ? length : 0;
8408             return isIndex2(n3, length) ? array2[n3] : undefined2;
8409           }
8410           function baseOrderBy(collection, iteratees, orders) {
8411             if (iteratees.length) {
8412               iteratees = arrayMap2(iteratees, function(iteratee2) {
8413                 if (isArray2(iteratee2)) {
8414                   return function(value) {
8415                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
8416                   };
8417                 }
8418                 return iteratee2;
8419               });
8420             } else {
8421               iteratees = [identity4];
8422             }
8423             var index = -1;
8424             iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
8425             var result2 = baseMap(collection, function(value, key, collection2) {
8426               var criteria = arrayMap2(iteratees, function(iteratee2) {
8427                 return iteratee2(value);
8428               });
8429               return { "criteria": criteria, "index": ++index, "value": value };
8430             });
8431             return baseSortBy(result2, function(object, other) {
8432               return compareMultiple(object, other, orders);
8433             });
8434           }
8435           function basePick(object, paths) {
8436             return basePickBy(object, paths, function(value, path) {
8437               return hasIn(object, path);
8438             });
8439           }
8440           function basePickBy(object, paths, predicate) {
8441             var index = -1, length = paths.length, result2 = {};
8442             while (++index < length) {
8443               var path = paths[index], value = baseGet(object, path);
8444               if (predicate(value, path)) {
8445                 baseSet(result2, castPath(path, object), value);
8446               }
8447             }
8448             return result2;
8449           }
8450           function basePropertyDeep(path) {
8451             return function(object) {
8452               return baseGet(object, path);
8453             };
8454           }
8455           function basePullAll(array2, values2, iteratee2, comparator) {
8456             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array2;
8457             if (array2 === values2) {
8458               values2 = copyArray(values2);
8459             }
8460             if (iteratee2) {
8461               seen = arrayMap2(array2, baseUnary2(iteratee2));
8462             }
8463             while (++index < length) {
8464               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
8465               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
8466                 if (seen !== array2) {
8467                   splice2.call(seen, fromIndex, 1);
8468                 }
8469                 splice2.call(array2, fromIndex, 1);
8470               }
8471             }
8472             return array2;
8473           }
8474           function basePullAt(array2, indexes) {
8475             var length = array2 ? indexes.length : 0, lastIndex = length - 1;
8476             while (length--) {
8477               var index = indexes[length];
8478               if (length == lastIndex || index !== previous) {
8479                 var previous = index;
8480                 if (isIndex2(index)) {
8481                   splice2.call(array2, index, 1);
8482                 } else {
8483                   baseUnset(array2, index);
8484                 }
8485               }
8486             }
8487             return array2;
8488           }
8489           function baseRandom(lower2, upper) {
8490             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
8491           }
8492           function baseRange(start2, end, step, fromRight) {
8493             var index = -1, length = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length);
8494             while (length--) {
8495               result2[fromRight ? length : ++index] = start2;
8496               start2 += step;
8497             }
8498             return result2;
8499           }
8500           function baseRepeat(string, n3) {
8501             var result2 = "";
8502             if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER3) {
8503               return result2;
8504             }
8505             do {
8506               if (n3 % 2) {
8507                 result2 += string;
8508               }
8509               n3 = nativeFloor(n3 / 2);
8510               if (n3) {
8511                 string += string;
8512               }
8513             } while (n3);
8514             return result2;
8515           }
8516           function baseRest(func, start2) {
8517             return setToString(overRest(func, start2, identity4), func + "");
8518           }
8519           function baseSample(collection) {
8520             return arraySample(values(collection));
8521           }
8522           function baseSampleSize(collection, n3) {
8523             var array2 = values(collection);
8524             return shuffleSelf(array2, baseClamp(n3, 0, array2.length));
8525           }
8526           function baseSet(object, path, value, customizer) {
8527             if (!isObject3(object)) {
8528               return object;
8529             }
8530             path = castPath(path, object);
8531             var index = -1, length = path.length, lastIndex = length - 1, nested = object;
8532             while (nested != null && ++index < length) {
8533               var key = toKey(path[index]), newValue = value;
8534               if (key === "__proto__" || key === "constructor" || key === "prototype") {
8535                 return object;
8536               }
8537               if (index != lastIndex) {
8538                 var objValue = nested[key];
8539                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
8540                 if (newValue === undefined2) {
8541                   newValue = isObject3(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
8542                 }
8543               }
8544               assignValue(nested, key, newValue);
8545               nested = nested[key];
8546             }
8547             return object;
8548           }
8549           var baseSetData = !metaMap ? identity4 : function(func, data) {
8550             metaMap.set(func, data);
8551             return func;
8552           };
8553           var baseSetToString = !defineProperty ? identity4 : function(func, string) {
8554             return defineProperty(func, "toString", {
8555               "configurable": true,
8556               "enumerable": false,
8557               "value": constant(string),
8558               "writable": true
8559             });
8560           };
8561           function baseShuffle(collection) {
8562             return shuffleSelf(values(collection));
8563           }
8564           function baseSlice(array2, start2, end) {
8565             var index = -1, length = array2.length;
8566             if (start2 < 0) {
8567               start2 = -start2 > length ? 0 : length + start2;
8568             }
8569             end = end > length ? length : end;
8570             if (end < 0) {
8571               end += length;
8572             }
8573             length = start2 > end ? 0 : end - start2 >>> 0;
8574             start2 >>>= 0;
8575             var result2 = Array2(length);
8576             while (++index < length) {
8577               result2[index] = array2[index + start2];
8578             }
8579             return result2;
8580           }
8581           function baseSome(collection, predicate) {
8582             var result2;
8583             baseEach(collection, function(value, index, collection2) {
8584               result2 = predicate(value, index, collection2);
8585               return !result2;
8586             });
8587             return !!result2;
8588           }
8589           function baseSortedIndex(array2, value, retHighest) {
8590             var low = 0, high = array2 == null ? low : array2.length;
8591             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
8592               while (low < high) {
8593                 var mid = low + high >>> 1, computed = array2[mid];
8594                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
8595                   low = mid + 1;
8596                 } else {
8597                   high = mid;
8598                 }
8599               }
8600               return high;
8601             }
8602             return baseSortedIndexBy(array2, value, identity4, retHighest);
8603           }
8604           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
8605             var low = 0, high = array2 == null ? 0 : array2.length;
8606             if (high === 0) {
8607               return 0;
8608             }
8609             value = iteratee2(value);
8610             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
8611             while (low < high) {
8612               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
8613               if (valIsNaN) {
8614                 var setLow = retHighest || othIsReflexive;
8615               } else if (valIsUndefined) {
8616                 setLow = othIsReflexive && (retHighest || othIsDefined);
8617               } else if (valIsNull) {
8618                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
8619               } else if (valIsSymbol) {
8620                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
8621               } else if (othIsNull || othIsSymbol) {
8622                 setLow = false;
8623               } else {
8624                 setLow = retHighest ? computed <= value : computed < value;
8625               }
8626               if (setLow) {
8627                 low = mid + 1;
8628               } else {
8629                 high = mid;
8630               }
8631             }
8632             return nativeMin2(high, MAX_ARRAY_INDEX);
8633           }
8634           function baseSortedUniq(array2, iteratee2) {
8635             var index = -1, length = array2.length, resIndex = 0, result2 = [];
8636             while (++index < length) {
8637               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8638               if (!index || !eq2(computed, seen)) {
8639                 var seen = computed;
8640                 result2[resIndex++] = value === 0 ? 0 : value;
8641               }
8642             }
8643             return result2;
8644           }
8645           function baseToNumber(value) {
8646             if (typeof value == "number") {
8647               return value;
8648             }
8649             if (isSymbol2(value)) {
8650               return NAN2;
8651             }
8652             return +value;
8653           }
8654           function baseToString2(value) {
8655             if (typeof value == "string") {
8656               return value;
8657             }
8658             if (isArray2(value)) {
8659               return arrayMap2(value, baseToString2) + "";
8660             }
8661             if (isSymbol2(value)) {
8662               return symbolToString2 ? symbolToString2.call(value) : "";
8663             }
8664             var result2 = value + "";
8665             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
8666           }
8667           function baseUniq(array2, iteratee2, comparator) {
8668             var index = -1, includes2 = arrayIncludes, length = array2.length, isCommon = true, result2 = [], seen = result2;
8669             if (comparator) {
8670               isCommon = false;
8671               includes2 = arrayIncludesWith;
8672             } else if (length >= LARGE_ARRAY_SIZE2) {
8673               var set4 = iteratee2 ? null : createSet(array2);
8674               if (set4) {
8675                 return setToArray2(set4);
8676               }
8677               isCommon = false;
8678               includes2 = cacheHas2;
8679               seen = new SetCache2();
8680             } else {
8681               seen = iteratee2 ? [] : result2;
8682             }
8683             outer:
8684               while (++index < length) {
8685                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8686                 value = comparator || value !== 0 ? value : 0;
8687                 if (isCommon && computed === computed) {
8688                   var seenIndex = seen.length;
8689                   while (seenIndex--) {
8690                     if (seen[seenIndex] === computed) {
8691                       continue outer;
8692                     }
8693                   }
8694                   if (iteratee2) {
8695                     seen.push(computed);
8696                   }
8697                   result2.push(value);
8698                 } else if (!includes2(seen, computed, comparator)) {
8699                   if (seen !== result2) {
8700                     seen.push(computed);
8701                   }
8702                   result2.push(value);
8703                 }
8704               }
8705             return result2;
8706           }
8707           function baseUnset(object, path) {
8708             path = castPath(path, object);
8709             object = parent(object, path);
8710             return object == null || delete object[toKey(last(path))];
8711           }
8712           function baseUpdate(object, path, updater, customizer) {
8713             return baseSet(object, path, updater(baseGet(object, path)), customizer);
8714           }
8715           function baseWhile(array2, predicate, isDrop, fromRight) {
8716             var length = array2.length, index = fromRight ? length : -1;
8717             while ((fromRight ? index-- : ++index < length) && predicate(array2[index], index, array2)) {
8718             }
8719             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length : index);
8720           }
8721           function baseWrapperValue(value, actions) {
8722             var result2 = value;
8723             if (result2 instanceof LazyWrapper) {
8724               result2 = result2.value();
8725             }
8726             return arrayReduce(actions, function(result3, action) {
8727               return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
8728             }, result2);
8729           }
8730           function baseXor(arrays, iteratee2, comparator) {
8731             var length = arrays.length;
8732             if (length < 2) {
8733               return length ? baseUniq(arrays[0]) : [];
8734             }
8735             var index = -1, result2 = Array2(length);
8736             while (++index < length) {
8737               var array2 = arrays[index], othIndex = -1;
8738               while (++othIndex < length) {
8739                 if (othIndex != index) {
8740                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
8741                 }
8742               }
8743             }
8744             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
8745           }
8746           function baseZipObject(props, values2, assignFunc) {
8747             var index = -1, length = props.length, valsLength = values2.length, result2 = {};
8748             while (++index < length) {
8749               var value = index < valsLength ? values2[index] : undefined2;
8750               assignFunc(result2, props[index], value);
8751             }
8752             return result2;
8753           }
8754           function castArrayLikeObject(value) {
8755             return isArrayLikeObject(value) ? value : [];
8756           }
8757           function castFunction(value) {
8758             return typeof value == "function" ? value : identity4;
8759           }
8760           function castPath(value, object) {
8761             if (isArray2(value)) {
8762               return value;
8763             }
8764             return isKey(value, object) ? [value] : stringToPath(toString2(value));
8765           }
8766           var castRest = baseRest;
8767           function castSlice(array2, start2, end) {
8768             var length = array2.length;
8769             end = end === undefined2 ? length : end;
8770             return !start2 && end >= length ? array2 : baseSlice(array2, start2, end);
8771           }
8772           var clearTimeout2 = ctxClearTimeout || function(id2) {
8773             return root3.clearTimeout(id2);
8774           };
8775           function cloneBuffer(buffer, isDeep) {
8776             if (isDeep) {
8777               return buffer.slice();
8778             }
8779             var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
8780             buffer.copy(result2);
8781             return result2;
8782           }
8783           function cloneArrayBuffer(arrayBuffer) {
8784             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
8785             new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
8786             return result2;
8787           }
8788           function cloneDataView(dataView, isDeep) {
8789             var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
8790             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
8791           }
8792           function cloneRegExp(regexp) {
8793             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
8794             result2.lastIndex = regexp.lastIndex;
8795             return result2;
8796           }
8797           function cloneSymbol(symbol) {
8798             return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
8799           }
8800           function cloneTypedArray(typedArray, isDeep) {
8801             var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
8802             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
8803           }
8804           function compareAscending(value, other) {
8805             if (value !== other) {
8806               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
8807               var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
8808               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
8809                 return 1;
8810               }
8811               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
8812                 return -1;
8813               }
8814             }
8815             return 0;
8816           }
8817           function compareMultiple(object, other, orders) {
8818             var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
8819             while (++index < length) {
8820               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
8821               if (result2) {
8822                 if (index >= ordersLength) {
8823                   return result2;
8824                 }
8825                 var order = orders[index];
8826                 return result2 * (order == "desc" ? -1 : 1);
8827               }
8828             }
8829             return object.index - other.index;
8830           }
8831           function composeArgs(args, partials, holders, isCurried) {
8832             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;
8833             while (++leftIndex < leftLength) {
8834               result2[leftIndex] = partials[leftIndex];
8835             }
8836             while (++argsIndex < holdersLength) {
8837               if (isUncurried || argsIndex < argsLength) {
8838                 result2[holders[argsIndex]] = args[argsIndex];
8839               }
8840             }
8841             while (rangeLength--) {
8842               result2[leftIndex++] = args[argsIndex++];
8843             }
8844             return result2;
8845           }
8846           function composeArgsRight(args, partials, holders, isCurried) {
8847             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;
8848             while (++argsIndex < rangeLength) {
8849               result2[argsIndex] = args[argsIndex];
8850             }
8851             var offset = argsIndex;
8852             while (++rightIndex < rightLength) {
8853               result2[offset + rightIndex] = partials[rightIndex];
8854             }
8855             while (++holdersIndex < holdersLength) {
8856               if (isUncurried || argsIndex < argsLength) {
8857                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
8858               }
8859             }
8860             return result2;
8861           }
8862           function copyArray(source, array2) {
8863             var index = -1, length = source.length;
8864             array2 || (array2 = Array2(length));
8865             while (++index < length) {
8866               array2[index] = source[index];
8867             }
8868             return array2;
8869           }
8870           function copyObject(source, props, object, customizer) {
8871             var isNew = !object;
8872             object || (object = {});
8873             var index = -1, length = props.length;
8874             while (++index < length) {
8875               var key = props[index];
8876               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
8877               if (newValue === undefined2) {
8878                 newValue = source[key];
8879               }
8880               if (isNew) {
8881                 baseAssignValue(object, key, newValue);
8882               } else {
8883                 assignValue(object, key, newValue);
8884               }
8885             }
8886             return object;
8887           }
8888           function copySymbols(source, object) {
8889             return copyObject(source, getSymbols2(source), object);
8890           }
8891           function copySymbolsIn(source, object) {
8892             return copyObject(source, getSymbolsIn(source), object);
8893           }
8894           function createAggregator(setter, initializer) {
8895             return function(collection, iteratee2) {
8896               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
8897               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
8898             };
8899           }
8900           function createAssigner(assigner) {
8901             return baseRest(function(object, sources) {
8902               var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
8903               customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
8904               if (guard && isIterateeCall(sources[0], sources[1], guard)) {
8905                 customizer = length < 3 ? undefined2 : customizer;
8906                 length = 1;
8907               }
8908               object = Object2(object);
8909               while (++index < length) {
8910                 var source = sources[index];
8911                 if (source) {
8912                   assigner(object, source, index, customizer);
8913                 }
8914               }
8915               return object;
8916             });
8917           }
8918           function createBaseEach(eachFunc, fromRight) {
8919             return function(collection, iteratee2) {
8920               if (collection == null) {
8921                 return collection;
8922               }
8923               if (!isArrayLike2(collection)) {
8924                 return eachFunc(collection, iteratee2);
8925               }
8926               var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
8927               while (fromRight ? index-- : ++index < length) {
8928                 if (iteratee2(iterable[index], index, iterable) === false) {
8929                   break;
8930                 }
8931               }
8932               return collection;
8933             };
8934           }
8935           function createBaseFor(fromRight) {
8936             return function(object, iteratee2, keysFunc) {
8937               var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
8938               while (length--) {
8939                 var key = props[fromRight ? length : ++index];
8940                 if (iteratee2(iterable[key], key, iterable) === false) {
8941                   break;
8942                 }
8943               }
8944               return object;
8945             };
8946           }
8947           function createBind(func, bitmask, thisArg) {
8948             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
8949             function wrapper() {
8950               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
8951               return fn.apply(isBind ? thisArg : this, arguments);
8952             }
8953             return wrapper;
8954           }
8955           function createCaseFirst(methodName) {
8956             return function(string) {
8957               string = toString2(string);
8958               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
8959               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
8960               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
8961               return chr[methodName]() + trailing;
8962             };
8963           }
8964           function createCompounder(callback) {
8965             return function(string) {
8966               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
8967             };
8968           }
8969           function createCtor(Ctor) {
8970             return function() {
8971               var args = arguments;
8972               switch (args.length) {
8973                 case 0:
8974                   return new Ctor();
8975                 case 1:
8976                   return new Ctor(args[0]);
8977                 case 2:
8978                   return new Ctor(args[0], args[1]);
8979                 case 3:
8980                   return new Ctor(args[0], args[1], args[2]);
8981                 case 4:
8982                   return new Ctor(args[0], args[1], args[2], args[3]);
8983                 case 5:
8984                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
8985                 case 6:
8986                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
8987                 case 7:
8988                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
8989               }
8990               var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
8991               return isObject3(result2) ? result2 : thisBinding;
8992             };
8993           }
8994           function createCurry(func, bitmask, arity) {
8995             var Ctor = createCtor(func);
8996             function wrapper() {
8997               var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
8998               while (index--) {
8999                 args[index] = arguments[index];
9000               }
9001               var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
9002               length -= holders.length;
9003               if (length < arity) {
9004                 return createRecurry(
9005                   func,
9006                   bitmask,
9007                   createHybrid,
9008                   wrapper.placeholder,
9009                   undefined2,
9010                   args,
9011                   holders,
9012                   undefined2,
9013                   undefined2,
9014                   arity - length
9015                 );
9016               }
9017               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9018               return apply(fn, this, args);
9019             }
9020             return wrapper;
9021           }
9022           function createFind(findIndexFunc) {
9023             return function(collection, predicate, fromIndex) {
9024               var iterable = Object2(collection);
9025               if (!isArrayLike2(collection)) {
9026                 var iteratee2 = getIteratee(predicate, 3);
9027                 collection = keys2(collection);
9028                 predicate = function(key) {
9029                   return iteratee2(iterable[key], key, iterable);
9030                 };
9031               }
9032               var index = findIndexFunc(collection, predicate, fromIndex);
9033               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
9034             };
9035           }
9036           function createFlow(fromRight) {
9037             return flatRest(function(funcs) {
9038               var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
9039               if (fromRight) {
9040                 funcs.reverse();
9041               }
9042               while (index--) {
9043                 var func = funcs[index];
9044                 if (typeof func != "function") {
9045                   throw new TypeError2(FUNC_ERROR_TEXT3);
9046                 }
9047                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
9048                   var wrapper = new LodashWrapper([], true);
9049                 }
9050               }
9051               index = wrapper ? index : length;
9052               while (++index < length) {
9053                 func = funcs[index];
9054                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
9055                 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) {
9056                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
9057                 } else {
9058                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
9059                 }
9060               }
9061               return function() {
9062                 var args = arguments, value = args[0];
9063                 if (wrapper && args.length == 1 && isArray2(value)) {
9064                   return wrapper.plant(value).value();
9065                 }
9066                 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
9067                 while (++index2 < length) {
9068                   result2 = funcs[index2].call(this, result2);
9069                 }
9070                 return result2;
9071               };
9072             });
9073           }
9074           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
9075             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);
9076             function wrapper() {
9077               var length = arguments.length, args = Array2(length), index = length;
9078               while (index--) {
9079                 args[index] = arguments[index];
9080               }
9081               if (isCurried) {
9082                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
9083               }
9084               if (partials) {
9085                 args = composeArgs(args, partials, holders, isCurried);
9086               }
9087               if (partialsRight) {
9088                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
9089               }
9090               length -= holdersCount;
9091               if (isCurried && length < arity) {
9092                 var newHolders = replaceHolders(args, placeholder);
9093                 return createRecurry(
9094                   func,
9095                   bitmask,
9096                   createHybrid,
9097                   wrapper.placeholder,
9098                   thisArg,
9099                   args,
9100                   newHolders,
9101                   argPos,
9102                   ary2,
9103                   arity - length
9104                 );
9105               }
9106               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
9107               length = args.length;
9108               if (argPos) {
9109                 args = reorder(args, argPos);
9110               } else if (isFlip && length > 1) {
9111                 args.reverse();
9112               }
9113               if (isAry && ary2 < length) {
9114                 args.length = ary2;
9115               }
9116               if (this && this !== root3 && this instanceof wrapper) {
9117                 fn = Ctor || createCtor(fn);
9118               }
9119               return fn.apply(thisBinding, args);
9120             }
9121             return wrapper;
9122           }
9123           function createInverter(setter, toIteratee) {
9124             return function(object, iteratee2) {
9125               return baseInverter(object, setter, toIteratee(iteratee2), {});
9126             };
9127           }
9128           function createMathOperation(operator, defaultValue) {
9129             return function(value, other) {
9130               var result2;
9131               if (value === undefined2 && other === undefined2) {
9132                 return defaultValue;
9133               }
9134               if (value !== undefined2) {
9135                 result2 = value;
9136               }
9137               if (other !== undefined2) {
9138                 if (result2 === undefined2) {
9139                   return other;
9140                 }
9141                 if (typeof value == "string" || typeof other == "string") {
9142                   value = baseToString2(value);
9143                   other = baseToString2(other);
9144                 } else {
9145                   value = baseToNumber(value);
9146                   other = baseToNumber(other);
9147                 }
9148                 result2 = operator(value, other);
9149               }
9150               return result2;
9151             };
9152           }
9153           function createOver(arrayFunc) {
9154             return flatRest(function(iteratees) {
9155               iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
9156               return baseRest(function(args) {
9157                 var thisArg = this;
9158                 return arrayFunc(iteratees, function(iteratee2) {
9159                   return apply(iteratee2, thisArg, args);
9160                 });
9161               });
9162             });
9163           }
9164           function createPadding(length, chars) {
9165             chars = chars === undefined2 ? " " : baseToString2(chars);
9166             var charsLength = chars.length;
9167             if (charsLength < 2) {
9168               return charsLength ? baseRepeat(chars, length) : chars;
9169             }
9170             var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
9171             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
9172           }
9173           function createPartial(func, bitmask, thisArg, partials) {
9174             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
9175             function wrapper() {
9176               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9177               while (++leftIndex < leftLength) {
9178                 args[leftIndex] = partials[leftIndex];
9179               }
9180               while (argsLength--) {
9181                 args[leftIndex++] = arguments[++argsIndex];
9182               }
9183               return apply(fn, isBind ? thisArg : this, args);
9184             }
9185             return wrapper;
9186           }
9187           function createRange(fromRight) {
9188             return function(start2, end, step) {
9189               if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
9190                 end = step = undefined2;
9191               }
9192               start2 = toFinite(start2);
9193               if (end === undefined2) {
9194                 end = start2;
9195                 start2 = 0;
9196               } else {
9197                 end = toFinite(end);
9198               }
9199               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
9200               return baseRange(start2, end, step, fromRight);
9201             };
9202           }
9203           function createRelationalOperation(operator) {
9204             return function(value, other) {
9205               if (!(typeof value == "string" && typeof other == "string")) {
9206                 value = toNumber3(value);
9207                 other = toNumber3(other);
9208               }
9209               return operator(value, other);
9210             };
9211           }
9212           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
9213             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
9214             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
9215             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
9216             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
9217               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
9218             }
9219             var newData = [
9220               func,
9221               bitmask,
9222               thisArg,
9223               newPartials,
9224               newHolders,
9225               newPartialsRight,
9226               newHoldersRight,
9227               argPos,
9228               ary2,
9229               arity
9230             ];
9231             var result2 = wrapFunc.apply(undefined2, newData);
9232             if (isLaziable(func)) {
9233               setData(result2, newData);
9234             }
9235             result2.placeholder = placeholder;
9236             return setWrapToString(result2, func, bitmask);
9237           }
9238           function createRound(methodName) {
9239             var func = Math2[methodName];
9240             return function(number3, precision2) {
9241               number3 = toNumber3(number3);
9242               precision2 = precision2 == null ? 0 : nativeMin2(toInteger(precision2), 292);
9243               if (precision2 && nativeIsFinite(number3)) {
9244                 var pair3 = (toString2(number3) + "e").split("e"), value = func(pair3[0] + "e" + (+pair3[1] + precision2));
9245                 pair3 = (toString2(value) + "e").split("e");
9246                 return +(pair3[0] + "e" + (+pair3[1] - precision2));
9247               }
9248               return func(number3);
9249             };
9250           }
9251           var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
9252             return new Set3(values2);
9253           };
9254           function createToPairs(keysFunc) {
9255             return function(object) {
9256               var tag = getTag2(object);
9257               if (tag == mapTag4) {
9258                 return mapToArray2(object);
9259               }
9260               if (tag == setTag4) {
9261                 return setToPairs(object);
9262               }
9263               return baseToPairs(object, keysFunc(object));
9264             };
9265           }
9266           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
9267             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
9268             if (!isBindKey && typeof func != "function") {
9269               throw new TypeError2(FUNC_ERROR_TEXT3);
9270             }
9271             var length = partials ? partials.length : 0;
9272             if (!length) {
9273               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
9274               partials = holders = undefined2;
9275             }
9276             ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
9277             arity = arity === undefined2 ? arity : toInteger(arity);
9278             length -= holders ? holders.length : 0;
9279             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
9280               var partialsRight = partials, holdersRight = holders;
9281               partials = holders = undefined2;
9282             }
9283             var data = isBindKey ? undefined2 : getData(func);
9284             var newData = [
9285               func,
9286               bitmask,
9287               thisArg,
9288               partials,
9289               holders,
9290               partialsRight,
9291               holdersRight,
9292               argPos,
9293               ary2,
9294               arity
9295             ];
9296             if (data) {
9297               mergeData(newData, data);
9298             }
9299             func = newData[0];
9300             bitmask = newData[1];
9301             thisArg = newData[2];
9302             partials = newData[3];
9303             holders = newData[4];
9304             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length, 0);
9305             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
9306               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
9307             }
9308             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
9309               var result2 = createBind(func, bitmask, thisArg);
9310             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
9311               result2 = createCurry(func, bitmask, arity);
9312             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
9313               result2 = createPartial(func, bitmask, thisArg, partials);
9314             } else {
9315               result2 = createHybrid.apply(undefined2, newData);
9316             }
9317             var setter = data ? baseSetData : setData;
9318             return setWrapToString(setter(result2, newData), func, bitmask);
9319           }
9320           function customDefaultsAssignIn(objValue, srcValue, key, object) {
9321             if (objValue === undefined2 || eq2(objValue, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
9322               return srcValue;
9323             }
9324             return objValue;
9325           }
9326           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
9327             if (isObject3(objValue) && isObject3(srcValue)) {
9328               stack.set(srcValue, objValue);
9329               baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
9330               stack["delete"](srcValue);
9331             }
9332             return objValue;
9333           }
9334           function customOmitClone(value) {
9335             return isPlainObject(value) ? undefined2 : value;
9336           }
9337           function equalArrays2(array2, other, bitmask, customizer, equalFunc, stack) {
9338             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other.length;
9339             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
9340               return false;
9341             }
9342             var arrStacked = stack.get(array2);
9343             var othStacked = stack.get(other);
9344             if (arrStacked && othStacked) {
9345               return arrStacked == other && othStacked == array2;
9346             }
9347             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
9348             stack.set(array2, other);
9349             stack.set(other, array2);
9350             while (++index < arrLength) {
9351               var arrValue = array2[index], othValue = other[index];
9352               if (customizer) {
9353                 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
9354               }
9355               if (compared !== undefined2) {
9356                 if (compared) {
9357                   continue;
9358                 }
9359                 result2 = false;
9360                 break;
9361               }
9362               if (seen) {
9363                 if (!arraySome2(other, function(othValue2, othIndex) {
9364                   if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
9365                     return seen.push(othIndex);
9366                   }
9367                 })) {
9368                   result2 = false;
9369                   break;
9370                 }
9371               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
9372                 result2 = false;
9373                 break;
9374               }
9375             }
9376             stack["delete"](array2);
9377             stack["delete"](other);
9378             return result2;
9379           }
9380           function equalByTag2(object, other, tag, bitmask, customizer, equalFunc, stack) {
9381             switch (tag) {
9382               case dataViewTag4:
9383                 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
9384                   return false;
9385                 }
9386                 object = object.buffer;
9387                 other = other.buffer;
9388               case arrayBufferTag3:
9389                 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other))) {
9390                   return false;
9391                 }
9392                 return true;
9393               case boolTag3:
9394               case dateTag3:
9395               case numberTag4:
9396                 return eq2(+object, +other);
9397               case errorTag3:
9398                 return object.name == other.name && object.message == other.message;
9399               case regexpTag3:
9400               case stringTag3:
9401                 return object == other + "";
9402               case mapTag4:
9403                 var convert = mapToArray2;
9404               case setTag4:
9405                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
9406                 convert || (convert = setToArray2);
9407                 if (object.size != other.size && !isPartial) {
9408                   return false;
9409                 }
9410                 var stacked = stack.get(object);
9411                 if (stacked) {
9412                   return stacked == other;
9413                 }
9414                 bitmask |= COMPARE_UNORDERED_FLAG3;
9415                 stack.set(object, other);
9416                 var result2 = equalArrays2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
9417                 stack["delete"](object);
9418                 return result2;
9419               case symbolTag3:
9420                 if (symbolValueOf2) {
9421                   return symbolValueOf2.call(object) == symbolValueOf2.call(other);
9422                 }
9423             }
9424             return false;
9425           }
9426           function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) {
9427             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
9428             if (objLength != othLength && !isPartial) {
9429               return false;
9430             }
9431             var index = objLength;
9432             while (index--) {
9433               var key = objProps[index];
9434               if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) {
9435                 return false;
9436               }
9437             }
9438             var objStacked = stack.get(object);
9439             var othStacked = stack.get(other);
9440             if (objStacked && othStacked) {
9441               return objStacked == other && othStacked == object;
9442             }
9443             var result2 = true;
9444             stack.set(object, other);
9445             stack.set(other, object);
9446             var skipCtor = isPartial;
9447             while (++index < objLength) {
9448               key = objProps[index];
9449               var objValue = object[key], othValue = other[key];
9450               if (customizer) {
9451                 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
9452               }
9453               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
9454                 result2 = false;
9455                 break;
9456               }
9457               skipCtor || (skipCtor = key == "constructor");
9458             }
9459             if (result2 && !skipCtor) {
9460               var objCtor = object.constructor, othCtor = other.constructor;
9461               if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
9462                 result2 = false;
9463               }
9464             }
9465             stack["delete"](object);
9466             stack["delete"](other);
9467             return result2;
9468           }
9469           function flatRest(func) {
9470             return setToString(overRest(func, undefined2, flatten2), func + "");
9471           }
9472           function getAllKeys2(object) {
9473             return baseGetAllKeys2(object, keys2, getSymbols2);
9474           }
9475           function getAllKeysIn(object) {
9476             return baseGetAllKeys2(object, keysIn, getSymbolsIn);
9477           }
9478           var getData = !metaMap ? noop3 : function(func) {
9479             return metaMap.get(func);
9480           };
9481           function getFuncName(func) {
9482             var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty10.call(realNames, result2) ? array2.length : 0;
9483             while (length--) {
9484               var data = array2[length], otherFunc = data.func;
9485               if (otherFunc == null || otherFunc == func) {
9486                 return data.name;
9487               }
9488             }
9489             return result2;
9490           }
9491           function getHolder(func) {
9492             var object = hasOwnProperty10.call(lodash, "placeholder") ? lodash : func;
9493             return object.placeholder;
9494           }
9495           function getIteratee() {
9496             var result2 = lodash.iteratee || iteratee;
9497             result2 = result2 === iteratee ? baseIteratee : result2;
9498             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
9499           }
9500           function getMapData2(map3, key) {
9501             var data = map3.__data__;
9502             return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9503           }
9504           function getMatchData(object) {
9505             var result2 = keys2(object), length = result2.length;
9506             while (length--) {
9507               var key = result2[length], value = object[key];
9508               result2[length] = [key, value, isStrictComparable(value)];
9509             }
9510             return result2;
9511           }
9512           function getNative2(object, key) {
9513             var value = getValue2(object, key);
9514             return baseIsNative2(value) ? value : undefined2;
9515           }
9516           function getRawTag2(value) {
9517             var isOwn = hasOwnProperty10.call(value, symToStringTag3), tag = value[symToStringTag3];
9518             try {
9519               value[symToStringTag3] = undefined2;
9520               var unmasked = true;
9521             } catch (e3) {
9522             }
9523             var result2 = nativeObjectToString3.call(value);
9524             if (unmasked) {
9525               if (isOwn) {
9526                 value[symToStringTag3] = tag;
9527               } else {
9528                 delete value[symToStringTag3];
9529               }
9530             }
9531             return result2;
9532           }
9533           var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
9534             if (object == null) {
9535               return [];
9536             }
9537             object = Object2(object);
9538             return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
9539               return propertyIsEnumerable3.call(object, symbol);
9540             });
9541           };
9542           var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
9543             var result2 = [];
9544             while (object) {
9545               arrayPush2(result2, getSymbols2(object));
9546               object = getPrototype(object);
9547             }
9548             return result2;
9549           };
9550           var getTag2 = baseGetTag2;
9551           if (DataView3 && getTag2(new DataView3(new ArrayBuffer(1))) != dataViewTag4 || Map3 && getTag2(new Map3()) != mapTag4 || Promise3 && getTag2(Promise3.resolve()) != promiseTag2 || Set3 && getTag2(new Set3()) != setTag4 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag3) {
9552             getTag2 = function(value) {
9553               var result2 = baseGetTag2(value), Ctor = result2 == objectTag4 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
9554               if (ctorString) {
9555                 switch (ctorString) {
9556                   case dataViewCtorString2:
9557                     return dataViewTag4;
9558                   case mapCtorString2:
9559                     return mapTag4;
9560                   case promiseCtorString2:
9561                     return promiseTag2;
9562                   case setCtorString2:
9563                     return setTag4;
9564                   case weakMapCtorString2:
9565                     return weakMapTag3;
9566                 }
9567               }
9568               return result2;
9569             };
9570           }
9571           function getView(start2, end, transforms) {
9572             var index = -1, length = transforms.length;
9573             while (++index < length) {
9574               var data = transforms[index], size2 = data.size;
9575               switch (data.type) {
9576                 case "drop":
9577                   start2 += size2;
9578                   break;
9579                 case "dropRight":
9580                   end -= size2;
9581                   break;
9582                 case "take":
9583                   end = nativeMin2(end, start2 + size2);
9584                   break;
9585                 case "takeRight":
9586                   start2 = nativeMax2(start2, end - size2);
9587                   break;
9588               }
9589             }
9590             return { "start": start2, "end": end };
9591           }
9592           function getWrapDetails(source) {
9593             var match = source.match(reWrapDetails);
9594             return match ? match[1].split(reSplitDetails) : [];
9595           }
9596           function hasPath(object, path, hasFunc) {
9597             path = castPath(path, object);
9598             var index = -1, length = path.length, result2 = false;
9599             while (++index < length) {
9600               var key = toKey(path[index]);
9601               if (!(result2 = object != null && hasFunc(object, key))) {
9602                 break;
9603               }
9604               object = object[key];
9605             }
9606             if (result2 || ++index != length) {
9607               return result2;
9608             }
9609             length = object == null ? 0 : object.length;
9610             return !!length && isLength2(length) && isIndex2(key, length) && (isArray2(object) || isArguments2(object));
9611           }
9612           function initCloneArray(array2) {
9613             var length = array2.length, result2 = new array2.constructor(length);
9614             if (length && typeof array2[0] == "string" && hasOwnProperty10.call(array2, "index")) {
9615               result2.index = array2.index;
9616               result2.input = array2.input;
9617             }
9618             return result2;
9619           }
9620           function initCloneObject(object) {
9621             return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {};
9622           }
9623           function initCloneByTag(object, tag, isDeep) {
9624             var Ctor = object.constructor;
9625             switch (tag) {
9626               case arrayBufferTag3:
9627                 return cloneArrayBuffer(object);
9628               case boolTag3:
9629               case dateTag3:
9630                 return new Ctor(+object);
9631               case dataViewTag4:
9632                 return cloneDataView(object, isDeep);
9633               case float32Tag2:
9634               case float64Tag2:
9635               case int8Tag2:
9636               case int16Tag2:
9637               case int32Tag2:
9638               case uint8Tag2:
9639               case uint8ClampedTag2:
9640               case uint16Tag2:
9641               case uint32Tag2:
9642                 return cloneTypedArray(object, isDeep);
9643               case mapTag4:
9644                 return new Ctor();
9645               case numberTag4:
9646               case stringTag3:
9647                 return new Ctor(object);
9648               case regexpTag3:
9649                 return cloneRegExp(object);
9650               case setTag4:
9651                 return new Ctor();
9652               case symbolTag3:
9653                 return cloneSymbol(object);
9654             }
9655           }
9656           function insertWrapDetails(source, details) {
9657             var length = details.length;
9658             if (!length) {
9659               return source;
9660             }
9661             var lastIndex = length - 1;
9662             details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
9663             details = details.join(length > 2 ? ", " : " ");
9664             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
9665           }
9666           function isFlattenable(value) {
9667             return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9668           }
9669           function isIndex2(value, length) {
9670             var type2 = typeof value;
9671             length = length == null ? MAX_SAFE_INTEGER3 : length;
9672             return !!length && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length);
9673           }
9674           function isIterateeCall(value, index, object) {
9675             if (!isObject3(object)) {
9676               return false;
9677             }
9678             var type2 = typeof index;
9679             if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
9680               return eq2(object[index], value);
9681             }
9682             return false;
9683           }
9684           function isKey(value, object) {
9685             if (isArray2(value)) {
9686               return false;
9687             }
9688             var type2 = typeof value;
9689             if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
9690               return true;
9691             }
9692             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
9693           }
9694           function isKeyable2(value) {
9695             var type2 = typeof value;
9696             return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9697           }
9698           function isLaziable(func) {
9699             var funcName = getFuncName(func), other = lodash[funcName];
9700             if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
9701               return false;
9702             }
9703             if (func === other) {
9704               return true;
9705             }
9706             var data = getData(other);
9707             return !!data && func === data[0];
9708           }
9709           function isMasked2(func) {
9710             return !!maskSrcKey2 && maskSrcKey2 in func;
9711           }
9712           var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
9713           function isPrototype2(value) {
9714             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto13;
9715             return value === proto;
9716           }
9717           function isStrictComparable(value) {
9718             return value === value && !isObject3(value);
9719           }
9720           function matchesStrictComparable(key, srcValue) {
9721             return function(object) {
9722               if (object == null) {
9723                 return false;
9724               }
9725               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
9726             };
9727           }
9728           function memoizeCapped(func) {
9729             var result2 = memoize(func, function(key) {
9730               if (cache.size === MAX_MEMOIZE_SIZE) {
9731                 cache.clear();
9732               }
9733               return key;
9734             });
9735             var cache = result2.cache;
9736             return result2;
9737           }
9738           function mergeData(data, source) {
9739             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
9740             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;
9741             if (!(isCommon || isCombo)) {
9742               return data;
9743             }
9744             if (srcBitmask & WRAP_BIND_FLAG) {
9745               data[2] = source[2];
9746               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
9747             }
9748             var value = source[3];
9749             if (value) {
9750               var partials = data[3];
9751               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
9752               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
9753             }
9754             value = source[5];
9755             if (value) {
9756               partials = data[5];
9757               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
9758               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
9759             }
9760             value = source[7];
9761             if (value) {
9762               data[7] = value;
9763             }
9764             if (srcBitmask & WRAP_ARY_FLAG) {
9765               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
9766             }
9767             if (data[9] == null) {
9768               data[9] = source[9];
9769             }
9770             data[0] = source[0];
9771             data[1] = newBitmask;
9772             return data;
9773           }
9774           function nativeKeysIn(object) {
9775             var result2 = [];
9776             if (object != null) {
9777               for (var key in Object2(object)) {
9778                 result2.push(key);
9779               }
9780             }
9781             return result2;
9782           }
9783           function objectToString2(value) {
9784             return nativeObjectToString3.call(value);
9785           }
9786           function overRest(func, start2, transform3) {
9787             start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
9788             return function() {
9789               var args = arguments, index = -1, length = nativeMax2(args.length - start2, 0), array2 = Array2(length);
9790               while (++index < length) {
9791                 array2[index] = args[start2 + index];
9792               }
9793               index = -1;
9794               var otherArgs = Array2(start2 + 1);
9795               while (++index < start2) {
9796                 otherArgs[index] = args[index];
9797               }
9798               otherArgs[start2] = transform3(array2);
9799               return apply(func, this, otherArgs);
9800             };
9801           }
9802           function parent(object, path) {
9803             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
9804           }
9805           function reorder(array2, indexes) {
9806             var arrLength = array2.length, length = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
9807             while (length--) {
9808               var index = indexes[length];
9809               array2[length] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
9810             }
9811             return array2;
9812           }
9813           function safeGet(object, key) {
9814             if (key === "constructor" && typeof object[key] === "function") {
9815               return;
9816             }
9817             if (key == "__proto__") {
9818               return;
9819             }
9820             return object[key];
9821           }
9822           var setData = shortOut(baseSetData);
9823           var setTimeout2 = ctxSetTimeout || function(func, wait) {
9824             return root3.setTimeout(func, wait);
9825           };
9826           var setToString = shortOut(baseSetToString);
9827           function setWrapToString(wrapper, reference, bitmask) {
9828             var source = reference + "";
9829             return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
9830           }
9831           function shortOut(func) {
9832             var count = 0, lastCalled = 0;
9833             return function() {
9834               var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
9835               lastCalled = stamp;
9836               if (remaining > 0) {
9837                 if (++count >= HOT_COUNT) {
9838                   return arguments[0];
9839                 }
9840               } else {
9841                 count = 0;
9842               }
9843               return func.apply(undefined2, arguments);
9844             };
9845           }
9846           function shuffleSelf(array2, size2) {
9847             var index = -1, length = array2.length, lastIndex = length - 1;
9848             size2 = size2 === undefined2 ? length : size2;
9849             while (++index < size2) {
9850               var rand = baseRandom(index, lastIndex), value = array2[rand];
9851               array2[rand] = array2[index];
9852               array2[index] = value;
9853             }
9854             array2.length = size2;
9855             return array2;
9856           }
9857           var stringToPath = memoizeCapped(function(string) {
9858             var result2 = [];
9859             if (string.charCodeAt(0) === 46) {
9860               result2.push("");
9861             }
9862             string.replace(rePropName, function(match, number3, quote2, subString) {
9863               result2.push(quote2 ? subString.replace(reEscapeChar, "$1") : number3 || match);
9864             });
9865             return result2;
9866           });
9867           function toKey(value) {
9868             if (typeof value == "string" || isSymbol2(value)) {
9869               return value;
9870             }
9871             var result2 = value + "";
9872             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
9873           }
9874           function toSource2(func) {
9875             if (func != null) {
9876               try {
9877                 return funcToString3.call(func);
9878               } catch (e3) {
9879               }
9880               try {
9881                 return func + "";
9882               } catch (e3) {
9883               }
9884             }
9885             return "";
9886           }
9887           function updateWrapDetails(details, bitmask) {
9888             arrayEach(wrapFlags, function(pair3) {
9889               var value = "_." + pair3[0];
9890               if (bitmask & pair3[1] && !arrayIncludes(details, value)) {
9891                 details.push(value);
9892               }
9893             });
9894             return details.sort();
9895           }
9896           function wrapperClone(wrapper) {
9897             if (wrapper instanceof LazyWrapper) {
9898               return wrapper.clone();
9899             }
9900             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
9901             result2.__actions__ = copyArray(wrapper.__actions__);
9902             result2.__index__ = wrapper.__index__;
9903             result2.__values__ = wrapper.__values__;
9904             return result2;
9905           }
9906           function chunk(array2, size2, guard) {
9907             if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
9908               size2 = 1;
9909             } else {
9910               size2 = nativeMax2(toInteger(size2), 0);
9911             }
9912             var length = array2 == null ? 0 : array2.length;
9913             if (!length || size2 < 1) {
9914               return [];
9915             }
9916             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
9917             while (index < length) {
9918               result2[resIndex++] = baseSlice(array2, index, index += size2);
9919             }
9920             return result2;
9921           }
9922           function compact(array2) {
9923             var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
9924             while (++index < length) {
9925               var value = array2[index];
9926               if (value) {
9927                 result2[resIndex++] = value;
9928               }
9929             }
9930             return result2;
9931           }
9932           function concat() {
9933             var length = arguments.length;
9934             if (!length) {
9935               return [];
9936             }
9937             var args = Array2(length - 1), array2 = arguments[0], index = length;
9938             while (index--) {
9939               args[index - 1] = arguments[index];
9940             }
9941             return arrayPush2(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
9942           }
9943           var difference = baseRest(function(array2, values2) {
9944             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
9945           });
9946           var differenceBy = baseRest(function(array2, values2) {
9947             var iteratee2 = last(values2);
9948             if (isArrayLikeObject(iteratee2)) {
9949               iteratee2 = undefined2;
9950             }
9951             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
9952           });
9953           var differenceWith = baseRest(function(array2, values2) {
9954             var comparator = last(values2);
9955             if (isArrayLikeObject(comparator)) {
9956               comparator = undefined2;
9957             }
9958             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
9959           });
9960           function drop(array2, n3, guard) {
9961             var length = array2 == null ? 0 : array2.length;
9962             if (!length) {
9963               return [];
9964             }
9965             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
9966             return baseSlice(array2, n3 < 0 ? 0 : n3, length);
9967           }
9968           function dropRight(array2, n3, guard) {
9969             var length = array2 == null ? 0 : array2.length;
9970             if (!length) {
9971               return [];
9972             }
9973             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
9974             n3 = length - n3;
9975             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
9976           }
9977           function dropRightWhile(array2, predicate) {
9978             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
9979           }
9980           function dropWhile(array2, predicate) {
9981             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
9982           }
9983           function fill(array2, value, start2, end) {
9984             var length = array2 == null ? 0 : array2.length;
9985             if (!length) {
9986               return [];
9987             }
9988             if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
9989               start2 = 0;
9990               end = length;
9991             }
9992             return baseFill(array2, value, start2, end);
9993           }
9994           function findIndex(array2, predicate, fromIndex) {
9995             var length = array2 == null ? 0 : array2.length;
9996             if (!length) {
9997               return -1;
9998             }
9999             var index = fromIndex == null ? 0 : toInteger(fromIndex);
10000             if (index < 0) {
10001               index = nativeMax2(length + index, 0);
10002             }
10003             return baseFindIndex(array2, getIteratee(predicate, 3), index);
10004           }
10005           function findLastIndex(array2, predicate, fromIndex) {
10006             var length = array2 == null ? 0 : array2.length;
10007             if (!length) {
10008               return -1;
10009             }
10010             var index = length - 1;
10011             if (fromIndex !== undefined2) {
10012               index = toInteger(fromIndex);
10013               index = fromIndex < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
10014             }
10015             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
10016           }
10017           function flatten2(array2) {
10018             var length = array2 == null ? 0 : array2.length;
10019             return length ? baseFlatten(array2, 1) : [];
10020           }
10021           function flattenDeep(array2) {
10022             var length = array2 == null ? 0 : array2.length;
10023             return length ? baseFlatten(array2, INFINITY2) : [];
10024           }
10025           function flattenDepth(array2, depth) {
10026             var length = array2 == null ? 0 : array2.length;
10027             if (!length) {
10028               return [];
10029             }
10030             depth = depth === undefined2 ? 1 : toInteger(depth);
10031             return baseFlatten(array2, depth);
10032           }
10033           function fromPairs(pairs2) {
10034             var index = -1, length = pairs2 == null ? 0 : pairs2.length, result2 = {};
10035             while (++index < length) {
10036               var pair3 = pairs2[index];
10037               result2[pair3[0]] = pair3[1];
10038             }
10039             return result2;
10040           }
10041           function head(array2) {
10042             return array2 && array2.length ? array2[0] : undefined2;
10043           }
10044           function indexOf(array2, value, fromIndex) {
10045             var length = array2 == null ? 0 : array2.length;
10046             if (!length) {
10047               return -1;
10048             }
10049             var index = fromIndex == null ? 0 : toInteger(fromIndex);
10050             if (index < 0) {
10051               index = nativeMax2(length + index, 0);
10052             }
10053             return baseIndexOf(array2, value, index);
10054           }
10055           function initial(array2) {
10056             var length = array2 == null ? 0 : array2.length;
10057             return length ? baseSlice(array2, 0, -1) : [];
10058           }
10059           var intersection = baseRest(function(arrays) {
10060             var mapped = arrayMap2(arrays, castArrayLikeObject);
10061             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
10062           });
10063           var intersectionBy = baseRest(function(arrays) {
10064             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
10065             if (iteratee2 === last(mapped)) {
10066               iteratee2 = undefined2;
10067             } else {
10068               mapped.pop();
10069             }
10070             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
10071           });
10072           var intersectionWith = baseRest(function(arrays) {
10073             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
10074             comparator = typeof comparator == "function" ? comparator : undefined2;
10075             if (comparator) {
10076               mapped.pop();
10077             }
10078             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
10079           });
10080           function join(array2, separator) {
10081             return array2 == null ? "" : nativeJoin.call(array2, separator);
10082           }
10083           function last(array2) {
10084             var length = array2 == null ? 0 : array2.length;
10085             return length ? array2[length - 1] : undefined2;
10086           }
10087           function lastIndexOf(array2, value, fromIndex) {
10088             var length = array2 == null ? 0 : array2.length;
10089             if (!length) {
10090               return -1;
10091             }
10092             var index = length;
10093             if (fromIndex !== undefined2) {
10094               index = toInteger(fromIndex);
10095               index = index < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
10096             }
10097             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
10098           }
10099           function nth(array2, n3) {
10100             return array2 && array2.length ? baseNth(array2, toInteger(n3)) : undefined2;
10101           }
10102           var pull = baseRest(pullAll);
10103           function pullAll(array2, values2) {
10104             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
10105           }
10106           function pullAllBy(array2, values2, iteratee2) {
10107             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
10108           }
10109           function pullAllWith(array2, values2, comparator) {
10110             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
10111           }
10112           var pullAt = flatRest(function(array2, indexes) {
10113             var length = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
10114             basePullAt(array2, arrayMap2(indexes, function(index) {
10115               return isIndex2(index, length) ? +index : index;
10116             }).sort(compareAscending));
10117             return result2;
10118           });
10119           function remove2(array2, predicate) {
10120             var result2 = [];
10121             if (!(array2 && array2.length)) {
10122               return result2;
10123             }
10124             var index = -1, indexes = [], length = array2.length;
10125             predicate = getIteratee(predicate, 3);
10126             while (++index < length) {
10127               var value = array2[index];
10128               if (predicate(value, index, array2)) {
10129                 result2.push(value);
10130                 indexes.push(index);
10131               }
10132             }
10133             basePullAt(array2, indexes);
10134             return result2;
10135           }
10136           function reverse(array2) {
10137             return array2 == null ? array2 : nativeReverse.call(array2);
10138           }
10139           function slice(array2, start2, end) {
10140             var length = array2 == null ? 0 : array2.length;
10141             if (!length) {
10142               return [];
10143             }
10144             if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
10145               start2 = 0;
10146               end = length;
10147             } else {
10148               start2 = start2 == null ? 0 : toInteger(start2);
10149               end = end === undefined2 ? length : toInteger(end);
10150             }
10151             return baseSlice(array2, start2, end);
10152           }
10153           function sortedIndex(array2, value) {
10154             return baseSortedIndex(array2, value);
10155           }
10156           function sortedIndexBy(array2, value, iteratee2) {
10157             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
10158           }
10159           function sortedIndexOf(array2, value) {
10160             var length = array2 == null ? 0 : array2.length;
10161             if (length) {
10162               var index = baseSortedIndex(array2, value);
10163               if (index < length && eq2(array2[index], value)) {
10164                 return index;
10165               }
10166             }
10167             return -1;
10168           }
10169           function sortedLastIndex(array2, value) {
10170             return baseSortedIndex(array2, value, true);
10171           }
10172           function sortedLastIndexBy(array2, value, iteratee2) {
10173             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
10174           }
10175           function sortedLastIndexOf(array2, value) {
10176             var length = array2 == null ? 0 : array2.length;
10177             if (length) {
10178               var index = baseSortedIndex(array2, value, true) - 1;
10179               if (eq2(array2[index], value)) {
10180                 return index;
10181               }
10182             }
10183             return -1;
10184           }
10185           function sortedUniq(array2) {
10186             return array2 && array2.length ? baseSortedUniq(array2) : [];
10187           }
10188           function sortedUniqBy(array2, iteratee2) {
10189             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
10190           }
10191           function tail(array2) {
10192             var length = array2 == null ? 0 : array2.length;
10193             return length ? baseSlice(array2, 1, length) : [];
10194           }
10195           function take(array2, n3, guard) {
10196             if (!(array2 && array2.length)) {
10197               return [];
10198             }
10199             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
10200             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
10201           }
10202           function takeRight(array2, n3, guard) {
10203             var length = array2 == null ? 0 : array2.length;
10204             if (!length) {
10205               return [];
10206             }
10207             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
10208             n3 = length - n3;
10209             return baseSlice(array2, n3 < 0 ? 0 : n3, length);
10210           }
10211           function takeRightWhile(array2, predicate) {
10212             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
10213           }
10214           function takeWhile(array2, predicate) {
10215             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
10216           }
10217           var union = baseRest(function(arrays) {
10218             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
10219           });
10220           var unionBy = baseRest(function(arrays) {
10221             var iteratee2 = last(arrays);
10222             if (isArrayLikeObject(iteratee2)) {
10223               iteratee2 = undefined2;
10224             }
10225             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
10226           });
10227           var unionWith = baseRest(function(arrays) {
10228             var comparator = last(arrays);
10229             comparator = typeof comparator == "function" ? comparator : undefined2;
10230             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
10231           });
10232           function uniq(array2) {
10233             return array2 && array2.length ? baseUniq(array2) : [];
10234           }
10235           function uniqBy(array2, iteratee2) {
10236             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
10237           }
10238           function uniqWith(array2, comparator) {
10239             comparator = typeof comparator == "function" ? comparator : undefined2;
10240             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
10241           }
10242           function unzip(array2) {
10243             if (!(array2 && array2.length)) {
10244               return [];
10245             }
10246             var length = 0;
10247             array2 = arrayFilter2(array2, function(group) {
10248               if (isArrayLikeObject(group)) {
10249                 length = nativeMax2(group.length, length);
10250                 return true;
10251               }
10252             });
10253             return baseTimes2(length, function(index) {
10254               return arrayMap2(array2, baseProperty(index));
10255             });
10256           }
10257           function unzipWith(array2, iteratee2) {
10258             if (!(array2 && array2.length)) {
10259               return [];
10260             }
10261             var result2 = unzip(array2);
10262             if (iteratee2 == null) {
10263               return result2;
10264             }
10265             return arrayMap2(result2, function(group) {
10266               return apply(iteratee2, undefined2, group);
10267             });
10268           }
10269           var without = baseRest(function(array2, values2) {
10270             return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
10271           });
10272           var xor = baseRest(function(arrays) {
10273             return baseXor(arrayFilter2(arrays, isArrayLikeObject));
10274           });
10275           var xorBy = baseRest(function(arrays) {
10276             var iteratee2 = last(arrays);
10277             if (isArrayLikeObject(iteratee2)) {
10278               iteratee2 = undefined2;
10279             }
10280             return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
10281           });
10282           var xorWith = baseRest(function(arrays) {
10283             var comparator = last(arrays);
10284             comparator = typeof comparator == "function" ? comparator : undefined2;
10285             return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined2, comparator);
10286           });
10287           var zip = baseRest(unzip);
10288           function zipObject(props, values2) {
10289             return baseZipObject(props || [], values2 || [], assignValue);
10290           }
10291           function zipObjectDeep(props, values2) {
10292             return baseZipObject(props || [], values2 || [], baseSet);
10293           }
10294           var zipWith = baseRest(function(arrays) {
10295             var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
10296             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
10297             return unzipWith(arrays, iteratee2);
10298           });
10299           function chain(value) {
10300             var result2 = lodash(value);
10301             result2.__chain__ = true;
10302             return result2;
10303           }
10304           function tap(value, interceptor) {
10305             interceptor(value);
10306             return value;
10307           }
10308           function thru(value, interceptor) {
10309             return interceptor(value);
10310           }
10311           var wrapperAt = flatRest(function(paths) {
10312             var length = paths.length, start2 = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
10313               return baseAt(object, paths);
10314             };
10315             if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
10316               return this.thru(interceptor);
10317             }
10318             value = value.slice(start2, +start2 + (length ? 1 : 0));
10319             value.__actions__.push({
10320               "func": thru,
10321               "args": [interceptor],
10322               "thisArg": undefined2
10323             });
10324             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
10325               if (length && !array2.length) {
10326                 array2.push(undefined2);
10327               }
10328               return array2;
10329             });
10330           });
10331           function wrapperChain() {
10332             return chain(this);
10333           }
10334           function wrapperCommit() {
10335             return new LodashWrapper(this.value(), this.__chain__);
10336           }
10337           function wrapperNext() {
10338             if (this.__values__ === undefined2) {
10339               this.__values__ = toArray(this.value());
10340             }
10341             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
10342             return { "done": done, "value": value };
10343           }
10344           function wrapperToIterator() {
10345             return this;
10346           }
10347           function wrapperPlant(value) {
10348             var result2, parent2 = this;
10349             while (parent2 instanceof baseLodash) {
10350               var clone2 = wrapperClone(parent2);
10351               clone2.__index__ = 0;
10352               clone2.__values__ = undefined2;
10353               if (result2) {
10354                 previous.__wrapped__ = clone2;
10355               } else {
10356                 result2 = clone2;
10357               }
10358               var previous = clone2;
10359               parent2 = parent2.__wrapped__;
10360             }
10361             previous.__wrapped__ = value;
10362             return result2;
10363           }
10364           function wrapperReverse() {
10365             var value = this.__wrapped__;
10366             if (value instanceof LazyWrapper) {
10367               var wrapped = value;
10368               if (this.__actions__.length) {
10369                 wrapped = new LazyWrapper(this);
10370               }
10371               wrapped = wrapped.reverse();
10372               wrapped.__actions__.push({
10373                 "func": thru,
10374                 "args": [reverse],
10375                 "thisArg": undefined2
10376               });
10377               return new LodashWrapper(wrapped, this.__chain__);
10378             }
10379             return this.thru(reverse);
10380           }
10381           function wrapperValue() {
10382             return baseWrapperValue(this.__wrapped__, this.__actions__);
10383           }
10384           var countBy = createAggregator(function(result2, value, key) {
10385             if (hasOwnProperty10.call(result2, key)) {
10386               ++result2[key];
10387             } else {
10388               baseAssignValue(result2, key, 1);
10389             }
10390           });
10391           function every(collection, predicate, guard) {
10392             var func = isArray2(collection) ? arrayEvery : baseEvery;
10393             if (guard && isIterateeCall(collection, predicate, guard)) {
10394               predicate = undefined2;
10395             }
10396             return func(collection, getIteratee(predicate, 3));
10397           }
10398           function filter2(collection, predicate) {
10399             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
10400             return func(collection, getIteratee(predicate, 3));
10401           }
10402           var find2 = createFind(findIndex);
10403           var findLast = createFind(findLastIndex);
10404           function flatMap(collection, iteratee2) {
10405             return baseFlatten(map2(collection, iteratee2), 1);
10406           }
10407           function flatMapDeep(collection, iteratee2) {
10408             return baseFlatten(map2(collection, iteratee2), INFINITY2);
10409           }
10410           function flatMapDepth(collection, iteratee2, depth) {
10411             depth = depth === undefined2 ? 1 : toInteger(depth);
10412             return baseFlatten(map2(collection, iteratee2), depth);
10413           }
10414           function forEach(collection, iteratee2) {
10415             var func = isArray2(collection) ? arrayEach : baseEach;
10416             return func(collection, getIteratee(iteratee2, 3));
10417           }
10418           function forEachRight(collection, iteratee2) {
10419             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
10420             return func(collection, getIteratee(iteratee2, 3));
10421           }
10422           var groupBy = createAggregator(function(result2, value, key) {
10423             if (hasOwnProperty10.call(result2, key)) {
10424               result2[key].push(value);
10425             } else {
10426               baseAssignValue(result2, key, [value]);
10427             }
10428           });
10429           function includes(collection, value, fromIndex, guard) {
10430             collection = isArrayLike2(collection) ? collection : values(collection);
10431             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10432             var length = collection.length;
10433             if (fromIndex < 0) {
10434               fromIndex = nativeMax2(length + fromIndex, 0);
10435             }
10436             return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10437           }
10438           var invokeMap = baseRest(function(collection, path, args) {
10439             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
10440             baseEach(collection, function(value) {
10441               result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10442             });
10443             return result2;
10444           });
10445           var keyBy = createAggregator(function(result2, value, key) {
10446             baseAssignValue(result2, key, value);
10447           });
10448           function map2(collection, iteratee2) {
10449             var func = isArray2(collection) ? arrayMap2 : baseMap;
10450             return func(collection, getIteratee(iteratee2, 3));
10451           }
10452           function orderBy(collection, iteratees, orders, guard) {
10453             if (collection == null) {
10454               return [];
10455             }
10456             if (!isArray2(iteratees)) {
10457               iteratees = iteratees == null ? [] : [iteratees];
10458             }
10459             orders = guard ? undefined2 : orders;
10460             if (!isArray2(orders)) {
10461               orders = orders == null ? [] : [orders];
10462             }
10463             return baseOrderBy(collection, iteratees, orders);
10464           }
10465           var partition = createAggregator(function(result2, value, key) {
10466             result2[key ? 0 : 1].push(value);
10467           }, function() {
10468             return [[], []];
10469           });
10470           function reduce(collection, iteratee2, accumulator) {
10471             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
10472             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
10473           }
10474           function reduceRight(collection, iteratee2, accumulator) {
10475             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
10476             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
10477           }
10478           function reject(collection, predicate) {
10479             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
10480             return func(collection, negate(getIteratee(predicate, 3)));
10481           }
10482           function sample(collection) {
10483             var func = isArray2(collection) ? arraySample : baseSample;
10484             return func(collection);
10485           }
10486           function sampleSize(collection, n3, guard) {
10487             if (guard ? isIterateeCall(collection, n3, guard) : n3 === undefined2) {
10488               n3 = 1;
10489             } else {
10490               n3 = toInteger(n3);
10491             }
10492             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
10493             return func(collection, n3);
10494           }
10495           function shuffle(collection) {
10496             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
10497             return func(collection);
10498           }
10499           function size(collection) {
10500             if (collection == null) {
10501               return 0;
10502             }
10503             if (isArrayLike2(collection)) {
10504               return isString(collection) ? stringSize(collection) : collection.length;
10505             }
10506             var tag = getTag2(collection);
10507             if (tag == mapTag4 || tag == setTag4) {
10508               return collection.size;
10509             }
10510             return baseKeys2(collection).length;
10511           }
10512           function some(collection, predicate, guard) {
10513             var func = isArray2(collection) ? arraySome2 : baseSome;
10514             if (guard && isIterateeCall(collection, predicate, guard)) {
10515               predicate = undefined2;
10516             }
10517             return func(collection, getIteratee(predicate, 3));
10518           }
10519           var sortBy = baseRest(function(collection, iteratees) {
10520             if (collection == null) {
10521               return [];
10522             }
10523             var length = iteratees.length;
10524             if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
10525               iteratees = [];
10526             } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
10527               iteratees = [iteratees[0]];
10528             }
10529             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10530           });
10531           var now3 = ctxNow || function() {
10532             return root3.Date.now();
10533           };
10534           function after(n3, func) {
10535             if (typeof func != "function") {
10536               throw new TypeError2(FUNC_ERROR_TEXT3);
10537             }
10538             n3 = toInteger(n3);
10539             return function() {
10540               if (--n3 < 1) {
10541                 return func.apply(this, arguments);
10542               }
10543             };
10544           }
10545           function ary(func, n3, guard) {
10546             n3 = guard ? undefined2 : n3;
10547             n3 = func && n3 == null ? func.length : n3;
10548             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
10549           }
10550           function before(n3, func) {
10551             var result2;
10552             if (typeof func != "function") {
10553               throw new TypeError2(FUNC_ERROR_TEXT3);
10554             }
10555             n3 = toInteger(n3);
10556             return function() {
10557               if (--n3 > 0) {
10558                 result2 = func.apply(this, arguments);
10559               }
10560               if (n3 <= 1) {
10561                 func = undefined2;
10562               }
10563               return result2;
10564             };
10565           }
10566           var bind = baseRest(function(func, thisArg, partials) {
10567             var bitmask = WRAP_BIND_FLAG;
10568             if (partials.length) {
10569               var holders = replaceHolders(partials, getHolder(bind));
10570               bitmask |= WRAP_PARTIAL_FLAG;
10571             }
10572             return createWrap(func, bitmask, thisArg, partials, holders);
10573           });
10574           var bindKey2 = baseRest(function(object, key, partials) {
10575             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10576             if (partials.length) {
10577               var holders = replaceHolders(partials, getHolder(bindKey2));
10578               bitmask |= WRAP_PARTIAL_FLAG;
10579             }
10580             return createWrap(key, bitmask, object, partials, holders);
10581           });
10582           function curry(func, arity, guard) {
10583             arity = guard ? undefined2 : arity;
10584             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10585             result2.placeholder = curry.placeholder;
10586             return result2;
10587           }
10588           function curryRight(func, arity, guard) {
10589             arity = guard ? undefined2 : arity;
10590             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10591             result2.placeholder = curryRight.placeholder;
10592             return result2;
10593           }
10594           function debounce2(func, wait, options2) {
10595             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10596             if (typeof func != "function") {
10597               throw new TypeError2(FUNC_ERROR_TEXT3);
10598             }
10599             wait = toNumber3(wait) || 0;
10600             if (isObject3(options2)) {
10601               leading = !!options2.leading;
10602               maxing = "maxWait" in options2;
10603               maxWait = maxing ? nativeMax2(toNumber3(options2.maxWait) || 0, wait) : maxWait;
10604               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10605             }
10606             function invokeFunc(time) {
10607               var args = lastArgs, thisArg = lastThis;
10608               lastArgs = lastThis = undefined2;
10609               lastInvokeTime = time;
10610               result2 = func.apply(thisArg, args);
10611               return result2;
10612             }
10613             function leadingEdge(time) {
10614               lastInvokeTime = time;
10615               timerId = setTimeout2(timerExpired, wait);
10616               return leading ? invokeFunc(time) : result2;
10617             }
10618             function remainingWait(time) {
10619               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10620               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10621             }
10622             function shouldInvoke(time) {
10623               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10624               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10625             }
10626             function timerExpired() {
10627               var time = now3();
10628               if (shouldInvoke(time)) {
10629                 return trailingEdge(time);
10630               }
10631               timerId = setTimeout2(timerExpired, remainingWait(time));
10632             }
10633             function trailingEdge(time) {
10634               timerId = undefined2;
10635               if (trailing && lastArgs) {
10636                 return invokeFunc(time);
10637               }
10638               lastArgs = lastThis = undefined2;
10639               return result2;
10640             }
10641             function cancel() {
10642               if (timerId !== undefined2) {
10643                 clearTimeout2(timerId);
10644               }
10645               lastInvokeTime = 0;
10646               lastArgs = lastCallTime = lastThis = timerId = undefined2;
10647             }
10648             function flush() {
10649               return timerId === undefined2 ? result2 : trailingEdge(now3());
10650             }
10651             function debounced() {
10652               var time = now3(), isInvoking = shouldInvoke(time);
10653               lastArgs = arguments;
10654               lastThis = this;
10655               lastCallTime = time;
10656               if (isInvoking) {
10657                 if (timerId === undefined2) {
10658                   return leadingEdge(lastCallTime);
10659                 }
10660                 if (maxing) {
10661                   clearTimeout2(timerId);
10662                   timerId = setTimeout2(timerExpired, wait);
10663                   return invokeFunc(lastCallTime);
10664                 }
10665               }
10666               if (timerId === undefined2) {
10667                 timerId = setTimeout2(timerExpired, wait);
10668               }
10669               return result2;
10670             }
10671             debounced.cancel = cancel;
10672             debounced.flush = flush;
10673             return debounced;
10674           }
10675           var defer = baseRest(function(func, args) {
10676             return baseDelay(func, 1, args);
10677           });
10678           var delay = baseRest(function(func, wait, args) {
10679             return baseDelay(func, toNumber3(wait) || 0, args);
10680           });
10681           function flip(func) {
10682             return createWrap(func, WRAP_FLIP_FLAG);
10683           }
10684           function memoize(func, resolver) {
10685             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
10686               throw new TypeError2(FUNC_ERROR_TEXT3);
10687             }
10688             var memoized = function() {
10689               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
10690               if (cache.has(key)) {
10691                 return cache.get(key);
10692               }
10693               var result2 = func.apply(this, args);
10694               memoized.cache = cache.set(key, result2) || cache;
10695               return result2;
10696             };
10697             memoized.cache = new (memoize.Cache || MapCache2)();
10698             return memoized;
10699           }
10700           memoize.Cache = MapCache2;
10701           function negate(predicate) {
10702             if (typeof predicate != "function") {
10703               throw new TypeError2(FUNC_ERROR_TEXT3);
10704             }
10705             return function() {
10706               var args = arguments;
10707               switch (args.length) {
10708                 case 0:
10709                   return !predicate.call(this);
10710                 case 1:
10711                   return !predicate.call(this, args[0]);
10712                 case 2:
10713                   return !predicate.call(this, args[0], args[1]);
10714                 case 3:
10715                   return !predicate.call(this, args[0], args[1], args[2]);
10716               }
10717               return !predicate.apply(this, args);
10718             };
10719           }
10720           function once(func) {
10721             return before(2, func);
10722           }
10723           var overArgs = castRest(function(func, transforms) {
10724             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
10725             var funcsLength = transforms.length;
10726             return baseRest(function(args) {
10727               var index = -1, length = nativeMin2(args.length, funcsLength);
10728               while (++index < length) {
10729                 args[index] = transforms[index].call(this, args[index]);
10730               }
10731               return apply(func, this, args);
10732             });
10733           });
10734           var partial = baseRest(function(func, partials) {
10735             var holders = replaceHolders(partials, getHolder(partial));
10736             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
10737           });
10738           var partialRight = baseRest(function(func, partials) {
10739             var holders = replaceHolders(partials, getHolder(partialRight));
10740             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
10741           });
10742           var rearg = flatRest(function(func, indexes) {
10743             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
10744           });
10745           function rest(func, start2) {
10746             if (typeof func != "function") {
10747               throw new TypeError2(FUNC_ERROR_TEXT3);
10748             }
10749             start2 = start2 === undefined2 ? start2 : toInteger(start2);
10750             return baseRest(func, start2);
10751           }
10752           function spread(func, start2) {
10753             if (typeof func != "function") {
10754               throw new TypeError2(FUNC_ERROR_TEXT3);
10755             }
10756             start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
10757             return baseRest(function(args) {
10758               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
10759               if (array2) {
10760                 arrayPush2(otherArgs, array2);
10761               }
10762               return apply(func, this, otherArgs);
10763             });
10764           }
10765           function throttle2(func, wait, options2) {
10766             var leading = true, trailing = true;
10767             if (typeof func != "function") {
10768               throw new TypeError2(FUNC_ERROR_TEXT3);
10769             }
10770             if (isObject3(options2)) {
10771               leading = "leading" in options2 ? !!options2.leading : leading;
10772               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10773             }
10774             return debounce2(func, wait, {
10775               "leading": leading,
10776               "maxWait": wait,
10777               "trailing": trailing
10778             });
10779           }
10780           function unary(func) {
10781             return ary(func, 1);
10782           }
10783           function wrap2(value, wrapper) {
10784             return partial(castFunction(wrapper), value);
10785           }
10786           function castArray() {
10787             if (!arguments.length) {
10788               return [];
10789             }
10790             var value = arguments[0];
10791             return isArray2(value) ? value : [value];
10792           }
10793           function clone(value) {
10794             return baseClone(value, CLONE_SYMBOLS_FLAG);
10795           }
10796           function cloneWith(value, customizer) {
10797             customizer = typeof customizer == "function" ? customizer : undefined2;
10798             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
10799           }
10800           function cloneDeep(value) {
10801             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
10802           }
10803           function cloneDeepWith(value, customizer) {
10804             customizer = typeof customizer == "function" ? customizer : undefined2;
10805             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
10806           }
10807           function conformsTo(object, source) {
10808             return source == null || baseConformsTo(object, source, keys2(source));
10809           }
10810           function eq2(value, other) {
10811             return value === other || value !== value && other !== other;
10812           }
10813           var gt2 = createRelationalOperation(baseGt);
10814           var gte = createRelationalOperation(function(value, other) {
10815             return value >= other;
10816           });
10817           var isArguments2 = baseIsArguments2(function() {
10818             return arguments;
10819           }()) ? baseIsArguments2 : function(value) {
10820             return isObjectLike2(value) && hasOwnProperty10.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
10821           };
10822           var isArray2 = Array2.isArray;
10823           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
10824           function isArrayLike2(value) {
10825             return value != null && isLength2(value.length) && !isFunction2(value);
10826           }
10827           function isArrayLikeObject(value) {
10828             return isObjectLike2(value) && isArrayLike2(value);
10829           }
10830           function isBoolean(value) {
10831             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
10832           }
10833           var isBuffer2 = nativeIsBuffer2 || stubFalse2;
10834           var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
10835           function isElement2(value) {
10836             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
10837           }
10838           function isEmpty(value) {
10839             if (value == null) {
10840               return true;
10841             }
10842             if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
10843               return !value.length;
10844             }
10845             var tag = getTag2(value);
10846             if (tag == mapTag4 || tag == setTag4) {
10847               return !value.size;
10848             }
10849             if (isPrototype2(value)) {
10850               return !baseKeys2(value).length;
10851             }
10852             for (var key in value) {
10853               if (hasOwnProperty10.call(value, key)) {
10854                 return false;
10855               }
10856             }
10857             return true;
10858           }
10859           function isEqual4(value, other) {
10860             return baseIsEqual2(value, other);
10861           }
10862           function isEqualWith(value, other, customizer) {
10863             customizer = typeof customizer == "function" ? customizer : undefined2;
10864             var result2 = customizer ? customizer(value, other) : undefined2;
10865             return result2 === undefined2 ? baseIsEqual2(value, other, undefined2, customizer) : !!result2;
10866           }
10867           function isError(value) {
10868             if (!isObjectLike2(value)) {
10869               return false;
10870             }
10871             var tag = baseGetTag2(value);
10872             return tag == errorTag3 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
10873           }
10874           function isFinite2(value) {
10875             return typeof value == "number" && nativeIsFinite(value);
10876           }
10877           function isFunction2(value) {
10878             if (!isObject3(value)) {
10879               return false;
10880             }
10881             var tag = baseGetTag2(value);
10882             return tag == funcTag3 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2;
10883           }
10884           function isInteger(value) {
10885             return typeof value == "number" && value == toInteger(value);
10886           }
10887           function isLength2(value) {
10888             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER3;
10889           }
10890           function isObject3(value) {
10891             var type2 = typeof value;
10892             return value != null && (type2 == "object" || type2 == "function");
10893           }
10894           function isObjectLike2(value) {
10895             return value != null && typeof value == "object";
10896           }
10897           var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
10898           function isMatch(object, source) {
10899             return object === source || baseIsMatch(object, source, getMatchData(source));
10900           }
10901           function isMatchWith(object, source, customizer) {
10902             customizer = typeof customizer == "function" ? customizer : undefined2;
10903             return baseIsMatch(object, source, getMatchData(source), customizer);
10904           }
10905           function isNaN2(value) {
10906             return isNumber3(value) && value != +value;
10907           }
10908           function isNative(value) {
10909             if (isMaskable(value)) {
10910               throw new Error2(CORE_ERROR_TEXT);
10911             }
10912             return baseIsNative2(value);
10913           }
10914           function isNull(value) {
10915             return value === null;
10916           }
10917           function isNil(value) {
10918             return value == null;
10919           }
10920           function isNumber3(value) {
10921             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag4;
10922           }
10923           function isPlainObject(value) {
10924             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag4) {
10925               return false;
10926             }
10927             var proto = getPrototype(value);
10928             if (proto === null) {
10929               return true;
10930             }
10931             var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
10932             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
10933           }
10934           var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
10935           function isSafeInteger(value) {
10936             return isInteger(value) && value >= -MAX_SAFE_INTEGER3 && value <= MAX_SAFE_INTEGER3;
10937           }
10938           var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
10939           function isString(value) {
10940             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
10941           }
10942           function isSymbol2(value) {
10943             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
10944           }
10945           var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
10946           function isUndefined(value) {
10947             return value === undefined2;
10948           }
10949           function isWeakMap(value) {
10950             return isObjectLike2(value) && getTag2(value) == weakMapTag3;
10951           }
10952           function isWeakSet(value) {
10953             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
10954           }
10955           var lt2 = createRelationalOperation(baseLt);
10956           var lte = createRelationalOperation(function(value, other) {
10957             return value <= other;
10958           });
10959           function toArray(value) {
10960             if (!value) {
10961               return [];
10962             }
10963             if (isArrayLike2(value)) {
10964               return isString(value) ? stringToArray(value) : copyArray(value);
10965             }
10966             if (symIterator && value[symIterator]) {
10967               return iteratorToArray(value[symIterator]());
10968             }
10969             var tag = getTag2(value), func = tag == mapTag4 ? mapToArray2 : tag == setTag4 ? setToArray2 : values;
10970             return func(value);
10971           }
10972           function toFinite(value) {
10973             if (!value) {
10974               return value === 0 ? value : 0;
10975             }
10976             value = toNumber3(value);
10977             if (value === INFINITY2 || value === -INFINITY2) {
10978               var sign2 = value < 0 ? -1 : 1;
10979               return sign2 * MAX_INTEGER;
10980             }
10981             return value === value ? value : 0;
10982           }
10983           function toInteger(value) {
10984             var result2 = toFinite(value), remainder = result2 % 1;
10985             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
10986           }
10987           function toLength(value) {
10988             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
10989           }
10990           function toNumber3(value) {
10991             if (typeof value == "number") {
10992               return value;
10993             }
10994             if (isSymbol2(value)) {
10995               return NAN2;
10996             }
10997             if (isObject3(value)) {
10998               var other = typeof value.valueOf == "function" ? value.valueOf() : value;
10999               value = isObject3(other) ? other + "" : other;
11000             }
11001             if (typeof value != "string") {
11002               return value === 0 ? value : +value;
11003             }
11004             value = baseTrim2(value);
11005             var isBinary = reIsBinary2.test(value);
11006             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
11007           }
11008           function toPlainObject(value) {
11009             return copyObject(value, keysIn(value));
11010           }
11011           function toSafeInteger(value) {
11012             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3) : value === 0 ? value : 0;
11013           }
11014           function toString2(value) {
11015             return value == null ? "" : baseToString2(value);
11016           }
11017           var assign = createAssigner(function(object, source) {
11018             if (isPrototype2(source) || isArrayLike2(source)) {
11019               copyObject(source, keys2(source), object);
11020               return;
11021             }
11022             for (var key in source) {
11023               if (hasOwnProperty10.call(source, key)) {
11024                 assignValue(object, key, source[key]);
11025               }
11026             }
11027           });
11028           var assignIn = createAssigner(function(object, source) {
11029             copyObject(source, keysIn(source), object);
11030           });
11031           var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
11032             copyObject(source, keysIn(source), object, customizer);
11033           });
11034           var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
11035             copyObject(source, keys2(source), object, customizer);
11036           });
11037           var at2 = flatRest(baseAt);
11038           function create2(prototype, properties) {
11039             var result2 = baseCreate(prototype);
11040             return properties == null ? result2 : baseAssign(result2, properties);
11041           }
11042           var defaults = baseRest(function(object, sources) {
11043             object = Object2(object);
11044             var index = -1;
11045             var length = sources.length;
11046             var guard = length > 2 ? sources[2] : undefined2;
11047             if (guard && isIterateeCall(sources[0], sources[1], guard)) {
11048               length = 1;
11049             }
11050             while (++index < length) {
11051               var source = sources[index];
11052               var props = keysIn(source);
11053               var propsIndex = -1;
11054               var propsLength = props.length;
11055               while (++propsIndex < propsLength) {
11056                 var key = props[propsIndex];
11057                 var value = object[key];
11058                 if (value === undefined2 || eq2(value, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
11059                   object[key] = source[key];
11060                 }
11061               }
11062             }
11063             return object;
11064           });
11065           var defaultsDeep = baseRest(function(args) {
11066             args.push(undefined2, customDefaultsMerge);
11067             return apply(mergeWith, undefined2, args);
11068           });
11069           function findKey(object, predicate) {
11070             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
11071           }
11072           function findLastKey(object, predicate) {
11073             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
11074           }
11075           function forIn(object, iteratee2) {
11076             return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
11077           }
11078           function forInRight(object, iteratee2) {
11079             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
11080           }
11081           function forOwn(object, iteratee2) {
11082             return object && baseForOwn(object, getIteratee(iteratee2, 3));
11083           }
11084           function forOwnRight(object, iteratee2) {
11085             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
11086           }
11087           function functions(object) {
11088             return object == null ? [] : baseFunctions(object, keys2(object));
11089           }
11090           function functionsIn(object) {
11091             return object == null ? [] : baseFunctions(object, keysIn(object));
11092           }
11093           function get4(object, path, defaultValue) {
11094             var result2 = object == null ? undefined2 : baseGet(object, path);
11095             return result2 === undefined2 ? defaultValue : result2;
11096           }
11097           function has(object, path) {
11098             return object != null && hasPath(object, path, baseHas);
11099           }
11100           function hasIn(object, path) {
11101             return object != null && hasPath(object, path, baseHasIn);
11102           }
11103           var invert = createInverter(function(result2, value, key) {
11104             if (value != null && typeof value.toString != "function") {
11105               value = nativeObjectToString3.call(value);
11106             }
11107             result2[value] = key;
11108           }, constant(identity4));
11109           var invertBy = createInverter(function(result2, value, key) {
11110             if (value != null && typeof value.toString != "function") {
11111               value = nativeObjectToString3.call(value);
11112             }
11113             if (hasOwnProperty10.call(result2, value)) {
11114               result2[value].push(key);
11115             } else {
11116               result2[value] = [key];
11117             }
11118           }, getIteratee);
11119           var invoke = baseRest(baseInvoke);
11120           function keys2(object) {
11121             return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
11122           }
11123           function keysIn(object) {
11124             return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn(object);
11125           }
11126           function mapKeys(object, iteratee2) {
11127             var result2 = {};
11128             iteratee2 = getIteratee(iteratee2, 3);
11129             baseForOwn(object, function(value, key, object2) {
11130               baseAssignValue(result2, iteratee2(value, key, object2), value);
11131             });
11132             return result2;
11133           }
11134           function mapValues(object, iteratee2) {
11135             var result2 = {};
11136             iteratee2 = getIteratee(iteratee2, 3);
11137             baseForOwn(object, function(value, key, object2) {
11138               baseAssignValue(result2, key, iteratee2(value, key, object2));
11139             });
11140             return result2;
11141           }
11142           var merge2 = createAssigner(function(object, source, srcIndex) {
11143             baseMerge(object, source, srcIndex);
11144           });
11145           var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
11146             baseMerge(object, source, srcIndex, customizer);
11147           });
11148           var omit = flatRest(function(object, paths) {
11149             var result2 = {};
11150             if (object == null) {
11151               return result2;
11152             }
11153             var isDeep = false;
11154             paths = arrayMap2(paths, function(path) {
11155               path = castPath(path, object);
11156               isDeep || (isDeep = path.length > 1);
11157               return path;
11158             });
11159             copyObject(object, getAllKeysIn(object), result2);
11160             if (isDeep) {
11161               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
11162             }
11163             var length = paths.length;
11164             while (length--) {
11165               baseUnset(result2, paths[length]);
11166             }
11167             return result2;
11168           });
11169           function omitBy(object, predicate) {
11170             return pickBy(object, negate(getIteratee(predicate)));
11171           }
11172           var pick = flatRest(function(object, paths) {
11173             return object == null ? {} : basePick(object, paths);
11174           });
11175           function pickBy(object, predicate) {
11176             if (object == null) {
11177               return {};
11178             }
11179             var props = arrayMap2(getAllKeysIn(object), function(prop) {
11180               return [prop];
11181             });
11182             predicate = getIteratee(predicate);
11183             return basePickBy(object, props, function(value, path) {
11184               return predicate(value, path[0]);
11185             });
11186           }
11187           function result(object, path, defaultValue) {
11188             path = castPath(path, object);
11189             var index = -1, length = path.length;
11190             if (!length) {
11191               length = 1;
11192               object = undefined2;
11193             }
11194             while (++index < length) {
11195               var value = object == null ? undefined2 : object[toKey(path[index])];
11196               if (value === undefined2) {
11197                 index = length;
11198                 value = defaultValue;
11199               }
11200               object = isFunction2(value) ? value.call(object) : value;
11201             }
11202             return object;
11203           }
11204           function set3(object, path, value) {
11205             return object == null ? object : baseSet(object, path, value);
11206           }
11207           function setWith(object, path, value, customizer) {
11208             customizer = typeof customizer == "function" ? customizer : undefined2;
11209             return object == null ? object : baseSet(object, path, value, customizer);
11210           }
11211           var toPairs = createToPairs(keys2);
11212           var toPairsIn = createToPairs(keysIn);
11213           function transform2(object, iteratee2, accumulator) {
11214             var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
11215             iteratee2 = getIteratee(iteratee2, 4);
11216             if (accumulator == null) {
11217               var Ctor = object && object.constructor;
11218               if (isArrLike) {
11219                 accumulator = isArr ? new Ctor() : [];
11220               } else if (isObject3(object)) {
11221                 accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
11222               } else {
11223                 accumulator = {};
11224               }
11225             }
11226             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
11227               return iteratee2(accumulator, value, index, object2);
11228             });
11229             return accumulator;
11230           }
11231           function unset(object, path) {
11232             return object == null ? true : baseUnset(object, path);
11233           }
11234           function update(object, path, updater) {
11235             return object == null ? object : baseUpdate(object, path, castFunction(updater));
11236           }
11237           function updateWith(object, path, updater, customizer) {
11238             customizer = typeof customizer == "function" ? customizer : undefined2;
11239             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
11240           }
11241           function values(object) {
11242             return object == null ? [] : baseValues(object, keys2(object));
11243           }
11244           function valuesIn(object) {
11245             return object == null ? [] : baseValues(object, keysIn(object));
11246           }
11247           function clamp3(number3, lower2, upper) {
11248             if (upper === undefined2) {
11249               upper = lower2;
11250               lower2 = undefined2;
11251             }
11252             if (upper !== undefined2) {
11253               upper = toNumber3(upper);
11254               upper = upper === upper ? upper : 0;
11255             }
11256             if (lower2 !== undefined2) {
11257               lower2 = toNumber3(lower2);
11258               lower2 = lower2 === lower2 ? lower2 : 0;
11259             }
11260             return baseClamp(toNumber3(number3), lower2, upper);
11261           }
11262           function inRange(number3, start2, end) {
11263             start2 = toFinite(start2);
11264             if (end === undefined2) {
11265               end = start2;
11266               start2 = 0;
11267             } else {
11268               end = toFinite(end);
11269             }
11270             number3 = toNumber3(number3);
11271             return baseInRange(number3, start2, end);
11272           }
11273           function random(lower2, upper, floating) {
11274             if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
11275               upper = floating = undefined2;
11276             }
11277             if (floating === undefined2) {
11278               if (typeof upper == "boolean") {
11279                 floating = upper;
11280                 upper = undefined2;
11281               } else if (typeof lower2 == "boolean") {
11282                 floating = lower2;
11283                 lower2 = undefined2;
11284               }
11285             }
11286             if (lower2 === undefined2 && upper === undefined2) {
11287               lower2 = 0;
11288               upper = 1;
11289             } else {
11290               lower2 = toFinite(lower2);
11291               if (upper === undefined2) {
11292                 upper = lower2;
11293                 lower2 = 0;
11294               } else {
11295                 upper = toFinite(upper);
11296               }
11297             }
11298             if (lower2 > upper) {
11299               var temp = lower2;
11300               lower2 = upper;
11301               upper = temp;
11302             }
11303             if (floating || lower2 % 1 || upper % 1) {
11304               var rand = nativeRandom();
11305               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
11306             }
11307             return baseRandom(lower2, upper);
11308           }
11309           var camelCase = createCompounder(function(result2, word, index) {
11310             word = word.toLowerCase();
11311             return result2 + (index ? capitalize(word) : word);
11312           });
11313           function capitalize(string) {
11314             return upperFirst(toString2(string).toLowerCase());
11315           }
11316           function deburr(string) {
11317             string = toString2(string);
11318             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
11319           }
11320           function endsWith(string, target, position) {
11321             string = toString2(string);
11322             target = baseToString2(target);
11323             var length = string.length;
11324             position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
11325             var end = position;
11326             position -= target.length;
11327             return position >= 0 && string.slice(position, end) == target;
11328           }
11329           function escape6(string) {
11330             string = toString2(string);
11331             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
11332           }
11333           function escapeRegExp(string) {
11334             string = toString2(string);
11335             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
11336           }
11337           var kebabCase = createCompounder(function(result2, word, index) {
11338             return result2 + (index ? "-" : "") + word.toLowerCase();
11339           });
11340           var lowerCase = createCompounder(function(result2, word, index) {
11341             return result2 + (index ? " " : "") + word.toLowerCase();
11342           });
11343           var lowerFirst = createCaseFirst("toLowerCase");
11344           function pad2(string, length, chars) {
11345             string = toString2(string);
11346             length = toInteger(length);
11347             var strLength = length ? stringSize(string) : 0;
11348             if (!length || strLength >= length) {
11349               return string;
11350             }
11351             var mid = (length - strLength) / 2;
11352             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
11353           }
11354           function padEnd(string, length, chars) {
11355             string = toString2(string);
11356             length = toInteger(length);
11357             var strLength = length ? stringSize(string) : 0;
11358             return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
11359           }
11360           function padStart(string, length, chars) {
11361             string = toString2(string);
11362             length = toInteger(length);
11363             var strLength = length ? stringSize(string) : 0;
11364             return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
11365           }
11366           function parseInt2(string, radix, guard) {
11367             if (guard || radix == null) {
11368               radix = 0;
11369             } else if (radix) {
11370               radix = +radix;
11371             }
11372             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
11373           }
11374           function repeat(string, n3, guard) {
11375             if (guard ? isIterateeCall(string, n3, guard) : n3 === undefined2) {
11376               n3 = 1;
11377             } else {
11378               n3 = toInteger(n3);
11379             }
11380             return baseRepeat(toString2(string), n3);
11381           }
11382           function replace() {
11383             var args = arguments, string = toString2(args[0]);
11384             return args.length < 3 ? string : string.replace(args[1], args[2]);
11385           }
11386           var snakeCase = createCompounder(function(result2, word, index) {
11387             return result2 + (index ? "_" : "") + word.toLowerCase();
11388           });
11389           function split(string, separator, limit) {
11390             if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
11391               separator = limit = undefined2;
11392             }
11393             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
11394             if (!limit) {
11395               return [];
11396             }
11397             string = toString2(string);
11398             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
11399               separator = baseToString2(separator);
11400               if (!separator && hasUnicode(string)) {
11401                 return castSlice(stringToArray(string), 0, limit);
11402               }
11403             }
11404             return string.split(separator, limit);
11405           }
11406           var startCase = createCompounder(function(result2, word, index) {
11407             return result2 + (index ? " " : "") + upperFirst(word);
11408           });
11409           function startsWith(string, target, position) {
11410             string = toString2(string);
11411             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
11412             target = baseToString2(target);
11413             return string.slice(position, position + target.length) == target;
11414           }
11415           function template(string, options2, guard) {
11416             var settings = lodash.templateSettings;
11417             if (guard && isIterateeCall(string, options2, guard)) {
11418               options2 = undefined2;
11419             }
11420             string = toString2(string);
11421             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
11422             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
11423             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
11424             var reDelimiters = RegExp2(
11425               (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
11426               "g"
11427             );
11428             var sourceURL = "//# sourceURL=" + (hasOwnProperty10.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
11429             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
11430               interpolateValue || (interpolateValue = esTemplateValue);
11431               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
11432               if (escapeValue) {
11433                 isEscaping = true;
11434                 source += "' +\n__e(" + escapeValue + ") +\n'";
11435               }
11436               if (evaluateValue) {
11437                 isEvaluating = true;
11438                 source += "';\n" + evaluateValue + ";\n__p += '";
11439               }
11440               if (interpolateValue) {
11441                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
11442               }
11443               index = offset + match.length;
11444               return match;
11445             });
11446             source += "';\n";
11447             var variable = hasOwnProperty10.call(options2, "variable") && options2.variable;
11448             if (!variable) {
11449               source = "with (obj) {\n" + source + "\n}\n";
11450             } else if (reForbiddenIdentifierChars.test(variable)) {
11451               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
11452             }
11453             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
11454             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}";
11455             var result2 = attempt(function() {
11456               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
11457             });
11458             result2.source = source;
11459             if (isError(result2)) {
11460               throw result2;
11461             }
11462             return result2;
11463           }
11464           function toLower(value) {
11465             return toString2(value).toLowerCase();
11466           }
11467           function toUpper(value) {
11468             return toString2(value).toUpperCase();
11469           }
11470           function trim(string, chars, guard) {
11471             string = toString2(string);
11472             if (string && (guard || chars === undefined2)) {
11473               return baseTrim2(string);
11474             }
11475             if (!string || !(chars = baseToString2(chars))) {
11476               return string;
11477             }
11478             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
11479             return castSlice(strSymbols, start2, end).join("");
11480           }
11481           function trimEnd(string, chars, guard) {
11482             string = toString2(string);
11483             if (string && (guard || chars === undefined2)) {
11484               return string.slice(0, trimmedEndIndex2(string) + 1);
11485             }
11486             if (!string || !(chars = baseToString2(chars))) {
11487               return string;
11488             }
11489             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
11490             return castSlice(strSymbols, 0, end).join("");
11491           }
11492           function trimStart(string, chars, guard) {
11493             string = toString2(string);
11494             if (string && (guard || chars === undefined2)) {
11495               return string.replace(reTrimStart2, "");
11496             }
11497             if (!string || !(chars = baseToString2(chars))) {
11498               return string;
11499             }
11500             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
11501             return castSlice(strSymbols, start2).join("");
11502           }
11503           function truncate(string, options2) {
11504             var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
11505             if (isObject3(options2)) {
11506               var separator = "separator" in options2 ? options2.separator : separator;
11507               length = "length" in options2 ? toInteger(options2.length) : length;
11508               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
11509             }
11510             string = toString2(string);
11511             var strLength = string.length;
11512             if (hasUnicode(string)) {
11513               var strSymbols = stringToArray(string);
11514               strLength = strSymbols.length;
11515             }
11516             if (length >= strLength) {
11517               return string;
11518             }
11519             var end = length - stringSize(omission);
11520             if (end < 1) {
11521               return omission;
11522             }
11523             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
11524             if (separator === undefined2) {
11525               return result2 + omission;
11526             }
11527             if (strSymbols) {
11528               end += result2.length - end;
11529             }
11530             if (isRegExp(separator)) {
11531               if (string.slice(end).search(separator)) {
11532                 var match, substring = result2;
11533                 if (!separator.global) {
11534                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
11535                 }
11536                 separator.lastIndex = 0;
11537                 while (match = separator.exec(substring)) {
11538                   var newEnd = match.index;
11539                 }
11540                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
11541               }
11542             } else if (string.indexOf(baseToString2(separator), end) != end) {
11543               var index = result2.lastIndexOf(separator);
11544               if (index > -1) {
11545                 result2 = result2.slice(0, index);
11546               }
11547             }
11548             return result2 + omission;
11549           }
11550           function unescape4(string) {
11551             string = toString2(string);
11552             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
11553           }
11554           var upperCase = createCompounder(function(result2, word, index) {
11555             return result2 + (index ? " " : "") + word.toUpperCase();
11556           });
11557           var upperFirst = createCaseFirst("toUpperCase");
11558           function words(string, pattern, guard) {
11559             string = toString2(string);
11560             pattern = guard ? undefined2 : pattern;
11561             if (pattern === undefined2) {
11562               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
11563             }
11564             return string.match(pattern) || [];
11565           }
11566           var attempt = baseRest(function(func, args) {
11567             try {
11568               return apply(func, undefined2, args);
11569             } catch (e3) {
11570               return isError(e3) ? e3 : new Error2(e3);
11571             }
11572           });
11573           var bindAll = flatRest(function(object, methodNames) {
11574             arrayEach(methodNames, function(key) {
11575               key = toKey(key);
11576               baseAssignValue(object, key, bind(object[key], object));
11577             });
11578             return object;
11579           });
11580           function cond(pairs2) {
11581             var length = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
11582             pairs2 = !length ? [] : arrayMap2(pairs2, function(pair3) {
11583               if (typeof pair3[1] != "function") {
11584                 throw new TypeError2(FUNC_ERROR_TEXT3);
11585               }
11586               return [toIteratee(pair3[0]), pair3[1]];
11587             });
11588             return baseRest(function(args) {
11589               var index = -1;
11590               while (++index < length) {
11591                 var pair3 = pairs2[index];
11592                 if (apply(pair3[0], this, args)) {
11593                   return apply(pair3[1], this, args);
11594                 }
11595               }
11596             });
11597           }
11598           function conforms(source) {
11599             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
11600           }
11601           function constant(value) {
11602             return function() {
11603               return value;
11604             };
11605           }
11606           function defaultTo(value, defaultValue) {
11607             return value == null || value !== value ? defaultValue : value;
11608           }
11609           var flow = createFlow();
11610           var flowRight = createFlow(true);
11611           function identity4(value) {
11612             return value;
11613           }
11614           function iteratee(func) {
11615             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
11616           }
11617           function matches(source) {
11618             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
11619           }
11620           function matchesProperty(path, srcValue) {
11621             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
11622           }
11623           var method = baseRest(function(path, args) {
11624             return function(object) {
11625               return baseInvoke(object, path, args);
11626             };
11627           });
11628           var methodOf = baseRest(function(object, args) {
11629             return function(path) {
11630               return baseInvoke(object, path, args);
11631             };
11632           });
11633           function mixin(object, source, options2) {
11634             var props = keys2(source), methodNames = baseFunctions(source, props);
11635             if (options2 == null && !(isObject3(source) && (methodNames.length || !props.length))) {
11636               options2 = source;
11637               source = object;
11638               object = this;
11639               methodNames = baseFunctions(source, keys2(source));
11640             }
11641             var chain2 = !(isObject3(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
11642             arrayEach(methodNames, function(methodName) {
11643               var func = source[methodName];
11644               object[methodName] = func;
11645               if (isFunc) {
11646                 object.prototype[methodName] = function() {
11647                   var chainAll = this.__chain__;
11648                   if (chain2 || chainAll) {
11649                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
11650                     actions.push({ "func": func, "args": arguments, "thisArg": object });
11651                     result2.__chain__ = chainAll;
11652                     return result2;
11653                   }
11654                   return func.apply(object, arrayPush2([this.value()], arguments));
11655                 };
11656               }
11657             });
11658             return object;
11659           }
11660           function noConflict() {
11661             if (root3._ === this) {
11662               root3._ = oldDash;
11663             }
11664             return this;
11665           }
11666           function noop3() {
11667           }
11668           function nthArg(n3) {
11669             n3 = toInteger(n3);
11670             return baseRest(function(args) {
11671               return baseNth(args, n3);
11672             });
11673           }
11674           var over = createOver(arrayMap2);
11675           var overEvery = createOver(arrayEvery);
11676           var overSome = createOver(arraySome2);
11677           function property(path) {
11678             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
11679           }
11680           function propertyOf(object) {
11681             return function(path) {
11682               return object == null ? undefined2 : baseGet(object, path);
11683             };
11684           }
11685           var range3 = createRange();
11686           var rangeRight = createRange(true);
11687           function stubArray2() {
11688             return [];
11689           }
11690           function stubFalse2() {
11691             return false;
11692           }
11693           function stubObject() {
11694             return {};
11695           }
11696           function stubString() {
11697             return "";
11698           }
11699           function stubTrue() {
11700             return true;
11701           }
11702           function times(n3, iteratee2) {
11703             n3 = toInteger(n3);
11704             if (n3 < 1 || n3 > MAX_SAFE_INTEGER3) {
11705               return [];
11706             }
11707             var index = MAX_ARRAY_LENGTH, length = nativeMin2(n3, MAX_ARRAY_LENGTH);
11708             iteratee2 = getIteratee(iteratee2);
11709             n3 -= MAX_ARRAY_LENGTH;
11710             var result2 = baseTimes2(length, iteratee2);
11711             while (++index < n3) {
11712               iteratee2(index);
11713             }
11714             return result2;
11715           }
11716           function toPath(value) {
11717             if (isArray2(value)) {
11718               return arrayMap2(value, toKey);
11719             }
11720             return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
11721           }
11722           function uniqueId(prefix) {
11723             var id2 = ++idCounter;
11724             return toString2(prefix) + id2;
11725           }
11726           var add = createMathOperation(function(augend, addend) {
11727             return augend + addend;
11728           }, 0);
11729           var ceil = createRound("ceil");
11730           var divide = createMathOperation(function(dividend, divisor) {
11731             return dividend / divisor;
11732           }, 1);
11733           var floor = createRound("floor");
11734           function max3(array2) {
11735             return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
11736           }
11737           function maxBy(array2, iteratee2) {
11738             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
11739           }
11740           function mean(array2) {
11741             return baseMean(array2, identity4);
11742           }
11743           function meanBy(array2, iteratee2) {
11744             return baseMean(array2, getIteratee(iteratee2, 2));
11745           }
11746           function min3(array2) {
11747             return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
11748           }
11749           function minBy(array2, iteratee2) {
11750             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
11751           }
11752           var multiply = createMathOperation(function(multiplier, multiplicand) {
11753             return multiplier * multiplicand;
11754           }, 1);
11755           var round = createRound("round");
11756           var subtract = createMathOperation(function(minuend, subtrahend) {
11757             return minuend - subtrahend;
11758           }, 0);
11759           function sum(array2) {
11760             return array2 && array2.length ? baseSum(array2, identity4) : 0;
11761           }
11762           function sumBy(array2, iteratee2) {
11763             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
11764           }
11765           lodash.after = after;
11766           lodash.ary = ary;
11767           lodash.assign = assign;
11768           lodash.assignIn = assignIn;
11769           lodash.assignInWith = assignInWith;
11770           lodash.assignWith = assignWith;
11771           lodash.at = at2;
11772           lodash.before = before;
11773           lodash.bind = bind;
11774           lodash.bindAll = bindAll;
11775           lodash.bindKey = bindKey2;
11776           lodash.castArray = castArray;
11777           lodash.chain = chain;
11778           lodash.chunk = chunk;
11779           lodash.compact = compact;
11780           lodash.concat = concat;
11781           lodash.cond = cond;
11782           lodash.conforms = conforms;
11783           lodash.constant = constant;
11784           lodash.countBy = countBy;
11785           lodash.create = create2;
11786           lodash.curry = curry;
11787           lodash.curryRight = curryRight;
11788           lodash.debounce = debounce2;
11789           lodash.defaults = defaults;
11790           lodash.defaultsDeep = defaultsDeep;
11791           lodash.defer = defer;
11792           lodash.delay = delay;
11793           lodash.difference = difference;
11794           lodash.differenceBy = differenceBy;
11795           lodash.differenceWith = differenceWith;
11796           lodash.drop = drop;
11797           lodash.dropRight = dropRight;
11798           lodash.dropRightWhile = dropRightWhile;
11799           lodash.dropWhile = dropWhile;
11800           lodash.fill = fill;
11801           lodash.filter = filter2;
11802           lodash.flatMap = flatMap;
11803           lodash.flatMapDeep = flatMapDeep;
11804           lodash.flatMapDepth = flatMapDepth;
11805           lodash.flatten = flatten2;
11806           lodash.flattenDeep = flattenDeep;
11807           lodash.flattenDepth = flattenDepth;
11808           lodash.flip = flip;
11809           lodash.flow = flow;
11810           lodash.flowRight = flowRight;
11811           lodash.fromPairs = fromPairs;
11812           lodash.functions = functions;
11813           lodash.functionsIn = functionsIn;
11814           lodash.groupBy = groupBy;
11815           lodash.initial = initial;
11816           lodash.intersection = intersection;
11817           lodash.intersectionBy = intersectionBy;
11818           lodash.intersectionWith = intersectionWith;
11819           lodash.invert = invert;
11820           lodash.invertBy = invertBy;
11821           lodash.invokeMap = invokeMap;
11822           lodash.iteratee = iteratee;
11823           lodash.keyBy = keyBy;
11824           lodash.keys = keys2;
11825           lodash.keysIn = keysIn;
11826           lodash.map = map2;
11827           lodash.mapKeys = mapKeys;
11828           lodash.mapValues = mapValues;
11829           lodash.matches = matches;
11830           lodash.matchesProperty = matchesProperty;
11831           lodash.memoize = memoize;
11832           lodash.merge = merge2;
11833           lodash.mergeWith = mergeWith;
11834           lodash.method = method;
11835           lodash.methodOf = methodOf;
11836           lodash.mixin = mixin;
11837           lodash.negate = negate;
11838           lodash.nthArg = nthArg;
11839           lodash.omit = omit;
11840           lodash.omitBy = omitBy;
11841           lodash.once = once;
11842           lodash.orderBy = orderBy;
11843           lodash.over = over;
11844           lodash.overArgs = overArgs;
11845           lodash.overEvery = overEvery;
11846           lodash.overSome = overSome;
11847           lodash.partial = partial;
11848           lodash.partialRight = partialRight;
11849           lodash.partition = partition;
11850           lodash.pick = pick;
11851           lodash.pickBy = pickBy;
11852           lodash.property = property;
11853           lodash.propertyOf = propertyOf;
11854           lodash.pull = pull;
11855           lodash.pullAll = pullAll;
11856           lodash.pullAllBy = pullAllBy;
11857           lodash.pullAllWith = pullAllWith;
11858           lodash.pullAt = pullAt;
11859           lodash.range = range3;
11860           lodash.rangeRight = rangeRight;
11861           lodash.rearg = rearg;
11862           lodash.reject = reject;
11863           lodash.remove = remove2;
11864           lodash.rest = rest;
11865           lodash.reverse = reverse;
11866           lodash.sampleSize = sampleSize;
11867           lodash.set = set3;
11868           lodash.setWith = setWith;
11869           lodash.shuffle = shuffle;
11870           lodash.slice = slice;
11871           lodash.sortBy = sortBy;
11872           lodash.sortedUniq = sortedUniq;
11873           lodash.sortedUniqBy = sortedUniqBy;
11874           lodash.split = split;
11875           lodash.spread = spread;
11876           lodash.tail = tail;
11877           lodash.take = take;
11878           lodash.takeRight = takeRight;
11879           lodash.takeRightWhile = takeRightWhile;
11880           lodash.takeWhile = takeWhile;
11881           lodash.tap = tap;
11882           lodash.throttle = throttle2;
11883           lodash.thru = thru;
11884           lodash.toArray = toArray;
11885           lodash.toPairs = toPairs;
11886           lodash.toPairsIn = toPairsIn;
11887           lodash.toPath = toPath;
11888           lodash.toPlainObject = toPlainObject;
11889           lodash.transform = transform2;
11890           lodash.unary = unary;
11891           lodash.union = union;
11892           lodash.unionBy = unionBy;
11893           lodash.unionWith = unionWith;
11894           lodash.uniq = uniq;
11895           lodash.uniqBy = uniqBy;
11896           lodash.uniqWith = uniqWith;
11897           lodash.unset = unset;
11898           lodash.unzip = unzip;
11899           lodash.unzipWith = unzipWith;
11900           lodash.update = update;
11901           lodash.updateWith = updateWith;
11902           lodash.values = values;
11903           lodash.valuesIn = valuesIn;
11904           lodash.without = without;
11905           lodash.words = words;
11906           lodash.wrap = wrap2;
11907           lodash.xor = xor;
11908           lodash.xorBy = xorBy;
11909           lodash.xorWith = xorWith;
11910           lodash.zip = zip;
11911           lodash.zipObject = zipObject;
11912           lodash.zipObjectDeep = zipObjectDeep;
11913           lodash.zipWith = zipWith;
11914           lodash.entries = toPairs;
11915           lodash.entriesIn = toPairsIn;
11916           lodash.extend = assignIn;
11917           lodash.extendWith = assignInWith;
11918           mixin(lodash, lodash);
11919           lodash.add = add;
11920           lodash.attempt = attempt;
11921           lodash.camelCase = camelCase;
11922           lodash.capitalize = capitalize;
11923           lodash.ceil = ceil;
11924           lodash.clamp = clamp3;
11925           lodash.clone = clone;
11926           lodash.cloneDeep = cloneDeep;
11927           lodash.cloneDeepWith = cloneDeepWith;
11928           lodash.cloneWith = cloneWith;
11929           lodash.conformsTo = conformsTo;
11930           lodash.deburr = deburr;
11931           lodash.defaultTo = defaultTo;
11932           lodash.divide = divide;
11933           lodash.endsWith = endsWith;
11934           lodash.eq = eq2;
11935           lodash.escape = escape6;
11936           lodash.escapeRegExp = escapeRegExp;
11937           lodash.every = every;
11938           lodash.find = find2;
11939           lodash.findIndex = findIndex;
11940           lodash.findKey = findKey;
11941           lodash.findLast = findLast;
11942           lodash.findLastIndex = findLastIndex;
11943           lodash.findLastKey = findLastKey;
11944           lodash.floor = floor;
11945           lodash.forEach = forEach;
11946           lodash.forEachRight = forEachRight;
11947           lodash.forIn = forIn;
11948           lodash.forInRight = forInRight;
11949           lodash.forOwn = forOwn;
11950           lodash.forOwnRight = forOwnRight;
11951           lodash.get = get4;
11952           lodash.gt = gt2;
11953           lodash.gte = gte;
11954           lodash.has = has;
11955           lodash.hasIn = hasIn;
11956           lodash.head = head;
11957           lodash.identity = identity4;
11958           lodash.includes = includes;
11959           lodash.indexOf = indexOf;
11960           lodash.inRange = inRange;
11961           lodash.invoke = invoke;
11962           lodash.isArguments = isArguments2;
11963           lodash.isArray = isArray2;
11964           lodash.isArrayBuffer = isArrayBuffer;
11965           lodash.isArrayLike = isArrayLike2;
11966           lodash.isArrayLikeObject = isArrayLikeObject;
11967           lodash.isBoolean = isBoolean;
11968           lodash.isBuffer = isBuffer2;
11969           lodash.isDate = isDate;
11970           lodash.isElement = isElement2;
11971           lodash.isEmpty = isEmpty;
11972           lodash.isEqual = isEqual4;
11973           lodash.isEqualWith = isEqualWith;
11974           lodash.isError = isError;
11975           lodash.isFinite = isFinite2;
11976           lodash.isFunction = isFunction2;
11977           lodash.isInteger = isInteger;
11978           lodash.isLength = isLength2;
11979           lodash.isMap = isMap;
11980           lodash.isMatch = isMatch;
11981           lodash.isMatchWith = isMatchWith;
11982           lodash.isNaN = isNaN2;
11983           lodash.isNative = isNative;
11984           lodash.isNil = isNil;
11985           lodash.isNull = isNull;
11986           lodash.isNumber = isNumber3;
11987           lodash.isObject = isObject3;
11988           lodash.isObjectLike = isObjectLike2;
11989           lodash.isPlainObject = isPlainObject;
11990           lodash.isRegExp = isRegExp;
11991           lodash.isSafeInteger = isSafeInteger;
11992           lodash.isSet = isSet;
11993           lodash.isString = isString;
11994           lodash.isSymbol = isSymbol2;
11995           lodash.isTypedArray = isTypedArray2;
11996           lodash.isUndefined = isUndefined;
11997           lodash.isWeakMap = isWeakMap;
11998           lodash.isWeakSet = isWeakSet;
11999           lodash.join = join;
12000           lodash.kebabCase = kebabCase;
12001           lodash.last = last;
12002           lodash.lastIndexOf = lastIndexOf;
12003           lodash.lowerCase = lowerCase;
12004           lodash.lowerFirst = lowerFirst;
12005           lodash.lt = lt2;
12006           lodash.lte = lte;
12007           lodash.max = max3;
12008           lodash.maxBy = maxBy;
12009           lodash.mean = mean;
12010           lodash.meanBy = meanBy;
12011           lodash.min = min3;
12012           lodash.minBy = minBy;
12013           lodash.stubArray = stubArray2;
12014           lodash.stubFalse = stubFalse2;
12015           lodash.stubObject = stubObject;
12016           lodash.stubString = stubString;
12017           lodash.stubTrue = stubTrue;
12018           lodash.multiply = multiply;
12019           lodash.nth = nth;
12020           lodash.noConflict = noConflict;
12021           lodash.noop = noop3;
12022           lodash.now = now3;
12023           lodash.pad = pad2;
12024           lodash.padEnd = padEnd;
12025           lodash.padStart = padStart;
12026           lodash.parseInt = parseInt2;
12027           lodash.random = random;
12028           lodash.reduce = reduce;
12029           lodash.reduceRight = reduceRight;
12030           lodash.repeat = repeat;
12031           lodash.replace = replace;
12032           lodash.result = result;
12033           lodash.round = round;
12034           lodash.runInContext = runInContext2;
12035           lodash.sample = sample;
12036           lodash.size = size;
12037           lodash.snakeCase = snakeCase;
12038           lodash.some = some;
12039           lodash.sortedIndex = sortedIndex;
12040           lodash.sortedIndexBy = sortedIndexBy;
12041           lodash.sortedIndexOf = sortedIndexOf;
12042           lodash.sortedLastIndex = sortedLastIndex;
12043           lodash.sortedLastIndexBy = sortedLastIndexBy;
12044           lodash.sortedLastIndexOf = sortedLastIndexOf;
12045           lodash.startCase = startCase;
12046           lodash.startsWith = startsWith;
12047           lodash.subtract = subtract;
12048           lodash.sum = sum;
12049           lodash.sumBy = sumBy;
12050           lodash.template = template;
12051           lodash.times = times;
12052           lodash.toFinite = toFinite;
12053           lodash.toInteger = toInteger;
12054           lodash.toLength = toLength;
12055           lodash.toLower = toLower;
12056           lodash.toNumber = toNumber3;
12057           lodash.toSafeInteger = toSafeInteger;
12058           lodash.toString = toString2;
12059           lodash.toUpper = toUpper;
12060           lodash.trim = trim;
12061           lodash.trimEnd = trimEnd;
12062           lodash.trimStart = trimStart;
12063           lodash.truncate = truncate;
12064           lodash.unescape = unescape4;
12065           lodash.uniqueId = uniqueId;
12066           lodash.upperCase = upperCase;
12067           lodash.upperFirst = upperFirst;
12068           lodash.each = forEach;
12069           lodash.eachRight = forEachRight;
12070           lodash.first = head;
12071           mixin(lodash, function() {
12072             var source = {};
12073             baseForOwn(lodash, function(func, methodName) {
12074               if (!hasOwnProperty10.call(lodash.prototype, methodName)) {
12075                 source[methodName] = func;
12076               }
12077             });
12078             return source;
12079           }(), { "chain": false });
12080           lodash.VERSION = VERSION;
12081           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
12082             lodash[methodName].placeholder = lodash;
12083           });
12084           arrayEach(["drop", "take"], function(methodName, index) {
12085             LazyWrapper.prototype[methodName] = function(n3) {
12086               n3 = n3 === undefined2 ? 1 : nativeMax2(toInteger(n3), 0);
12087               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
12088               if (result2.__filtered__) {
12089                 result2.__takeCount__ = nativeMin2(n3, result2.__takeCount__);
12090               } else {
12091                 result2.__views__.push({
12092                   "size": nativeMin2(n3, MAX_ARRAY_LENGTH),
12093                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
12094                 });
12095               }
12096               return result2;
12097             };
12098             LazyWrapper.prototype[methodName + "Right"] = function(n3) {
12099               return this.reverse()[methodName](n3).reverse();
12100             };
12101           });
12102           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
12103             var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
12104             LazyWrapper.prototype[methodName] = function(iteratee2) {
12105               var result2 = this.clone();
12106               result2.__iteratees__.push({
12107                 "iteratee": getIteratee(iteratee2, 3),
12108                 "type": type2
12109               });
12110               result2.__filtered__ = result2.__filtered__ || isFilter;
12111               return result2;
12112             };
12113           });
12114           arrayEach(["head", "last"], function(methodName, index) {
12115             var takeName = "take" + (index ? "Right" : "");
12116             LazyWrapper.prototype[methodName] = function() {
12117               return this[takeName](1).value()[0];
12118             };
12119           });
12120           arrayEach(["initial", "tail"], function(methodName, index) {
12121             var dropName = "drop" + (index ? "" : "Right");
12122             LazyWrapper.prototype[methodName] = function() {
12123               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
12124             };
12125           });
12126           LazyWrapper.prototype.compact = function() {
12127             return this.filter(identity4);
12128           };
12129           LazyWrapper.prototype.find = function(predicate) {
12130             return this.filter(predicate).head();
12131           };
12132           LazyWrapper.prototype.findLast = function(predicate) {
12133             return this.reverse().find(predicate);
12134           };
12135           LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
12136             if (typeof path == "function") {
12137               return new LazyWrapper(this);
12138             }
12139             return this.map(function(value) {
12140               return baseInvoke(value, path, args);
12141             });
12142           });
12143           LazyWrapper.prototype.reject = function(predicate) {
12144             return this.filter(negate(getIteratee(predicate)));
12145           };
12146           LazyWrapper.prototype.slice = function(start2, end) {
12147             start2 = toInteger(start2);
12148             var result2 = this;
12149             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
12150               return new LazyWrapper(result2);
12151             }
12152             if (start2 < 0) {
12153               result2 = result2.takeRight(-start2);
12154             } else if (start2) {
12155               result2 = result2.drop(start2);
12156             }
12157             if (end !== undefined2) {
12158               end = toInteger(end);
12159               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
12160             }
12161             return result2;
12162           };
12163           LazyWrapper.prototype.takeRightWhile = function(predicate) {
12164             return this.reverse().takeWhile(predicate).reverse();
12165           };
12166           LazyWrapper.prototype.toArray = function() {
12167             return this.take(MAX_ARRAY_LENGTH);
12168           };
12169           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12170             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);
12171             if (!lodashFunc) {
12172               return;
12173             }
12174             lodash.prototype[methodName] = function() {
12175               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
12176               var interceptor = function(value2) {
12177                 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
12178                 return isTaker && chainAll ? result3[0] : result3;
12179               };
12180               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
12181                 isLazy = useLazy = false;
12182               }
12183               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
12184               if (!retUnwrapped && useLazy) {
12185                 value = onlyLazy ? value : new LazyWrapper(this);
12186                 var result2 = func.apply(value, args);
12187                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
12188                 return new LodashWrapper(result2, chainAll);
12189               }
12190               if (isUnwrapped && onlyLazy) {
12191                 return func.apply(this, args);
12192               }
12193               result2 = this.thru(interceptor);
12194               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
12195             };
12196           });
12197           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
12198             var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
12199             lodash.prototype[methodName] = function() {
12200               var args = arguments;
12201               if (retUnwrapped && !this.__chain__) {
12202                 var value = this.value();
12203                 return func.apply(isArray2(value) ? value : [], args);
12204               }
12205               return this[chainName](function(value2) {
12206                 return func.apply(isArray2(value2) ? value2 : [], args);
12207               });
12208             };
12209           });
12210           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12211             var lodashFunc = lodash[methodName];
12212             if (lodashFunc) {
12213               var key = lodashFunc.name + "";
12214               if (!hasOwnProperty10.call(realNames, key)) {
12215                 realNames[key] = [];
12216               }
12217               realNames[key].push({ "name": methodName, "func": lodashFunc });
12218             }
12219           });
12220           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
12221             "name": "wrapper",
12222             "func": undefined2
12223           }];
12224           LazyWrapper.prototype.clone = lazyClone;
12225           LazyWrapper.prototype.reverse = lazyReverse;
12226           LazyWrapper.prototype.value = lazyValue;
12227           lodash.prototype.at = wrapperAt;
12228           lodash.prototype.chain = wrapperChain;
12229           lodash.prototype.commit = wrapperCommit;
12230           lodash.prototype.next = wrapperNext;
12231           lodash.prototype.plant = wrapperPlant;
12232           lodash.prototype.reverse = wrapperReverse;
12233           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
12234           lodash.prototype.first = lodash.prototype.head;
12235           if (symIterator) {
12236             lodash.prototype[symIterator] = wrapperToIterator;
12237           }
12238           return lodash;
12239         };
12240         var _2 = runInContext();
12241         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
12242           root3._ = _2;
12243           define(function() {
12244             return _2;
12245           });
12246         } else if (freeModule3) {
12247           (freeModule3.exports = _2)._ = _2;
12248           freeExports3._ = _2;
12249         } else {
12250           root3._ = _2;
12251         }
12252       }).call(exports2);
12253     }
12254   });
12255
12256   // node_modules/fast-deep-equal/index.js
12257   var require_fast_deep_equal = __commonJS({
12258     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
12259       "use strict";
12260       module2.exports = function equal(a2, b2) {
12261         if (a2 === b2)
12262           return true;
12263         if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
12264           if (a2.constructor !== b2.constructor)
12265             return false;
12266           var length, i3, keys2;
12267           if (Array.isArray(a2)) {
12268             length = a2.length;
12269             if (length != b2.length)
12270               return false;
12271             for (i3 = length; i3-- !== 0; )
12272               if (!equal(a2[i3], b2[i3]))
12273                 return false;
12274             return true;
12275           }
12276           if (a2.constructor === RegExp)
12277             return a2.source === b2.source && a2.flags === b2.flags;
12278           if (a2.valueOf !== Object.prototype.valueOf)
12279             return a2.valueOf() === b2.valueOf();
12280           if (a2.toString !== Object.prototype.toString)
12281             return a2.toString() === b2.toString();
12282           keys2 = Object.keys(a2);
12283           length = keys2.length;
12284           if (length !== Object.keys(b2).length)
12285             return false;
12286           for (i3 = length; i3-- !== 0; )
12287             if (!Object.prototype.hasOwnProperty.call(b2, keys2[i3]))
12288               return false;
12289           for (i3 = length; i3-- !== 0; ) {
12290             var key = keys2[i3];
12291             if (!equal(a2[key], b2[key]))
12292               return false;
12293           }
12294           return true;
12295         }
12296         return a2 !== a2 && b2 !== b2;
12297       };
12298     }
12299   });
12300
12301   // node_modules/rbush/rbush.min.js
12302   var require_rbush_min = __commonJS({
12303     "node_modules/rbush/rbush.min.js"(exports2, module2) {
12304       !function(t2, i3) {
12305         "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = i3() : "function" == typeof define && define.amd ? define(i3) : (t2 = t2 || self).RBush = i3();
12306       }(exports2, function() {
12307         "use strict";
12308         function t2(t3, r3, e4, a3, h3) {
12309           !function t4(n4, r4, e6, a4, h4) {
12310             for (; a4 > e6; ) {
12311               if (a4 - e6 > 600) {
12312                 var o3 = a4 - e6 + 1, s3 = r4 - e6 + 1, l3 = Math.log(o3), f4 = 0.5 * Math.exp(2 * l3 / 3), u3 = 0.5 * Math.sqrt(l3 * f4 * (o3 - f4) / o3) * (s3 - o3 / 2 < 0 ? -1 : 1), m3 = Math.max(e6, Math.floor(r4 - s3 * f4 / o3 + u3)), c3 = Math.min(a4, Math.floor(r4 + (o3 - s3) * f4 / o3 + u3));
12313                 t4(n4, r4, m3, c3, h4);
12314               }
12315               var p3 = n4[r4], d4 = e6, x2 = a4;
12316               for (i3(n4, e6, r4), h4(n4[a4], p3) > 0 && i3(n4, e6, a4); d4 < x2; ) {
12317                 for (i3(n4, d4, x2), d4++, x2--; h4(n4[d4], p3) < 0; )
12318                   d4++;
12319                 for (; h4(n4[x2], p3) > 0; )
12320                   x2--;
12321               }
12322               0 === h4(n4[e6], p3) ? i3(n4, e6, x2) : i3(n4, ++x2, a4), x2 <= r4 && (e6 = x2 + 1), r4 <= x2 && (a4 = x2 - 1);
12323             }
12324           }(t3, r3, e4 || 0, a3 || t3.length - 1, h3 || n3);
12325         }
12326         function i3(t3, i4, n4) {
12327           var r3 = t3[i4];
12328           t3[i4] = t3[n4], t3[n4] = r3;
12329         }
12330         function n3(t3, i4) {
12331           return t3 < i4 ? -1 : t3 > i4 ? 1 : 0;
12332         }
12333         var r2 = function(t3) {
12334           void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
12335         };
12336         function e3(t3, i4, n4) {
12337           if (!n4)
12338             return i4.indexOf(t3);
12339           for (var r3 = 0; r3 < i4.length; r3++)
12340             if (n4(t3, i4[r3]))
12341               return r3;
12342           return -1;
12343         }
12344         function a2(t3, i4) {
12345           h2(t3, 0, t3.children.length, i4, t3);
12346         }
12347         function h2(t3, i4, n4, r3, e4) {
12348           e4 || (e4 = p2(null)), e4.minX = 1 / 0, e4.minY = 1 / 0, e4.maxX = -1 / 0, e4.maxY = -1 / 0;
12349           for (var a3 = i4; a3 < n4; a3++) {
12350             var h3 = t3.children[a3];
12351             o2(e4, t3.leaf ? r3(h3) : h3);
12352           }
12353           return e4;
12354         }
12355         function o2(t3, i4) {
12356           return t3.minX = Math.min(t3.minX, i4.minX), t3.minY = Math.min(t3.minY, i4.minY), t3.maxX = Math.max(t3.maxX, i4.maxX), t3.maxY = Math.max(t3.maxY, i4.maxY), t3;
12357         }
12358         function s2(t3, i4) {
12359           return t3.minX - i4.minX;
12360         }
12361         function l2(t3, i4) {
12362           return t3.minY - i4.minY;
12363         }
12364         function f3(t3) {
12365           return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
12366         }
12367         function u2(t3) {
12368           return t3.maxX - t3.minX + (t3.maxY - t3.minY);
12369         }
12370         function m2(t3, i4) {
12371           return t3.minX <= i4.minX && t3.minY <= i4.minY && i4.maxX <= t3.maxX && i4.maxY <= t3.maxY;
12372         }
12373         function c2(t3, i4) {
12374           return i4.minX <= t3.maxX && i4.minY <= t3.maxY && i4.maxX >= t3.minX && i4.maxY >= t3.minY;
12375         }
12376         function p2(t3) {
12377           return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
12378         }
12379         function d2(i4, n4, r3, e4, a3) {
12380           for (var h3 = [n4, r3]; h3.length; )
12381             if (!((r3 = h3.pop()) - (n4 = h3.pop()) <= e4)) {
12382               var o3 = n4 + Math.ceil((r3 - n4) / e4 / 2) * e4;
12383               t2(i4, o3, n4, r3, a3), h3.push(n4, o3, o3, r3);
12384             }
12385         }
12386         return r2.prototype.all = function() {
12387           return this._all(this.data, []);
12388         }, r2.prototype.search = function(t3) {
12389           var i4 = this.data, n4 = [];
12390           if (!c2(t3, i4))
12391             return n4;
12392           for (var r3 = this.toBBox, e4 = []; i4; ) {
12393             for (var a3 = 0; a3 < i4.children.length; a3++) {
12394               var h3 = i4.children[a3], o3 = i4.leaf ? r3(h3) : h3;
12395               c2(t3, o3) && (i4.leaf ? n4.push(h3) : m2(t3, o3) ? this._all(h3, n4) : e4.push(h3));
12396             }
12397             i4 = e4.pop();
12398           }
12399           return n4;
12400         }, r2.prototype.collides = function(t3) {
12401           var i4 = this.data;
12402           if (!c2(t3, i4))
12403             return false;
12404           for (var n4 = []; i4; ) {
12405             for (var r3 = 0; r3 < i4.children.length; r3++) {
12406               var e4 = i4.children[r3], a3 = i4.leaf ? this.toBBox(e4) : e4;
12407               if (c2(t3, a3)) {
12408                 if (i4.leaf || m2(t3, a3))
12409                   return true;
12410                 n4.push(e4);
12411               }
12412             }
12413             i4 = n4.pop();
12414           }
12415           return false;
12416         }, r2.prototype.load = function(t3) {
12417           if (!t3 || !t3.length)
12418             return this;
12419           if (t3.length < this._minEntries) {
12420             for (var i4 = 0; i4 < t3.length; i4++)
12421               this.insert(t3[i4]);
12422             return this;
12423           }
12424           var n4 = this._build(t3.slice(), 0, t3.length - 1, 0);
12425           if (this.data.children.length)
12426             if (this.data.height === n4.height)
12427               this._splitRoot(this.data, n4);
12428             else {
12429               if (this.data.height < n4.height) {
12430                 var r3 = this.data;
12431                 this.data = n4, n4 = r3;
12432               }
12433               this._insert(n4, this.data.height - n4.height - 1, true);
12434             }
12435           else
12436             this.data = n4;
12437           return this;
12438         }, r2.prototype.insert = function(t3) {
12439           return t3 && this._insert(t3, this.data.height - 1), this;
12440         }, r2.prototype.clear = function() {
12441           return this.data = p2([]), this;
12442         }, r2.prototype.remove = function(t3, i4) {
12443           if (!t3)
12444             return this;
12445           for (var n4, r3, a3, h3 = this.data, o3 = this.toBBox(t3), s3 = [], l3 = []; h3 || s3.length; ) {
12446             if (h3 || (h3 = s3.pop(), r3 = s3[s3.length - 1], n4 = l3.pop(), a3 = true), h3.leaf) {
12447               var f4 = e3(t3, h3.children, i4);
12448               if (-1 !== f4)
12449                 return h3.children.splice(f4, 1), s3.push(h3), this._condense(s3), this;
12450             }
12451             a3 || h3.leaf || !m2(h3, o3) ? r3 ? (n4++, h3 = r3.children[n4], a3 = false) : h3 = null : (s3.push(h3), l3.push(n4), n4 = 0, r3 = h3, h3 = h3.children[0]);
12452           }
12453           return this;
12454         }, r2.prototype.toBBox = function(t3) {
12455           return t3;
12456         }, r2.prototype.compareMinX = function(t3, i4) {
12457           return t3.minX - i4.minX;
12458         }, r2.prototype.compareMinY = function(t3, i4) {
12459           return t3.minY - i4.minY;
12460         }, r2.prototype.toJSON = function() {
12461           return this.data;
12462         }, r2.prototype.fromJSON = function(t3) {
12463           return this.data = t3, this;
12464         }, r2.prototype._all = function(t3, i4) {
12465           for (var n4 = []; t3; )
12466             t3.leaf ? i4.push.apply(i4, t3.children) : n4.push.apply(n4, t3.children), t3 = n4.pop();
12467           return i4;
12468         }, r2.prototype._build = function(t3, i4, n4, r3) {
12469           var e4, h3 = n4 - i4 + 1, o3 = this._maxEntries;
12470           if (h3 <= o3)
12471             return a2(e4 = p2(t3.slice(i4, n4 + 1)), this.toBBox), e4;
12472           r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o3)), o3 = Math.ceil(h3 / Math.pow(o3, r3 - 1))), (e4 = p2([])).leaf = false, e4.height = r3;
12473           var s3 = Math.ceil(h3 / o3), l3 = s3 * Math.ceil(Math.sqrt(o3));
12474           d2(t3, i4, n4, l3, this.compareMinX);
12475           for (var f4 = i4; f4 <= n4; f4 += l3) {
12476             var u3 = Math.min(f4 + l3 - 1, n4);
12477             d2(t3, f4, u3, s3, this.compareMinY);
12478             for (var m3 = f4; m3 <= u3; m3 += s3) {
12479               var c3 = Math.min(m3 + s3 - 1, u3);
12480               e4.children.push(this._build(t3, m3, c3, r3 - 1));
12481             }
12482           }
12483           return a2(e4, this.toBBox), e4;
12484         }, r2.prototype._chooseSubtree = function(t3, i4, n4, r3) {
12485           for (; r3.push(i4), !i4.leaf && r3.length - 1 !== n4; ) {
12486             for (var e4 = 1 / 0, a3 = 1 / 0, h3 = void 0, o3 = 0; o3 < i4.children.length; o3++) {
12487               var s3 = i4.children[o3], l3 = f3(s3), u3 = (m3 = t3, c3 = s3, (Math.max(c3.maxX, m3.maxX) - Math.min(c3.minX, m3.minX)) * (Math.max(c3.maxY, m3.maxY) - Math.min(c3.minY, m3.minY)) - l3);
12488               u3 < a3 ? (a3 = u3, e4 = l3 < e4 ? l3 : e4, h3 = s3) : u3 === a3 && l3 < e4 && (e4 = l3, h3 = s3);
12489             }
12490             i4 = h3 || i4.children[0];
12491           }
12492           var m3, c3;
12493           return i4;
12494         }, r2.prototype._insert = function(t3, i4, n4) {
12495           var r3 = n4 ? t3 : this.toBBox(t3), e4 = [], a3 = this._chooseSubtree(r3, this.data, i4, e4);
12496           for (a3.children.push(t3), o2(a3, r3); i4 >= 0 && e4[i4].children.length > this._maxEntries; )
12497             this._split(e4, i4), i4--;
12498           this._adjustParentBBoxes(r3, e4, i4);
12499         }, r2.prototype._split = function(t3, i4) {
12500           var n4 = t3[i4], r3 = n4.children.length, e4 = this._minEntries;
12501           this._chooseSplitAxis(n4, e4, r3);
12502           var h3 = this._chooseSplitIndex(n4, e4, r3), o3 = p2(n4.children.splice(h3, n4.children.length - h3));
12503           o3.height = n4.height, o3.leaf = n4.leaf, a2(n4, this.toBBox), a2(o3, this.toBBox), i4 ? t3[i4 - 1].children.push(o3) : this._splitRoot(n4, o3);
12504         }, r2.prototype._splitRoot = function(t3, i4) {
12505           this.data = p2([t3, i4]), this.data.height = t3.height + 1, this.data.leaf = false, a2(this.data, this.toBBox);
12506         }, r2.prototype._chooseSplitIndex = function(t3, i4, n4) {
12507           for (var r3, e4, a3, o3, s3, l3, u3, m3 = 1 / 0, c3 = 1 / 0, p3 = i4; p3 <= n4 - i4; p3++) {
12508             var d4 = h2(t3, 0, p3, this.toBBox), x2 = h2(t3, p3, n4, this.toBBox), v2 = (e4 = d4, a3 = x2, o3 = void 0, s3 = void 0, l3 = void 0, u3 = void 0, o3 = Math.max(e4.minX, a3.minX), s3 = Math.max(e4.minY, a3.minY), l3 = Math.min(e4.maxX, a3.maxX), u3 = Math.min(e4.maxY, a3.maxY), Math.max(0, l3 - o3) * Math.max(0, u3 - s3)), M2 = f3(d4) + f3(x2);
12509             v2 < m3 ? (m3 = v2, r3 = p3, c3 = M2 < c3 ? M2 : c3) : v2 === m3 && M2 < c3 && (c3 = M2, r3 = p3);
12510           }
12511           return r3 || n4 - i4;
12512         }, r2.prototype._chooseSplitAxis = function(t3, i4, n4) {
12513           var r3 = t3.leaf ? this.compareMinX : s2, e4 = t3.leaf ? this.compareMinY : l2;
12514           this._allDistMargin(t3, i4, n4, r3) < this._allDistMargin(t3, i4, n4, e4) && t3.children.sort(r3);
12515         }, r2.prototype._allDistMargin = function(t3, i4, n4, r3) {
12516           t3.children.sort(r3);
12517           for (var e4 = this.toBBox, a3 = h2(t3, 0, i4, e4), s3 = h2(t3, n4 - i4, n4, e4), l3 = u2(a3) + u2(s3), f4 = i4; f4 < n4 - i4; f4++) {
12518             var m3 = t3.children[f4];
12519             o2(a3, t3.leaf ? e4(m3) : m3), l3 += u2(a3);
12520           }
12521           for (var c3 = n4 - i4 - 1; c3 >= i4; c3--) {
12522             var p3 = t3.children[c3];
12523             o2(s3, t3.leaf ? e4(p3) : p3), l3 += u2(s3);
12524           }
12525           return l3;
12526         }, r2.prototype._adjustParentBBoxes = function(t3, i4, n4) {
12527           for (var r3 = n4; r3 >= 0; r3--)
12528             o2(i4[r3], t3);
12529         }, r2.prototype._condense = function(t3) {
12530           for (var i4 = t3.length - 1, n4 = void 0; i4 >= 0; i4--)
12531             0 === t3[i4].children.length ? i4 > 0 ? (n4 = t3[i4 - 1].children).splice(n4.indexOf(t3[i4]), 1) : this.clear() : a2(t3[i4], this.toBBox);
12532         }, r2;
12533       });
12534     }
12535   });
12536
12537   // node_modules/ieee754/index.js
12538   var require_ieee754 = __commonJS({
12539     "node_modules/ieee754/index.js"(exports2) {
12540       exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
12541         var e3, m2;
12542         var eLen = nBytes * 8 - mLen - 1;
12543         var eMax = (1 << eLen) - 1;
12544         var eBias = eMax >> 1;
12545         var nBits = -7;
12546         var i3 = isLE ? nBytes - 1 : 0;
12547         var d2 = isLE ? -1 : 1;
12548         var s2 = buffer[offset + i3];
12549         i3 += d2;
12550         e3 = s2 & (1 << -nBits) - 1;
12551         s2 >>= -nBits;
12552         nBits += eLen;
12553         for (; nBits > 0; e3 = e3 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
12554         }
12555         m2 = e3 & (1 << -nBits) - 1;
12556         e3 >>= -nBits;
12557         nBits += mLen;
12558         for (; nBits > 0; m2 = m2 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
12559         }
12560         if (e3 === 0) {
12561           e3 = 1 - eBias;
12562         } else if (e3 === eMax) {
12563           return m2 ? NaN : (s2 ? -1 : 1) * Infinity;
12564         } else {
12565           m2 = m2 + Math.pow(2, mLen);
12566           e3 = e3 - eBias;
12567         }
12568         return (s2 ? -1 : 1) * m2 * Math.pow(2, e3 - mLen);
12569       };
12570       exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
12571         var e3, m2, c2;
12572         var eLen = nBytes * 8 - mLen - 1;
12573         var eMax = (1 << eLen) - 1;
12574         var eBias = eMax >> 1;
12575         var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
12576         var i3 = isLE ? 0 : nBytes - 1;
12577         var d2 = isLE ? 1 : -1;
12578         var s2 = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
12579         value = Math.abs(value);
12580         if (isNaN(value) || value === Infinity) {
12581           m2 = isNaN(value) ? 1 : 0;
12582           e3 = eMax;
12583         } else {
12584           e3 = Math.floor(Math.log(value) / Math.LN2);
12585           if (value * (c2 = Math.pow(2, -e3)) < 1) {
12586             e3--;
12587             c2 *= 2;
12588           }
12589           if (e3 + eBias >= 1) {
12590             value += rt / c2;
12591           } else {
12592             value += rt * Math.pow(2, 1 - eBias);
12593           }
12594           if (value * c2 >= 2) {
12595             e3++;
12596             c2 /= 2;
12597           }
12598           if (e3 + eBias >= eMax) {
12599             m2 = 0;
12600             e3 = eMax;
12601           } else if (e3 + eBias >= 1) {
12602             m2 = (value * c2 - 1) * Math.pow(2, mLen);
12603             e3 = e3 + eBias;
12604           } else {
12605             m2 = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
12606             e3 = 0;
12607           }
12608         }
12609         for (; mLen >= 8; buffer[offset + i3] = m2 & 255, i3 += d2, m2 /= 256, mLen -= 8) {
12610         }
12611         e3 = e3 << mLen | m2;
12612         eLen += mLen;
12613         for (; eLen > 0; buffer[offset + i3] = e3 & 255, i3 += d2, e3 /= 256, eLen -= 8) {
12614         }
12615         buffer[offset + i3 - d2] |= s2 * 128;
12616       };
12617     }
12618   });
12619
12620   // node_modules/pbf/index.js
12621   var require_pbf = __commonJS({
12622     "node_modules/pbf/index.js"(exports2, module2) {
12623       "use strict";
12624       module2.exports = Pbf;
12625       var ieee754 = require_ieee754();
12626       function Pbf(buf) {
12627         this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
12628         this.pos = 0;
12629         this.type = 0;
12630         this.length = this.buf.length;
12631       }
12632       Pbf.Varint = 0;
12633       Pbf.Fixed64 = 1;
12634       Pbf.Bytes = 2;
12635       Pbf.Fixed32 = 5;
12636       var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
12637       var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
12638       var TEXT_DECODER_MIN_LENGTH = 12;
12639       var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
12640       Pbf.prototype = {
12641         destroy: function() {
12642           this.buf = null;
12643         },
12644         // === READING =================================================================
12645         readFields: function(readField, result, end) {
12646           end = end || this.length;
12647           while (this.pos < end) {
12648             var val = this.readVarint(), tag = val >> 3, startPos = this.pos;
12649             this.type = val & 7;
12650             readField(tag, result, this);
12651             if (this.pos === startPos)
12652               this.skip(val);
12653           }
12654           return result;
12655         },
12656         readMessage: function(readField, result) {
12657           return this.readFields(readField, result, this.readVarint() + this.pos);
12658         },
12659         readFixed32: function() {
12660           var val = readUInt32(this.buf, this.pos);
12661           this.pos += 4;
12662           return val;
12663         },
12664         readSFixed32: function() {
12665           var val = readInt32(this.buf, this.pos);
12666           this.pos += 4;
12667           return val;
12668         },
12669         // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
12670         readFixed64: function() {
12671           var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12672           this.pos += 8;
12673           return val;
12674         },
12675         readSFixed64: function() {
12676           var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12677           this.pos += 8;
12678           return val;
12679         },
12680         readFloat: function() {
12681           var val = ieee754.read(this.buf, this.pos, true, 23, 4);
12682           this.pos += 4;
12683           return val;
12684         },
12685         readDouble: function() {
12686           var val = ieee754.read(this.buf, this.pos, true, 52, 8);
12687           this.pos += 8;
12688           return val;
12689         },
12690         readVarint: function(isSigned) {
12691           var buf = this.buf, val, b2;
12692           b2 = buf[this.pos++];
12693           val = b2 & 127;
12694           if (b2 < 128)
12695             return val;
12696           b2 = buf[this.pos++];
12697           val |= (b2 & 127) << 7;
12698           if (b2 < 128)
12699             return val;
12700           b2 = buf[this.pos++];
12701           val |= (b2 & 127) << 14;
12702           if (b2 < 128)
12703             return val;
12704           b2 = buf[this.pos++];
12705           val |= (b2 & 127) << 21;
12706           if (b2 < 128)
12707             return val;
12708           b2 = buf[this.pos];
12709           val |= (b2 & 15) << 28;
12710           return readVarintRemainder(val, isSigned, this);
12711         },
12712         readVarint64: function() {
12713           return this.readVarint(true);
12714         },
12715         readSVarint: function() {
12716           var num = this.readVarint();
12717           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
12718         },
12719         readBoolean: function() {
12720           return Boolean(this.readVarint());
12721         },
12722         readString: function() {
12723           var end = this.readVarint() + this.pos;
12724           var pos = this.pos;
12725           this.pos = end;
12726           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
12727             return readUtf8TextDecoder(this.buf, pos, end);
12728           }
12729           return readUtf8(this.buf, pos, end);
12730         },
12731         readBytes: function() {
12732           var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
12733           this.pos = end;
12734           return buffer;
12735         },
12736         // verbose for performance reasons; doesn't affect gzipped size
12737         readPackedVarint: function(arr, isSigned) {
12738           if (this.type !== Pbf.Bytes)
12739             return arr.push(this.readVarint(isSigned));
12740           var end = readPackedEnd(this);
12741           arr = arr || [];
12742           while (this.pos < end)
12743             arr.push(this.readVarint(isSigned));
12744           return arr;
12745         },
12746         readPackedSVarint: function(arr) {
12747           if (this.type !== Pbf.Bytes)
12748             return arr.push(this.readSVarint());
12749           var end = readPackedEnd(this);
12750           arr = arr || [];
12751           while (this.pos < end)
12752             arr.push(this.readSVarint());
12753           return arr;
12754         },
12755         readPackedBoolean: function(arr) {
12756           if (this.type !== Pbf.Bytes)
12757             return arr.push(this.readBoolean());
12758           var end = readPackedEnd(this);
12759           arr = arr || [];
12760           while (this.pos < end)
12761             arr.push(this.readBoolean());
12762           return arr;
12763         },
12764         readPackedFloat: function(arr) {
12765           if (this.type !== Pbf.Bytes)
12766             return arr.push(this.readFloat());
12767           var end = readPackedEnd(this);
12768           arr = arr || [];
12769           while (this.pos < end)
12770             arr.push(this.readFloat());
12771           return arr;
12772         },
12773         readPackedDouble: function(arr) {
12774           if (this.type !== Pbf.Bytes)
12775             return arr.push(this.readDouble());
12776           var end = readPackedEnd(this);
12777           arr = arr || [];
12778           while (this.pos < end)
12779             arr.push(this.readDouble());
12780           return arr;
12781         },
12782         readPackedFixed32: function(arr) {
12783           if (this.type !== Pbf.Bytes)
12784             return arr.push(this.readFixed32());
12785           var end = readPackedEnd(this);
12786           arr = arr || [];
12787           while (this.pos < end)
12788             arr.push(this.readFixed32());
12789           return arr;
12790         },
12791         readPackedSFixed32: function(arr) {
12792           if (this.type !== Pbf.Bytes)
12793             return arr.push(this.readSFixed32());
12794           var end = readPackedEnd(this);
12795           arr = arr || [];
12796           while (this.pos < end)
12797             arr.push(this.readSFixed32());
12798           return arr;
12799         },
12800         readPackedFixed64: function(arr) {
12801           if (this.type !== Pbf.Bytes)
12802             return arr.push(this.readFixed64());
12803           var end = readPackedEnd(this);
12804           arr = arr || [];
12805           while (this.pos < end)
12806             arr.push(this.readFixed64());
12807           return arr;
12808         },
12809         readPackedSFixed64: function(arr) {
12810           if (this.type !== Pbf.Bytes)
12811             return arr.push(this.readSFixed64());
12812           var end = readPackedEnd(this);
12813           arr = arr || [];
12814           while (this.pos < end)
12815             arr.push(this.readSFixed64());
12816           return arr;
12817         },
12818         skip: function(val) {
12819           var type2 = val & 7;
12820           if (type2 === Pbf.Varint)
12821             while (this.buf[this.pos++] > 127) {
12822             }
12823           else if (type2 === Pbf.Bytes)
12824             this.pos = this.readVarint() + this.pos;
12825           else if (type2 === Pbf.Fixed32)
12826             this.pos += 4;
12827           else if (type2 === Pbf.Fixed64)
12828             this.pos += 8;
12829           else
12830             throw new Error("Unimplemented type: " + type2);
12831         },
12832         // === WRITING =================================================================
12833         writeTag: function(tag, type2) {
12834           this.writeVarint(tag << 3 | type2);
12835         },
12836         realloc: function(min3) {
12837           var length = this.length || 16;
12838           while (length < this.pos + min3)
12839             length *= 2;
12840           if (length !== this.length) {
12841             var buf = new Uint8Array(length);
12842             buf.set(this.buf);
12843             this.buf = buf;
12844             this.length = length;
12845           }
12846         },
12847         finish: function() {
12848           this.length = this.pos;
12849           this.pos = 0;
12850           return this.buf.subarray(0, this.length);
12851         },
12852         writeFixed32: function(val) {
12853           this.realloc(4);
12854           writeInt32(this.buf, val, this.pos);
12855           this.pos += 4;
12856         },
12857         writeSFixed32: function(val) {
12858           this.realloc(4);
12859           writeInt32(this.buf, val, this.pos);
12860           this.pos += 4;
12861         },
12862         writeFixed64: function(val) {
12863           this.realloc(8);
12864           writeInt32(this.buf, val & -1, this.pos);
12865           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12866           this.pos += 8;
12867         },
12868         writeSFixed64: function(val) {
12869           this.realloc(8);
12870           writeInt32(this.buf, val & -1, this.pos);
12871           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12872           this.pos += 8;
12873         },
12874         writeVarint: function(val) {
12875           val = +val || 0;
12876           if (val > 268435455 || val < 0) {
12877             writeBigVarint(val, this);
12878             return;
12879           }
12880           this.realloc(4);
12881           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
12882           if (val <= 127)
12883             return;
12884           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12885           if (val <= 127)
12886             return;
12887           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12888           if (val <= 127)
12889             return;
12890           this.buf[this.pos++] = val >>> 7 & 127;
12891         },
12892         writeSVarint: function(val) {
12893           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
12894         },
12895         writeBoolean: function(val) {
12896           this.writeVarint(Boolean(val));
12897         },
12898         writeString: function(str2) {
12899           str2 = String(str2);
12900           this.realloc(str2.length * 4);
12901           this.pos++;
12902           var startPos = this.pos;
12903           this.pos = writeUtf8(this.buf, str2, this.pos);
12904           var len = this.pos - startPos;
12905           if (len >= 128)
12906             makeRoomForExtraLength(startPos, len, this);
12907           this.pos = startPos - 1;
12908           this.writeVarint(len);
12909           this.pos += len;
12910         },
12911         writeFloat: function(val) {
12912           this.realloc(4);
12913           ieee754.write(this.buf, val, this.pos, true, 23, 4);
12914           this.pos += 4;
12915         },
12916         writeDouble: function(val) {
12917           this.realloc(8);
12918           ieee754.write(this.buf, val, this.pos, true, 52, 8);
12919           this.pos += 8;
12920         },
12921         writeBytes: function(buffer) {
12922           var len = buffer.length;
12923           this.writeVarint(len);
12924           this.realloc(len);
12925           for (var i3 = 0; i3 < len; i3++)
12926             this.buf[this.pos++] = buffer[i3];
12927         },
12928         writeRawMessage: function(fn, obj) {
12929           this.pos++;
12930           var startPos = this.pos;
12931           fn(obj, this);
12932           var len = this.pos - startPos;
12933           if (len >= 128)
12934             makeRoomForExtraLength(startPos, len, this);
12935           this.pos = startPos - 1;
12936           this.writeVarint(len);
12937           this.pos += len;
12938         },
12939         writeMessage: function(tag, fn, obj) {
12940           this.writeTag(tag, Pbf.Bytes);
12941           this.writeRawMessage(fn, obj);
12942         },
12943         writePackedVarint: function(tag, arr) {
12944           if (arr.length)
12945             this.writeMessage(tag, writePackedVarint, arr);
12946         },
12947         writePackedSVarint: function(tag, arr) {
12948           if (arr.length)
12949             this.writeMessage(tag, writePackedSVarint, arr);
12950         },
12951         writePackedBoolean: function(tag, arr) {
12952           if (arr.length)
12953             this.writeMessage(tag, writePackedBoolean, arr);
12954         },
12955         writePackedFloat: function(tag, arr) {
12956           if (arr.length)
12957             this.writeMessage(tag, writePackedFloat, arr);
12958         },
12959         writePackedDouble: function(tag, arr) {
12960           if (arr.length)
12961             this.writeMessage(tag, writePackedDouble, arr);
12962         },
12963         writePackedFixed32: function(tag, arr) {
12964           if (arr.length)
12965             this.writeMessage(tag, writePackedFixed32, arr);
12966         },
12967         writePackedSFixed32: function(tag, arr) {
12968           if (arr.length)
12969             this.writeMessage(tag, writePackedSFixed32, arr);
12970         },
12971         writePackedFixed64: function(tag, arr) {
12972           if (arr.length)
12973             this.writeMessage(tag, writePackedFixed64, arr);
12974         },
12975         writePackedSFixed64: function(tag, arr) {
12976           if (arr.length)
12977             this.writeMessage(tag, writePackedSFixed64, arr);
12978         },
12979         writeBytesField: function(tag, buffer) {
12980           this.writeTag(tag, Pbf.Bytes);
12981           this.writeBytes(buffer);
12982         },
12983         writeFixed32Field: function(tag, val) {
12984           this.writeTag(tag, Pbf.Fixed32);
12985           this.writeFixed32(val);
12986         },
12987         writeSFixed32Field: function(tag, val) {
12988           this.writeTag(tag, Pbf.Fixed32);
12989           this.writeSFixed32(val);
12990         },
12991         writeFixed64Field: function(tag, val) {
12992           this.writeTag(tag, Pbf.Fixed64);
12993           this.writeFixed64(val);
12994         },
12995         writeSFixed64Field: function(tag, val) {
12996           this.writeTag(tag, Pbf.Fixed64);
12997           this.writeSFixed64(val);
12998         },
12999         writeVarintField: function(tag, val) {
13000           this.writeTag(tag, Pbf.Varint);
13001           this.writeVarint(val);
13002         },
13003         writeSVarintField: function(tag, val) {
13004           this.writeTag(tag, Pbf.Varint);
13005           this.writeSVarint(val);
13006         },
13007         writeStringField: function(tag, str2) {
13008           this.writeTag(tag, Pbf.Bytes);
13009           this.writeString(str2);
13010         },
13011         writeFloatField: function(tag, val) {
13012           this.writeTag(tag, Pbf.Fixed32);
13013           this.writeFloat(val);
13014         },
13015         writeDoubleField: function(tag, val) {
13016           this.writeTag(tag, Pbf.Fixed64);
13017           this.writeDouble(val);
13018         },
13019         writeBooleanField: function(tag, val) {
13020           this.writeVarintField(tag, Boolean(val));
13021         }
13022       };
13023       function readVarintRemainder(l2, s2, p2) {
13024         var buf = p2.buf, h2, b2;
13025         b2 = buf[p2.pos++];
13026         h2 = (b2 & 112) >> 4;
13027         if (b2 < 128)
13028           return toNum(l2, h2, s2);
13029         b2 = buf[p2.pos++];
13030         h2 |= (b2 & 127) << 3;
13031         if (b2 < 128)
13032           return toNum(l2, h2, s2);
13033         b2 = buf[p2.pos++];
13034         h2 |= (b2 & 127) << 10;
13035         if (b2 < 128)
13036           return toNum(l2, h2, s2);
13037         b2 = buf[p2.pos++];
13038         h2 |= (b2 & 127) << 17;
13039         if (b2 < 128)
13040           return toNum(l2, h2, s2);
13041         b2 = buf[p2.pos++];
13042         h2 |= (b2 & 127) << 24;
13043         if (b2 < 128)
13044           return toNum(l2, h2, s2);
13045         b2 = buf[p2.pos++];
13046         h2 |= (b2 & 1) << 31;
13047         if (b2 < 128)
13048           return toNum(l2, h2, s2);
13049         throw new Error("Expected varint not more than 10 bytes");
13050       }
13051       function readPackedEnd(pbf) {
13052         return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
13053       }
13054       function toNum(low, high, isSigned) {
13055         if (isSigned) {
13056           return high * 4294967296 + (low >>> 0);
13057         }
13058         return (high >>> 0) * 4294967296 + (low >>> 0);
13059       }
13060       function writeBigVarint(val, pbf) {
13061         var low, high;
13062         if (val >= 0) {
13063           low = val % 4294967296 | 0;
13064           high = val / 4294967296 | 0;
13065         } else {
13066           low = ~(-val % 4294967296);
13067           high = ~(-val / 4294967296);
13068           if (low ^ 4294967295) {
13069             low = low + 1 | 0;
13070           } else {
13071             low = 0;
13072             high = high + 1 | 0;
13073           }
13074         }
13075         if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
13076           throw new Error("Given varint doesn't fit into 10 bytes");
13077         }
13078         pbf.realloc(10);
13079         writeBigVarintLow(low, high, pbf);
13080         writeBigVarintHigh(high, pbf);
13081       }
13082       function writeBigVarintLow(low, high, pbf) {
13083         pbf.buf[pbf.pos++] = low & 127 | 128;
13084         low >>>= 7;
13085         pbf.buf[pbf.pos++] = low & 127 | 128;
13086         low >>>= 7;
13087         pbf.buf[pbf.pos++] = low & 127 | 128;
13088         low >>>= 7;
13089         pbf.buf[pbf.pos++] = low & 127 | 128;
13090         low >>>= 7;
13091         pbf.buf[pbf.pos] = low & 127;
13092       }
13093       function writeBigVarintHigh(high, pbf) {
13094         var lsb = (high & 7) << 4;
13095         pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
13096         if (!high)
13097           return;
13098         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13099         if (!high)
13100           return;
13101         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13102         if (!high)
13103           return;
13104         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13105         if (!high)
13106           return;
13107         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13108         if (!high)
13109           return;
13110         pbf.buf[pbf.pos++] = high & 127;
13111       }
13112       function makeRoomForExtraLength(startPos, len, pbf) {
13113         var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
13114         pbf.realloc(extraLen);
13115         for (var i3 = pbf.pos - 1; i3 >= startPos; i3--)
13116           pbf.buf[i3 + extraLen] = pbf.buf[i3];
13117       }
13118       function writePackedVarint(arr, pbf) {
13119         for (var i3 = 0; i3 < arr.length; i3++)
13120           pbf.writeVarint(arr[i3]);
13121       }
13122       function writePackedSVarint(arr, pbf) {
13123         for (var i3 = 0; i3 < arr.length; i3++)
13124           pbf.writeSVarint(arr[i3]);
13125       }
13126       function writePackedFloat(arr, pbf) {
13127         for (var i3 = 0; i3 < arr.length; i3++)
13128           pbf.writeFloat(arr[i3]);
13129       }
13130       function writePackedDouble(arr, pbf) {
13131         for (var i3 = 0; i3 < arr.length; i3++)
13132           pbf.writeDouble(arr[i3]);
13133       }
13134       function writePackedBoolean(arr, pbf) {
13135         for (var i3 = 0; i3 < arr.length; i3++)
13136           pbf.writeBoolean(arr[i3]);
13137       }
13138       function writePackedFixed32(arr, pbf) {
13139         for (var i3 = 0; i3 < arr.length; i3++)
13140           pbf.writeFixed32(arr[i3]);
13141       }
13142       function writePackedSFixed32(arr, pbf) {
13143         for (var i3 = 0; i3 < arr.length; i3++)
13144           pbf.writeSFixed32(arr[i3]);
13145       }
13146       function writePackedFixed64(arr, pbf) {
13147         for (var i3 = 0; i3 < arr.length; i3++)
13148           pbf.writeFixed64(arr[i3]);
13149       }
13150       function writePackedSFixed64(arr, pbf) {
13151         for (var i3 = 0; i3 < arr.length; i3++)
13152           pbf.writeSFixed64(arr[i3]);
13153       }
13154       function readUInt32(buf, pos) {
13155         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
13156       }
13157       function writeInt32(buf, val, pos) {
13158         buf[pos] = val;
13159         buf[pos + 1] = val >>> 8;
13160         buf[pos + 2] = val >>> 16;
13161         buf[pos + 3] = val >>> 24;
13162       }
13163       function readInt32(buf, pos) {
13164         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
13165       }
13166       function readUtf8(buf, pos, end) {
13167         var str2 = "";
13168         var i3 = pos;
13169         while (i3 < end) {
13170           var b0 = buf[i3];
13171           var c2 = null;
13172           var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
13173           if (i3 + bytesPerSequence > end)
13174             break;
13175           var b1, b2, b3;
13176           if (bytesPerSequence === 1) {
13177             if (b0 < 128) {
13178               c2 = b0;
13179             }
13180           } else if (bytesPerSequence === 2) {
13181             b1 = buf[i3 + 1];
13182             if ((b1 & 192) === 128) {
13183               c2 = (b0 & 31) << 6 | b1 & 63;
13184               if (c2 <= 127) {
13185                 c2 = null;
13186               }
13187             }
13188           } else if (bytesPerSequence === 3) {
13189             b1 = buf[i3 + 1];
13190             b2 = buf[i3 + 2];
13191             if ((b1 & 192) === 128 && (b2 & 192) === 128) {
13192               c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
13193               if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
13194                 c2 = null;
13195               }
13196             }
13197           } else if (bytesPerSequence === 4) {
13198             b1 = buf[i3 + 1];
13199             b2 = buf[i3 + 2];
13200             b3 = buf[i3 + 3];
13201             if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
13202               c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
13203               if (c2 <= 65535 || c2 >= 1114112) {
13204                 c2 = null;
13205               }
13206             }
13207           }
13208           if (c2 === null) {
13209             c2 = 65533;
13210             bytesPerSequence = 1;
13211           } else if (c2 > 65535) {
13212             c2 -= 65536;
13213             str2 += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
13214             c2 = 56320 | c2 & 1023;
13215           }
13216           str2 += String.fromCharCode(c2);
13217           i3 += bytesPerSequence;
13218         }
13219         return str2;
13220       }
13221       function readUtf8TextDecoder(buf, pos, end) {
13222         return utf8TextDecoder.decode(buf.subarray(pos, end));
13223       }
13224       function writeUtf8(buf, str2, pos) {
13225         for (var i3 = 0, c2, lead; i3 < str2.length; i3++) {
13226           c2 = str2.charCodeAt(i3);
13227           if (c2 > 55295 && c2 < 57344) {
13228             if (lead) {
13229               if (c2 < 56320) {
13230                 buf[pos++] = 239;
13231                 buf[pos++] = 191;
13232                 buf[pos++] = 189;
13233                 lead = c2;
13234                 continue;
13235               } else {
13236                 c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
13237                 lead = null;
13238               }
13239             } else {
13240               if (c2 > 56319 || i3 + 1 === str2.length) {
13241                 buf[pos++] = 239;
13242                 buf[pos++] = 191;
13243                 buf[pos++] = 189;
13244               } else {
13245                 lead = c2;
13246               }
13247               continue;
13248             }
13249           } else if (lead) {
13250             buf[pos++] = 239;
13251             buf[pos++] = 191;
13252             buf[pos++] = 189;
13253             lead = null;
13254           }
13255           if (c2 < 128) {
13256             buf[pos++] = c2;
13257           } else {
13258             if (c2 < 2048) {
13259               buf[pos++] = c2 >> 6 | 192;
13260             } else {
13261               if (c2 < 65536) {
13262                 buf[pos++] = c2 >> 12 | 224;
13263               } else {
13264                 buf[pos++] = c2 >> 18 | 240;
13265                 buf[pos++] = c2 >> 12 & 63 | 128;
13266               }
13267               buf[pos++] = c2 >> 6 & 63 | 128;
13268             }
13269             buf[pos++] = c2 & 63 | 128;
13270           }
13271         }
13272         return pos;
13273       }
13274     }
13275   });
13276
13277   // node_modules/@mapbox/point-geometry/index.js
13278   var require_point_geometry = __commonJS({
13279     "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
13280       "use strict";
13281       module2.exports = Point;
13282       function Point(x2, y2) {
13283         this.x = x2;
13284         this.y = y2;
13285       }
13286       Point.prototype = {
13287         /**
13288          * Clone this point, returning a new point that can be modified
13289          * without affecting the old one.
13290          * @return {Point} the clone
13291          */
13292         clone: function() {
13293           return new Point(this.x, this.y);
13294         },
13295         /**
13296          * Add this point's x & y coordinates to another point,
13297          * yielding a new point.
13298          * @param {Point} p the other point
13299          * @return {Point} output point
13300          */
13301         add: function(p2) {
13302           return this.clone()._add(p2);
13303         },
13304         /**
13305          * Subtract this point's x & y coordinates to from point,
13306          * yielding a new point.
13307          * @param {Point} p the other point
13308          * @return {Point} output point
13309          */
13310         sub: function(p2) {
13311           return this.clone()._sub(p2);
13312         },
13313         /**
13314          * Multiply this point's x & y coordinates by point,
13315          * yielding a new point.
13316          * @param {Point} p the other point
13317          * @return {Point} output point
13318          */
13319         multByPoint: function(p2) {
13320           return this.clone()._multByPoint(p2);
13321         },
13322         /**
13323          * Divide this point's x & y coordinates by point,
13324          * yielding a new point.
13325          * @param {Point} p the other point
13326          * @return {Point} output point
13327          */
13328         divByPoint: function(p2) {
13329           return this.clone()._divByPoint(p2);
13330         },
13331         /**
13332          * Multiply this point's x & y coordinates by a factor,
13333          * yielding a new point.
13334          * @param {Point} k factor
13335          * @return {Point} output point
13336          */
13337         mult: function(k2) {
13338           return this.clone()._mult(k2);
13339         },
13340         /**
13341          * Divide this point's x & y coordinates by a factor,
13342          * yielding a new point.
13343          * @param {Point} k factor
13344          * @return {Point} output point
13345          */
13346         div: function(k2) {
13347           return this.clone()._div(k2);
13348         },
13349         /**
13350          * Rotate this point around the 0, 0 origin by an angle a,
13351          * given in radians
13352          * @param {Number} a angle to rotate around, in radians
13353          * @return {Point} output point
13354          */
13355         rotate: function(a2) {
13356           return this.clone()._rotate(a2);
13357         },
13358         /**
13359          * Rotate this point around p point by an angle a,
13360          * given in radians
13361          * @param {Number} a angle to rotate around, in radians
13362          * @param {Point} p Point to rotate around
13363          * @return {Point} output point
13364          */
13365         rotateAround: function(a2, p2) {
13366           return this.clone()._rotateAround(a2, p2);
13367         },
13368         /**
13369          * Multiply this point by a 4x1 transformation matrix
13370          * @param {Array<Number>} m transformation matrix
13371          * @return {Point} output point
13372          */
13373         matMult: function(m2) {
13374           return this.clone()._matMult(m2);
13375         },
13376         /**
13377          * Calculate this point but as a unit vector from 0, 0, meaning
13378          * that the distance from the resulting point to the 0, 0
13379          * coordinate will be equal to 1 and the angle from the resulting
13380          * point to the 0, 0 coordinate will be the same as before.
13381          * @return {Point} unit vector point
13382          */
13383         unit: function() {
13384           return this.clone()._unit();
13385         },
13386         /**
13387          * Compute a perpendicular point, where the new y coordinate
13388          * is the old x coordinate and the new x coordinate is the old y
13389          * coordinate multiplied by -1
13390          * @return {Point} perpendicular point
13391          */
13392         perp: function() {
13393           return this.clone()._perp();
13394         },
13395         /**
13396          * Return a version of this point with the x & y coordinates
13397          * rounded to integers.
13398          * @return {Point} rounded point
13399          */
13400         round: function() {
13401           return this.clone()._round();
13402         },
13403         /**
13404          * Return the magitude of this point: this is the Euclidean
13405          * distance from the 0, 0 coordinate to this point's x and y
13406          * coordinates.
13407          * @return {Number} magnitude
13408          */
13409         mag: function() {
13410           return Math.sqrt(this.x * this.x + this.y * this.y);
13411         },
13412         /**
13413          * Judge whether this point is equal to another point, returning
13414          * true or false.
13415          * @param {Point} other the other point
13416          * @return {boolean} whether the points are equal
13417          */
13418         equals: function(other) {
13419           return this.x === other.x && this.y === other.y;
13420         },
13421         /**
13422          * Calculate the distance from this point to another point
13423          * @param {Point} p the other point
13424          * @return {Number} distance
13425          */
13426         dist: function(p2) {
13427           return Math.sqrt(this.distSqr(p2));
13428         },
13429         /**
13430          * Calculate the distance from this point to another point,
13431          * without the square root step. Useful if you're comparing
13432          * relative distances.
13433          * @param {Point} p the other point
13434          * @return {Number} distance
13435          */
13436         distSqr: function(p2) {
13437           var dx = p2.x - this.x, dy = p2.y - this.y;
13438           return dx * dx + dy * dy;
13439         },
13440         /**
13441          * Get the angle from the 0, 0 coordinate to this point, in radians
13442          * coordinates.
13443          * @return {Number} angle
13444          */
13445         angle: function() {
13446           return Math.atan2(this.y, this.x);
13447         },
13448         /**
13449          * Get the angle from this point to another point, in radians
13450          * @param {Point} b the other point
13451          * @return {Number} angle
13452          */
13453         angleTo: function(b2) {
13454           return Math.atan2(this.y - b2.y, this.x - b2.x);
13455         },
13456         /**
13457          * Get the angle between this point and another point, in radians
13458          * @param {Point} b the other point
13459          * @return {Number} angle
13460          */
13461         angleWith: function(b2) {
13462           return this.angleWithSep(b2.x, b2.y);
13463         },
13464         /*
13465          * Find the angle of the two vectors, solving the formula for
13466          * the cross product a x b = |a||b|sin(θ) for θ.
13467          * @param {Number} x the x-coordinate
13468          * @param {Number} y the y-coordinate
13469          * @return {Number} the angle in radians
13470          */
13471         angleWithSep: function(x2, y2) {
13472           return Math.atan2(
13473             this.x * y2 - this.y * x2,
13474             this.x * x2 + this.y * y2
13475           );
13476         },
13477         _matMult: function(m2) {
13478           var x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
13479           this.x = x2;
13480           this.y = y2;
13481           return this;
13482         },
13483         _add: function(p2) {
13484           this.x += p2.x;
13485           this.y += p2.y;
13486           return this;
13487         },
13488         _sub: function(p2) {
13489           this.x -= p2.x;
13490           this.y -= p2.y;
13491           return this;
13492         },
13493         _mult: function(k2) {
13494           this.x *= k2;
13495           this.y *= k2;
13496           return this;
13497         },
13498         _div: function(k2) {
13499           this.x /= k2;
13500           this.y /= k2;
13501           return this;
13502         },
13503         _multByPoint: function(p2) {
13504           this.x *= p2.x;
13505           this.y *= p2.y;
13506           return this;
13507         },
13508         _divByPoint: function(p2) {
13509           this.x /= p2.x;
13510           this.y /= p2.y;
13511           return this;
13512         },
13513         _unit: function() {
13514           this._div(this.mag());
13515           return this;
13516         },
13517         _perp: function() {
13518           var y2 = this.y;
13519           this.y = this.x;
13520           this.x = -y2;
13521           return this;
13522         },
13523         _rotate: function(angle2) {
13524           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
13525           this.x = x2;
13526           this.y = y2;
13527           return this;
13528         },
13529         _rotateAround: function(angle2, p2) {
13530           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = p2.x + cos2 * (this.x - p2.x) - sin2 * (this.y - p2.y), y2 = p2.y + sin2 * (this.x - p2.x) + cos2 * (this.y - p2.y);
13531           this.x = x2;
13532           this.y = y2;
13533           return this;
13534         },
13535         _round: function() {
13536           this.x = Math.round(this.x);
13537           this.y = Math.round(this.y);
13538           return this;
13539         }
13540       };
13541       Point.convert = function(a2) {
13542         if (a2 instanceof Point) {
13543           return a2;
13544         }
13545         if (Array.isArray(a2)) {
13546           return new Point(a2[0], a2[1]);
13547         }
13548         return a2;
13549       };
13550     }
13551   });
13552
13553   // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
13554   var require_vectortilefeature = __commonJS({
13555     "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
13556       "use strict";
13557       var Point = require_point_geometry();
13558       module2.exports = VectorTileFeature;
13559       function VectorTileFeature(pbf, end, extent, keys2, values) {
13560         this.properties = {};
13561         this.extent = extent;
13562         this.type = 0;
13563         this._pbf = pbf;
13564         this._geometry = -1;
13565         this._keys = keys2;
13566         this._values = values;
13567         pbf.readFields(readFeature, this, end);
13568       }
13569       function readFeature(tag, feature3, pbf) {
13570         if (tag == 1)
13571           feature3.id = pbf.readVarint();
13572         else if (tag == 2)
13573           readTag(pbf, feature3);
13574         else if (tag == 3)
13575           feature3.type = pbf.readVarint();
13576         else if (tag == 4)
13577           feature3._geometry = pbf.pos;
13578       }
13579       function readTag(pbf, feature3) {
13580         var end = pbf.readVarint() + pbf.pos;
13581         while (pbf.pos < end) {
13582           var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
13583           feature3.properties[key] = value;
13584         }
13585       }
13586       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
13587       VectorTileFeature.prototype.loadGeometry = function() {
13588         var pbf = this._pbf;
13589         pbf.pos = this._geometry;
13590         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x2 = 0, y2 = 0, lines = [], line;
13591         while (pbf.pos < end) {
13592           if (length <= 0) {
13593             var cmdLen = pbf.readVarint();
13594             cmd = cmdLen & 7;
13595             length = cmdLen >> 3;
13596           }
13597           length--;
13598           if (cmd === 1 || cmd === 2) {
13599             x2 += pbf.readSVarint();
13600             y2 += pbf.readSVarint();
13601             if (cmd === 1) {
13602               if (line)
13603                 lines.push(line);
13604               line = [];
13605             }
13606             line.push(new Point(x2, y2));
13607           } else if (cmd === 7) {
13608             if (line) {
13609               line.push(line[0].clone());
13610             }
13611           } else {
13612             throw new Error("unknown command " + cmd);
13613           }
13614         }
13615         if (line)
13616           lines.push(line);
13617         return lines;
13618       };
13619       VectorTileFeature.prototype.bbox = function() {
13620         var pbf = this._pbf;
13621         pbf.pos = this._geometry;
13622         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
13623         while (pbf.pos < end) {
13624           if (length <= 0) {
13625             var cmdLen = pbf.readVarint();
13626             cmd = cmdLen & 7;
13627             length = cmdLen >> 3;
13628           }
13629           length--;
13630           if (cmd === 1 || cmd === 2) {
13631             x2 += pbf.readSVarint();
13632             y2 += pbf.readSVarint();
13633             if (x2 < x12)
13634               x12 = x2;
13635             if (x2 > x22)
13636               x22 = x2;
13637             if (y2 < y12)
13638               y12 = y2;
13639             if (y2 > y22)
13640               y22 = y2;
13641           } else if (cmd !== 7) {
13642             throw new Error("unknown command " + cmd);
13643           }
13644         }
13645         return [x12, y12, x22, y22];
13646       };
13647       VectorTileFeature.prototype.toGeoJSON = function(x2, y2, z2) {
13648         var size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, coords = this.loadGeometry(), type2 = VectorTileFeature.types[this.type], i3, j3;
13649         function project(line) {
13650           for (var j4 = 0; j4 < line.length; j4++) {
13651             var p2 = line[j4], y22 = 180 - (p2.y + y05) * 360 / size;
13652             line[j4] = [
13653               (p2.x + x05) * 360 / size - 180,
13654               360 / Math.PI * Math.atan(Math.exp(y22 * Math.PI / 180)) - 90
13655             ];
13656           }
13657         }
13658         switch (this.type) {
13659           case 1:
13660             var points = [];
13661             for (i3 = 0; i3 < coords.length; i3++) {
13662               points[i3] = coords[i3][0];
13663             }
13664             coords = points;
13665             project(coords);
13666             break;
13667           case 2:
13668             for (i3 = 0; i3 < coords.length; i3++) {
13669               project(coords[i3]);
13670             }
13671             break;
13672           case 3:
13673             coords = classifyRings(coords);
13674             for (i3 = 0; i3 < coords.length; i3++) {
13675               for (j3 = 0; j3 < coords[i3].length; j3++) {
13676                 project(coords[i3][j3]);
13677               }
13678             }
13679             break;
13680         }
13681         if (coords.length === 1) {
13682           coords = coords[0];
13683         } else {
13684           type2 = "Multi" + type2;
13685         }
13686         var result = {
13687           type: "Feature",
13688           geometry: {
13689             type: type2,
13690             coordinates: coords
13691           },
13692           properties: this.properties
13693         };
13694         if ("id" in this) {
13695           result.id = this.id;
13696         }
13697         return result;
13698       };
13699       function classifyRings(rings) {
13700         var len = rings.length;
13701         if (len <= 1)
13702           return [rings];
13703         var polygons = [], polygon2, ccw;
13704         for (var i3 = 0; i3 < len; i3++) {
13705           var area = signedArea(rings[i3]);
13706           if (area === 0)
13707             continue;
13708           if (ccw === void 0)
13709             ccw = area < 0;
13710           if (ccw === area < 0) {
13711             if (polygon2)
13712               polygons.push(polygon2);
13713             polygon2 = [rings[i3]];
13714           } else {
13715             polygon2.push(rings[i3]);
13716           }
13717         }
13718         if (polygon2)
13719           polygons.push(polygon2);
13720         return polygons;
13721       }
13722       function signedArea(ring) {
13723         var sum = 0;
13724         for (var i3 = 0, len = ring.length, j3 = len - 1, p1, p2; i3 < len; j3 = i3++) {
13725           p1 = ring[i3];
13726           p2 = ring[j3];
13727           sum += (p2.x - p1.x) * (p1.y + p2.y);
13728         }
13729         return sum;
13730       }
13731     }
13732   });
13733
13734   // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
13735   var require_vectortilelayer = __commonJS({
13736     "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
13737       "use strict";
13738       var VectorTileFeature = require_vectortilefeature();
13739       module2.exports = VectorTileLayer;
13740       function VectorTileLayer(pbf, end) {
13741         this.version = 1;
13742         this.name = null;
13743         this.extent = 4096;
13744         this.length = 0;
13745         this._pbf = pbf;
13746         this._keys = [];
13747         this._values = [];
13748         this._features = [];
13749         pbf.readFields(readLayer, this, end);
13750         this.length = this._features.length;
13751       }
13752       function readLayer(tag, layer, pbf) {
13753         if (tag === 15)
13754           layer.version = pbf.readVarint();
13755         else if (tag === 1)
13756           layer.name = pbf.readString();
13757         else if (tag === 5)
13758           layer.extent = pbf.readVarint();
13759         else if (tag === 2)
13760           layer._features.push(pbf.pos);
13761         else if (tag === 3)
13762           layer._keys.push(pbf.readString());
13763         else if (tag === 4)
13764           layer._values.push(readValueMessage(pbf));
13765       }
13766       function readValueMessage(pbf) {
13767         var value = null, end = pbf.readVarint() + pbf.pos;
13768         while (pbf.pos < end) {
13769           var tag = pbf.readVarint() >> 3;
13770           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;
13771         }
13772         return value;
13773       }
13774       VectorTileLayer.prototype.feature = function(i3) {
13775         if (i3 < 0 || i3 >= this._features.length)
13776           throw new Error("feature index out of bounds");
13777         this._pbf.pos = this._features[i3];
13778         var end = this._pbf.readVarint() + this._pbf.pos;
13779         return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
13780       };
13781     }
13782   });
13783
13784   // node_modules/@mapbox/vector-tile/lib/vectortile.js
13785   var require_vectortile = __commonJS({
13786     "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
13787       "use strict";
13788       var VectorTileLayer = require_vectortilelayer();
13789       module2.exports = VectorTile3;
13790       function VectorTile3(pbf, end) {
13791         this.layers = pbf.readFields(readTile, {}, end);
13792       }
13793       function readTile(tag, layers, pbf) {
13794         if (tag === 3) {
13795           var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
13796           if (layer.length)
13797             layers[layer.name] = layer;
13798         }
13799       }
13800     }
13801   });
13802
13803   // node_modules/@mapbox/vector-tile/index.js
13804   var require_vector_tile = __commonJS({
13805     "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
13806       module2.exports.VectorTile = require_vectortile();
13807       module2.exports.VectorTileFeature = require_vectortilefeature();
13808       module2.exports.VectorTileLayer = require_vectortilelayer();
13809     }
13810   });
13811
13812   // node_modules/fast-json-stable-stringify/index.js
13813   var require_fast_json_stable_stringify = __commonJS({
13814     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
13815       "use strict";
13816       module2.exports = function(data, opts) {
13817         if (!opts)
13818           opts = {};
13819         if (typeof opts === "function")
13820           opts = { cmp: opts };
13821         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
13822         var cmp = opts.cmp && function(f3) {
13823           return function(node) {
13824             return function(a2, b2) {
13825               var aobj = { key: a2, value: node[a2] };
13826               var bobj = { key: b2, value: node[b2] };
13827               return f3(aobj, bobj);
13828             };
13829           };
13830         }(opts.cmp);
13831         var seen = [];
13832         return function stringify3(node) {
13833           if (node && node.toJSON && typeof node.toJSON === "function") {
13834             node = node.toJSON();
13835           }
13836           if (node === void 0)
13837             return;
13838           if (typeof node == "number")
13839             return isFinite(node) ? "" + node : "null";
13840           if (typeof node !== "object")
13841             return JSON.stringify(node);
13842           var i3, out;
13843           if (Array.isArray(node)) {
13844             out = "[";
13845             for (i3 = 0; i3 < node.length; i3++) {
13846               if (i3)
13847                 out += ",";
13848               out += stringify3(node[i3]) || "null";
13849             }
13850             return out + "]";
13851           }
13852           if (node === null)
13853             return "null";
13854           if (seen.indexOf(node) !== -1) {
13855             if (cycles)
13856               return JSON.stringify("__cycle__");
13857             throw new TypeError("Converting circular structure to JSON");
13858           }
13859           var seenIndex = seen.push(node) - 1;
13860           var keys2 = Object.keys(node).sort(cmp && cmp(node));
13861           out = "";
13862           for (i3 = 0; i3 < keys2.length; i3++) {
13863             var key = keys2[i3];
13864             var value = stringify3(node[key]);
13865             if (!value)
13866               continue;
13867             if (out)
13868               out += ",";
13869             out += JSON.stringify(key) + ":" + value;
13870           }
13871           seen.splice(seenIndex, 1);
13872           return "{" + out + "}";
13873         }(data);
13874       };
13875     }
13876   });
13877
13878   // node_modules/@mapbox/sexagesimal/index.js
13879   var require_sexagesimal = __commonJS({
13880     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
13881       module2.exports = element;
13882       module2.exports.pair = pair3;
13883       module2.exports.format = format2;
13884       module2.exports.formatPair = formatPair;
13885       module2.exports.coordToDMS = coordToDMS;
13886       function element(input, dims) {
13887         var result = search(input, dims);
13888         return result === null ? null : result.val;
13889       }
13890       function formatPair(input) {
13891         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
13892       }
13893       function format2(input, dim) {
13894         var dms = coordToDMS(input, dim);
13895         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
13896       }
13897       function coordToDMS(input, dim) {
13898         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
13899         var dir = dirs[input >= 0 ? 0 : 1];
13900         var abs3 = Math.abs(input);
13901         var whole = Math.floor(abs3);
13902         var fraction = abs3 - whole;
13903         var fractionMinutes = fraction * 60;
13904         var minutes = Math.floor(fractionMinutes);
13905         var seconds = Math.floor((fractionMinutes - minutes) * 60);
13906         return {
13907           whole,
13908           minutes,
13909           seconds,
13910           dir
13911         };
13912       }
13913       function search(input, dims) {
13914         if (!dims)
13915           dims = "NSEW";
13916         if (typeof input !== "string")
13917           return null;
13918         input = input.toUpperCase();
13919         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
13920         var m2 = input.match(regex);
13921         if (!m2)
13922           return null;
13923         var matched = m2[0];
13924         var dim;
13925         if (m2[1] && m2[5]) {
13926           dim = m2[1];
13927           matched = matched.slice(0, -1);
13928         } else {
13929           dim = m2[1] || m2[5];
13930         }
13931         if (dim && dims.indexOf(dim) === -1)
13932           return null;
13933         var deg = m2[2] ? parseFloat(m2[2]) : 0;
13934         var min3 = m2[3] ? parseFloat(m2[3]) / 60 : 0;
13935         var sec = m2[4] ? parseFloat(m2[4]) / 3600 : 0;
13936         var sign2 = deg < 0 ? -1 : 1;
13937         if (dim === "S" || dim === "W")
13938           sign2 *= -1;
13939         return {
13940           val: (Math.abs(deg) + min3 + sec) * sign2,
13941           dim,
13942           matched,
13943           remain: input.slice(matched.length)
13944         };
13945       }
13946       function pair3(input, dims) {
13947         input = input.trim();
13948         var one2 = search(input, dims);
13949         if (!one2)
13950           return null;
13951         input = one2.remain.trim();
13952         var two = search(input, dims);
13953         if (!two || two.remain)
13954           return null;
13955         if (one2.dim) {
13956           return swapdim(one2.val, two.val, one2.dim);
13957         } else {
13958           return [one2.val, two.val];
13959         }
13960       }
13961       function swapdim(a2, b2, dim) {
13962         if (dim === "N" || dim === "S")
13963           return [a2, b2];
13964         if (dim === "W" || dim === "E")
13965           return [b2, a2];
13966       }
13967     }
13968   });
13969
13970   // node_modules/store/src/util.js
13971   var require_util = __commonJS({
13972     "node_modules/store/src/util.js"(exports2, module2) {
13973       var assign = make_assign();
13974       var create2 = make_create();
13975       var trim = make_trim();
13976       var Global = typeof window !== "undefined" ? window : global;
13977       module2.exports = {
13978         assign,
13979         create: create2,
13980         trim,
13981         bind,
13982         slice,
13983         each,
13984         map: map2,
13985         pluck,
13986         isList,
13987         isFunction: isFunction2,
13988         isObject: isObject3,
13989         Global
13990       };
13991       function make_assign() {
13992         if (Object.assign) {
13993           return Object.assign;
13994         } else {
13995           return function shimAssign(obj, props1, props2, etc) {
13996             for (var i3 = 1; i3 < arguments.length; i3++) {
13997               each(Object(arguments[i3]), function(val, key) {
13998                 obj[key] = val;
13999               });
14000             }
14001             return obj;
14002           };
14003         }
14004       }
14005       function make_create() {
14006         if (Object.create) {
14007           return function create3(obj, assignProps1, assignProps2, etc) {
14008             var assignArgsList = slice(arguments, 1);
14009             return assign.apply(this, [Object.create(obj)].concat(assignArgsList));
14010           };
14011         } else {
14012           let F3 = function() {
14013           };
14014           var F2 = F3;
14015           return function create3(obj, assignProps1, assignProps2, etc) {
14016             var assignArgsList = slice(arguments, 1);
14017             F3.prototype = obj;
14018             return assign.apply(this, [new F3()].concat(assignArgsList));
14019           };
14020         }
14021       }
14022       function make_trim() {
14023         if (String.prototype.trim) {
14024           return function trim2(str2) {
14025             return String.prototype.trim.call(str2);
14026           };
14027         } else {
14028           return function trim2(str2) {
14029             return str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
14030           };
14031         }
14032       }
14033       function bind(obj, fn) {
14034         return function() {
14035           return fn.apply(obj, Array.prototype.slice.call(arguments, 0));
14036         };
14037       }
14038       function slice(arr, index) {
14039         return Array.prototype.slice.call(arr, index || 0);
14040       }
14041       function each(obj, fn) {
14042         pluck(obj, function(val, key) {
14043           fn(val, key);
14044           return false;
14045         });
14046       }
14047       function map2(obj, fn) {
14048         var res = isList(obj) ? [] : {};
14049         pluck(obj, function(v2, k2) {
14050           res[k2] = fn(v2, k2);
14051           return false;
14052         });
14053         return res;
14054       }
14055       function pluck(obj, fn) {
14056         if (isList(obj)) {
14057           for (var i3 = 0; i3 < obj.length; i3++) {
14058             if (fn(obj[i3], i3)) {
14059               return obj[i3];
14060             }
14061           }
14062         } else {
14063           for (var key in obj) {
14064             if (obj.hasOwnProperty(key)) {
14065               if (fn(obj[key], key)) {
14066                 return obj[key];
14067               }
14068             }
14069           }
14070         }
14071       }
14072       function isList(val) {
14073         return val != null && typeof val != "function" && typeof val.length == "number";
14074       }
14075       function isFunction2(val) {
14076         return val && {}.toString.call(val) === "[object Function]";
14077       }
14078       function isObject3(val) {
14079         return val && {}.toString.call(val) === "[object Object]";
14080       }
14081     }
14082   });
14083
14084   // node_modules/store/src/store-engine.js
14085   var require_store_engine = __commonJS({
14086     "node_modules/store/src/store-engine.js"(exports2, module2) {
14087       var util = require_util();
14088       var slice = util.slice;
14089       var pluck = util.pluck;
14090       var each = util.each;
14091       var bind = util.bind;
14092       var create2 = util.create;
14093       var isList = util.isList;
14094       var isFunction2 = util.isFunction;
14095       var isObject3 = util.isObject;
14096       module2.exports = {
14097         createStore
14098       };
14099       var storeAPI = {
14100         version: "2.0.12",
14101         enabled: false,
14102         // get returns the value of the given key. If that value
14103         // is undefined, it returns optionalDefaultValue instead.
14104         get: function(key, optionalDefaultValue) {
14105           var data = this.storage.read(this._namespacePrefix + key);
14106           return this._deserialize(data, optionalDefaultValue);
14107         },
14108         // set will store the given value at key and returns value.
14109         // Calling set with value === undefined is equivalent to calling remove.
14110         set: function(key, value) {
14111           if (value === void 0) {
14112             return this.remove(key);
14113           }
14114           this.storage.write(this._namespacePrefix + key, this._serialize(value));
14115           return value;
14116         },
14117         // remove deletes the key and value stored at the given key.
14118         remove: function(key) {
14119           this.storage.remove(this._namespacePrefix + key);
14120         },
14121         // each will call the given callback once for each key-value pair
14122         // in this store.
14123         each: function(callback) {
14124           var self2 = this;
14125           this.storage.each(function(val, namespacedKey) {
14126             callback.call(self2, self2._deserialize(val), (namespacedKey || "").replace(self2._namespaceRegexp, ""));
14127           });
14128         },
14129         // clearAll will remove all the stored key-value pairs in this store.
14130         clearAll: function() {
14131           this.storage.clearAll();
14132         },
14133         // additional functionality that can't live in plugins
14134         // ---------------------------------------------------
14135         // hasNamespace returns true if this store instance has the given namespace.
14136         hasNamespace: function(namespace) {
14137           return this._namespacePrefix == "__storejs_" + namespace + "_";
14138         },
14139         // createStore creates a store.js instance with the first
14140         // functioning storage in the list of storage candidates,
14141         // and applies the the given mixins to the instance.
14142         createStore: function() {
14143           return createStore.apply(this, arguments);
14144         },
14145         addPlugin: function(plugin) {
14146           this._addPlugin(plugin);
14147         },
14148         namespace: function(namespace) {
14149           return createStore(this.storage, this.plugins, namespace);
14150         }
14151       };
14152       function _warn() {
14153         var _console = typeof console == "undefined" ? null : console;
14154         if (!_console) {
14155           return;
14156         }
14157         var fn = _console.warn ? _console.warn : _console.log;
14158         fn.apply(_console, arguments);
14159       }
14160       function createStore(storages, plugins, namespace) {
14161         if (!namespace) {
14162           namespace = "";
14163         }
14164         if (storages && !isList(storages)) {
14165           storages = [storages];
14166         }
14167         if (plugins && !isList(plugins)) {
14168           plugins = [plugins];
14169         }
14170         var namespacePrefix = namespace ? "__storejs_" + namespace + "_" : "";
14171         var namespaceRegexp = namespace ? new RegExp("^" + namespacePrefix) : null;
14172         var legalNamespaces = /^[a-zA-Z0-9_\-]*$/;
14173         if (!legalNamespaces.test(namespace)) {
14174           throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");
14175         }
14176         var _privateStoreProps = {
14177           _namespacePrefix: namespacePrefix,
14178           _namespaceRegexp: namespaceRegexp,
14179           _testStorage: function(storage) {
14180             try {
14181               var testStr = "__storejs__test__";
14182               storage.write(testStr, testStr);
14183               var ok = storage.read(testStr) === testStr;
14184               storage.remove(testStr);
14185               return ok;
14186             } catch (e3) {
14187               return false;
14188             }
14189           },
14190           _assignPluginFnProp: function(pluginFnProp, propName) {
14191             var oldFn = this[propName];
14192             this[propName] = function pluginFn() {
14193               var args = slice(arguments, 0);
14194               var self2 = this;
14195               function super_fn() {
14196                 if (!oldFn) {
14197                   return;
14198                 }
14199                 each(arguments, function(arg, i3) {
14200                   args[i3] = arg;
14201                 });
14202                 return oldFn.apply(self2, args);
14203               }
14204               var newFnArgs = [super_fn].concat(args);
14205               return pluginFnProp.apply(self2, newFnArgs);
14206             };
14207           },
14208           _serialize: function(obj) {
14209             return JSON.stringify(obj);
14210           },
14211           _deserialize: function(strVal, defaultVal) {
14212             if (!strVal) {
14213               return defaultVal;
14214             }
14215             var val = "";
14216             try {
14217               val = JSON.parse(strVal);
14218             } catch (e3) {
14219               val = strVal;
14220             }
14221             return val !== void 0 ? val : defaultVal;
14222           },
14223           _addStorage: function(storage) {
14224             if (this.enabled) {
14225               return;
14226             }
14227             if (this._testStorage(storage)) {
14228               this.storage = storage;
14229               this.enabled = true;
14230             }
14231           },
14232           _addPlugin: function(plugin) {
14233             var self2 = this;
14234             if (isList(plugin)) {
14235               each(plugin, function(plugin2) {
14236                 self2._addPlugin(plugin2);
14237               });
14238               return;
14239             }
14240             var seenPlugin = pluck(this.plugins, function(seenPlugin2) {
14241               return plugin === seenPlugin2;
14242             });
14243             if (seenPlugin) {
14244               return;
14245             }
14246             this.plugins.push(plugin);
14247             if (!isFunction2(plugin)) {
14248               throw new Error("Plugins must be function values that return objects");
14249             }
14250             var pluginProperties = plugin.call(this);
14251             if (!isObject3(pluginProperties)) {
14252               throw new Error("Plugins must return an object of function properties");
14253             }
14254             each(pluginProperties, function(pluginFnProp, propName) {
14255               if (!isFunction2(pluginFnProp)) {
14256                 throw new Error("Bad plugin property: " + propName + " from plugin " + plugin.name + ". Plugins should only return functions.");
14257               }
14258               self2._assignPluginFnProp(pluginFnProp, propName);
14259             });
14260           },
14261           // Put deprecated properties in the private API, so as to not expose it to accidential
14262           // discovery through inspection of the store object.
14263           // Deprecated: addStorage
14264           addStorage: function(storage) {
14265             _warn("store.addStorage(storage) is deprecated. Use createStore([storages])");
14266             this._addStorage(storage);
14267           }
14268         };
14269         var store2 = create2(_privateStoreProps, storeAPI, {
14270           plugins: []
14271         });
14272         store2.raw = {};
14273         each(store2, function(prop, propName) {
14274           if (isFunction2(prop)) {
14275             store2.raw[propName] = bind(store2, prop);
14276           }
14277         });
14278         each(storages, function(storage) {
14279           store2._addStorage(storage);
14280         });
14281         each(plugins, function(plugin) {
14282           store2._addPlugin(plugin);
14283         });
14284         return store2;
14285       }
14286     }
14287   });
14288
14289   // node_modules/store/storages/localStorage.js
14290   var require_localStorage = __commonJS({
14291     "node_modules/store/storages/localStorage.js"(exports2, module2) {
14292       var util = require_util();
14293       var Global = util.Global;
14294       module2.exports = {
14295         name: "localStorage",
14296         read,
14297         write,
14298         each,
14299         remove: remove2,
14300         clearAll
14301       };
14302       function localStorage2() {
14303         return Global.localStorage;
14304       }
14305       function read(key) {
14306         return localStorage2().getItem(key);
14307       }
14308       function write(key, data) {
14309         return localStorage2().setItem(key, data);
14310       }
14311       function each(fn) {
14312         for (var i3 = localStorage2().length - 1; i3 >= 0; i3--) {
14313           var key = localStorage2().key(i3);
14314           fn(read(key), key);
14315         }
14316       }
14317       function remove2(key) {
14318         return localStorage2().removeItem(key);
14319       }
14320       function clearAll() {
14321         return localStorage2().clear();
14322       }
14323     }
14324   });
14325
14326   // node_modules/store/storages/oldFF-globalStorage.js
14327   var require_oldFF_globalStorage = __commonJS({
14328     "node_modules/store/storages/oldFF-globalStorage.js"(exports2, module2) {
14329       var util = require_util();
14330       var Global = util.Global;
14331       module2.exports = {
14332         name: "oldFF-globalStorage",
14333         read,
14334         write,
14335         each,
14336         remove: remove2,
14337         clearAll
14338       };
14339       var globalStorage = Global.globalStorage;
14340       function read(key) {
14341         return globalStorage[key];
14342       }
14343       function write(key, data) {
14344         globalStorage[key] = data;
14345       }
14346       function each(fn) {
14347         for (var i3 = globalStorage.length - 1; i3 >= 0; i3--) {
14348           var key = globalStorage.key(i3);
14349           fn(globalStorage[key], key);
14350         }
14351       }
14352       function remove2(key) {
14353         return globalStorage.removeItem(key);
14354       }
14355       function clearAll() {
14356         each(function(key, _2) {
14357           delete globalStorage[key];
14358         });
14359       }
14360     }
14361   });
14362
14363   // node_modules/store/storages/oldIE-userDataStorage.js
14364   var require_oldIE_userDataStorage = __commonJS({
14365     "node_modules/store/storages/oldIE-userDataStorage.js"(exports2, module2) {
14366       var util = require_util();
14367       var Global = util.Global;
14368       module2.exports = {
14369         name: "oldIE-userDataStorage",
14370         write,
14371         read,
14372         each,
14373         remove: remove2,
14374         clearAll
14375       };
14376       var storageName = "storejs";
14377       var doc = Global.document;
14378       var _withStorageEl = _makeIEStorageElFunction();
14379       var disable = (Global.navigator ? Global.navigator.userAgent : "").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);
14380       function write(unfixedKey, data) {
14381         if (disable) {
14382           return;
14383         }
14384         var fixedKey = fixKey(unfixedKey);
14385         _withStorageEl(function(storageEl) {
14386           storageEl.setAttribute(fixedKey, data);
14387           storageEl.save(storageName);
14388         });
14389       }
14390       function read(unfixedKey) {
14391         if (disable) {
14392           return;
14393         }
14394         var fixedKey = fixKey(unfixedKey);
14395         var res = null;
14396         _withStorageEl(function(storageEl) {
14397           res = storageEl.getAttribute(fixedKey);
14398         });
14399         return res;
14400       }
14401       function each(callback) {
14402         _withStorageEl(function(storageEl) {
14403           var attributes = storageEl.XMLDocument.documentElement.attributes;
14404           for (var i3 = attributes.length - 1; i3 >= 0; i3--) {
14405             var attr = attributes[i3];
14406             callback(storageEl.getAttribute(attr.name), attr.name);
14407           }
14408         });
14409       }
14410       function remove2(unfixedKey) {
14411         var fixedKey = fixKey(unfixedKey);
14412         _withStorageEl(function(storageEl) {
14413           storageEl.removeAttribute(fixedKey);
14414           storageEl.save(storageName);
14415         });
14416       }
14417       function clearAll() {
14418         _withStorageEl(function(storageEl) {
14419           var attributes = storageEl.XMLDocument.documentElement.attributes;
14420           storageEl.load(storageName);
14421           for (var i3 = attributes.length - 1; i3 >= 0; i3--) {
14422             storageEl.removeAttribute(attributes[i3].name);
14423           }
14424           storageEl.save(storageName);
14425         });
14426       }
14427       var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g");
14428       function fixKey(key) {
14429         return key.replace(/^\d/, "___$&").replace(forbiddenCharsRegex, "___");
14430       }
14431       function _makeIEStorageElFunction() {
14432         if (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {
14433           return null;
14434         }
14435         var scriptTag = "script", storageOwner, storageContainer, storageEl;
14436         try {
14437           storageContainer = new ActiveXObject("htmlfile");
14438           storageContainer.open();
14439           storageContainer.write("<" + scriptTag + ">document.w=window</" + scriptTag + '><iframe src="/favicon.ico"></iframe>');
14440           storageContainer.close();
14441           storageOwner = storageContainer.w.frames[0].document;
14442           storageEl = storageOwner.createElement("div");
14443         } catch (e3) {
14444           storageEl = doc.createElement("div");
14445           storageOwner = doc.body;
14446         }
14447         return function(storeFunction) {
14448           var args = [].slice.call(arguments, 0);
14449           args.unshift(storageEl);
14450           storageOwner.appendChild(storageEl);
14451           storageEl.addBehavior("#default#userData");
14452           storageEl.load(storageName);
14453           storeFunction.apply(this, args);
14454           storageOwner.removeChild(storageEl);
14455           return;
14456         };
14457       }
14458     }
14459   });
14460
14461   // node_modules/store/storages/cookieStorage.js
14462   var require_cookieStorage = __commonJS({
14463     "node_modules/store/storages/cookieStorage.js"(exports2, module2) {
14464       var util = require_util();
14465       var Global = util.Global;
14466       var trim = util.trim;
14467       module2.exports = {
14468         name: "cookieStorage",
14469         read,
14470         write,
14471         each,
14472         remove: remove2,
14473         clearAll
14474       };
14475       var doc = Global.document;
14476       function read(key) {
14477         if (!key || !_has(key)) {
14478           return null;
14479         }
14480         var regexpStr = "(?:^|.*;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";
14481         return unescape(doc.cookie.replace(new RegExp(regexpStr), "$1"));
14482       }
14483       function each(callback) {
14484         var cookies = doc.cookie.split(/; ?/g);
14485         for (var i3 = cookies.length - 1; i3 >= 0; i3--) {
14486           if (!trim(cookies[i3])) {
14487             continue;
14488           }
14489           var kvp = cookies[i3].split("=");
14490           var key = unescape(kvp[0]);
14491           var val = unescape(kvp[1]);
14492           callback(val, key);
14493         }
14494       }
14495       function write(key, data) {
14496         if (!key) {
14497           return;
14498         }
14499         doc.cookie = escape(key) + "=" + escape(data) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
14500       }
14501       function remove2(key) {
14502         if (!key || !_has(key)) {
14503           return;
14504         }
14505         doc.cookie = escape(key) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
14506       }
14507       function clearAll() {
14508         each(function(_2, key) {
14509           remove2(key);
14510         });
14511       }
14512       function _has(key) {
14513         return new RegExp("(?:^|;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(doc.cookie);
14514       }
14515     }
14516   });
14517
14518   // node_modules/store/storages/sessionStorage.js
14519   var require_sessionStorage = __commonJS({
14520     "node_modules/store/storages/sessionStorage.js"(exports2, module2) {
14521       var util = require_util();
14522       var Global = util.Global;
14523       module2.exports = {
14524         name: "sessionStorage",
14525         read,
14526         write,
14527         each,
14528         remove: remove2,
14529         clearAll
14530       };
14531       function sessionStorage() {
14532         return Global.sessionStorage;
14533       }
14534       function read(key) {
14535         return sessionStorage().getItem(key);
14536       }
14537       function write(key, data) {
14538         return sessionStorage().setItem(key, data);
14539       }
14540       function each(fn) {
14541         for (var i3 = sessionStorage().length - 1; i3 >= 0; i3--) {
14542           var key = sessionStorage().key(i3);
14543           fn(read(key), key);
14544         }
14545       }
14546       function remove2(key) {
14547         return sessionStorage().removeItem(key);
14548       }
14549       function clearAll() {
14550         return sessionStorage().clear();
14551       }
14552     }
14553   });
14554
14555   // node_modules/store/storages/memoryStorage.js
14556   var require_memoryStorage = __commonJS({
14557     "node_modules/store/storages/memoryStorage.js"(exports2, module2) {
14558       module2.exports = {
14559         name: "memoryStorage",
14560         read,
14561         write,
14562         each,
14563         remove: remove2,
14564         clearAll
14565       };
14566       var memoryStorage = {};
14567       function read(key) {
14568         return memoryStorage[key];
14569       }
14570       function write(key, data) {
14571         memoryStorage[key] = data;
14572       }
14573       function each(callback) {
14574         for (var key in memoryStorage) {
14575           if (memoryStorage.hasOwnProperty(key)) {
14576             callback(memoryStorage[key], key);
14577           }
14578         }
14579       }
14580       function remove2(key) {
14581         delete memoryStorage[key];
14582       }
14583       function clearAll(key) {
14584         memoryStorage = {};
14585       }
14586     }
14587   });
14588
14589   // node_modules/store/storages/all.js
14590   var require_all = __commonJS({
14591     "node_modules/store/storages/all.js"(exports2, module2) {
14592       module2.exports = [
14593         // Listed in order of usage preference
14594         require_localStorage(),
14595         require_oldFF_globalStorage(),
14596         require_oldIE_userDataStorage(),
14597         require_cookieStorage(),
14598         require_sessionStorage(),
14599         require_memoryStorage()
14600       ];
14601     }
14602   });
14603
14604   // node_modules/store/plugins/lib/json2.js
14605   var require_json2 = __commonJS({
14606     "node_modules/store/plugins/lib/json2.js"(exports, module) {
14607       if (typeof JSON !== "object") {
14608         JSON = {};
14609       }
14610       (function() {
14611         "use strict";
14612         var rx_one = /^[\],:{}\s]*$/;
14613         var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
14614         var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
14615         var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
14616         var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14617         var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14618         function f(n3) {
14619           return n3 < 10 ? "0" + n3 : n3;
14620         }
14621         function this_value() {
14622           return this.valueOf();
14623         }
14624         if (typeof Date.prototype.toJSON !== "function") {
14625           Date.prototype.toJSON = function() {
14626             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;
14627           };
14628           Boolean.prototype.toJSON = this_value;
14629           Number.prototype.toJSON = this_value;
14630           String.prototype.toJSON = this_value;
14631         }
14632         var gap;
14633         var indent;
14634         var meta;
14635         var rep;
14636         function quote(string) {
14637           rx_escapable.lastIndex = 0;
14638           return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function(a2) {
14639             var c2 = meta[a2];
14640             return typeof c2 === "string" ? c2 : "\\u" + ("0000" + a2.charCodeAt(0).toString(16)).slice(-4);
14641           }) + '"' : '"' + string + '"';
14642         }
14643         function str(key, holder) {
14644           var i3;
14645           var k2;
14646           var v2;
14647           var length;
14648           var mind = gap;
14649           var partial;
14650           var value = holder[key];
14651           if (value && typeof value === "object" && typeof value.toJSON === "function") {
14652             value = value.toJSON(key);
14653           }
14654           if (typeof rep === "function") {
14655             value = rep.call(holder, key, value);
14656           }
14657           switch (typeof value) {
14658             case "string":
14659               return quote(value);
14660             case "number":
14661               return isFinite(value) ? String(value) : "null";
14662             case "boolean":
14663             case "null":
14664               return String(value);
14665             case "object":
14666               if (!value) {
14667                 return "null";
14668               }
14669               gap += indent;
14670               partial = [];
14671               if (Object.prototype.toString.apply(value) === "[object Array]") {
14672                 length = value.length;
14673                 for (i3 = 0; i3 < length; i3 += 1) {
14674                   partial[i3] = str(i3, value) || "null";
14675                 }
14676                 v2 = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
14677                 gap = mind;
14678                 return v2;
14679               }
14680               if (rep && typeof rep === "object") {
14681                 length = rep.length;
14682                 for (i3 = 0; i3 < length; i3 += 1) {
14683                   if (typeof rep[i3] === "string") {
14684                     k2 = rep[i3];
14685                     v2 = str(k2, value);
14686                     if (v2) {
14687                       partial.push(quote(k2) + (gap ? ": " : ":") + v2);
14688                     }
14689                   }
14690                 }
14691               } else {
14692                 for (k2 in value) {
14693                   if (Object.prototype.hasOwnProperty.call(value, k2)) {
14694                     v2 = str(k2, value);
14695                     if (v2) {
14696                       partial.push(quote(k2) + (gap ? ": " : ":") + v2);
14697                     }
14698                   }
14699                 }
14700               }
14701               v2 = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
14702               gap = mind;
14703               return v2;
14704           }
14705         }
14706         if (typeof JSON.stringify !== "function") {
14707           meta = {
14708             // table of character substitutions
14709             "\b": "\\b",
14710             "   ": "\\t",
14711             "\n": "\\n",
14712             "\f": "\\f",
14713             "\r": "\\r",
14714             '"': '\\"',
14715             "\\": "\\\\"
14716           };
14717           JSON.stringify = function(value, replacer, space) {
14718             var i3;
14719             gap = "";
14720             indent = "";
14721             if (typeof space === "number") {
14722               for (i3 = 0; i3 < space; i3 += 1) {
14723                 indent += " ";
14724               }
14725             } else if (typeof space === "string") {
14726               indent = space;
14727             }
14728             rep = replacer;
14729             if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
14730               throw new Error("JSON.stringify");
14731             }
14732             return str("", { "": value });
14733           };
14734         }
14735         if (typeof JSON.parse !== "function") {
14736           JSON.parse = function(text, reviver) {
14737             var j;
14738             function walk(holder, key) {
14739               var k2;
14740               var v2;
14741               var value = holder[key];
14742               if (value && typeof value === "object") {
14743                 for (k2 in value) {
14744                   if (Object.prototype.hasOwnProperty.call(value, k2)) {
14745                     v2 = walk(value, k2);
14746                     if (v2 !== void 0) {
14747                       value[k2] = v2;
14748                     } else {
14749                       delete value[k2];
14750                     }
14751                   }
14752                 }
14753               }
14754               return reviver.call(holder, key, value);
14755             }
14756             text = String(text);
14757             rx_dangerous.lastIndex = 0;
14758             if (rx_dangerous.test(text)) {
14759               text = text.replace(rx_dangerous, function(a2) {
14760                 return "\\u" + ("0000" + a2.charCodeAt(0).toString(16)).slice(-4);
14761               });
14762             }
14763             if (rx_one.test(
14764               text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, "")
14765             )) {
14766               j = eval("(" + text + ")");
14767               return typeof reviver === "function" ? walk({ "": j }, "") : j;
14768             }
14769             throw new SyntaxError("JSON.parse");
14770           };
14771         }
14772       })();
14773     }
14774   });
14775
14776   // node_modules/store/plugins/json2.js
14777   var require_json22 = __commonJS({
14778     "node_modules/store/plugins/json2.js"(exports2, module2) {
14779       module2.exports = json2Plugin;
14780       function json2Plugin() {
14781         require_json2();
14782         return {};
14783       }
14784     }
14785   });
14786
14787   // node_modules/store/dist/store.legacy.js
14788   var require_store_legacy = __commonJS({
14789     "node_modules/store/dist/store.legacy.js"(exports2, module2) {
14790       var engine = require_store_engine();
14791       var storages = require_all();
14792       var plugins = [require_json22()];
14793       module2.exports = engine.createStore(storages, plugins);
14794     }
14795   });
14796
14797   // node_modules/whatwg-fetch/fetch.js
14798   var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
14799   typeof global !== "undefined" && global || {};
14800   var support = {
14801     searchParams: "URLSearchParams" in g,
14802     iterable: "Symbol" in g && "iterator" in Symbol,
14803     blob: "FileReader" in g && "Blob" in g && function() {
14804       try {
14805         new Blob();
14806         return true;
14807       } catch (e3) {
14808         return false;
14809       }
14810     }(),
14811     formData: "FormData" in g,
14812     arrayBuffer: "ArrayBuffer" in g
14813   };
14814   function isDataView(obj) {
14815     return obj && DataView.prototype.isPrototypeOf(obj);
14816   }
14817   if (support.arrayBuffer) {
14818     viewClasses = [
14819       "[object Int8Array]",
14820       "[object Uint8Array]",
14821       "[object Uint8ClampedArray]",
14822       "[object Int16Array]",
14823       "[object Uint16Array]",
14824       "[object Int32Array]",
14825       "[object Uint32Array]",
14826       "[object Float32Array]",
14827       "[object Float64Array]"
14828     ];
14829     isArrayBufferView = ArrayBuffer.isView || function(obj) {
14830       return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
14831     };
14832   }
14833   var viewClasses;
14834   var isArrayBufferView;
14835   function normalizeName(name) {
14836     if (typeof name !== "string") {
14837       name = String(name);
14838     }
14839     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
14840       throw new TypeError('Invalid character in header field name: "' + name + '"');
14841     }
14842     return name.toLowerCase();
14843   }
14844   function normalizeValue(value) {
14845     if (typeof value !== "string") {
14846       value = String(value);
14847     }
14848     return value;
14849   }
14850   function iteratorFor(items) {
14851     var iterator = {
14852       next: function() {
14853         var value = items.shift();
14854         return { done: value === void 0, value };
14855       }
14856     };
14857     if (support.iterable) {
14858       iterator[Symbol.iterator] = function() {
14859         return iterator;
14860       };
14861     }
14862     return iterator;
14863   }
14864   function Headers(headers) {
14865     this.map = {};
14866     if (headers instanceof Headers) {
14867       headers.forEach(function(value, name) {
14868         this.append(name, value);
14869       }, this);
14870     } else if (Array.isArray(headers)) {
14871       headers.forEach(function(header) {
14872         if (header.length != 2) {
14873           throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
14874         }
14875         this.append(header[0], header[1]);
14876       }, this);
14877     } else if (headers) {
14878       Object.getOwnPropertyNames(headers).forEach(function(name) {
14879         this.append(name, headers[name]);
14880       }, this);
14881     }
14882   }
14883   Headers.prototype.append = function(name, value) {
14884     name = normalizeName(name);
14885     value = normalizeValue(value);
14886     var oldValue = this.map[name];
14887     this.map[name] = oldValue ? oldValue + ", " + value : value;
14888   };
14889   Headers.prototype["delete"] = function(name) {
14890     delete this.map[normalizeName(name)];
14891   };
14892   Headers.prototype.get = function(name) {
14893     name = normalizeName(name);
14894     return this.has(name) ? this.map[name] : null;
14895   };
14896   Headers.prototype.has = function(name) {
14897     return this.map.hasOwnProperty(normalizeName(name));
14898   };
14899   Headers.prototype.set = function(name, value) {
14900     this.map[normalizeName(name)] = normalizeValue(value);
14901   };
14902   Headers.prototype.forEach = function(callback, thisArg) {
14903     for (var name in this.map) {
14904       if (this.map.hasOwnProperty(name)) {
14905         callback.call(thisArg, this.map[name], name, this);
14906       }
14907     }
14908   };
14909   Headers.prototype.keys = function() {
14910     var items = [];
14911     this.forEach(function(value, name) {
14912       items.push(name);
14913     });
14914     return iteratorFor(items);
14915   };
14916   Headers.prototype.values = function() {
14917     var items = [];
14918     this.forEach(function(value) {
14919       items.push(value);
14920     });
14921     return iteratorFor(items);
14922   };
14923   Headers.prototype.entries = function() {
14924     var items = [];
14925     this.forEach(function(value, name) {
14926       items.push([name, value]);
14927     });
14928     return iteratorFor(items);
14929   };
14930   if (support.iterable) {
14931     Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
14932   }
14933   function consumed(body) {
14934     if (body._noBody)
14935       return;
14936     if (body.bodyUsed) {
14937       return Promise.reject(new TypeError("Already read"));
14938     }
14939     body.bodyUsed = true;
14940   }
14941   function fileReaderReady(reader) {
14942     return new Promise(function(resolve, reject) {
14943       reader.onload = function() {
14944         resolve(reader.result);
14945       };
14946       reader.onerror = function() {
14947         reject(reader.error);
14948       };
14949     });
14950   }
14951   function readBlobAsArrayBuffer(blob) {
14952     var reader = new FileReader();
14953     var promise = fileReaderReady(reader);
14954     reader.readAsArrayBuffer(blob);
14955     return promise;
14956   }
14957   function readBlobAsText(blob) {
14958     var reader = new FileReader();
14959     var promise = fileReaderReady(reader);
14960     var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
14961     var encoding = match ? match[1] : "utf-8";
14962     reader.readAsText(blob, encoding);
14963     return promise;
14964   }
14965   function readArrayBufferAsText(buf) {
14966     var view = new Uint8Array(buf);
14967     var chars = new Array(view.length);
14968     for (var i3 = 0; i3 < view.length; i3++) {
14969       chars[i3] = String.fromCharCode(view[i3]);
14970     }
14971     return chars.join("");
14972   }
14973   function bufferClone(buf) {
14974     if (buf.slice) {
14975       return buf.slice(0);
14976     } else {
14977       var view = new Uint8Array(buf.byteLength);
14978       view.set(new Uint8Array(buf));
14979       return view.buffer;
14980     }
14981   }
14982   function Body() {
14983     this.bodyUsed = false;
14984     this._initBody = function(body) {
14985       this.bodyUsed = this.bodyUsed;
14986       this._bodyInit = body;
14987       if (!body) {
14988         this._noBody = true;
14989         this._bodyText = "";
14990       } else if (typeof body === "string") {
14991         this._bodyText = body;
14992       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
14993         this._bodyBlob = body;
14994       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
14995         this._bodyFormData = body;
14996       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14997         this._bodyText = body.toString();
14998       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
14999         this._bodyArrayBuffer = bufferClone(body.buffer);
15000         this._bodyInit = new Blob([this._bodyArrayBuffer]);
15001       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
15002         this._bodyArrayBuffer = bufferClone(body);
15003       } else {
15004         this._bodyText = body = Object.prototype.toString.call(body);
15005       }
15006       if (!this.headers.get("content-type")) {
15007         if (typeof body === "string") {
15008           this.headers.set("content-type", "text/plain;charset=UTF-8");
15009         } else if (this._bodyBlob && this._bodyBlob.type) {
15010           this.headers.set("content-type", this._bodyBlob.type);
15011         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
15012           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
15013         }
15014       }
15015     };
15016     if (support.blob) {
15017       this.blob = function() {
15018         var rejected = consumed(this);
15019         if (rejected) {
15020           return rejected;
15021         }
15022         if (this._bodyBlob) {
15023           return Promise.resolve(this._bodyBlob);
15024         } else if (this._bodyArrayBuffer) {
15025           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
15026         } else if (this._bodyFormData) {
15027           throw new Error("could not read FormData body as blob");
15028         } else {
15029           return Promise.resolve(new Blob([this._bodyText]));
15030         }
15031       };
15032     }
15033     this.arrayBuffer = function() {
15034       if (this._bodyArrayBuffer) {
15035         var isConsumed = consumed(this);
15036         if (isConsumed) {
15037           return isConsumed;
15038         } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
15039           return Promise.resolve(
15040             this._bodyArrayBuffer.buffer.slice(
15041               this._bodyArrayBuffer.byteOffset,
15042               this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
15043             )
15044           );
15045         } else {
15046           return Promise.resolve(this._bodyArrayBuffer);
15047         }
15048       } else if (support.blob) {
15049         return this.blob().then(readBlobAsArrayBuffer);
15050       } else {
15051         throw new Error("could not read as ArrayBuffer");
15052       }
15053     };
15054     this.text = function() {
15055       var rejected = consumed(this);
15056       if (rejected) {
15057         return rejected;
15058       }
15059       if (this._bodyBlob) {
15060         return readBlobAsText(this._bodyBlob);
15061       } else if (this._bodyArrayBuffer) {
15062         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
15063       } else if (this._bodyFormData) {
15064         throw new Error("could not read FormData body as text");
15065       } else {
15066         return Promise.resolve(this._bodyText);
15067       }
15068     };
15069     if (support.formData) {
15070       this.formData = function() {
15071         return this.text().then(decode);
15072       };
15073     }
15074     this.json = function() {
15075       return this.text().then(JSON.parse);
15076     };
15077     return this;
15078   }
15079   var methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
15080   function normalizeMethod(method) {
15081     var upcased = method.toUpperCase();
15082     return methods.indexOf(upcased) > -1 ? upcased : method;
15083   }
15084   function Request(input, options2) {
15085     if (!(this instanceof Request)) {
15086       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
15087     }
15088     options2 = options2 || {};
15089     var body = options2.body;
15090     if (input instanceof Request) {
15091       if (input.bodyUsed) {
15092         throw new TypeError("Already read");
15093       }
15094       this.url = input.url;
15095       this.credentials = input.credentials;
15096       if (!options2.headers) {
15097         this.headers = new Headers(input.headers);
15098       }
15099       this.method = input.method;
15100       this.mode = input.mode;
15101       this.signal = input.signal;
15102       if (!body && input._bodyInit != null) {
15103         body = input._bodyInit;
15104         input.bodyUsed = true;
15105       }
15106     } else {
15107       this.url = String(input);
15108     }
15109     this.credentials = options2.credentials || this.credentials || "same-origin";
15110     if (options2.headers || !this.headers) {
15111       this.headers = new Headers(options2.headers);
15112     }
15113     this.method = normalizeMethod(options2.method || this.method || "GET");
15114     this.mode = options2.mode || this.mode || null;
15115     this.signal = options2.signal || this.signal || function() {
15116       if ("AbortController" in g) {
15117         var ctrl = new AbortController();
15118         return ctrl.signal;
15119       }
15120     }();
15121     this.referrer = null;
15122     if ((this.method === "GET" || this.method === "HEAD") && body) {
15123       throw new TypeError("Body not allowed for GET or HEAD requests");
15124     }
15125     this._initBody(body);
15126     if (this.method === "GET" || this.method === "HEAD") {
15127       if (options2.cache === "no-store" || options2.cache === "no-cache") {
15128         var reParamSearch = /([?&])_=[^&]*/;
15129         if (reParamSearch.test(this.url)) {
15130           this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
15131         } else {
15132           var reQueryString = /\?/;
15133           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
15134         }
15135       }
15136     }
15137   }
15138   Request.prototype.clone = function() {
15139     return new Request(this, { body: this._bodyInit });
15140   };
15141   function decode(body) {
15142     var form = new FormData();
15143     body.trim().split("&").forEach(function(bytes) {
15144       if (bytes) {
15145         var split = bytes.split("=");
15146         var name = split.shift().replace(/\+/g, " ");
15147         var value = split.join("=").replace(/\+/g, " ");
15148         form.append(decodeURIComponent(name), decodeURIComponent(value));
15149       }
15150     });
15151     return form;
15152   }
15153   function parseHeaders(rawHeaders) {
15154     var headers = new Headers();
15155     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
15156     preProcessedHeaders.split("\r").map(function(header) {
15157       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
15158     }).forEach(function(line) {
15159       var parts = line.split(":");
15160       var key = parts.shift().trim();
15161       if (key) {
15162         var value = parts.join(":").trim();
15163         try {
15164           headers.append(key, value);
15165         } catch (error) {
15166           console.warn("Response " + error.message);
15167         }
15168       }
15169     });
15170     return headers;
15171   }
15172   Body.call(Request.prototype);
15173   function Response(bodyInit, options2) {
15174     if (!(this instanceof Response)) {
15175       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
15176     }
15177     if (!options2) {
15178       options2 = {};
15179     }
15180     this.type = "default";
15181     this.status = options2.status === void 0 ? 200 : options2.status;
15182     if (this.status < 200 || this.status > 599) {
15183       throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
15184     }
15185     this.ok = this.status >= 200 && this.status < 300;
15186     this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
15187     this.headers = new Headers(options2.headers);
15188     this.url = options2.url || "";
15189     this._initBody(bodyInit);
15190   }
15191   Body.call(Response.prototype);
15192   Response.prototype.clone = function() {
15193     return new Response(this._bodyInit, {
15194       status: this.status,
15195       statusText: this.statusText,
15196       headers: new Headers(this.headers),
15197       url: this.url
15198     });
15199   };
15200   Response.error = function() {
15201     var response = new Response(null, { status: 200, statusText: "" });
15202     response.status = 0;
15203     response.type = "error";
15204     return response;
15205   };
15206   var redirectStatuses = [301, 302, 303, 307, 308];
15207   Response.redirect = function(url, status) {
15208     if (redirectStatuses.indexOf(status) === -1) {
15209       throw new RangeError("Invalid status code");
15210     }
15211     return new Response(null, { status, headers: { location: url } });
15212   };
15213   var DOMException2 = g.DOMException;
15214   try {
15215     new DOMException2();
15216   } catch (err) {
15217     DOMException2 = function(message, name) {
15218       this.message = message;
15219       this.name = name;
15220       var error = Error(message);
15221       this.stack = error.stack;
15222     };
15223     DOMException2.prototype = Object.create(Error.prototype);
15224     DOMException2.prototype.constructor = DOMException2;
15225   }
15226   function fetch2(input, init2) {
15227     return new Promise(function(resolve, reject) {
15228       var request3 = new Request(input, init2);
15229       if (request3.signal && request3.signal.aborted) {
15230         return reject(new DOMException2("Aborted", "AbortError"));
15231       }
15232       var xhr = new XMLHttpRequest();
15233       function abortXhr() {
15234         xhr.abort();
15235       }
15236       xhr.onload = function() {
15237         var options2 = {
15238           status: xhr.status,
15239           statusText: xhr.statusText,
15240           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
15241         };
15242         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
15243         var body = "response" in xhr ? xhr.response : xhr.responseText;
15244         setTimeout(function() {
15245           resolve(new Response(body, options2));
15246         }, 0);
15247       };
15248       xhr.onerror = function() {
15249         setTimeout(function() {
15250           reject(new TypeError("Network request failed"));
15251         }, 0);
15252       };
15253       xhr.ontimeout = function() {
15254         setTimeout(function() {
15255           reject(new TypeError("Network request failed"));
15256         }, 0);
15257       };
15258       xhr.onabort = function() {
15259         setTimeout(function() {
15260           reject(new DOMException2("Aborted", "AbortError"));
15261         }, 0);
15262       };
15263       function fixUrl(url) {
15264         try {
15265           return url === "" && g.location.href ? g.location.href : url;
15266         } catch (e3) {
15267           return url;
15268         }
15269       }
15270       xhr.open(request3.method, fixUrl(request3.url), true);
15271       if (request3.credentials === "include") {
15272         xhr.withCredentials = true;
15273       } else if (request3.credentials === "omit") {
15274         xhr.withCredentials = false;
15275       }
15276       if ("responseType" in xhr) {
15277         if (support.blob) {
15278           xhr.responseType = "blob";
15279         } else if (support.arrayBuffer) {
15280           xhr.responseType = "arraybuffer";
15281         }
15282       }
15283       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers || g.Headers && init2.headers instanceof g.Headers)) {
15284         var names = [];
15285         Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
15286           names.push(normalizeName(name));
15287           xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
15288         });
15289         request3.headers.forEach(function(value, name) {
15290           if (names.indexOf(name) === -1) {
15291             xhr.setRequestHeader(name, value);
15292           }
15293         });
15294       } else {
15295         request3.headers.forEach(function(value, name) {
15296           xhr.setRequestHeader(name, value);
15297         });
15298       }
15299       if (request3.signal) {
15300         request3.signal.addEventListener("abort", abortXhr);
15301         xhr.onreadystatechange = function() {
15302           if (xhr.readyState === 4) {
15303             request3.signal.removeEventListener("abort", abortXhr);
15304           }
15305         };
15306       }
15307       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
15308     });
15309   }
15310   fetch2.polyfill = true;
15311   if (!g.fetch) {
15312     g.fetch = fetch2;
15313     g.Headers = Headers;
15314     g.Request = Request;
15315     g.Response = Response;
15316   }
15317
15318   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
15319   (function(factory) {
15320     typeof define === "function" && define.amd ? define(factory) : factory();
15321   })(function() {
15322     "use strict";
15323     function _classCallCheck(instance, Constructor) {
15324       if (!(instance instanceof Constructor)) {
15325         throw new TypeError("Cannot call a class as a function");
15326       }
15327     }
15328     function _defineProperties(target, props) {
15329       for (var i3 = 0; i3 < props.length; i3++) {
15330         var descriptor = props[i3];
15331         descriptor.enumerable = descriptor.enumerable || false;
15332         descriptor.configurable = true;
15333         if ("value" in descriptor)
15334           descriptor.writable = true;
15335         Object.defineProperty(target, descriptor.key, descriptor);
15336       }
15337     }
15338     function _createClass(Constructor, protoProps, staticProps) {
15339       if (protoProps)
15340         _defineProperties(Constructor.prototype, protoProps);
15341       if (staticProps)
15342         _defineProperties(Constructor, staticProps);
15343       Object.defineProperty(Constructor, "prototype", {
15344         writable: false
15345       });
15346       return Constructor;
15347     }
15348     function _inherits(subClass, superClass) {
15349       if (typeof superClass !== "function" && superClass !== null) {
15350         throw new TypeError("Super expression must either be null or a function");
15351       }
15352       subClass.prototype = Object.create(superClass && superClass.prototype, {
15353         constructor: {
15354           value: subClass,
15355           writable: true,
15356           configurable: true
15357         }
15358       });
15359       Object.defineProperty(subClass, "prototype", {
15360         writable: false
15361       });
15362       if (superClass)
15363         _setPrototypeOf(subClass, superClass);
15364     }
15365     function _getPrototypeOf(o2) {
15366       _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
15367         return o3.__proto__ || Object.getPrototypeOf(o3);
15368       };
15369       return _getPrototypeOf(o2);
15370     }
15371     function _setPrototypeOf(o2, p2) {
15372       _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
15373         o3.__proto__ = p3;
15374         return o3;
15375       };
15376       return _setPrototypeOf(o2, p2);
15377     }
15378     function _isNativeReflectConstruct() {
15379       if (typeof Reflect === "undefined" || !Reflect.construct)
15380         return false;
15381       if (Reflect.construct.sham)
15382         return false;
15383       if (typeof Proxy === "function")
15384         return true;
15385       try {
15386         Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
15387         }));
15388         return true;
15389       } catch (e3) {
15390         return false;
15391       }
15392     }
15393     function _assertThisInitialized(self2) {
15394       if (self2 === void 0) {
15395         throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15396       }
15397       return self2;
15398     }
15399     function _possibleConstructorReturn(self2, call) {
15400       if (call && (typeof call === "object" || typeof call === "function")) {
15401         return call;
15402       } else if (call !== void 0) {
15403         throw new TypeError("Derived constructors may only return object or undefined");
15404       }
15405       return _assertThisInitialized(self2);
15406     }
15407     function _createSuper(Derived) {
15408       var hasNativeReflectConstruct = _isNativeReflectConstruct();
15409       return function _createSuperInternal() {
15410         var Super = _getPrototypeOf(Derived), result;
15411         if (hasNativeReflectConstruct) {
15412           var NewTarget = _getPrototypeOf(this).constructor;
15413           result = Reflect.construct(Super, arguments, NewTarget);
15414         } else {
15415           result = Super.apply(this, arguments);
15416         }
15417         return _possibleConstructorReturn(this, result);
15418       };
15419     }
15420     function _superPropBase(object, property) {
15421       while (!Object.prototype.hasOwnProperty.call(object, property)) {
15422         object = _getPrototypeOf(object);
15423         if (object === null)
15424           break;
15425       }
15426       return object;
15427     }
15428     function _get() {
15429       if (typeof Reflect !== "undefined" && Reflect.get) {
15430         _get = Reflect.get.bind();
15431       } else {
15432         _get = function _get2(target, property, receiver) {
15433           var base = _superPropBase(target, property);
15434           if (!base)
15435             return;
15436           var desc = Object.getOwnPropertyDescriptor(base, property);
15437           if (desc.get) {
15438             return desc.get.call(arguments.length < 3 ? target : receiver);
15439           }
15440           return desc.value;
15441         };
15442       }
15443       return _get.apply(this, arguments);
15444     }
15445     var Emitter = /* @__PURE__ */ function() {
15446       function Emitter2() {
15447         _classCallCheck(this, Emitter2);
15448         Object.defineProperty(this, "listeners", {
15449           value: {},
15450           writable: true,
15451           configurable: true
15452         });
15453       }
15454       _createClass(Emitter2, [{
15455         key: "addEventListener",
15456         value: function addEventListener(type2, callback, options2) {
15457           if (!(type2 in this.listeners)) {
15458             this.listeners[type2] = [];
15459           }
15460           this.listeners[type2].push({
15461             callback,
15462             options: options2
15463           });
15464         }
15465       }, {
15466         key: "removeEventListener",
15467         value: function removeEventListener(type2, callback) {
15468           if (!(type2 in this.listeners)) {
15469             return;
15470           }
15471           var stack = this.listeners[type2];
15472           for (var i3 = 0, l2 = stack.length; i3 < l2; i3++) {
15473             if (stack[i3].callback === callback) {
15474               stack.splice(i3, 1);
15475               return;
15476             }
15477           }
15478         }
15479       }, {
15480         key: "dispatchEvent",
15481         value: function dispatchEvent2(event) {
15482           if (!(event.type in this.listeners)) {
15483             return;
15484           }
15485           var stack = this.listeners[event.type];
15486           var stackToCall = stack.slice();
15487           for (var i3 = 0, l2 = stackToCall.length; i3 < l2; i3++) {
15488             var listener = stackToCall[i3];
15489             try {
15490               listener.callback.call(this, event);
15491             } catch (e3) {
15492               Promise.resolve().then(function() {
15493                 throw e3;
15494               });
15495             }
15496             if (listener.options && listener.options.once) {
15497               this.removeEventListener(event.type, listener.callback);
15498             }
15499           }
15500           return !event.defaultPrevented;
15501         }
15502       }]);
15503       return Emitter2;
15504     }();
15505     var AbortSignal = /* @__PURE__ */ function(_Emitter) {
15506       _inherits(AbortSignal2, _Emitter);
15507       var _super = _createSuper(AbortSignal2);
15508       function AbortSignal2() {
15509         var _this;
15510         _classCallCheck(this, AbortSignal2);
15511         _this = _super.call(this);
15512         if (!_this.listeners) {
15513           Emitter.call(_assertThisInitialized(_this));
15514         }
15515         Object.defineProperty(_assertThisInitialized(_this), "aborted", {
15516           value: false,
15517           writable: true,
15518           configurable: true
15519         });
15520         Object.defineProperty(_assertThisInitialized(_this), "onabort", {
15521           value: null,
15522           writable: true,
15523           configurable: true
15524         });
15525         Object.defineProperty(_assertThisInitialized(_this), "reason", {
15526           value: void 0,
15527           writable: true,
15528           configurable: true
15529         });
15530         return _this;
15531       }
15532       _createClass(AbortSignal2, [{
15533         key: "toString",
15534         value: function toString2() {
15535           return "[object AbortSignal]";
15536         }
15537       }, {
15538         key: "dispatchEvent",
15539         value: function dispatchEvent2(event) {
15540           if (event.type === "abort") {
15541             this.aborted = true;
15542             if (typeof this.onabort === "function") {
15543               this.onabort.call(this, event);
15544             }
15545           }
15546           _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
15547         }
15548       }]);
15549       return AbortSignal2;
15550     }(Emitter);
15551     var AbortController2 = /* @__PURE__ */ function() {
15552       function AbortController3() {
15553         _classCallCheck(this, AbortController3);
15554         Object.defineProperty(this, "signal", {
15555           value: new AbortSignal(),
15556           writable: true,
15557           configurable: true
15558         });
15559       }
15560       _createClass(AbortController3, [{
15561         key: "abort",
15562         value: function abort(reason) {
15563           var event;
15564           try {
15565             event = new Event("abort");
15566           } catch (e3) {
15567             if (typeof document !== "undefined") {
15568               if (!document.createEvent) {
15569                 event = document.createEventObject();
15570                 event.type = "abort";
15571               } else {
15572                 event = document.createEvent("Event");
15573                 event.initEvent("abort", false, false);
15574               }
15575             } else {
15576               event = {
15577                 type: "abort",
15578                 bubbles: false,
15579                 cancelable: false
15580               };
15581             }
15582           }
15583           var signalReason = reason;
15584           if (signalReason === void 0) {
15585             if (typeof document === "undefined") {
15586               signalReason = new Error("This operation was aborted");
15587               signalReason.name = "AbortError";
15588             } else {
15589               try {
15590                 signalReason = new DOMException("signal is aborted without reason");
15591               } catch (err) {
15592                 signalReason = new Error("This operation was aborted");
15593                 signalReason.name = "AbortError";
15594               }
15595             }
15596           }
15597           this.signal.reason = signalReason;
15598           this.signal.dispatchEvent(event);
15599         }
15600       }, {
15601         key: "toString",
15602         value: function toString2() {
15603           return "[object AbortController]";
15604         }
15605       }]);
15606       return AbortController3;
15607     }();
15608     if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
15609       AbortController2.prototype[Symbol.toStringTag] = "AbortController";
15610       AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
15611     }
15612     function polyfillNeeded(self2) {
15613       if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15614         console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
15615         return true;
15616       }
15617       return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
15618     }
15619     function abortableFetchDecorator(patchTargets) {
15620       if ("function" === typeof patchTargets) {
15621         patchTargets = {
15622           fetch: patchTargets
15623         };
15624       }
15625       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;
15626       if (!polyfillNeeded({
15627         fetch: fetch3,
15628         Request: NativeRequest,
15629         AbortController: NativeAbortController,
15630         __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
15631       })) {
15632         return {
15633           fetch: fetch3,
15634           Request: Request2
15635         };
15636       }
15637       var Request2 = NativeRequest;
15638       if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15639         Request2 = function Request3(input, init2) {
15640           var signal;
15641           if (init2 && init2.signal) {
15642             signal = init2.signal;
15643             delete init2.signal;
15644           }
15645           var request3 = new NativeRequest(input, init2);
15646           if (signal) {
15647             Object.defineProperty(request3, "signal", {
15648               writable: false,
15649               enumerable: false,
15650               configurable: true,
15651               value: signal
15652             });
15653           }
15654           return request3;
15655         };
15656         Request2.prototype = NativeRequest.prototype;
15657       }
15658       var realFetch = fetch3;
15659       var abortableFetch = function abortableFetch2(input, init2) {
15660         var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
15661         if (signal) {
15662           var abortError;
15663           try {
15664             abortError = new DOMException("Aborted", "AbortError");
15665           } catch (err) {
15666             abortError = new Error("Aborted");
15667             abortError.name = "AbortError";
15668           }
15669           if (signal.aborted) {
15670             return Promise.reject(abortError);
15671           }
15672           var cancellation = new Promise(function(_2, reject) {
15673             signal.addEventListener("abort", function() {
15674               return reject(abortError);
15675             }, {
15676               once: true
15677             });
15678           });
15679           if (init2 && init2.signal) {
15680             delete init2.signal;
15681           }
15682           return Promise.race([cancellation, realFetch(input, init2)]);
15683         }
15684         return realFetch(input, init2);
15685       };
15686       return {
15687         fetch: abortableFetch,
15688         Request: Request2
15689       };
15690     }
15691     (function(self2) {
15692       if (!polyfillNeeded(self2)) {
15693         return;
15694       }
15695       if (!self2.fetch) {
15696         console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
15697         return;
15698       }
15699       var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
15700       self2.fetch = fetch3;
15701       self2.Request = Request2;
15702       Object.defineProperty(self2, "AbortController", {
15703         writable: true,
15704         enumerable: false,
15705         configurable: true,
15706         value: AbortController2
15707       });
15708       Object.defineProperty(self2, "AbortSignal", {
15709         writable: true,
15710         enumerable: false,
15711         configurable: true,
15712         value: AbortSignal
15713       });
15714     })(typeof self !== "undefined" ? self : global);
15715   });
15716
15717   // modules/index.js
15718   var modules_exports = {};
15719   __export(modules_exports, {
15720     LocationManager: () => LocationManager,
15721     QAItem: () => QAItem,
15722     actionAddEntity: () => actionAddEntity,
15723     actionAddMember: () => actionAddMember,
15724     actionAddMidpoint: () => actionAddMidpoint,
15725     actionAddVertex: () => actionAddVertex,
15726     actionChangeMember: () => actionChangeMember,
15727     actionChangePreset: () => actionChangePreset,
15728     actionChangeTags: () => actionChangeTags,
15729     actionCircularize: () => actionCircularize,
15730     actionConnect: () => actionConnect,
15731     actionCopyEntities: () => actionCopyEntities,
15732     actionDeleteMember: () => actionDeleteMember,
15733     actionDeleteMultiple: () => actionDeleteMultiple,
15734     actionDeleteNode: () => actionDeleteNode,
15735     actionDeleteRelation: () => actionDeleteRelation,
15736     actionDeleteWay: () => actionDeleteWay,
15737     actionDiscardTags: () => actionDiscardTags,
15738     actionDisconnect: () => actionDisconnect,
15739     actionExtract: () => actionExtract,
15740     actionJoin: () => actionJoin,
15741     actionMerge: () => actionMerge,
15742     actionMergeNodes: () => actionMergeNodes,
15743     actionMergePolygon: () => actionMergePolygon,
15744     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
15745     actionMove: () => actionMove,
15746     actionMoveMember: () => actionMoveMember,
15747     actionMoveNode: () => actionMoveNode,
15748     actionNoop: () => actionNoop,
15749     actionOrthogonalize: () => actionOrthogonalize,
15750     actionReflect: () => actionReflect,
15751     actionRestrictTurn: () => actionRestrictTurn,
15752     actionReverse: () => actionReverse,
15753     actionRevert: () => actionRevert,
15754     actionRotate: () => actionRotate,
15755     actionScale: () => actionScale,
15756     actionSplit: () => actionSplit,
15757     actionStraightenNodes: () => actionStraightenNodes,
15758     actionStraightenWay: () => actionStraightenWay,
15759     actionUnrestrictTurn: () => actionUnrestrictTurn,
15760     actionUpgradeTags: () => actionUpgradeTags,
15761     behaviorAddWay: () => behaviorAddWay,
15762     behaviorBreathe: () => behaviorBreathe,
15763     behaviorDrag: () => behaviorDrag,
15764     behaviorDraw: () => behaviorDraw,
15765     behaviorDrawWay: () => behaviorDrawWay,
15766     behaviorEdit: () => behaviorEdit,
15767     behaviorHash: () => behaviorHash,
15768     behaviorHover: () => behaviorHover,
15769     behaviorLasso: () => behaviorLasso,
15770     behaviorOperation: () => behaviorOperation,
15771     behaviorPaste: () => behaviorPaste,
15772     behaviorSelect: () => behaviorSelect,
15773     coreContext: () => coreContext,
15774     coreDifference: () => coreDifference,
15775     coreFileFetcher: () => coreFileFetcher,
15776     coreGraph: () => coreGraph,
15777     coreHistory: () => coreHistory,
15778     coreLocalizer: () => coreLocalizer,
15779     coreTree: () => coreTree,
15780     coreUploader: () => coreUploader,
15781     coreValidator: () => coreValidator,
15782     d3: () => d3,
15783     debug: () => debug,
15784     fileFetcher: () => _mainFileFetcher,
15785     geoAngle: () => geoAngle,
15786     geoChooseEdge: () => geoChooseEdge,
15787     geoEdgeEqual: () => geoEdgeEqual,
15788     geoExtent: () => geoExtent,
15789     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
15790     geoHasLineIntersections: () => geoHasLineIntersections,
15791     geoHasSelfIntersections: () => geoHasSelfIntersections,
15792     geoLatToMeters: () => geoLatToMeters,
15793     geoLineIntersection: () => geoLineIntersection,
15794     geoLonToMeters: () => geoLonToMeters,
15795     geoMetersToLat: () => geoMetersToLat,
15796     geoMetersToLon: () => geoMetersToLon,
15797     geoMetersToOffset: () => geoMetersToOffset,
15798     geoOffsetToMeters: () => geoOffsetToMeters,
15799     geoOrthoCalcScore: () => geoOrthoCalcScore,
15800     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
15801     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
15802     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
15803     geoPathHasIntersections: () => geoPathHasIntersections,
15804     geoPathIntersections: () => geoPathIntersections,
15805     geoPathLength: () => geoPathLength,
15806     geoPointInPolygon: () => geoPointInPolygon,
15807     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
15808     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
15809     geoRawMercator: () => geoRawMercator,
15810     geoRotate: () => geoRotate,
15811     geoScaleToZoom: () => geoScaleToZoom,
15812     geoSphericalClosestNode: () => geoSphericalClosestNode,
15813     geoSphericalDistance: () => geoSphericalDistance,
15814     geoVecAdd: () => geoVecAdd,
15815     geoVecAngle: () => geoVecAngle,
15816     geoVecCross: () => geoVecCross,
15817     geoVecDot: () => geoVecDot,
15818     geoVecEqual: () => geoVecEqual,
15819     geoVecFloor: () => geoVecFloor,
15820     geoVecInterp: () => geoVecInterp,
15821     geoVecLength: () => geoVecLength,
15822     geoVecLengthSquare: () => geoVecLengthSquare,
15823     geoVecNormalize: () => geoVecNormalize,
15824     geoVecNormalizedDot: () => geoVecNormalizedDot,
15825     geoVecProject: () => geoVecProject,
15826     geoVecScale: () => geoVecScale,
15827     geoVecSubtract: () => geoVecSubtract,
15828     geoViewportEdge: () => geoViewportEdge,
15829     geoZoomToScale: () => geoZoomToScale,
15830     likelyRawNumberFormat: () => likelyRawNumberFormat,
15831     localizer: () => _mainLocalizer,
15832     locationManager: () => _sharedLocationManager,
15833     modeAddArea: () => modeAddArea,
15834     modeAddLine: () => modeAddLine,
15835     modeAddNote: () => modeAddNote,
15836     modeAddPoint: () => modeAddPoint,
15837     modeBrowse: () => modeBrowse,
15838     modeDragNode: () => modeDragNode,
15839     modeDragNote: () => modeDragNote,
15840     modeDrawArea: () => modeDrawArea,
15841     modeDrawLine: () => modeDrawLine,
15842     modeMove: () => modeMove,
15843     modeRotate: () => modeRotate,
15844     modeSave: () => modeSave,
15845     modeSelect: () => modeSelect,
15846     modeSelectData: () => modeSelectData,
15847     modeSelectError: () => modeSelectError,
15848     modeSelectNote: () => modeSelectNote,
15849     operationCircularize: () => operationCircularize,
15850     operationContinue: () => operationContinue,
15851     operationCopy: () => operationCopy,
15852     operationDelete: () => operationDelete,
15853     operationDisconnect: () => operationDisconnect,
15854     operationDowngrade: () => operationDowngrade,
15855     operationExtract: () => operationExtract,
15856     operationMerge: () => operationMerge,
15857     operationMove: () => operationMove,
15858     operationOrthogonalize: () => operationOrthogonalize,
15859     operationPaste: () => operationPaste,
15860     operationReflectLong: () => operationReflectLong,
15861     operationReflectShort: () => operationReflectShort,
15862     operationReverse: () => operationReverse,
15863     operationRotate: () => operationRotate,
15864     operationSplit: () => operationSplit,
15865     operationStraighten: () => operationStraighten,
15866     osmAreaKeys: () => osmAreaKeys,
15867     osmChangeset: () => osmChangeset,
15868     osmEntity: () => osmEntity,
15869     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
15870     osmInferRestriction: () => osmInferRestriction,
15871     osmIntersection: () => osmIntersection,
15872     osmIsInterestingTag: () => osmIsInterestingTag,
15873     osmIsOldMultipolygonOuterMember: () => osmIsOldMultipolygonOuterMember,
15874     osmJoinWays: () => osmJoinWays,
15875     osmLanes: () => osmLanes,
15876     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
15877     osmNode: () => osmNode,
15878     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
15879     osmNote: () => osmNote,
15880     osmOldMultipolygonOuterMember: () => osmOldMultipolygonOuterMember,
15881     osmOldMultipolygonOuterMemberOfRelation: () => osmOldMultipolygonOuterMemberOfRelation,
15882     osmOneWayTags: () => osmOneWayTags,
15883     osmPavedTags: () => osmPavedTags,
15884     osmPointTags: () => osmPointTags,
15885     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
15886     osmRelation: () => osmRelation,
15887     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
15888     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
15889     osmSetAreaKeys: () => osmSetAreaKeys,
15890     osmSetPointTags: () => osmSetPointTags,
15891     osmSetVertexTags: () => osmSetVertexTags,
15892     osmTagSuggestingArea: () => osmTagSuggestingArea,
15893     osmTurn: () => osmTurn,
15894     osmVertexTags: () => osmVertexTags,
15895     osmWay: () => osmWay,
15896     prefs: () => corePreferences,
15897     presetCategory: () => presetCategory,
15898     presetCollection: () => presetCollection,
15899     presetField: () => presetField,
15900     presetIndex: () => presetIndex,
15901     presetManager: () => _mainPresetIndex,
15902     presetPreset: () => presetPreset,
15903     rendererBackground: () => rendererBackground,
15904     rendererBackgroundSource: () => rendererBackgroundSource,
15905     rendererFeatures: () => rendererFeatures,
15906     rendererMap: () => rendererMap,
15907     rendererPhotos: () => rendererPhotos,
15908     rendererTileLayer: () => rendererTileLayer,
15909     serviceImproveOSM: () => improveOSM_default,
15910     serviceKartaview: () => kartaview_default,
15911     serviceKeepRight: () => keepRight_default,
15912     serviceMapRules: () => maprules_default,
15913     serviceMapilio: () => mapilio_default,
15914     serviceMapillary: () => mapillary_default,
15915     serviceNominatim: () => nominatim_default,
15916     serviceNsi: () => nsi_default,
15917     serviceOsm: () => osm_default,
15918     serviceOsmWikibase: () => osm_wikibase_default,
15919     serviceOsmose: () => osmose_default,
15920     serviceStreetside: () => streetside_default,
15921     serviceTaginfo: () => taginfo_default,
15922     serviceVectorTile: () => vector_tile_default,
15923     serviceVegbilder: () => vegbilder_default,
15924     serviceWikidata: () => wikidata_default,
15925     serviceWikipedia: () => wikipedia_default,
15926     services: () => services,
15927     svgAreas: () => svgAreas,
15928     svgData: () => svgData,
15929     svgDebug: () => svgDebug,
15930     svgDefs: () => svgDefs,
15931     svgGeolocate: () => svgGeolocate,
15932     svgIcon: () => svgIcon,
15933     svgKartaviewImages: () => svgKartaviewImages,
15934     svgKeepRight: () => svgKeepRight,
15935     svgLabels: () => svgLabels,
15936     svgLayers: () => svgLayers,
15937     svgLines: () => svgLines,
15938     svgMapilioImages: () => svgMapilioImages,
15939     svgMapillaryImages: () => svgMapillaryImages,
15940     svgMapillarySigns: () => svgMapillarySigns,
15941     svgMarkerSegments: () => svgMarkerSegments,
15942     svgMidpoints: () => svgMidpoints,
15943     svgNotes: () => svgNotes,
15944     svgOsm: () => svgOsm,
15945     svgPassiveVertex: () => svgPassiveVertex,
15946     svgPath: () => svgPath,
15947     svgPointTransform: () => svgPointTransform,
15948     svgPoints: () => svgPoints,
15949     svgRelationMemberTags: () => svgRelationMemberTags,
15950     svgSegmentWay: () => svgSegmentWay,
15951     svgStreetside: () => svgStreetside,
15952     svgTagClasses: () => svgTagClasses,
15953     svgTagPattern: () => svgTagPattern,
15954     svgTouch: () => svgTouch,
15955     svgTurns: () => svgTurns,
15956     svgVegbilder: () => svgVegbilder,
15957     svgVertices: () => svgVertices,
15958     t: () => _t,
15959     uiAccount: () => uiAccount,
15960     uiAttribution: () => uiAttribution,
15961     uiChangesetEditor: () => uiChangesetEditor,
15962     uiCmd: () => uiCmd,
15963     uiCombobox: () => uiCombobox,
15964     uiCommit: () => uiCommit,
15965     uiCommitWarnings: () => uiCommitWarnings,
15966     uiConfirm: () => uiConfirm,
15967     uiConflicts: () => uiConflicts,
15968     uiContributors: () => uiContributors,
15969     uiCurtain: () => uiCurtain,
15970     uiDataEditor: () => uiDataEditor,
15971     uiDataHeader: () => uiDataHeader,
15972     uiDisclosure: () => uiDisclosure,
15973     uiEditMenu: () => uiEditMenu,
15974     uiEntityEditor: () => uiEntityEditor,
15975     uiFeatureInfo: () => uiFeatureInfo,
15976     uiFeatureList: () => uiFeatureList,
15977     uiField: () => uiField,
15978     uiFieldAccess: () => uiFieldAccess,
15979     uiFieldAddress: () => uiFieldAddress,
15980     uiFieldCheck: () => uiFieldCheck,
15981     uiFieldColour: () => uiFieldText,
15982     uiFieldCombo: () => uiFieldCombo,
15983     uiFieldDefaultCheck: () => uiFieldCheck,
15984     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
15985     uiFieldEmail: () => uiFieldText,
15986     uiFieldHelp: () => uiFieldHelp,
15987     uiFieldIdentifier: () => uiFieldText,
15988     uiFieldLanes: () => uiFieldLanes,
15989     uiFieldLocalized: () => uiFieldLocalized,
15990     uiFieldManyCombo: () => uiFieldCombo,
15991     uiFieldMultiCombo: () => uiFieldCombo,
15992     uiFieldNetworkCombo: () => uiFieldCombo,
15993     uiFieldNumber: () => uiFieldText,
15994     uiFieldOnewayCheck: () => uiFieldCheck,
15995     uiFieldRadio: () => uiFieldRadio,
15996     uiFieldRestrictions: () => uiFieldRestrictions,
15997     uiFieldRoadheight: () => uiFieldRoadheight,
15998     uiFieldRoadspeed: () => uiFieldRoadspeed,
15999     uiFieldSemiCombo: () => uiFieldCombo,
16000     uiFieldStructureRadio: () => uiFieldRadio,
16001     uiFieldTel: () => uiFieldText,
16002     uiFieldText: () => uiFieldText,
16003     uiFieldTextarea: () => uiFieldTextarea,
16004     uiFieldTypeCombo: () => uiFieldCombo,
16005     uiFieldUrl: () => uiFieldText,
16006     uiFieldWikidata: () => uiFieldWikidata,
16007     uiFieldWikipedia: () => uiFieldWikipedia,
16008     uiFields: () => uiFields,
16009     uiFlash: () => uiFlash,
16010     uiFormFields: () => uiFormFields,
16011     uiFullScreen: () => uiFullScreen,
16012     uiGeolocate: () => uiGeolocate,
16013     uiImproveOsmComments: () => uiImproveOsmComments,
16014     uiImproveOsmDetails: () => uiImproveOsmDetails,
16015     uiImproveOsmEditor: () => uiImproveOsmEditor,
16016     uiImproveOsmHeader: () => uiImproveOsmHeader,
16017     uiInfo: () => uiInfo,
16018     uiInfoPanels: () => uiInfoPanels,
16019     uiInit: () => uiInit,
16020     uiInspector: () => uiInspector,
16021     uiIntro: () => uiIntro,
16022     uiIssuesInfo: () => uiIssuesInfo,
16023     uiKeepRightDetails: () => uiKeepRightDetails,
16024     uiKeepRightEditor: () => uiKeepRightEditor,
16025     uiKeepRightHeader: () => uiKeepRightHeader,
16026     uiLasso: () => uiLasso,
16027     uiLengthIndicator: () => uiLengthIndicator,
16028     uiLoading: () => uiLoading,
16029     uiMapInMap: () => uiMapInMap,
16030     uiModal: () => uiModal,
16031     uiNoteComments: () => uiNoteComments,
16032     uiNoteEditor: () => uiNoteEditor,
16033     uiNoteHeader: () => uiNoteHeader,
16034     uiNoteReport: () => uiNoteReport,
16035     uiNotice: () => uiNotice,
16036     uiPaneBackground: () => uiPaneBackground,
16037     uiPaneHelp: () => uiPaneHelp,
16038     uiPaneIssues: () => uiPaneIssues,
16039     uiPaneMapData: () => uiPaneMapData,
16040     uiPanePreferences: () => uiPanePreferences,
16041     uiPanelBackground: () => uiPanelBackground,
16042     uiPanelHistory: () => uiPanelHistory,
16043     uiPanelLocation: () => uiPanelLocation,
16044     uiPanelMeasurement: () => uiPanelMeasurement,
16045     uiPopover: () => uiPopover,
16046     uiPresetIcon: () => uiPresetIcon,
16047     uiPresetList: () => uiPresetList,
16048     uiRestore: () => uiRestore,
16049     uiScale: () => uiScale,
16050     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
16051     uiSectionBackgroundList: () => uiSectionBackgroundList,
16052     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
16053     uiSectionChanges: () => uiSectionChanges,
16054     uiSectionDataLayers: () => uiSectionDataLayers,
16055     uiSectionEntityIssues: () => uiSectionEntityIssues,
16056     uiSectionFeatureType: () => uiSectionFeatureType,
16057     uiSectionMapFeatures: () => uiSectionMapFeatures,
16058     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
16059     uiSectionOverlayList: () => uiSectionOverlayList,
16060     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
16061     uiSectionPresetFields: () => uiSectionPresetFields,
16062     uiSectionPrivacy: () => uiSectionPrivacy,
16063     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
16064     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
16065     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
16066     uiSectionSelectionList: () => uiSectionSelectionList,
16067     uiSectionValidationIssues: () => uiSectionValidationIssues,
16068     uiSectionValidationOptions: () => uiSectionValidationOptions,
16069     uiSectionValidationRules: () => uiSectionValidationRules,
16070     uiSectionValidationStatus: () => uiSectionValidationStatus,
16071     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
16072     uiSettingsCustomData: () => uiSettingsCustomData,
16073     uiSidebar: () => uiSidebar,
16074     uiSourceSwitch: () => uiSourceSwitch,
16075     uiSpinner: () => uiSpinner,
16076     uiSplash: () => uiSplash,
16077     uiStatus: () => uiStatus,
16078     uiSuccess: () => uiSuccess,
16079     uiTagReference: () => uiTagReference,
16080     uiToggle: () => uiToggle,
16081     uiTooltip: () => uiTooltip,
16082     uiVersion: () => uiVersion,
16083     uiViewOnKeepRight: () => uiViewOnKeepRight,
16084     uiViewOnOSM: () => uiViewOnOSM,
16085     uiZoom: () => uiZoom,
16086     utilAesDecrypt: () => utilAesDecrypt,
16087     utilAesEncrypt: () => utilAesEncrypt,
16088     utilArrayChunk: () => utilArrayChunk,
16089     utilArrayDifference: () => utilArrayDifference,
16090     utilArrayFlatten: () => utilArrayFlatten,
16091     utilArrayGroupBy: () => utilArrayGroupBy,
16092     utilArrayIdentical: () => utilArrayIdentical,
16093     utilArrayIntersection: () => utilArrayIntersection,
16094     utilArrayUnion: () => utilArrayUnion,
16095     utilArrayUniq: () => utilArrayUniq,
16096     utilArrayUniqBy: () => utilArrayUniqBy,
16097     utilAsyncMap: () => utilAsyncMap,
16098     utilCleanOsmString: () => utilCleanOsmString,
16099     utilCleanTags: () => utilCleanTags,
16100     utilCombinedTags: () => utilCombinedTags,
16101     utilCompareIDs: () => utilCompareIDs,
16102     utilDeepMemberSelector: () => utilDeepMemberSelector,
16103     utilDetect: () => utilDetect,
16104     utilDisplayLabel: () => utilDisplayLabel,
16105     utilDisplayName: () => utilDisplayName,
16106     utilDisplayNameForPath: () => utilDisplayNameForPath,
16107     utilDisplayType: () => utilDisplayType,
16108     utilEditDistance: () => utilEditDistance,
16109     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
16110     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
16111     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
16112     utilEntityRoot: () => utilEntityRoot,
16113     utilEntitySelector: () => utilEntitySelector,
16114     utilFastMouse: () => utilFastMouse,
16115     utilFunctor: () => utilFunctor,
16116     utilGetAllNodes: () => utilGetAllNodes,
16117     utilGetSetValue: () => utilGetSetValue,
16118     utilHashcode: () => utilHashcode,
16119     utilHighlightEntities: () => utilHighlightEntities,
16120     utilKeybinding: () => utilKeybinding,
16121     utilNoAuto: () => utilNoAuto,
16122     utilObjectOmit: () => utilObjectOmit,
16123     utilOldestID: () => utilOldestID,
16124     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
16125     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
16126     utilQsString: () => utilQsString,
16127     utilRebind: () => utilRebind,
16128     utilSafeClassName: () => utilSafeClassName,
16129     utilSessionMutex: () => utilSessionMutex,
16130     utilSetTransform: () => utilSetTransform,
16131     utilStringQs: () => utilStringQs,
16132     utilTagDiff: () => utilTagDiff,
16133     utilTagText: () => utilTagText,
16134     utilTiler: () => utilTiler,
16135     utilTotalExtent: () => utilTotalExtent,
16136     utilTriggerEvent: () => utilTriggerEvent,
16137     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
16138     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
16139     utilUniqueDomId: () => utilUniqueDomId,
16140     utilWrap: () => utilWrap,
16141     validationAlmostJunction: () => validationAlmostJunction,
16142     validationCloseNodes: () => validationCloseNodes,
16143     validationCrossingWays: () => validationCrossingWays,
16144     validationDisconnectedWay: () => validationDisconnectedWay,
16145     validationFormatting: () => validationFormatting,
16146     validationHelpRequest: () => validationHelpRequest,
16147     validationImpossibleOneway: () => validationImpossibleOneway,
16148     validationIncompatibleSource: () => validationIncompatibleSource,
16149     validationMaprules: () => validationMaprules,
16150     validationMismatchedGeometry: () => validationMismatchedGeometry,
16151     validationMissingRole: () => validationMissingRole,
16152     validationMissingTag: () => validationMissingTag,
16153     validationOutdatedTags: () => validationOutdatedTags,
16154     validationPrivateData: () => validationPrivateData,
16155     validationSuspiciousName: () => validationSuspiciousName,
16156     validationUnsquareWay: () => validationUnsquareWay
16157   });
16158
16159   // modules/actions/add_entity.js
16160   function actionAddEntity(way) {
16161     return function(graph) {
16162       return graph.replace(way);
16163     };
16164   }
16165
16166   // modules/actions/reverse.js
16167   function actionReverse(entityID, options2) {
16168     var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
16169     var numeric = /^([+\-]?)(?=[\d.])/;
16170     var directionKey = /direction$/;
16171     var turn_lanes = /^turn:lanes:?/;
16172     var keyReplacements = [
16173       [/:right$/, ":left"],
16174       [/:left$/, ":right"],
16175       [/:forward$/, ":backward"],
16176       [/:backward$/, ":forward"],
16177       [/:right:/, ":left:"],
16178       [/:left:/, ":right:"],
16179       [/:forward:/, ":backward:"],
16180       [/:backward:/, ":forward:"]
16181     ];
16182     var valueReplacements = {
16183       left: "right",
16184       right: "left",
16185       up: "down",
16186       down: "up",
16187       forward: "backward",
16188       backward: "forward",
16189       forwards: "backward",
16190       backwards: "forward"
16191     };
16192     var roleReplacements = {
16193       forward: "backward",
16194       backward: "forward",
16195       forwards: "backward",
16196       backwards: "forward"
16197     };
16198     var onewayReplacements = {
16199       yes: "-1",
16200       "1": "-1",
16201       "-1": "yes"
16202     };
16203     var compassReplacements = {
16204       N: "S",
16205       NNE: "SSW",
16206       NE: "SW",
16207       ENE: "WSW",
16208       E: "W",
16209       ESE: "WNW",
16210       SE: "NW",
16211       SSE: "NNW",
16212       S: "N",
16213       SSW: "NNE",
16214       SW: "NE",
16215       WSW: "ENE",
16216       W: "E",
16217       WNW: "ESE",
16218       NW: "SE",
16219       NNW: "SSE"
16220     };
16221     function reverseKey(key) {
16222       for (var i3 = 0; i3 < keyReplacements.length; ++i3) {
16223         var replacement = keyReplacements[i3];
16224         if (replacement[0].test(key)) {
16225           return key.replace(replacement[0], replacement[1]);
16226         }
16227       }
16228       return key;
16229     }
16230     function reverseValue(key, value, includeAbsolute) {
16231       if (ignoreKey.test(key))
16232         return value;
16233       if (turn_lanes.test(key)) {
16234         return value;
16235       } else if (key === "incline" && numeric.test(value)) {
16236         return value.replace(numeric, function(_2, sign2) {
16237           return sign2 === "-" ? "" : "-";
16238         });
16239       } else if (options2 && options2.reverseOneway && key === "oneway") {
16240         return onewayReplacements[value] || value;
16241       } else if (includeAbsolute && directionKey.test(key)) {
16242         return value.split(";").map((value2) => {
16243           if (compassReplacements[value2])
16244             return compassReplacements[value2];
16245           var degrees3 = Number(value2);
16246           if (isFinite(degrees3)) {
16247             if (degrees3 < 180) {
16248               degrees3 += 180;
16249             } else {
16250               degrees3 -= 180;
16251             }
16252             return degrees3.toString();
16253           } else {
16254             return valueReplacements[value2] || value2;
16255           }
16256         }).join(";");
16257       }
16258       return valueReplacements[value] || value;
16259     }
16260     function reverseNodeTags(graph, nodeIDs) {
16261       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
16262         var node = graph.hasEntity(nodeIDs[i3]);
16263         if (!node || !Object.keys(node.tags).length)
16264           continue;
16265         var tags = {};
16266         for (var key in node.tags) {
16267           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID);
16268         }
16269         graph = graph.replace(node.update({ tags }));
16270       }
16271       return graph;
16272     }
16273     function reverseWay(graph, way) {
16274       var nodes = way.nodes.slice().reverse();
16275       var tags = {};
16276       var role;
16277       for (var key in way.tags) {
16278         tags[reverseKey(key)] = reverseValue(key, way.tags[key]);
16279       }
16280       graph.parentRelations(way).forEach(function(relation) {
16281         relation.members.forEach(function(member, index) {
16282           if (member.id === way.id && (role = roleReplacements[member.role])) {
16283             relation = relation.updateMember({ role }, index);
16284             graph = graph.replace(relation);
16285           }
16286         });
16287       });
16288       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
16289     }
16290     var action = function(graph) {
16291       var entity = graph.entity(entityID);
16292       if (entity.type === "way") {
16293         return reverseWay(graph, entity);
16294       }
16295       return reverseNodeTags(graph, [entityID]);
16296     };
16297     action.disabled = function(graph) {
16298       var entity = graph.hasEntity(entityID);
16299       if (!entity || entity.type === "way")
16300         return false;
16301       for (var key in entity.tags) {
16302         var value = entity.tags[key];
16303         if (reverseKey(key) !== key || reverseValue(key, value, true) !== value) {
16304           return false;
16305         }
16306       }
16307       return "nondirectional_node";
16308     };
16309     action.entityID = function() {
16310       return entityID;
16311     };
16312     return action;
16313   }
16314
16315   // modules/osm/tags.js
16316   function osmIsInterestingTag(key) {
16317     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
16318     key.indexOf("tiger:") !== 0;
16319   }
16320   var osmLifecyclePrefixes = {
16321     // nonexistent, might be built
16322     proposed: true,
16323     planned: true,
16324     // under maintentance or between groundbreaking and opening
16325     construction: true,
16326     // existent but not functional
16327     disused: true,
16328     // dilapidated to nonexistent
16329     abandoned: true,
16330     was: true,
16331     // nonexistent, still may appear in imagery
16332     dismantled: true,
16333     razed: true,
16334     demolished: true,
16335     destroyed: true,
16336     removed: true,
16337     obliterated: true,
16338     // existent occasionally, e.g. stormwater drainage basin
16339     intermittent: true
16340   };
16341   function osmRemoveLifecyclePrefix(key) {
16342     const keySegments = key.split(":");
16343     if (keySegments.length === 1)
16344       return key;
16345     if (keySegments[0] in osmLifecyclePrefixes) {
16346       return key.slice(keySegments[0].length + 1);
16347     }
16348     return key;
16349   }
16350   var osmAreaKeys = {};
16351   function osmSetAreaKeys(value) {
16352     osmAreaKeys = value;
16353   }
16354   var osmAreaKeysExceptions = {
16355     highway: {
16356       elevator: true,
16357       rest_area: true,
16358       services: true
16359     },
16360     public_transport: {
16361       platform: true
16362     },
16363     railway: {
16364       platform: true,
16365       roundhouse: true,
16366       station: true,
16367       traverser: true,
16368       turntable: true,
16369       wash: true
16370     },
16371     traffic_calming: {
16372       island: true
16373     },
16374     waterway: {
16375       dam: true
16376     }
16377   };
16378   function osmTagSuggestingArea(tags) {
16379     if (tags.area === "yes")
16380       return { area: "yes" };
16381     if (tags.area === "no")
16382       return null;
16383     var returnTags = {};
16384     for (var realKey in tags) {
16385       const key = osmRemoveLifecyclePrefix(realKey);
16386       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
16387         returnTags[realKey] = tags[realKey];
16388         return returnTags;
16389       }
16390       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
16391         returnTags[realKey] = tags[realKey];
16392         return returnTags;
16393       }
16394     }
16395     return null;
16396   }
16397   var osmLineTags = {};
16398   function osmSetLineTags(value) {
16399     osmLineTags = value;
16400   }
16401   var osmPointTags = {};
16402   function osmSetPointTags(value) {
16403     osmPointTags = value;
16404   }
16405   var osmVertexTags = {};
16406   function osmSetVertexTags(value) {
16407     osmVertexTags = value;
16408   }
16409   function osmNodeGeometriesForTags(nodeTags) {
16410     var geometries = {};
16411     for (var key in nodeTags) {
16412       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
16413         geometries.point = true;
16414       }
16415       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
16416         geometries.vertex = true;
16417       }
16418       if (geometries.point && geometries.vertex)
16419         break;
16420     }
16421     return geometries;
16422   }
16423   var osmOneWayTags = {
16424     "aerialway": {
16425       "chair_lift": true,
16426       "drag_lift": true,
16427       "j-bar": true,
16428       "magic_carpet": true,
16429       "mixed_lift": true,
16430       "platter": true,
16431       "rope_tow": true,
16432       "t-bar": true,
16433       "zip_line": true
16434     },
16435     "highway": {
16436       "motorway": true
16437     },
16438     "junction": {
16439       "circular": true,
16440       "roundabout": true
16441     },
16442     "man_made": {
16443       "goods_conveyor": true,
16444       "piste:halfpipe": true
16445     },
16446     "piste:type": {
16447       "downhill": true,
16448       "sled": true,
16449       "yes": true
16450     },
16451     "seamark:type": {
16452       "two-way_route": true,
16453       "recommended_traffic_lane": true,
16454       "separation_lane": true,
16455       "separation_roundabout": true
16456     },
16457     "waterway": {
16458       "canal": true,
16459       "ditch": true,
16460       "drain": true,
16461       "fish_pass": true,
16462       "pressurised": true,
16463       "river": true,
16464       "spillway": true,
16465       "stream": true,
16466       "tidal_channel": true
16467     }
16468   };
16469   var osmPavedTags = {
16470     "surface": {
16471       "paved": true,
16472       "asphalt": true,
16473       "concrete": true,
16474       "chipseal": true,
16475       "concrete:lanes": true,
16476       "concrete:plates": true
16477     },
16478     "tracktype": {
16479       "grade1": true
16480     }
16481   };
16482   var osmSemipavedTags = {
16483     "surface": {
16484       "cobblestone": true,
16485       "cobblestone:flattened": true,
16486       "unhewn_cobblestone": true,
16487       "sett": true,
16488       "paving_stones": true,
16489       "metal": true,
16490       "wood": true
16491     }
16492   };
16493   var osmRightSideIsInsideTags = {
16494     "natural": {
16495       "cliff": true,
16496       "coastline": "coastline"
16497     },
16498     "barrier": {
16499       "retaining_wall": true,
16500       "kerb": true,
16501       "guard_rail": true,
16502       "city_wall": true
16503     },
16504     "man_made": {
16505       "embankment": true,
16506       "quay": true
16507     },
16508     "waterway": {
16509       "weir": true
16510     }
16511   };
16512   var osmRoutableHighwayTagValues = {
16513     motorway: true,
16514     trunk: true,
16515     primary: true,
16516     secondary: true,
16517     tertiary: true,
16518     residential: true,
16519     motorway_link: true,
16520     trunk_link: true,
16521     primary_link: true,
16522     secondary_link: true,
16523     tertiary_link: true,
16524     unclassified: true,
16525     road: true,
16526     service: true,
16527     track: true,
16528     living_street: true,
16529     bus_guideway: true,
16530     path: true,
16531     footway: true,
16532     cycleway: true,
16533     bridleway: true,
16534     pedestrian: true,
16535     corridor: true,
16536     steps: true
16537   };
16538   var osmPathHighwayTagValues = {
16539     path: true,
16540     footway: true,
16541     cycleway: true,
16542     bridleway: true,
16543     pedestrian: true,
16544     corridor: true,
16545     steps: true
16546   };
16547   var osmRailwayTrackTagValues = {
16548     rail: true,
16549     light_rail: true,
16550     tram: true,
16551     subway: true,
16552     monorail: true,
16553     funicular: true,
16554     miniature: true,
16555     narrow_gauge: true,
16556     disused: true,
16557     preserved: true
16558   };
16559   var osmFlowingWaterwayTagValues = {
16560     canal: true,
16561     ditch: true,
16562     drain: true,
16563     fish_pass: true,
16564     river: true,
16565     stream: true,
16566     tidal_channel: true
16567   };
16568   var allowUpperCaseTagValues = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale|traffic_sign/;
16569
16570   // node_modules/d3-array/src/ascending.js
16571   function ascending(a2, b2) {
16572     return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
16573   }
16574
16575   // node_modules/d3-array/src/descending.js
16576   function descending(a2, b2) {
16577     return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
16578   }
16579
16580   // node_modules/d3-array/src/bisector.js
16581   function bisector(f3) {
16582     let compare1, compare2, delta;
16583     if (f3.length !== 2) {
16584       compare1 = ascending;
16585       compare2 = (d2, x2) => ascending(f3(d2), x2);
16586       delta = (d2, x2) => f3(d2) - x2;
16587     } else {
16588       compare1 = f3 === ascending || f3 === descending ? f3 : zero;
16589       compare2 = f3;
16590       delta = f3;
16591     }
16592     function left(a2, x2, lo = 0, hi = a2.length) {
16593       if (lo < hi) {
16594         if (compare1(x2, x2) !== 0)
16595           return hi;
16596         do {
16597           const mid = lo + hi >>> 1;
16598           if (compare2(a2[mid], x2) < 0)
16599             lo = mid + 1;
16600           else
16601             hi = mid;
16602         } while (lo < hi);
16603       }
16604       return lo;
16605     }
16606     function right(a2, x2, lo = 0, hi = a2.length) {
16607       if (lo < hi) {
16608         if (compare1(x2, x2) !== 0)
16609           return hi;
16610         do {
16611           const mid = lo + hi >>> 1;
16612           if (compare2(a2[mid], x2) <= 0)
16613             lo = mid + 1;
16614           else
16615             hi = mid;
16616         } while (lo < hi);
16617       }
16618       return lo;
16619     }
16620     function center(a2, x2, lo = 0, hi = a2.length) {
16621       const i3 = left(a2, x2, lo, hi - 1);
16622       return i3 > lo && delta(a2[i3 - 1], x2) > -delta(a2[i3], x2) ? i3 - 1 : i3;
16623     }
16624     return { left, center, right };
16625   }
16626   function zero() {
16627     return 0;
16628   }
16629
16630   // node_modules/d3-array/src/number.js
16631   function number(x2) {
16632     return x2 === null ? NaN : +x2;
16633   }
16634   function* numbers(values, valueof) {
16635     if (valueof === void 0) {
16636       for (let value of values) {
16637         if (value != null && (value = +value) >= value) {
16638           yield value;
16639         }
16640       }
16641     } else {
16642       let index = -1;
16643       for (let value of values) {
16644         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
16645           yield value;
16646         }
16647       }
16648     }
16649   }
16650
16651   // node_modules/d3-array/src/bisect.js
16652   var ascendingBisect = bisector(ascending);
16653   var bisectRight = ascendingBisect.right;
16654   var bisectLeft = ascendingBisect.left;
16655   var bisectCenter = bisector(number).center;
16656   var bisect_default = bisectRight;
16657
16658   // node_modules/d3-array/src/fsum.js
16659   var Adder = class {
16660     constructor() {
16661       this._partials = new Float64Array(32);
16662       this._n = 0;
16663     }
16664     add(x2) {
16665       const p2 = this._partials;
16666       let i3 = 0;
16667       for (let j3 = 0; j3 < this._n && j3 < 32; j3++) {
16668         const y2 = p2[j3], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
16669         if (lo)
16670           p2[i3++] = lo;
16671         x2 = hi;
16672       }
16673       p2[i3] = x2;
16674       this._n = i3 + 1;
16675       return this;
16676     }
16677     valueOf() {
16678       const p2 = this._partials;
16679       let n3 = this._n, x2, y2, lo, hi = 0;
16680       if (n3 > 0) {
16681         hi = p2[--n3];
16682         while (n3 > 0) {
16683           x2 = hi;
16684           y2 = p2[--n3];
16685           hi = x2 + y2;
16686           lo = y2 - (hi - x2);
16687           if (lo)
16688             break;
16689         }
16690         if (n3 > 0 && (lo < 0 && p2[n3 - 1] < 0 || lo > 0 && p2[n3 - 1] > 0)) {
16691           y2 = lo * 2;
16692           x2 = hi + y2;
16693           if (y2 == x2 - hi)
16694             hi = x2;
16695         }
16696       }
16697       return hi;
16698     }
16699   };
16700
16701   // node_modules/d3-array/src/sort.js
16702   function compareDefined(compare = ascending) {
16703     if (compare === ascending)
16704       return ascendingDefined;
16705     if (typeof compare !== "function")
16706       throw new TypeError("compare is not a function");
16707     return (a2, b2) => {
16708       const x2 = compare(a2, b2);
16709       if (x2 || x2 === 0)
16710         return x2;
16711       return (compare(b2, b2) === 0) - (compare(a2, a2) === 0);
16712     };
16713   }
16714   function ascendingDefined(a2, b2) {
16715     return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
16716   }
16717
16718   // node_modules/d3-array/src/ticks.js
16719   var e10 = Math.sqrt(50);
16720   var e5 = Math.sqrt(10);
16721   var e2 = Math.sqrt(2);
16722   function ticks(start2, stop, count) {
16723     var reverse, i3 = -1, n3, ticks2, step;
16724     stop = +stop, start2 = +start2, count = +count;
16725     if (start2 === stop && count > 0)
16726       return [start2];
16727     if (reverse = stop < start2)
16728       n3 = start2, start2 = stop, stop = n3;
16729     if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step))
16730       return [];
16731     if (step > 0) {
16732       let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
16733       if (r0 * step < start2)
16734         ++r0;
16735       if (r1 * step > stop)
16736         --r1;
16737       ticks2 = new Array(n3 = r1 - r0 + 1);
16738       while (++i3 < n3)
16739         ticks2[i3] = (r0 + i3) * step;
16740     } else {
16741       step = -step;
16742       let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
16743       if (r0 / step < start2)
16744         ++r0;
16745       if (r1 / step > stop)
16746         --r1;
16747       ticks2 = new Array(n3 = r1 - r0 + 1);
16748       while (++i3 < n3)
16749         ticks2[i3] = (r0 + i3) / step;
16750     }
16751     if (reverse)
16752       ticks2.reverse();
16753     return ticks2;
16754   }
16755   function tickIncrement(start2, stop, count) {
16756     var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
16757     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);
16758   }
16759   function tickStep(start2, stop, count) {
16760     var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
16761     if (error >= e10)
16762       step1 *= 10;
16763     else if (error >= e5)
16764       step1 *= 5;
16765     else if (error >= e2)
16766       step1 *= 2;
16767     return stop < start2 ? -step1 : step1;
16768   }
16769
16770   // node_modules/d3-array/src/max.js
16771   function max(values, valueof) {
16772     let max3;
16773     if (valueof === void 0) {
16774       for (const value of values) {
16775         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
16776           max3 = value;
16777         }
16778       }
16779     } else {
16780       let index = -1;
16781       for (let value of values) {
16782         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
16783           max3 = value;
16784         }
16785       }
16786     }
16787     return max3;
16788   }
16789
16790   // node_modules/d3-array/src/min.js
16791   function min(values, valueof) {
16792     let min3;
16793     if (valueof === void 0) {
16794       for (const value of values) {
16795         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
16796           min3 = value;
16797         }
16798       }
16799     } else {
16800       let index = -1;
16801       for (let value of values) {
16802         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
16803           min3 = value;
16804         }
16805       }
16806     }
16807     return min3;
16808   }
16809
16810   // node_modules/d3-array/src/quickselect.js
16811   function quickselect(array2, k2, left = 0, right = array2.length - 1, compare) {
16812     compare = compare === void 0 ? ascendingDefined : compareDefined(compare);
16813     while (right > left) {
16814       if (right - left > 600) {
16815         const n3 = right - left + 1;
16816         const m2 = k2 - left + 1;
16817         const z2 = Math.log(n3);
16818         const s2 = 0.5 * Math.exp(2 * z2 / 3);
16819         const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
16820         const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
16821         const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
16822         quickselect(array2, k2, newLeft, newRight, compare);
16823       }
16824       const t2 = array2[k2];
16825       let i3 = left;
16826       let j3 = right;
16827       swap(array2, left, k2);
16828       if (compare(array2[right], t2) > 0)
16829         swap(array2, left, right);
16830       while (i3 < j3) {
16831         swap(array2, i3, j3), ++i3, --j3;
16832         while (compare(array2[i3], t2) < 0)
16833           ++i3;
16834         while (compare(array2[j3], t2) > 0)
16835           --j3;
16836       }
16837       if (compare(array2[left], t2) === 0)
16838         swap(array2, left, j3);
16839       else
16840         ++j3, swap(array2, j3, right);
16841       if (j3 <= k2)
16842         left = j3 + 1;
16843       if (k2 <= j3)
16844         right = j3 - 1;
16845     }
16846     return array2;
16847   }
16848   function swap(array2, i3, j3) {
16849     const t2 = array2[i3];
16850     array2[i3] = array2[j3];
16851     array2[j3] = t2;
16852   }
16853
16854   // node_modules/d3-array/src/quantile.js
16855   function quantile(values, p2, valueof) {
16856     values = Float64Array.from(numbers(values, valueof));
16857     if (!(n3 = values.length))
16858       return;
16859     if ((p2 = +p2) <= 0 || n3 < 2)
16860       return min(values);
16861     if (p2 >= 1)
16862       return max(values);
16863     var n3, i3 = (n3 - 1) * p2, i0 = Math.floor(i3), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
16864     return value0 + (value1 - value0) * (i3 - i0);
16865   }
16866
16867   // node_modules/d3-array/src/median.js
16868   function median(values, valueof) {
16869     return quantile(values, 0.5, valueof);
16870   }
16871
16872   // node_modules/d3-array/src/merge.js
16873   function* flatten(arrays) {
16874     for (const array2 of arrays) {
16875       yield* array2;
16876     }
16877   }
16878   function merge(arrays) {
16879     return Array.from(flatten(arrays));
16880   }
16881
16882   // node_modules/d3-array/src/pairs.js
16883   function pairs(values, pairof = pair) {
16884     const pairs2 = [];
16885     let previous;
16886     let first = false;
16887     for (const value of values) {
16888       if (first)
16889         pairs2.push(pairof(previous, value));
16890       previous = value;
16891       first = true;
16892     }
16893     return pairs2;
16894   }
16895   function pair(a2, b2) {
16896     return [a2, b2];
16897   }
16898
16899   // node_modules/d3-array/src/range.js
16900   function range(start2, stop, step) {
16901     start2 = +start2, stop = +stop, step = (n3 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n3 < 3 ? 1 : +step;
16902     var i3 = -1, n3 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n3);
16903     while (++i3 < n3) {
16904       range3[i3] = start2 + i3 * step;
16905     }
16906     return range3;
16907   }
16908
16909   // node_modules/d3-geo/src/math.js
16910   var epsilon = 1e-6;
16911   var epsilon2 = 1e-12;
16912   var pi = Math.PI;
16913   var halfPi = pi / 2;
16914   var quarterPi = pi / 4;
16915   var tau = pi * 2;
16916   var degrees = 180 / pi;
16917   var radians = pi / 180;
16918   var abs = Math.abs;
16919   var atan = Math.atan;
16920   var atan2 = Math.atan2;
16921   var cos = Math.cos;
16922   var exp = Math.exp;
16923   var log = Math.log;
16924   var sin = Math.sin;
16925   var sign = Math.sign || function(x2) {
16926     return x2 > 0 ? 1 : x2 < 0 ? -1 : 0;
16927   };
16928   var sqrt = Math.sqrt;
16929   var tan = Math.tan;
16930   function acos(x2) {
16931     return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
16932   }
16933   function asin(x2) {
16934     return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2);
16935   }
16936
16937   // node_modules/d3-geo/src/noop.js
16938   function noop() {
16939   }
16940
16941   // node_modules/d3-geo/src/stream.js
16942   function streamGeometry(geometry, stream) {
16943     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
16944       streamGeometryType[geometry.type](geometry, stream);
16945     }
16946   }
16947   var streamObjectType = {
16948     Feature: function(object, stream) {
16949       streamGeometry(object.geometry, stream);
16950     },
16951     FeatureCollection: function(object, stream) {
16952       var features = object.features, i3 = -1, n3 = features.length;
16953       while (++i3 < n3)
16954         streamGeometry(features[i3].geometry, stream);
16955     }
16956   };
16957   var streamGeometryType = {
16958     Sphere: function(object, stream) {
16959       stream.sphere();
16960     },
16961     Point: function(object, stream) {
16962       object = object.coordinates;
16963       stream.point(object[0], object[1], object[2]);
16964     },
16965     MultiPoint: function(object, stream) {
16966       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
16967       while (++i3 < n3)
16968         object = coordinates[i3], stream.point(object[0], object[1], object[2]);
16969     },
16970     LineString: function(object, stream) {
16971       streamLine(object.coordinates, stream, 0);
16972     },
16973     MultiLineString: function(object, stream) {
16974       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
16975       while (++i3 < n3)
16976         streamLine(coordinates[i3], stream, 0);
16977     },
16978     Polygon: function(object, stream) {
16979       streamPolygon(object.coordinates, stream);
16980     },
16981     MultiPolygon: function(object, stream) {
16982       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
16983       while (++i3 < n3)
16984         streamPolygon(coordinates[i3], stream);
16985     },
16986     GeometryCollection: function(object, stream) {
16987       var geometries = object.geometries, i3 = -1, n3 = geometries.length;
16988       while (++i3 < n3)
16989         streamGeometry(geometries[i3], stream);
16990     }
16991   };
16992   function streamLine(coordinates, stream, closed) {
16993     var i3 = -1, n3 = coordinates.length - closed, coordinate;
16994     stream.lineStart();
16995     while (++i3 < n3)
16996       coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
16997     stream.lineEnd();
16998   }
16999   function streamPolygon(coordinates, stream) {
17000     var i3 = -1, n3 = coordinates.length;
17001     stream.polygonStart();
17002     while (++i3 < n3)
17003       streamLine(coordinates[i3], stream, 1);
17004     stream.polygonEnd();
17005   }
17006   function stream_default(object, stream) {
17007     if (object && streamObjectType.hasOwnProperty(object.type)) {
17008       streamObjectType[object.type](object, stream);
17009     } else {
17010       streamGeometry(object, stream);
17011     }
17012   }
17013
17014   // node_modules/d3-geo/src/area.js
17015   var areaRingSum = new Adder();
17016   var areaSum = new Adder();
17017   var lambda00;
17018   var phi00;
17019   var lambda0;
17020   var cosPhi0;
17021   var sinPhi0;
17022   var areaStream = {
17023     point: noop,
17024     lineStart: noop,
17025     lineEnd: noop,
17026     polygonStart: function() {
17027       areaRingSum = new Adder();
17028       areaStream.lineStart = areaRingStart;
17029       areaStream.lineEnd = areaRingEnd;
17030     },
17031     polygonEnd: function() {
17032       var areaRing = +areaRingSum;
17033       areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
17034       this.lineStart = this.lineEnd = this.point = noop;
17035     },
17036     sphere: function() {
17037       areaSum.add(tau);
17038     }
17039   };
17040   function areaRingStart() {
17041     areaStream.point = areaPointFirst;
17042   }
17043   function areaRingEnd() {
17044     areaPoint(lambda00, phi00);
17045   }
17046   function areaPointFirst(lambda, phi) {
17047     areaStream.point = areaPoint;
17048     lambda00 = lambda, phi00 = phi;
17049     lambda *= radians, phi *= radians;
17050     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
17051   }
17052   function areaPoint(lambda, phi) {
17053     lambda *= radians, phi *= radians;
17054     phi = phi / 2 + quarterPi;
17055     var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k2 = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k2 * cos(adLambda), v2 = k2 * sdLambda * sin(adLambda);
17056     areaRingSum.add(atan2(v2, u2));
17057     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
17058   }
17059   function area_default(object) {
17060     areaSum = new Adder();
17061     stream_default(object, areaStream);
17062     return areaSum * 2;
17063   }
17064
17065   // node_modules/d3-geo/src/cartesian.js
17066   function spherical(cartesian2) {
17067     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
17068   }
17069   function cartesian(spherical2) {
17070     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
17071     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
17072   }
17073   function cartesianDot(a2, b2) {
17074     return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2];
17075   }
17076   function cartesianCross(a2, b2) {
17077     return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]];
17078   }
17079   function cartesianAddInPlace(a2, b2) {
17080     a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2];
17081   }
17082   function cartesianScale(vector, k2) {
17083     return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
17084   }
17085   function cartesianNormalizeInPlace(d2) {
17086     var l2 = sqrt(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]);
17087     d2[0] /= l2, d2[1] /= l2, d2[2] /= l2;
17088   }
17089
17090   // node_modules/d3-geo/src/bounds.js
17091   var lambda02;
17092   var phi0;
17093   var lambda1;
17094   var phi1;
17095   var lambda2;
17096   var lambda002;
17097   var phi002;
17098   var p0;
17099   var deltaSum;
17100   var ranges;
17101   var range2;
17102   var boundsStream = {
17103     point: boundsPoint,
17104     lineStart: boundsLineStart,
17105     lineEnd: boundsLineEnd,
17106     polygonStart: function() {
17107       boundsStream.point = boundsRingPoint;
17108       boundsStream.lineStart = boundsRingStart;
17109       boundsStream.lineEnd = boundsRingEnd;
17110       deltaSum = new Adder();
17111       areaStream.polygonStart();
17112     },
17113     polygonEnd: function() {
17114       areaStream.polygonEnd();
17115       boundsStream.point = boundsPoint;
17116       boundsStream.lineStart = boundsLineStart;
17117       boundsStream.lineEnd = boundsLineEnd;
17118       if (areaRingSum < 0)
17119         lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
17120       else if (deltaSum > epsilon)
17121         phi1 = 90;
17122       else if (deltaSum < -epsilon)
17123         phi0 = -90;
17124       range2[0] = lambda02, range2[1] = lambda1;
17125     },
17126     sphere: function() {
17127       lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
17128     }
17129   };
17130   function boundsPoint(lambda, phi) {
17131     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
17132     if (phi < phi0)
17133       phi0 = phi;
17134     if (phi > phi1)
17135       phi1 = phi;
17136   }
17137   function linePoint(lambda, phi) {
17138     var p2 = cartesian([lambda * radians, phi * radians]);
17139     if (p0) {
17140       var normal = cartesianCross(p0, p2), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
17141       cartesianNormalizeInPlace(inflection);
17142       inflection = spherical(inflection);
17143       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
17144       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
17145         phii = inflection[1] * degrees;
17146         if (phii > phi1)
17147           phi1 = phii;
17148       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
17149         phii = -inflection[1] * degrees;
17150         if (phii < phi0)
17151           phi0 = phii;
17152       } else {
17153         if (phi < phi0)
17154           phi0 = phi;
17155         if (phi > phi1)
17156           phi1 = phi;
17157       }
17158       if (antimeridian) {
17159         if (lambda < lambda2) {
17160           if (angle(lambda02, lambda) > angle(lambda02, lambda1))
17161             lambda1 = lambda;
17162         } else {
17163           if (angle(lambda, lambda1) > angle(lambda02, lambda1))
17164             lambda02 = lambda;
17165         }
17166       } else {
17167         if (lambda1 >= lambda02) {
17168           if (lambda < lambda02)
17169             lambda02 = lambda;
17170           if (lambda > lambda1)
17171             lambda1 = lambda;
17172         } else {
17173           if (lambda > lambda2) {
17174             if (angle(lambda02, lambda) > angle(lambda02, lambda1))
17175               lambda1 = lambda;
17176           } else {
17177             if (angle(lambda, lambda1) > angle(lambda02, lambda1))
17178               lambda02 = lambda;
17179           }
17180         }
17181       }
17182     } else {
17183       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
17184     }
17185     if (phi < phi0)
17186       phi0 = phi;
17187     if (phi > phi1)
17188       phi1 = phi;
17189     p0 = p2, lambda2 = lambda;
17190   }
17191   function boundsLineStart() {
17192     boundsStream.point = linePoint;
17193   }
17194   function boundsLineEnd() {
17195     range2[0] = lambda02, range2[1] = lambda1;
17196     boundsStream.point = boundsPoint;
17197     p0 = null;
17198   }
17199   function boundsRingPoint(lambda, phi) {
17200     if (p0) {
17201       var delta = lambda - lambda2;
17202       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
17203     } else {
17204       lambda002 = lambda, phi002 = phi;
17205     }
17206     areaStream.point(lambda, phi);
17207     linePoint(lambda, phi);
17208   }
17209   function boundsRingStart() {
17210     areaStream.lineStart();
17211   }
17212   function boundsRingEnd() {
17213     boundsRingPoint(lambda002, phi002);
17214     areaStream.lineEnd();
17215     if (abs(deltaSum) > epsilon)
17216       lambda02 = -(lambda1 = 180);
17217     range2[0] = lambda02, range2[1] = lambda1;
17218     p0 = null;
17219   }
17220   function angle(lambda04, lambda12) {
17221     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
17222   }
17223   function rangeCompare(a2, b2) {
17224     return a2[0] - b2[0];
17225   }
17226   function rangeContains(range3, x2) {
17227     return range3[0] <= range3[1] ? range3[0] <= x2 && x2 <= range3[1] : x2 < range3[0] || range3[1] < x2;
17228   }
17229   function bounds_default(feature3) {
17230     var i3, n3, a2, b2, merged, deltaMax, delta;
17231     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
17232     ranges = [];
17233     stream_default(feature3, boundsStream);
17234     if (n3 = ranges.length) {
17235       ranges.sort(rangeCompare);
17236       for (i3 = 1, a2 = ranges[0], merged = [a2]; i3 < n3; ++i3) {
17237         b2 = ranges[i3];
17238         if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) {
17239           if (angle(a2[0], b2[1]) > angle(a2[0], a2[1]))
17240             a2[1] = b2[1];
17241           if (angle(b2[0], a2[1]) > angle(a2[0], a2[1]))
17242             a2[0] = b2[0];
17243         } else {
17244           merged.push(a2 = b2);
17245         }
17246       }
17247       for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a2 = merged[n3]; i3 <= n3; a2 = b2, ++i3) {
17248         b2 = merged[i3];
17249         if ((delta = angle(a2[1], b2[0])) > deltaMax)
17250           deltaMax = delta, lambda02 = b2[0], lambda1 = a2[1];
17251       }
17252     }
17253     ranges = range2 = null;
17254     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
17255   }
17256
17257   // node_modules/d3-geo/src/compose.js
17258   function compose_default(a2, b2) {
17259     function compose(x2, y2) {
17260       return x2 = a2(x2, y2), b2(x2[0], x2[1]);
17261     }
17262     if (a2.invert && b2.invert)
17263       compose.invert = function(x2, y2) {
17264         return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]);
17265       };
17266     return compose;
17267   }
17268
17269   // node_modules/d3-geo/src/rotation.js
17270   function rotationIdentity(lambda, phi) {
17271     return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
17272   }
17273   rotationIdentity.invert = rotationIdentity;
17274   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
17275     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
17276   }
17277   function forwardRotationLambda(deltaLambda) {
17278     return function(lambda, phi) {
17279       return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
17280     };
17281   }
17282   function rotationLambda(deltaLambda) {
17283     var rotation = forwardRotationLambda(deltaLambda);
17284     rotation.invert = forwardRotationLambda(-deltaLambda);
17285     return rotation;
17286   }
17287   function rotationPhiGamma(deltaPhi, deltaGamma) {
17288     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
17289     function rotation(lambda, phi) {
17290       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
17291       return [
17292         atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
17293         asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
17294       ];
17295     }
17296     rotation.invert = function(lambda, phi) {
17297       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
17298       return [
17299         atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
17300         asin(k2 * cosDeltaPhi - x2 * sinDeltaPhi)
17301       ];
17302     };
17303     return rotation;
17304   }
17305   function rotation_default(rotate) {
17306     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
17307     function forward(coordinates) {
17308       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
17309       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
17310     }
17311     forward.invert = function(coordinates) {
17312       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
17313       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
17314     };
17315     return forward;
17316   }
17317
17318   // node_modules/d3-geo/src/circle.js
17319   function circleStream(stream, radius, delta, direction, t0, t1) {
17320     if (!delta)
17321       return;
17322     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
17323     if (t0 == null) {
17324       t0 = radius + direction * tau;
17325       t1 = radius - step / 2;
17326     } else {
17327       t0 = circleRadius(cosRadius, t0);
17328       t1 = circleRadius(cosRadius, t1);
17329       if (direction > 0 ? t0 < t1 : t0 > t1)
17330         t0 += direction * tau;
17331     }
17332     for (var point2, t2 = t0; direction > 0 ? t2 > t1 : t2 < t1; t2 -= step) {
17333       point2 = spherical([cosRadius, -sinRadius * cos(t2), -sinRadius * sin(t2)]);
17334       stream.point(point2[0], point2[1]);
17335     }
17336   }
17337   function circleRadius(cosRadius, point2) {
17338     point2 = cartesian(point2), point2[0] -= cosRadius;
17339     cartesianNormalizeInPlace(point2);
17340     var radius = acos(-point2[1]);
17341     return ((-point2[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
17342   }
17343
17344   // node_modules/d3-geo/src/clip/buffer.js
17345   function buffer_default() {
17346     var lines = [], line;
17347     return {
17348       point: function(x2, y2, m2) {
17349         line.push([x2, y2, m2]);
17350       },
17351       lineStart: function() {
17352         lines.push(line = []);
17353       },
17354       lineEnd: noop,
17355       rejoin: function() {
17356         if (lines.length > 1)
17357           lines.push(lines.pop().concat(lines.shift()));
17358       },
17359       result: function() {
17360         var result = lines;
17361         lines = [];
17362         line = null;
17363         return result;
17364       }
17365     };
17366   }
17367
17368   // node_modules/d3-geo/src/pointEqual.js
17369   function pointEqual_default(a2, b2) {
17370     return abs(a2[0] - b2[0]) < epsilon && abs(a2[1] - b2[1]) < epsilon;
17371   }
17372
17373   // node_modules/d3-geo/src/clip/rejoin.js
17374   function Intersection(point2, points, other, entry) {
17375     this.x = point2;
17376     this.z = points;
17377     this.o = other;
17378     this.e = entry;
17379     this.v = false;
17380     this.n = this.p = null;
17381   }
17382   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
17383     var subject = [], clip = [], i3, n3;
17384     segments.forEach(function(segment) {
17385       if ((n4 = segment.length - 1) <= 0)
17386         return;
17387       var n4, p02 = segment[0], p1 = segment[n4], x2;
17388       if (pointEqual_default(p02, p1)) {
17389         if (!p02[2] && !p1[2]) {
17390           stream.lineStart();
17391           for (i3 = 0; i3 < n4; ++i3)
17392             stream.point((p02 = segment[i3])[0], p02[1]);
17393           stream.lineEnd();
17394           return;
17395         }
17396         p1[0] += 2 * epsilon;
17397       }
17398       subject.push(x2 = new Intersection(p02, segment, null, true));
17399       clip.push(x2.o = new Intersection(p02, null, x2, false));
17400       subject.push(x2 = new Intersection(p1, segment, null, false));
17401       clip.push(x2.o = new Intersection(p1, null, x2, true));
17402     });
17403     if (!subject.length)
17404       return;
17405     clip.sort(compareIntersection2);
17406     link(subject);
17407     link(clip);
17408     for (i3 = 0, n3 = clip.length; i3 < n3; ++i3) {
17409       clip[i3].e = startInside = !startInside;
17410     }
17411     var start2 = subject[0], points, point2;
17412     while (1) {
17413       var current = start2, isSubject = true;
17414       while (current.v)
17415         if ((current = current.n) === start2)
17416           return;
17417       points = current.z;
17418       stream.lineStart();
17419       do {
17420         current.v = current.o.v = true;
17421         if (current.e) {
17422           if (isSubject) {
17423             for (i3 = 0, n3 = points.length; i3 < n3; ++i3)
17424               stream.point((point2 = points[i3])[0], point2[1]);
17425           } else {
17426             interpolate(current.x, current.n.x, 1, stream);
17427           }
17428           current = current.n;
17429         } else {
17430           if (isSubject) {
17431             points = current.p.z;
17432             for (i3 = points.length - 1; i3 >= 0; --i3)
17433               stream.point((point2 = points[i3])[0], point2[1]);
17434           } else {
17435             interpolate(current.x, current.p.x, -1, stream);
17436           }
17437           current = current.p;
17438         }
17439         current = current.o;
17440         points = current.z;
17441         isSubject = !isSubject;
17442       } while (!current.v);
17443       stream.lineEnd();
17444     }
17445   }
17446   function link(array2) {
17447     if (!(n3 = array2.length))
17448       return;
17449     var n3, i3 = 0, a2 = array2[0], b2;
17450     while (++i3 < n3) {
17451       a2.n = b2 = array2[i3];
17452       b2.p = a2;
17453       a2 = b2;
17454     }
17455     a2.n = b2 = array2[0];
17456     b2.p = a2;
17457   }
17458
17459   // node_modules/d3-geo/src/polygonContains.js
17460   function longitude(point2) {
17461     return abs(point2[0]) <= pi ? point2[0] : sign(point2[0]) * ((abs(point2[0]) + pi) % tau - pi);
17462   }
17463   function polygonContains_default(polygon2, point2) {
17464     var lambda = longitude(point2), phi = point2[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
17465     var sum = new Adder();
17466     if (sinPhi === 1)
17467       phi = halfPi + epsilon;
17468     else if (sinPhi === -1)
17469       phi = -halfPi - epsilon;
17470     for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
17471       if (!(m2 = (ring = polygon2[i3]).length))
17472         continue;
17473       var ring, m2, point0 = ring[m2 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
17474       for (var j3 = 0; j3 < m2; ++j3, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
17475         var point1 = ring[j3], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k2 = sinPhi03 * sinPhi1;
17476         sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k2 * cos(absDelta)));
17477         angle2 += antimeridian ? delta + sign2 * tau : delta;
17478         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
17479           var arc = cartesianCross(cartesian(point0), cartesian(point1));
17480           cartesianNormalizeInPlace(arc);
17481           var intersection = cartesianCross(normal, arc);
17482           cartesianNormalizeInPlace(intersection);
17483           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
17484           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
17485             winding += antimeridian ^ delta >= 0 ? 1 : -1;
17486           }
17487         }
17488       }
17489     }
17490     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
17491   }
17492
17493   // node_modules/d3-geo/src/clip/index.js
17494   function clip_default(pointVisible, clipLine, interpolate, start2) {
17495     return function(sink) {
17496       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
17497       var clip = {
17498         point: point2,
17499         lineStart,
17500         lineEnd,
17501         polygonStart: function() {
17502           clip.point = pointRing;
17503           clip.lineStart = ringStart;
17504           clip.lineEnd = ringEnd;
17505           segments = [];
17506           polygon2 = [];
17507         },
17508         polygonEnd: function() {
17509           clip.point = point2;
17510           clip.lineStart = lineStart;
17511           clip.lineEnd = lineEnd;
17512           segments = merge(segments);
17513           var startInside = polygonContains_default(polygon2, start2);
17514           if (segments.length) {
17515             if (!polygonStarted)
17516               sink.polygonStart(), polygonStarted = true;
17517             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
17518           } else if (startInside) {
17519             if (!polygonStarted)
17520               sink.polygonStart(), polygonStarted = true;
17521             sink.lineStart();
17522             interpolate(null, null, 1, sink);
17523             sink.lineEnd();
17524           }
17525           if (polygonStarted)
17526             sink.polygonEnd(), polygonStarted = false;
17527           segments = polygon2 = null;
17528         },
17529         sphere: function() {
17530           sink.polygonStart();
17531           sink.lineStart();
17532           interpolate(null, null, 1, sink);
17533           sink.lineEnd();
17534           sink.polygonEnd();
17535         }
17536       };
17537       function point2(lambda, phi) {
17538         if (pointVisible(lambda, phi))
17539           sink.point(lambda, phi);
17540       }
17541       function pointLine(lambda, phi) {
17542         line.point(lambda, phi);
17543       }
17544       function lineStart() {
17545         clip.point = pointLine;
17546         line.lineStart();
17547       }
17548       function lineEnd() {
17549         clip.point = point2;
17550         line.lineEnd();
17551       }
17552       function pointRing(lambda, phi) {
17553         ring.push([lambda, phi]);
17554         ringSink.point(lambda, phi);
17555       }
17556       function ringStart() {
17557         ringSink.lineStart();
17558         ring = [];
17559       }
17560       function ringEnd() {
17561         pointRing(ring[0][0], ring[0][1]);
17562         ringSink.lineEnd();
17563         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n3 = ringSegments.length, m2, segment, point3;
17564         ring.pop();
17565         polygon2.push(ring);
17566         ring = null;
17567         if (!n3)
17568           return;
17569         if (clean2 & 1) {
17570           segment = ringSegments[0];
17571           if ((m2 = segment.length - 1) > 0) {
17572             if (!polygonStarted)
17573               sink.polygonStart(), polygonStarted = true;
17574             sink.lineStart();
17575             for (i3 = 0; i3 < m2; ++i3)
17576               sink.point((point3 = segment[i3])[0], point3[1]);
17577             sink.lineEnd();
17578           }
17579           return;
17580         }
17581         if (n3 > 1 && clean2 & 2)
17582           ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
17583         segments.push(ringSegments.filter(validSegment));
17584       }
17585       return clip;
17586     };
17587   }
17588   function validSegment(segment) {
17589     return segment.length > 1;
17590   }
17591   function compareIntersection(a2, b2) {
17592     return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi - epsilon : halfPi - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi - epsilon : halfPi - b2[1]);
17593   }
17594
17595   // node_modules/d3-geo/src/clip/antimeridian.js
17596   var antimeridian_default = clip_default(
17597     function() {
17598       return true;
17599     },
17600     clipAntimeridianLine,
17601     clipAntimeridianInterpolate,
17602     [-pi, -halfPi]
17603   );
17604   function clipAntimeridianLine(stream) {
17605     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
17606     return {
17607       lineStart: function() {
17608         stream.lineStart();
17609         clean2 = 1;
17610       },
17611       point: function(lambda12, phi12) {
17612         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
17613         if (abs(delta - pi) < epsilon) {
17614           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
17615           stream.point(sign0, phi02);
17616           stream.lineEnd();
17617           stream.lineStart();
17618           stream.point(sign1, phi02);
17619           stream.point(lambda12, phi02);
17620           clean2 = 0;
17621         } else if (sign0 !== sign1 && delta >= pi) {
17622           if (abs(lambda04 - sign0) < epsilon)
17623             lambda04 -= sign0 * epsilon;
17624           if (abs(lambda12 - sign1) < epsilon)
17625             lambda12 -= sign1 * epsilon;
17626           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
17627           stream.point(sign0, phi02);
17628           stream.lineEnd();
17629           stream.lineStart();
17630           stream.point(sign1, phi02);
17631           clean2 = 0;
17632         }
17633         stream.point(lambda04 = lambda12, phi02 = phi12);
17634         sign0 = sign1;
17635       },
17636       lineEnd: function() {
17637         stream.lineEnd();
17638         lambda04 = phi02 = NaN;
17639       },
17640       clean: function() {
17641         return 2 - clean2;
17642       }
17643     };
17644   }
17645   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
17646     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
17647     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;
17648   }
17649   function clipAntimeridianInterpolate(from, to, direction, stream) {
17650     var phi;
17651     if (from == null) {
17652       phi = direction * halfPi;
17653       stream.point(-pi, phi);
17654       stream.point(0, phi);
17655       stream.point(pi, phi);
17656       stream.point(pi, 0);
17657       stream.point(pi, -phi);
17658       stream.point(0, -phi);
17659       stream.point(-pi, -phi);
17660       stream.point(-pi, 0);
17661       stream.point(-pi, phi);
17662     } else if (abs(from[0] - to[0]) > epsilon) {
17663       var lambda = from[0] < to[0] ? pi : -pi;
17664       phi = direction * lambda / 2;
17665       stream.point(-lambda, phi);
17666       stream.point(0, phi);
17667       stream.point(lambda, phi);
17668     } else {
17669       stream.point(to[0], to[1]);
17670     }
17671   }
17672
17673   // node_modules/d3-geo/src/clip/circle.js
17674   function circle_default(radius) {
17675     var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
17676     function interpolate(from, to, direction, stream) {
17677       circleStream(stream, radius, delta, direction, from, to);
17678     }
17679     function visible(lambda, phi) {
17680       return cos(lambda) * cos(phi) > cr;
17681     }
17682     function clipLine(stream) {
17683       var point0, c0, v0, v00, clean2;
17684       return {
17685         lineStart: function() {
17686           v00 = v0 = false;
17687           clean2 = 1;
17688         },
17689         point: function(lambda, phi) {
17690           var point1 = [lambda, phi], point2, v2 = visible(lambda, phi), c2 = smallRadius ? v2 ? 0 : code(lambda, phi) : v2 ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
17691           if (!point0 && (v00 = v0 = v2))
17692             stream.lineStart();
17693           if (v2 !== v0) {
17694             point2 = intersect2(point0, point1);
17695             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
17696               point1[2] = 1;
17697           }
17698           if (v2 !== v0) {
17699             clean2 = 0;
17700             if (v2) {
17701               stream.lineStart();
17702               point2 = intersect2(point1, point0);
17703               stream.point(point2[0], point2[1]);
17704             } else {
17705               point2 = intersect2(point0, point1);
17706               stream.point(point2[0], point2[1], 2);
17707               stream.lineEnd();
17708             }
17709             point0 = point2;
17710           } else if (notHemisphere && point0 && smallRadius ^ v2) {
17711             var t2;
17712             if (!(c2 & c0) && (t2 = intersect2(point1, point0, true))) {
17713               clean2 = 0;
17714               if (smallRadius) {
17715                 stream.lineStart();
17716                 stream.point(t2[0][0], t2[0][1]);
17717                 stream.point(t2[1][0], t2[1][1]);
17718                 stream.lineEnd();
17719               } else {
17720                 stream.point(t2[1][0], t2[1][1]);
17721                 stream.lineEnd();
17722                 stream.lineStart();
17723                 stream.point(t2[0][0], t2[0][1], 3);
17724               }
17725             }
17726           }
17727           if (v2 && (!point0 || !pointEqual_default(point0, point1))) {
17728             stream.point(point1[0], point1[1]);
17729           }
17730           point0 = point1, v0 = v2, c0 = c2;
17731         },
17732         lineEnd: function() {
17733           if (v0)
17734             stream.lineEnd();
17735           point0 = null;
17736         },
17737         // Rejoin first and last segments if there were intersections and the first
17738         // and last points were visible.
17739         clean: function() {
17740           return clean2 | (v00 && v0) << 1;
17741         }
17742       };
17743     }
17744     function intersect2(a2, b2, two) {
17745       var pa = cartesian(a2), pb = cartesian(b2);
17746       var n1 = [1, 0, 0], n22 = cartesianCross(pa, pb), n2n2 = cartesianDot(n22, n22), n1n2 = n22[0], determinant = n2n2 - n1n2 * n1n2;
17747       if (!determinant)
17748         return !two && a2;
17749       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n22, c2);
17750       cartesianAddInPlace(A2, B2);
17751       var u2 = n1xn2, w2 = cartesianDot(A2, u2), uu = cartesianDot(u2, u2), t2 = w2 * w2 - uu * (cartesianDot(A2, A2) - 1);
17752       if (t2 < 0)
17753         return;
17754       var t3 = sqrt(t2), q2 = cartesianScale(u2, (-w2 - t3) / uu);
17755       cartesianAddInPlace(q2, A2);
17756       q2 = spherical(q2);
17757       if (!two)
17758         return q2;
17759       var lambda04 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2;
17760       if (lambda12 < lambda04)
17761         z2 = lambda04, lambda04 = lambda12, lambda12 = z2;
17762       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
17763       if (!polar && phi12 < phi02)
17764         z2 = phi02, phi02 = phi12, phi12 = z2;
17765       if (meridian ? polar ? phi02 + phi12 > 0 ^ q2[1] < (abs(q2[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q2[1] && q2[1] <= phi12 : delta2 > pi ^ (lambda04 <= q2[0] && q2[0] <= lambda12)) {
17766         var q1 = cartesianScale(u2, (-w2 + t3) / uu);
17767         cartesianAddInPlace(q1, A2);
17768         return [q2, spherical(q1)];
17769       }
17770     }
17771     function code(lambda, phi) {
17772       var r2 = smallRadius ? radius : pi - radius, code2 = 0;
17773       if (lambda < -r2)
17774         code2 |= 1;
17775       else if (lambda > r2)
17776         code2 |= 2;
17777       if (phi < -r2)
17778         code2 |= 4;
17779       else if (phi > r2)
17780         code2 |= 8;
17781       return code2;
17782     }
17783     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
17784   }
17785
17786   // node_modules/d3-geo/src/clip/line.js
17787   function line_default(a2, b2, x05, y05, x12, y12) {
17788     var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r2;
17789     r2 = x05 - ax;
17790     if (!dx && r2 > 0)
17791       return;
17792     r2 /= dx;
17793     if (dx < 0) {
17794       if (r2 < t0)
17795         return;
17796       if (r2 < t1)
17797         t1 = r2;
17798     } else if (dx > 0) {
17799       if (r2 > t1)
17800         return;
17801       if (r2 > t0)
17802         t0 = r2;
17803     }
17804     r2 = x12 - ax;
17805     if (!dx && r2 < 0)
17806       return;
17807     r2 /= dx;
17808     if (dx < 0) {
17809       if (r2 > t1)
17810         return;
17811       if (r2 > t0)
17812         t0 = r2;
17813     } else if (dx > 0) {
17814       if (r2 < t0)
17815         return;
17816       if (r2 < t1)
17817         t1 = r2;
17818     }
17819     r2 = y05 - ay;
17820     if (!dy && r2 > 0)
17821       return;
17822     r2 /= dy;
17823     if (dy < 0) {
17824       if (r2 < t0)
17825         return;
17826       if (r2 < t1)
17827         t1 = r2;
17828     } else if (dy > 0) {
17829       if (r2 > t1)
17830         return;
17831       if (r2 > t0)
17832         t0 = r2;
17833     }
17834     r2 = y12 - ay;
17835     if (!dy && r2 < 0)
17836       return;
17837     r2 /= dy;
17838     if (dy < 0) {
17839       if (r2 > t1)
17840         return;
17841       if (r2 > t0)
17842         t0 = r2;
17843     } else if (dy > 0) {
17844       if (r2 < t0)
17845         return;
17846       if (r2 < t1)
17847         t1 = r2;
17848     }
17849     if (t0 > 0)
17850       a2[0] = ax + t0 * dx, a2[1] = ay + t0 * dy;
17851     if (t1 < 1)
17852       b2[0] = ax + t1 * dx, b2[1] = ay + t1 * dy;
17853     return true;
17854   }
17855
17856   // node_modules/d3-geo/src/clip/rectangle.js
17857   var clipMax = 1e9;
17858   var clipMin = -clipMax;
17859   function clipRectangle(x05, y05, x12, y12) {
17860     function visible(x2, y2) {
17861       return x05 <= x2 && x2 <= x12 && y05 <= y2 && y2 <= y12;
17862     }
17863     function interpolate(from, to, direction, stream) {
17864       var a2 = 0, a1 = 0;
17865       if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
17866         do
17867           stream.point(a2 === 0 || a2 === 3 ? x05 : x12, a2 > 1 ? y12 : y05);
17868         while ((a2 = (a2 + direction + 4) % 4) !== a1);
17869       } else {
17870         stream.point(to[0], to[1]);
17871       }
17872     }
17873     function corner(p2, direction) {
17874       return abs(p2[0] - x05) < epsilon ? direction > 0 ? 0 : 3 : abs(p2[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p2[1] - y05) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
17875     }
17876     function compareIntersection2(a2, b2) {
17877       return comparePoint(a2.x, b2.x);
17878     }
17879     function comparePoint(a2, b2) {
17880       var ca = corner(a2, 1), cb = corner(b2, 1);
17881       return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[0];
17882     }
17883     return function(stream) {
17884       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
17885       var clipStream = {
17886         point: point2,
17887         lineStart,
17888         lineEnd,
17889         polygonStart,
17890         polygonEnd
17891       };
17892       function point2(x2, y2) {
17893         if (visible(x2, y2))
17894           activeStream.point(x2, y2);
17895       }
17896       function polygonInside() {
17897         var winding = 0;
17898         for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
17899           for (var ring2 = polygon2[i3], j3 = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j3 < m2; ++j3) {
17900             a0 = b0, a1 = b1, point3 = ring2[j3], b0 = point3[0], b1 = point3[1];
17901             if (a1 <= y12) {
17902               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0))
17903                 ++winding;
17904             } else {
17905               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0))
17906                 --winding;
17907             }
17908           }
17909         }
17910         return winding;
17911       }
17912       function polygonStart() {
17913         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
17914       }
17915       function polygonEnd() {
17916         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
17917         if (cleanInside || visible2) {
17918           stream.polygonStart();
17919           if (cleanInside) {
17920             stream.lineStart();
17921             interpolate(null, null, 1, stream);
17922             stream.lineEnd();
17923           }
17924           if (visible2) {
17925             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
17926           }
17927           stream.polygonEnd();
17928         }
17929         activeStream = stream, segments = polygon2 = ring = null;
17930       }
17931       function lineStart() {
17932         clipStream.point = linePoint2;
17933         if (polygon2)
17934           polygon2.push(ring = []);
17935         first = true;
17936         v_ = false;
17937         x_ = y_ = NaN;
17938       }
17939       function lineEnd() {
17940         if (segments) {
17941           linePoint2(x__, y__);
17942           if (v__ && v_)
17943             bufferStream.rejoin();
17944           segments.push(bufferStream.result());
17945         }
17946         clipStream.point = point2;
17947         if (v_)
17948           activeStream.lineEnd();
17949       }
17950       function linePoint2(x2, y2) {
17951         var v2 = visible(x2, y2);
17952         if (polygon2)
17953           ring.push([x2, y2]);
17954         if (first) {
17955           x__ = x2, y__ = y2, v__ = v2;
17956           first = false;
17957           if (v2) {
17958             activeStream.lineStart();
17959             activeStream.point(x2, y2);
17960           }
17961         } else {
17962           if (v2 && v_)
17963             activeStream.point(x2, y2);
17964           else {
17965             var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))];
17966             if (line_default(a2, b2, x05, y05, x12, y12)) {
17967               if (!v_) {
17968                 activeStream.lineStart();
17969                 activeStream.point(a2[0], a2[1]);
17970               }
17971               activeStream.point(b2[0], b2[1]);
17972               if (!v2)
17973                 activeStream.lineEnd();
17974               clean2 = false;
17975             } else if (v2) {
17976               activeStream.lineStart();
17977               activeStream.point(x2, y2);
17978               clean2 = false;
17979             }
17980           }
17981         }
17982         x_ = x2, y_ = y2, v_ = v2;
17983       }
17984       return clipStream;
17985     };
17986   }
17987
17988   // node_modules/d3-geo/src/length.js
17989   var lengthSum;
17990   var lambda03;
17991   var sinPhi02;
17992   var cosPhi02;
17993   var lengthStream = {
17994     sphere: noop,
17995     point: noop,
17996     lineStart: lengthLineStart,
17997     lineEnd: noop,
17998     polygonStart: noop,
17999     polygonEnd: noop
18000   };
18001   function lengthLineStart() {
18002     lengthStream.point = lengthPointFirst;
18003     lengthStream.lineEnd = lengthLineEnd;
18004   }
18005   function lengthLineEnd() {
18006     lengthStream.point = lengthStream.lineEnd = noop;
18007   }
18008   function lengthPointFirst(lambda, phi) {
18009     lambda *= radians, phi *= radians;
18010     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
18011     lengthStream.point = lengthPoint;
18012   }
18013   function lengthPoint(lambda, phi) {
18014     lambda *= radians, phi *= radians;
18015     var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda03), cosDelta = cos(delta), sinDelta = sin(delta), x2 = cosPhi * sinDelta, y2 = cosPhi02 * sinPhi - sinPhi02 * cosPhi * cosDelta, z2 = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
18016     lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z2));
18017     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
18018   }
18019   function length_default(object) {
18020     lengthSum = new Adder();
18021     stream_default(object, lengthStream);
18022     return +lengthSum;
18023   }
18024
18025   // node_modules/d3-geo/src/identity.js
18026   var identity_default = (x2) => x2;
18027
18028   // node_modules/d3-geo/src/path/area.js
18029   var areaSum2 = new Adder();
18030   var areaRingSum2 = new Adder();
18031   var x00;
18032   var y00;
18033   var x0;
18034   var y0;
18035   var areaStream2 = {
18036     point: noop,
18037     lineStart: noop,
18038     lineEnd: noop,
18039     polygonStart: function() {
18040       areaStream2.lineStart = areaRingStart2;
18041       areaStream2.lineEnd = areaRingEnd2;
18042     },
18043     polygonEnd: function() {
18044       areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
18045       areaSum2.add(abs(areaRingSum2));
18046       areaRingSum2 = new Adder();
18047     },
18048     result: function() {
18049       var area = areaSum2 / 2;
18050       areaSum2 = new Adder();
18051       return area;
18052     }
18053   };
18054   function areaRingStart2() {
18055     areaStream2.point = areaPointFirst2;
18056   }
18057   function areaPointFirst2(x2, y2) {
18058     areaStream2.point = areaPoint2;
18059     x00 = x0 = x2, y00 = y0 = y2;
18060   }
18061   function areaPoint2(x2, y2) {
18062     areaRingSum2.add(y0 * x2 - x0 * y2);
18063     x0 = x2, y0 = y2;
18064   }
18065   function areaRingEnd2() {
18066     areaPoint2(x00, y00);
18067   }
18068   var area_default2 = areaStream2;
18069
18070   // node_modules/d3-geo/src/path/bounds.js
18071   var x02 = Infinity;
18072   var y02 = x02;
18073   var x1 = -x02;
18074   var y1 = x1;
18075   var boundsStream2 = {
18076     point: boundsPoint2,
18077     lineStart: noop,
18078     lineEnd: noop,
18079     polygonStart: noop,
18080     polygonEnd: noop,
18081     result: function() {
18082       var bounds = [[x02, y02], [x1, y1]];
18083       x1 = y1 = -(y02 = x02 = Infinity);
18084       return bounds;
18085     }
18086   };
18087   function boundsPoint2(x2, y2) {
18088     if (x2 < x02)
18089       x02 = x2;
18090     if (x2 > x1)
18091       x1 = x2;
18092     if (y2 < y02)
18093       y02 = y2;
18094     if (y2 > y1)
18095       y1 = y2;
18096   }
18097   var bounds_default2 = boundsStream2;
18098
18099   // node_modules/d3-geo/src/path/centroid.js
18100   var X0 = 0;
18101   var Y0 = 0;
18102   var Z0 = 0;
18103   var X1 = 0;
18104   var Y1 = 0;
18105   var Z1 = 0;
18106   var X2 = 0;
18107   var Y2 = 0;
18108   var Z2 = 0;
18109   var x002;
18110   var y002;
18111   var x03;
18112   var y03;
18113   var centroidStream = {
18114     point: centroidPoint,
18115     lineStart: centroidLineStart,
18116     lineEnd: centroidLineEnd,
18117     polygonStart: function() {
18118       centroidStream.lineStart = centroidRingStart;
18119       centroidStream.lineEnd = centroidRingEnd;
18120     },
18121     polygonEnd: function() {
18122       centroidStream.point = centroidPoint;
18123       centroidStream.lineStart = centroidLineStart;
18124       centroidStream.lineEnd = centroidLineEnd;
18125     },
18126     result: function() {
18127       var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
18128       X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
18129       return centroid;
18130     }
18131   };
18132   function centroidPoint(x2, y2) {
18133     X0 += x2;
18134     Y0 += y2;
18135     ++Z0;
18136   }
18137   function centroidLineStart() {
18138     centroidStream.point = centroidPointFirstLine;
18139   }
18140   function centroidPointFirstLine(x2, y2) {
18141     centroidStream.point = centroidPointLine;
18142     centroidPoint(x03 = x2, y03 = y2);
18143   }
18144   function centroidPointLine(x2, y2) {
18145     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
18146     X1 += z2 * (x03 + x2) / 2;
18147     Y1 += z2 * (y03 + y2) / 2;
18148     Z1 += z2;
18149     centroidPoint(x03 = x2, y03 = y2);
18150   }
18151   function centroidLineEnd() {
18152     centroidStream.point = centroidPoint;
18153   }
18154   function centroidRingStart() {
18155     centroidStream.point = centroidPointFirstRing;
18156   }
18157   function centroidRingEnd() {
18158     centroidPointRing(x002, y002);
18159   }
18160   function centroidPointFirstRing(x2, y2) {
18161     centroidStream.point = centroidPointRing;
18162     centroidPoint(x002 = x03 = x2, y002 = y03 = y2);
18163   }
18164   function centroidPointRing(x2, y2) {
18165     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
18166     X1 += z2 * (x03 + x2) / 2;
18167     Y1 += z2 * (y03 + y2) / 2;
18168     Z1 += z2;
18169     z2 = y03 * x2 - x03 * y2;
18170     X2 += z2 * (x03 + x2);
18171     Y2 += z2 * (y03 + y2);
18172     Z2 += z2 * 3;
18173     centroidPoint(x03 = x2, y03 = y2);
18174   }
18175   var centroid_default = centroidStream;
18176
18177   // node_modules/d3-geo/src/path/context.js
18178   function PathContext(context) {
18179     this._context = context;
18180   }
18181   PathContext.prototype = {
18182     _radius: 4.5,
18183     pointRadius: function(_2) {
18184       return this._radius = _2, this;
18185     },
18186     polygonStart: function() {
18187       this._line = 0;
18188     },
18189     polygonEnd: function() {
18190       this._line = NaN;
18191     },
18192     lineStart: function() {
18193       this._point = 0;
18194     },
18195     lineEnd: function() {
18196       if (this._line === 0)
18197         this._context.closePath();
18198       this._point = NaN;
18199     },
18200     point: function(x2, y2) {
18201       switch (this._point) {
18202         case 0: {
18203           this._context.moveTo(x2, y2);
18204           this._point = 1;
18205           break;
18206         }
18207         case 1: {
18208           this._context.lineTo(x2, y2);
18209           break;
18210         }
18211         default: {
18212           this._context.moveTo(x2 + this._radius, y2);
18213           this._context.arc(x2, y2, this._radius, 0, tau);
18214           break;
18215         }
18216       }
18217     },
18218     result: noop
18219   };
18220
18221   // node_modules/d3-geo/src/path/measure.js
18222   var lengthSum2 = new Adder();
18223   var lengthRing;
18224   var x003;
18225   var y003;
18226   var x04;
18227   var y04;
18228   var lengthStream2 = {
18229     point: noop,
18230     lineStart: function() {
18231       lengthStream2.point = lengthPointFirst2;
18232     },
18233     lineEnd: function() {
18234       if (lengthRing)
18235         lengthPoint2(x003, y003);
18236       lengthStream2.point = noop;
18237     },
18238     polygonStart: function() {
18239       lengthRing = true;
18240     },
18241     polygonEnd: function() {
18242       lengthRing = null;
18243     },
18244     result: function() {
18245       var length = +lengthSum2;
18246       lengthSum2 = new Adder();
18247       return length;
18248     }
18249   };
18250   function lengthPointFirst2(x2, y2) {
18251     lengthStream2.point = lengthPoint2;
18252     x003 = x04 = x2, y003 = y04 = y2;
18253   }
18254   function lengthPoint2(x2, y2) {
18255     x04 -= x2, y04 -= y2;
18256     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
18257     x04 = x2, y04 = y2;
18258   }
18259   var measure_default = lengthStream2;
18260
18261   // node_modules/d3-geo/src/path/string.js
18262   function PathString() {
18263     this._string = [];
18264   }
18265   PathString.prototype = {
18266     _radius: 4.5,
18267     _circle: circle(4.5),
18268     pointRadius: function(_2) {
18269       if ((_2 = +_2) !== this._radius)
18270         this._radius = _2, this._circle = null;
18271       return this;
18272     },
18273     polygonStart: function() {
18274       this._line = 0;
18275     },
18276     polygonEnd: function() {
18277       this._line = NaN;
18278     },
18279     lineStart: function() {
18280       this._point = 0;
18281     },
18282     lineEnd: function() {
18283       if (this._line === 0)
18284         this._string.push("Z");
18285       this._point = NaN;
18286     },
18287     point: function(x2, y2) {
18288       switch (this._point) {
18289         case 0: {
18290           this._string.push("M", x2, ",", y2);
18291           this._point = 1;
18292           break;
18293         }
18294         case 1: {
18295           this._string.push("L", x2, ",", y2);
18296           break;
18297         }
18298         default: {
18299           if (this._circle == null)
18300             this._circle = circle(this._radius);
18301           this._string.push("M", x2, ",", y2, this._circle);
18302           break;
18303         }
18304       }
18305     },
18306     result: function() {
18307       if (this._string.length) {
18308         var result = this._string.join("");
18309         this._string = [];
18310         return result;
18311       } else {
18312         return null;
18313       }
18314     }
18315   };
18316   function circle(radius) {
18317     return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
18318   }
18319
18320   // node_modules/d3-geo/src/path/index.js
18321   function path_default(projection2, context) {
18322     var pointRadius = 4.5, projectionStream, contextStream;
18323     function path(object) {
18324       if (object) {
18325         if (typeof pointRadius === "function")
18326           contextStream.pointRadius(+pointRadius.apply(this, arguments));
18327         stream_default(object, projectionStream(contextStream));
18328       }
18329       return contextStream.result();
18330     }
18331     path.area = function(object) {
18332       stream_default(object, projectionStream(area_default2));
18333       return area_default2.result();
18334     };
18335     path.measure = function(object) {
18336       stream_default(object, projectionStream(measure_default));
18337       return measure_default.result();
18338     };
18339     path.bounds = function(object) {
18340       stream_default(object, projectionStream(bounds_default2));
18341       return bounds_default2.result();
18342     };
18343     path.centroid = function(object) {
18344       stream_default(object, projectionStream(centroid_default));
18345       return centroid_default.result();
18346     };
18347     path.projection = function(_2) {
18348       return arguments.length ? (projectionStream = _2 == null ? (projection2 = null, identity_default) : (projection2 = _2).stream, path) : projection2;
18349     };
18350     path.context = function(_2) {
18351       if (!arguments.length)
18352         return context;
18353       contextStream = _2 == null ? (context = null, new PathString()) : new PathContext(context = _2);
18354       if (typeof pointRadius !== "function")
18355         contextStream.pointRadius(pointRadius);
18356       return path;
18357     };
18358     path.pointRadius = function(_2) {
18359       if (!arguments.length)
18360         return pointRadius;
18361       pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
18362       return path;
18363     };
18364     return path.projection(projection2).context(context);
18365   }
18366
18367   // node_modules/d3-geo/src/transform.js
18368   function transform_default(methods2) {
18369     return {
18370       stream: transformer(methods2)
18371     };
18372   }
18373   function transformer(methods2) {
18374     return function(stream) {
18375       var s2 = new TransformStream();
18376       for (var key in methods2)
18377         s2[key] = methods2[key];
18378       s2.stream = stream;
18379       return s2;
18380     };
18381   }
18382   function TransformStream() {
18383   }
18384   TransformStream.prototype = {
18385     constructor: TransformStream,
18386     point: function(x2, y2) {
18387       this.stream.point(x2, y2);
18388     },
18389     sphere: function() {
18390       this.stream.sphere();
18391     },
18392     lineStart: function() {
18393       this.stream.lineStart();
18394     },
18395     lineEnd: function() {
18396       this.stream.lineEnd();
18397     },
18398     polygonStart: function() {
18399       this.stream.polygonStart();
18400     },
18401     polygonEnd: function() {
18402       this.stream.polygonEnd();
18403     }
18404   };
18405
18406   // node_modules/d3-geo/src/projection/fit.js
18407   function fit(projection2, fitBounds, object) {
18408     var clip = projection2.clipExtent && projection2.clipExtent();
18409     projection2.scale(150).translate([0, 0]);
18410     if (clip != null)
18411       projection2.clipExtent(null);
18412     stream_default(object, projection2.stream(bounds_default2));
18413     fitBounds(bounds_default2.result());
18414     if (clip != null)
18415       projection2.clipExtent(clip);
18416     return projection2;
18417   }
18418   function fitExtent(projection2, extent, object) {
18419     return fit(projection2, function(b2) {
18420       var w2 = extent[1][0] - extent[0][0], h2 = extent[1][1] - extent[0][1], k2 = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent[0][0] + (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = +extent[0][1] + (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
18421       projection2.scale(150 * k2).translate([x2, y2]);
18422     }, object);
18423   }
18424   function fitSize(projection2, size, object) {
18425     return fitExtent(projection2, [[0, 0], size], object);
18426   }
18427   function fitWidth(projection2, width, object) {
18428     return fit(projection2, function(b2) {
18429       var w2 = +width, k2 = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = -k2 * b2[0][1];
18430       projection2.scale(150 * k2).translate([x2, y2]);
18431     }, object);
18432   }
18433   function fitHeight(projection2, height, object) {
18434     return fit(projection2, function(b2) {
18435       var h2 = +height, k2 = h2 / (b2[1][1] - b2[0][1]), x2 = -k2 * b2[0][0], y2 = (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
18436       projection2.scale(150 * k2).translate([x2, y2]);
18437     }, object);
18438   }
18439
18440   // node_modules/d3-geo/src/projection/resample.js
18441   var maxDepth = 16;
18442   var cosMinDistance = cos(30 * radians);
18443   function resample_default(project, delta2) {
18444     return +delta2 ? resample(project, delta2) : resampleNone(project);
18445   }
18446   function resampleNone(project) {
18447     return transformer({
18448       point: function(x2, y2) {
18449         x2 = project(x2, y2);
18450         this.stream.point(x2[0], x2[1]);
18451       }
18452     });
18453   }
18454   function resample(project, delta2) {
18455     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
18456       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
18457       if (d2 > 4 * delta2 && depth--) {
18458         var a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin(c2 /= m2), lambda22 = abs(abs(c2) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b2, a2), p2 = project(lambda22, phi2), x2 = p2[0], y2 = p2[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
18459         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
18460           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream);
18461           stream.point(x2, y2);
18462           resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream);
18463         }
18464       }
18465     }
18466     return function(stream) {
18467       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
18468       var resampleStream = {
18469         point: point2,
18470         lineStart,
18471         lineEnd,
18472         polygonStart: function() {
18473           stream.polygonStart();
18474           resampleStream.lineStart = ringStart;
18475         },
18476         polygonEnd: function() {
18477           stream.polygonEnd();
18478           resampleStream.lineStart = lineStart;
18479         }
18480       };
18481       function point2(x2, y2) {
18482         x2 = project(x2, y2);
18483         stream.point(x2[0], x2[1]);
18484       }
18485       function lineStart() {
18486         x05 = NaN;
18487         resampleStream.point = linePoint2;
18488         stream.lineStart();
18489       }
18490       function linePoint2(lambda, phi) {
18491         var c2 = cartesian([lambda, phi]), p2 = project(lambda, phi);
18492         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x05 = p2[0], y05 = p2[1], lambda04 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream);
18493         stream.point(x05, y05);
18494       }
18495       function lineEnd() {
18496         resampleStream.point = point2;
18497         stream.lineEnd();
18498       }
18499       function ringStart() {
18500         lineStart();
18501         resampleStream.point = ringPoint;
18502         resampleStream.lineEnd = ringEnd;
18503       }
18504       function ringPoint(lambda, phi) {
18505         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
18506         resampleStream.point = linePoint2;
18507       }
18508       function ringEnd() {
18509         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
18510         resampleStream.lineEnd = lineEnd;
18511         lineEnd();
18512       }
18513       return resampleStream;
18514     };
18515   }
18516
18517   // node_modules/d3-geo/src/projection/index.js
18518   var transformRadians = transformer({
18519     point: function(x2, y2) {
18520       this.stream.point(x2 * radians, y2 * radians);
18521     }
18522   });
18523   function transformRotate(rotate) {
18524     return transformer({
18525       point: function(x2, y2) {
18526         var r2 = rotate(x2, y2);
18527         return this.stream.point(r2[0], r2[1]);
18528       }
18529     });
18530   }
18531   function scaleTranslate(k2, dx, dy, sx, sy) {
18532     function transform2(x2, y2) {
18533       x2 *= sx;
18534       y2 *= sy;
18535       return [dx + k2 * x2, dy - k2 * y2];
18536     }
18537     transform2.invert = function(x2, y2) {
18538       return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
18539     };
18540     return transform2;
18541   }
18542   function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
18543     if (!alpha)
18544       return scaleTranslate(k2, dx, dy, sx, sy);
18545     var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a2 = cosAlpha * k2, b2 = sinAlpha * k2, ai = cosAlpha / k2, bi = sinAlpha / k2, ci = (sinAlpha * dy - cosAlpha * dx) / k2, fi = (sinAlpha * dx + cosAlpha * dy) / k2;
18546     function transform2(x2, y2) {
18547       x2 *= sx;
18548       y2 *= sy;
18549       return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2];
18550     }
18551     transform2.invert = function(x2, y2) {
18552       return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)];
18553     };
18554     return transform2;
18555   }
18556   function projection(project) {
18557     return projectionMutator(function() {
18558       return project;
18559     })();
18560   }
18561   function projectionMutator(projectAt) {
18562     var project, k2 = 150, x2 = 480, y2 = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = antimeridian_default, x05 = null, y05, x12, y12, postclip = identity_default, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream;
18563     function projection2(point2) {
18564       return projectRotateTransform(point2[0] * radians, point2[1] * radians);
18565     }
18566     function invert(point2) {
18567       point2 = projectRotateTransform.invert(point2[0], point2[1]);
18568       return point2 && [point2[0] * degrees, point2[1] * degrees];
18569     }
18570     projection2.stream = function(stream) {
18571       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
18572     };
18573     projection2.preclip = function(_2) {
18574       return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
18575     };
18576     projection2.postclip = function(_2) {
18577       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18578     };
18579     projection2.clipAngle = function(_2) {
18580       return arguments.length ? (preclip = +_2 ? circle_default(theta = _2 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
18581     };
18582     projection2.clipExtent = function(_2) {
18583       return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18584     };
18585     projection2.scale = function(_2) {
18586       return arguments.length ? (k2 = +_2, recenter()) : k2;
18587     };
18588     projection2.translate = function(_2) {
18589       return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
18590     };
18591     projection2.center = function(_2) {
18592       return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
18593     };
18594     projection2.rotate = function(_2) {
18595       return arguments.length ? (deltaLambda = _2[0] % 360 * radians, deltaPhi = _2[1] % 360 * radians, deltaGamma = _2.length > 2 ? _2[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
18596     };
18597     projection2.angle = function(_2) {
18598       return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
18599     };
18600     projection2.reflectX = function(_2) {
18601       return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
18602     };
18603     projection2.reflectY = function(_2) {
18604       return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
18605     };
18606     projection2.precision = function(_2) {
18607       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _2 * _2), reset()) : sqrt(delta2);
18608     };
18609     projection2.fitExtent = function(extent, object) {
18610       return fitExtent(projection2, extent, object);
18611     };
18612     projection2.fitSize = function(size, object) {
18613       return fitSize(projection2, size, object);
18614     };
18615     projection2.fitWidth = function(width, object) {
18616       return fitWidth(projection2, width, object);
18617     };
18618     projection2.fitHeight = function(height, object) {
18619       return fitHeight(projection2, height, object);
18620     };
18621     function recenter() {
18622       var center = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k2, x2 - center[0], y2 - center[1], sx, sy, alpha);
18623       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
18624       projectTransform = compose_default(project, transform2);
18625       projectRotateTransform = compose_default(rotate, projectTransform);
18626       projectResample = resample_default(projectTransform, delta2);
18627       return reset();
18628     }
18629     function reset() {
18630       cache = cacheStream = null;
18631       return projection2;
18632     }
18633     return function() {
18634       project = projectAt.apply(this, arguments);
18635       projection2.invert = project.invert && invert;
18636       return recenter();
18637     };
18638   }
18639
18640   // node_modules/d3-geo/src/projection/mercator.js
18641   function mercatorRaw(lambda, phi) {
18642     return [lambda, log(tan((halfPi + phi) / 2))];
18643   }
18644   mercatorRaw.invert = function(x2, y2) {
18645     return [x2, 2 * atan(exp(y2)) - halfPi];
18646   };
18647   function mercator_default() {
18648     return mercatorProjection(mercatorRaw).scale(961 / tau);
18649   }
18650   function mercatorProjection(project) {
18651     var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x05 = null, y05, x12, y12;
18652     m2.scale = function(_2) {
18653       return arguments.length ? (scale(_2), reclip()) : scale();
18654     };
18655     m2.translate = function(_2) {
18656       return arguments.length ? (translate(_2), reclip()) : translate();
18657     };
18658     m2.center = function(_2) {
18659       return arguments.length ? (center(_2), reclip()) : center();
18660     };
18661     m2.clipExtent = function(_2) {
18662       return arguments.length ? (_2 == null ? x05 = y05 = x12 = y12 = null : (x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18663     };
18664     function reclip() {
18665       var k2 = pi * scale(), t2 = m2(rotation_default(m2.rotate()).invert([0, 0]));
18666       return clipExtent(x05 == null ? [[t2[0] - k2, t2[1] - k2], [t2[0] + k2, t2[1] + k2]] : project === mercatorRaw ? [[Math.max(t2[0] - k2, x05), y05], [Math.min(t2[0] + k2, x12), y12]] : [[x05, Math.max(t2[1] - k2, y05)], [x12, Math.min(t2[1] + k2, y12)]]);
18667     }
18668     return reclip();
18669   }
18670
18671   // node_modules/d3-geo/src/projection/identity.js
18672   function identity_default2() {
18673     var k2 = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x05 = null, y05, x12, y12, kx = 1, ky = 1, transform2 = transformer({
18674       point: function(x2, y2) {
18675         var p2 = projection2([x2, y2]);
18676         this.stream.point(p2[0], p2[1]);
18677       }
18678     }), postclip = identity_default, cache, cacheStream;
18679     function reset() {
18680       kx = k2 * sx;
18681       ky = k2 * sy;
18682       cache = cacheStream = null;
18683       return projection2;
18684     }
18685     function projection2(p2) {
18686       var x2 = p2[0] * kx, y2 = p2[1] * ky;
18687       if (alpha) {
18688         var t2 = y2 * ca - x2 * sa;
18689         x2 = x2 * ca + y2 * sa;
18690         y2 = t2;
18691       }
18692       return [x2 + tx, y2 + ty];
18693     }
18694     projection2.invert = function(p2) {
18695       var x2 = p2[0] - tx, y2 = p2[1] - ty;
18696       if (alpha) {
18697         var t2 = y2 * ca + x2 * sa;
18698         x2 = x2 * ca - y2 * sa;
18699         y2 = t2;
18700       }
18701       return [x2 / kx, y2 / ky];
18702     };
18703     projection2.stream = function(stream) {
18704       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
18705     };
18706     projection2.postclip = function(_2) {
18707       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18708     };
18709     projection2.clipExtent = function(_2) {
18710       return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
18711     };
18712     projection2.scale = function(_2) {
18713       return arguments.length ? (k2 = +_2, reset()) : k2;
18714     };
18715     projection2.translate = function(_2) {
18716       return arguments.length ? (tx = +_2[0], ty = +_2[1], reset()) : [tx, ty];
18717     };
18718     projection2.angle = function(_2) {
18719       return arguments.length ? (alpha = _2 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
18720     };
18721     projection2.reflectX = function(_2) {
18722       return arguments.length ? (sx = _2 ? -1 : 1, reset()) : sx < 0;
18723     };
18724     projection2.reflectY = function(_2) {
18725       return arguments.length ? (sy = _2 ? -1 : 1, reset()) : sy < 0;
18726     };
18727     projection2.fitExtent = function(extent, object) {
18728       return fitExtent(projection2, extent, object);
18729     };
18730     projection2.fitSize = function(size, object) {
18731       return fitSize(projection2, size, object);
18732     };
18733     projection2.fitWidth = function(width, object) {
18734       return fitWidth(projection2, width, object);
18735     };
18736     projection2.fitHeight = function(height, object) {
18737       return fitHeight(projection2, height, object);
18738     };
18739     return projection2;
18740   }
18741
18742   // modules/geo/geo.js
18743   var TAU = 2 * Math.PI;
18744   var EQUATORIAL_RADIUS = 6378137;
18745   var POLAR_RADIUS = 63567523e-1;
18746   function geoLatToMeters(dLat) {
18747     return dLat * (TAU * POLAR_RADIUS / 360);
18748   }
18749   function geoLonToMeters(dLon, atLat) {
18750     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
18751   }
18752   function geoMetersToLat(m2) {
18753     return m2 / (TAU * POLAR_RADIUS / 360);
18754   }
18755   function geoMetersToLon(m2, atLat) {
18756     return Math.abs(atLat) >= 90 ? 0 : m2 / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
18757   }
18758   function geoMetersToOffset(meters, tileSize) {
18759     tileSize = tileSize || 256;
18760     return [
18761       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
18762       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
18763     ];
18764   }
18765   function geoOffsetToMeters(offset, tileSize) {
18766     tileSize = tileSize || 256;
18767     return [
18768       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
18769       -offset[1] * TAU * POLAR_RADIUS / tileSize
18770     ];
18771   }
18772   function geoSphericalDistance(a2, b2) {
18773     var x2 = geoLonToMeters(a2[0] - b2[0], (a2[1] + b2[1]) / 2);
18774     var y2 = geoLatToMeters(a2[1] - b2[1]);
18775     return Math.sqrt(x2 * x2 + y2 * y2);
18776   }
18777   function geoScaleToZoom(k2, tileSize) {
18778     tileSize = tileSize || 256;
18779     var log2ts = Math.log(tileSize) * Math.LOG2E;
18780     return Math.log(k2 * TAU) / Math.LN2 - log2ts;
18781   }
18782   function geoZoomToScale(z2, tileSize) {
18783     tileSize = tileSize || 256;
18784     return tileSize * Math.pow(2, z2) / TAU;
18785   }
18786   function geoSphericalClosestNode(nodes, point2) {
18787     var minDistance = Infinity, distance;
18788     var indexOfMin;
18789     for (var i3 in nodes) {
18790       distance = geoSphericalDistance(nodes[i3].loc, point2);
18791       if (distance < minDistance) {
18792         minDistance = distance;
18793         indexOfMin = i3;
18794       }
18795     }
18796     if (indexOfMin !== void 0) {
18797       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
18798     } else {
18799       return null;
18800     }
18801   }
18802
18803   // modules/geo/extent.js
18804   function geoExtent(min3, max3) {
18805     if (!(this instanceof geoExtent)) {
18806       return new geoExtent(min3, max3);
18807     } else if (min3 instanceof geoExtent) {
18808       return min3;
18809     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
18810       this[0] = min3[0];
18811       this[1] = min3[1];
18812     } else {
18813       this[0] = min3 || [Infinity, Infinity];
18814       this[1] = max3 || min3 || [-Infinity, -Infinity];
18815     }
18816   }
18817   geoExtent.prototype = new Array(2);
18818   Object.assign(geoExtent.prototype, {
18819     equals: function(obj) {
18820       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];
18821     },
18822     extend: function(obj) {
18823       if (!(obj instanceof geoExtent))
18824         obj = new geoExtent(obj);
18825       return geoExtent(
18826         [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
18827         [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
18828       );
18829     },
18830     _extend: function(extent) {
18831       this[0][0] = Math.min(extent[0][0], this[0][0]);
18832       this[0][1] = Math.min(extent[0][1], this[0][1]);
18833       this[1][0] = Math.max(extent[1][0], this[1][0]);
18834       this[1][1] = Math.max(extent[1][1], this[1][1]);
18835     },
18836     area: function() {
18837       return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
18838     },
18839     center: function() {
18840       return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
18841     },
18842     rectangle: function() {
18843       return [this[0][0], this[0][1], this[1][0], this[1][1]];
18844     },
18845     bbox: function() {
18846       return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
18847     },
18848     polygon: function() {
18849       return [
18850         [this[0][0], this[0][1]],
18851         [this[0][0], this[1][1]],
18852         [this[1][0], this[1][1]],
18853         [this[1][0], this[0][1]],
18854         [this[0][0], this[0][1]]
18855       ];
18856     },
18857     contains: function(obj) {
18858       if (!(obj instanceof geoExtent))
18859         obj = new geoExtent(obj);
18860       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];
18861     },
18862     intersects: function(obj) {
18863       if (!(obj instanceof geoExtent))
18864         obj = new geoExtent(obj);
18865       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];
18866     },
18867     intersection: function(obj) {
18868       if (!this.intersects(obj))
18869         return new geoExtent();
18870       return new geoExtent(
18871         [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
18872         [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
18873       );
18874     },
18875     percentContainedIn: function(obj) {
18876       if (!(obj instanceof geoExtent))
18877         obj = new geoExtent(obj);
18878       var a1 = this.intersection(obj).area();
18879       var a2 = this.area();
18880       if (a1 === Infinity || a2 === Infinity) {
18881         return 0;
18882       } else if (a1 === 0 || a2 === 0) {
18883         if (obj.contains(this)) {
18884           return 1;
18885         }
18886         return 0;
18887       } else {
18888         return a1 / a2;
18889       }
18890     },
18891     padByMeters: function(meters) {
18892       var dLat = geoMetersToLat(meters);
18893       var dLon = geoMetersToLon(meters, this.center()[1]);
18894       return geoExtent(
18895         [this[0][0] - dLon, this[0][1] - dLat],
18896         [this[1][0] + dLon, this[1][1] + dLat]
18897       );
18898     },
18899     toParam: function() {
18900       return this.rectangle().join(",");
18901     }
18902   });
18903
18904   // node_modules/d3-polygon/src/area.js
18905   function area_default3(polygon2) {
18906     var i3 = -1, n3 = polygon2.length, a2, b2 = polygon2[n3 - 1], area = 0;
18907     while (++i3 < n3) {
18908       a2 = b2;
18909       b2 = polygon2[i3];
18910       area += a2[1] * b2[0] - a2[0] * b2[1];
18911     }
18912     return area / 2;
18913   }
18914
18915   // node_modules/d3-polygon/src/centroid.js
18916   function centroid_default2(polygon2) {
18917     var i3 = -1, n3 = polygon2.length, x2 = 0, y2 = 0, a2, b2 = polygon2[n3 - 1], c2, k2 = 0;
18918     while (++i3 < n3) {
18919       a2 = b2;
18920       b2 = polygon2[i3];
18921       k2 += c2 = a2[0] * b2[1] - b2[0] * a2[1];
18922       x2 += (a2[0] + b2[0]) * c2;
18923       y2 += (a2[1] + b2[1]) * c2;
18924     }
18925     return k2 *= 3, [x2 / k2, y2 / k2];
18926   }
18927
18928   // node_modules/d3-polygon/src/cross.js
18929   function cross_default(a2, b2, c2) {
18930     return (b2[0] - a2[0]) * (c2[1] - a2[1]) - (b2[1] - a2[1]) * (c2[0] - a2[0]);
18931   }
18932
18933   // node_modules/d3-polygon/src/hull.js
18934   function lexicographicOrder(a2, b2) {
18935     return a2[0] - b2[0] || a2[1] - b2[1];
18936   }
18937   function computeUpperHullIndexes(points) {
18938     const n3 = points.length, indexes = [0, 1];
18939     let size = 2, i3;
18940     for (i3 = 2; i3 < n3; ++i3) {
18941       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i3]) <= 0)
18942         --size;
18943       indexes[size++] = i3;
18944     }
18945     return indexes.slice(0, size);
18946   }
18947   function hull_default(points) {
18948     if ((n3 = points.length) < 3)
18949       return null;
18950     var i3, n3, sortedPoints = new Array(n3), flippedPoints = new Array(n3);
18951     for (i3 = 0; i3 < n3; ++i3)
18952       sortedPoints[i3] = [+points[i3][0], +points[i3][1], i3];
18953     sortedPoints.sort(lexicographicOrder);
18954     for (i3 = 0; i3 < n3; ++i3)
18955       flippedPoints[i3] = [sortedPoints[i3][0], -sortedPoints[i3][1]];
18956     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
18957     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
18958     for (i3 = upperIndexes.length - 1; i3 >= 0; --i3)
18959       hull.push(points[sortedPoints[upperIndexes[i3]][2]]);
18960     for (i3 = +skipLeft; i3 < lowerIndexes.length - skipRight; ++i3)
18961       hull.push(points[sortedPoints[lowerIndexes[i3]][2]]);
18962     return hull;
18963   }
18964
18965   // modules/geo/vector.js
18966   function geoVecEqual(a2, b2, epsilon3) {
18967     if (epsilon3) {
18968       return Math.abs(a2[0] - b2[0]) <= epsilon3 && Math.abs(a2[1] - b2[1]) <= epsilon3;
18969     } else {
18970       return a2[0] === b2[0] && a2[1] === b2[1];
18971     }
18972   }
18973   function geoVecAdd(a2, b2) {
18974     return [a2[0] + b2[0], a2[1] + b2[1]];
18975   }
18976   function geoVecSubtract(a2, b2) {
18977     return [a2[0] - b2[0], a2[1] - b2[1]];
18978   }
18979   function geoVecScale(a2, mag) {
18980     return [a2[0] * mag, a2[1] * mag];
18981   }
18982   function geoVecFloor(a2) {
18983     return [Math.floor(a2[0]), Math.floor(a2[1])];
18984   }
18985   function geoVecInterp(a2, b2, t2) {
18986     return [
18987       a2[0] + (b2[0] - a2[0]) * t2,
18988       a2[1] + (b2[1] - a2[1]) * t2
18989     ];
18990   }
18991   function geoVecLength(a2, b2) {
18992     return Math.sqrt(geoVecLengthSquare(a2, b2));
18993   }
18994   function geoVecLengthSquare(a2, b2) {
18995     b2 = b2 || [0, 0];
18996     var x2 = a2[0] - b2[0];
18997     var y2 = a2[1] - b2[1];
18998     return x2 * x2 + y2 * y2;
18999   }
19000   function geoVecNormalize(a2) {
19001     var length = Math.sqrt(a2[0] * a2[0] + a2[1] * a2[1]);
19002     if (length !== 0) {
19003       return geoVecScale(a2, 1 / length);
19004     }
19005     return [0, 0];
19006   }
19007   function geoVecAngle(a2, b2) {
19008     return Math.atan2(b2[1] - a2[1], b2[0] - a2[0]);
19009   }
19010   function geoVecDot(a2, b2, origin) {
19011     origin = origin || [0, 0];
19012     var p2 = geoVecSubtract(a2, origin);
19013     var q2 = geoVecSubtract(b2, origin);
19014     return p2[0] * q2[0] + p2[1] * q2[1];
19015   }
19016   function geoVecNormalizedDot(a2, b2, origin) {
19017     origin = origin || [0, 0];
19018     var p2 = geoVecNormalize(geoVecSubtract(a2, origin));
19019     var q2 = geoVecNormalize(geoVecSubtract(b2, origin));
19020     return geoVecDot(p2, q2);
19021   }
19022   function geoVecCross(a2, b2, origin) {
19023     origin = origin || [0, 0];
19024     var p2 = geoVecSubtract(a2, origin);
19025     var q2 = geoVecSubtract(b2, origin);
19026     return p2[0] * q2[1] - p2[1] * q2[0];
19027   }
19028   function geoVecProject(a2, points) {
19029     var min3 = Infinity;
19030     var idx;
19031     var target;
19032     for (var i3 = 0; i3 < points.length - 1; i3++) {
19033       var o2 = points[i3];
19034       var s2 = geoVecSubtract(points[i3 + 1], o2);
19035       var v2 = geoVecSubtract(a2, o2);
19036       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
19037       var p2;
19038       if (proj < 0) {
19039         p2 = o2;
19040       } else if (proj > 1) {
19041         p2 = points[i3 + 1];
19042       } else {
19043         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
19044       }
19045       var dist = geoVecLength(p2, a2);
19046       if (dist < min3) {
19047         min3 = dist;
19048         idx = i3 + 1;
19049         target = p2;
19050       }
19051     }
19052     if (idx !== void 0) {
19053       return { index: idx, distance: min3, target };
19054     } else {
19055       return null;
19056     }
19057   }
19058
19059   // modules/geo/geom.js
19060   function geoAngle(a2, b2, projection2) {
19061     return geoVecAngle(projection2(a2.loc), projection2(b2.loc));
19062   }
19063   function geoEdgeEqual(a2, b2) {
19064     return a2[0] === b2[0] && a2[1] === b2[1] || a2[0] === b2[1] && a2[1] === b2[0];
19065   }
19066   function geoRotate(points, angle2, around) {
19067     return points.map(function(point2) {
19068       var radial = geoVecSubtract(point2, around);
19069       return [
19070         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
19071         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
19072       ];
19073     });
19074   }
19075   function geoChooseEdge(nodes, point2, projection2, activeID) {
19076     var dist = geoVecLength;
19077     var points = nodes.map(function(n3) {
19078       return projection2(n3.loc);
19079     });
19080     var ids = nodes.map(function(n3) {
19081       return n3.id;
19082     });
19083     var min3 = Infinity;
19084     var idx;
19085     var loc;
19086     for (var i3 = 0; i3 < points.length - 1; i3++) {
19087       if (ids[i3] === activeID || ids[i3 + 1] === activeID)
19088         continue;
19089       var o2 = points[i3];
19090       var s2 = geoVecSubtract(points[i3 + 1], o2);
19091       var v2 = geoVecSubtract(point2, o2);
19092       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
19093       var p2;
19094       if (proj < 0) {
19095         p2 = o2;
19096       } else if (proj > 1) {
19097         p2 = points[i3 + 1];
19098       } else {
19099         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
19100       }
19101       var d2 = dist(p2, point2);
19102       if (d2 < min3) {
19103         min3 = d2;
19104         idx = i3 + 1;
19105         loc = projection2.invert(p2);
19106       }
19107     }
19108     if (idx !== void 0) {
19109       return { index: idx, distance: min3, loc };
19110     } else {
19111       return null;
19112     }
19113   }
19114   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
19115     var actives = [];
19116     var inactives = [];
19117     var j3, k2, n1, n22, segment;
19118     for (j3 = 0; j3 < activeNodes.length - 1; j3++) {
19119       n1 = activeNodes[j3];
19120       n22 = activeNodes[j3 + 1];
19121       segment = [n1.loc, n22.loc];
19122       if (n1.id === activeID || n22.id === activeID) {
19123         actives.push(segment);
19124       }
19125     }
19126     for (j3 = 0; j3 < inactiveNodes.length - 1; j3++) {
19127       n1 = inactiveNodes[j3];
19128       n22 = inactiveNodes[j3 + 1];
19129       segment = [n1.loc, n22.loc];
19130       inactives.push(segment);
19131     }
19132     for (j3 = 0; j3 < actives.length; j3++) {
19133       for (k2 = 0; k2 < inactives.length; k2++) {
19134         var p2 = actives[j3];
19135         var q2 = inactives[k2];
19136         var hit = geoLineIntersection(p2, q2);
19137         if (hit) {
19138           return true;
19139         }
19140       }
19141     }
19142     return false;
19143   }
19144   function geoHasSelfIntersections(nodes, activeID) {
19145     var actives = [];
19146     var inactives = [];
19147     var j3, k2;
19148     for (j3 = 0; j3 < nodes.length - 1; j3++) {
19149       var n1 = nodes[j3];
19150       var n22 = nodes[j3 + 1];
19151       var segment = [n1.loc, n22.loc];
19152       if (n1.id === activeID || n22.id === activeID) {
19153         actives.push(segment);
19154       } else {
19155         inactives.push(segment);
19156       }
19157     }
19158     for (j3 = 0; j3 < actives.length; j3++) {
19159       for (k2 = 0; k2 < inactives.length; k2++) {
19160         var p2 = actives[j3];
19161         var q2 = inactives[k2];
19162         if (geoVecEqual(p2[1], q2[0]) || geoVecEqual(p2[0], q2[1]) || geoVecEqual(p2[0], q2[0]) || geoVecEqual(p2[1], q2[1])) {
19163           continue;
19164         }
19165         var hit = geoLineIntersection(p2, q2);
19166         if (hit) {
19167           var epsilon3 = 1e-8;
19168           if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q2[1], hit, epsilon3) || geoVecEqual(q2[0], hit, epsilon3)) {
19169             continue;
19170           } else {
19171             return true;
19172           }
19173         }
19174       }
19175     }
19176     return false;
19177   }
19178   function geoLineIntersection(a2, b2) {
19179     var p2 = [a2[0][0], a2[0][1]];
19180     var p22 = [a2[1][0], a2[1][1]];
19181     var q2 = [b2[0][0], b2[0][1]];
19182     var q22 = [b2[1][0], b2[1][1]];
19183     var r2 = geoVecSubtract(p22, p2);
19184     var s2 = geoVecSubtract(q22, q2);
19185     var uNumerator = geoVecCross(geoVecSubtract(q2, p2), r2);
19186     var denominator = geoVecCross(r2, s2);
19187     if (uNumerator && denominator) {
19188       var u2 = uNumerator / denominator;
19189       var t2 = geoVecCross(geoVecSubtract(q2, p2), s2) / denominator;
19190       if (t2 >= 0 && t2 <= 1 && u2 >= 0 && u2 <= 1) {
19191         return geoVecInterp(p2, p22, t2);
19192       }
19193     }
19194     return null;
19195   }
19196   function geoPathIntersections(path1, path2) {
19197     var intersections = [];
19198     for (var i3 = 0; i3 < path1.length - 1; i3++) {
19199       for (var j3 = 0; j3 < path2.length - 1; j3++) {
19200         var a2 = [path1[i3], path1[i3 + 1]];
19201         var b2 = [path2[j3], path2[j3 + 1]];
19202         var hit = geoLineIntersection(a2, b2);
19203         if (hit) {
19204           intersections.push(hit);
19205         }
19206       }
19207     }
19208     return intersections;
19209   }
19210   function geoPathHasIntersections(path1, path2) {
19211     for (var i3 = 0; i3 < path1.length - 1; i3++) {
19212       for (var j3 = 0; j3 < path2.length - 1; j3++) {
19213         var a2 = [path1[i3], path1[i3 + 1]];
19214         var b2 = [path2[j3], path2[j3 + 1]];
19215         var hit = geoLineIntersection(a2, b2);
19216         if (hit) {
19217           return true;
19218         }
19219       }
19220     }
19221     return false;
19222   }
19223   function geoPointInPolygon(point2, polygon2) {
19224     var x2 = point2[0];
19225     var y2 = point2[1];
19226     var inside = false;
19227     for (var i3 = 0, j3 = polygon2.length - 1; i3 < polygon2.length; j3 = i3++) {
19228       var xi = polygon2[i3][0];
19229       var yi = polygon2[i3][1];
19230       var xj = polygon2[j3][0];
19231       var yj = polygon2[j3][1];
19232       var intersect2 = yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi;
19233       if (intersect2)
19234         inside = !inside;
19235     }
19236     return inside;
19237   }
19238   function geoPolygonContainsPolygon(outer, inner) {
19239     return inner.every(function(point2) {
19240       return geoPointInPolygon(point2, outer);
19241     });
19242   }
19243   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
19244     function testPoints(outer2, inner2) {
19245       return inner2.some(function(point2) {
19246         return geoPointInPolygon(point2, outer2);
19247       });
19248     }
19249     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
19250   }
19251   function geoGetSmallestSurroundingRectangle(points) {
19252     var hull = hull_default(points);
19253     var centroid = centroid_default2(hull);
19254     var minArea = Infinity;
19255     var ssrExtent = [];
19256     var ssrAngle = 0;
19257     var c1 = hull[0];
19258     for (var i3 = 0; i3 <= hull.length - 1; i3++) {
19259       var c2 = i3 === hull.length - 1 ? hull[0] : hull[i3 + 1];
19260       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
19261       var poly = geoRotate(hull, -angle2, centroid);
19262       var extent = poly.reduce(function(extent2, point2) {
19263         return extent2.extend(geoExtent(point2));
19264       }, geoExtent());
19265       var area = extent.area();
19266       if (area < minArea) {
19267         minArea = area;
19268         ssrExtent = extent;
19269         ssrAngle = angle2;
19270       }
19271       c1 = c2;
19272     }
19273     return {
19274       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
19275       angle: ssrAngle
19276     };
19277   }
19278   function geoPathLength(path) {
19279     var length = 0;
19280     for (var i3 = 0; i3 < path.length - 1; i3++) {
19281       length += geoVecLength(path[i3], path[i3 + 1]);
19282     }
19283     return length;
19284   }
19285   function geoViewportEdge(point2, dimensions) {
19286     var pad2 = [80, 20, 50, 20];
19287     var x2 = 0;
19288     var y2 = 0;
19289     if (point2[0] > dimensions[0] - pad2[1]) {
19290       x2 = -10;
19291     }
19292     if (point2[0] < pad2[3]) {
19293       x2 = 10;
19294     }
19295     if (point2[1] > dimensions[1] - pad2[2]) {
19296       y2 = -10;
19297     }
19298     if (point2[1] < pad2[0]) {
19299       y2 = 10;
19300     }
19301     if (x2 || y2) {
19302       return [x2, y2];
19303     } else {
19304       return null;
19305     }
19306   }
19307
19308   // node_modules/d3-dispatch/src/dispatch.js
19309   var noop2 = { value: () => {
19310   } };
19311   function dispatch() {
19312     for (var i3 = 0, n3 = arguments.length, _2 = {}, t2; i3 < n3; ++i3) {
19313       if (!(t2 = arguments[i3] + "") || t2 in _2 || /[\s.]/.test(t2))
19314         throw new Error("illegal type: " + t2);
19315       _2[t2] = [];
19316     }
19317     return new Dispatch(_2);
19318   }
19319   function Dispatch(_2) {
19320     this._ = _2;
19321   }
19322   function parseTypenames(typenames, types) {
19323     return typenames.trim().split(/^|\s+/).map(function(t2) {
19324       var name = "", i3 = t2.indexOf(".");
19325       if (i3 >= 0)
19326         name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
19327       if (t2 && !types.hasOwnProperty(t2))
19328         throw new Error("unknown type: " + t2);
19329       return { type: t2, name };
19330     });
19331   }
19332   Dispatch.prototype = dispatch.prototype = {
19333     constructor: Dispatch,
19334     on: function(typename, callback) {
19335       var _2 = this._, T2 = parseTypenames(typename + "", _2), t2, i3 = -1, n3 = T2.length;
19336       if (arguments.length < 2) {
19337         while (++i3 < n3)
19338           if ((t2 = (typename = T2[i3]).type) && (t2 = get(_2[t2], typename.name)))
19339             return t2;
19340         return;
19341       }
19342       if (callback != null && typeof callback !== "function")
19343         throw new Error("invalid callback: " + callback);
19344       while (++i3 < n3) {
19345         if (t2 = (typename = T2[i3]).type)
19346           _2[t2] = set(_2[t2], typename.name, callback);
19347         else if (callback == null)
19348           for (t2 in _2)
19349             _2[t2] = set(_2[t2], typename.name, null);
19350       }
19351       return this;
19352     },
19353     copy: function() {
19354       var copy2 = {}, _2 = this._;
19355       for (var t2 in _2)
19356         copy2[t2] = _2[t2].slice();
19357       return new Dispatch(copy2);
19358     },
19359     call: function(type2, that) {
19360       if ((n3 = arguments.length - 2) > 0)
19361         for (var args = new Array(n3), i3 = 0, n3, t2; i3 < n3; ++i3)
19362           args[i3] = arguments[i3 + 2];
19363       if (!this._.hasOwnProperty(type2))
19364         throw new Error("unknown type: " + type2);
19365       for (t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3)
19366         t2[i3].value.apply(that, args);
19367     },
19368     apply: function(type2, that, args) {
19369       if (!this._.hasOwnProperty(type2))
19370         throw new Error("unknown type: " + type2);
19371       for (var t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3)
19372         t2[i3].value.apply(that, args);
19373     }
19374   };
19375   function get(type2, name) {
19376     for (var i3 = 0, n3 = type2.length, c2; i3 < n3; ++i3) {
19377       if ((c2 = type2[i3]).name === name) {
19378         return c2.value;
19379       }
19380     }
19381   }
19382   function set(type2, name, callback) {
19383     for (var i3 = 0, n3 = type2.length; i3 < n3; ++i3) {
19384       if (type2[i3].name === name) {
19385         type2[i3] = noop2, type2 = type2.slice(0, i3).concat(type2.slice(i3 + 1));
19386         break;
19387       }
19388     }
19389     if (callback != null)
19390       type2.push({ name, value: callback });
19391     return type2;
19392   }
19393   var dispatch_default = dispatch;
19394
19395   // node_modules/d3-selection/src/namespaces.js
19396   var xhtml = "http://www.w3.org/1999/xhtml";
19397   var namespaces_default = {
19398     svg: "http://www.w3.org/2000/svg",
19399     xhtml,
19400     xlink: "http://www.w3.org/1999/xlink",
19401     xml: "http://www.w3.org/XML/1998/namespace",
19402     xmlns: "http://www.w3.org/2000/xmlns/"
19403   };
19404
19405   // node_modules/d3-selection/src/namespace.js
19406   function namespace_default(name) {
19407     var prefix = name += "", i3 = prefix.indexOf(":");
19408     if (i3 >= 0 && (prefix = name.slice(0, i3)) !== "xmlns")
19409       name = name.slice(i3 + 1);
19410     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
19411   }
19412
19413   // node_modules/d3-selection/src/creator.js
19414   function creatorInherit(name) {
19415     return function() {
19416       var document2 = this.ownerDocument, uri = this.namespaceURI;
19417       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
19418     };
19419   }
19420   function creatorFixed(fullname) {
19421     return function() {
19422       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
19423     };
19424   }
19425   function creator_default(name) {
19426     var fullname = namespace_default(name);
19427     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
19428   }
19429
19430   // node_modules/d3-selection/src/selector.js
19431   function none() {
19432   }
19433   function selector_default(selector) {
19434     return selector == null ? none : function() {
19435       return this.querySelector(selector);
19436     };
19437   }
19438
19439   // node_modules/d3-selection/src/selection/select.js
19440   function select_default(select) {
19441     if (typeof select !== "function")
19442       select = selector_default(select);
19443     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19444       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
19445         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
19446           if ("__data__" in node)
19447             subnode.__data__ = node.__data__;
19448           subgroup[i3] = subnode;
19449         }
19450       }
19451     }
19452     return new Selection(subgroups, this._parents);
19453   }
19454
19455   // node_modules/d3-selection/src/array.js
19456   function array(x2) {
19457     return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
19458   }
19459
19460   // node_modules/d3-selection/src/selectorAll.js
19461   function empty() {
19462     return [];
19463   }
19464   function selectorAll_default(selector) {
19465     return selector == null ? empty : function() {
19466       return this.querySelectorAll(selector);
19467     };
19468   }
19469
19470   // node_modules/d3-selection/src/selection/selectAll.js
19471   function arrayAll(select) {
19472     return function() {
19473       return array(select.apply(this, arguments));
19474     };
19475   }
19476   function selectAll_default(select) {
19477     if (typeof select === "function")
19478       select = arrayAll(select);
19479     else
19480       select = selectorAll_default(select);
19481     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m2; ++j3) {
19482       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
19483         if (node = group[i3]) {
19484           subgroups.push(select.call(node, node.__data__, i3, group));
19485           parents.push(node);
19486         }
19487       }
19488     }
19489     return new Selection(subgroups, parents);
19490   }
19491
19492   // node_modules/d3-selection/src/matcher.js
19493   function matcher_default(selector) {
19494     return function() {
19495       return this.matches(selector);
19496     };
19497   }
19498   function childMatcher(selector) {
19499     return function(node) {
19500       return node.matches(selector);
19501     };
19502   }
19503
19504   // node_modules/d3-selection/src/selection/selectChild.js
19505   var find = Array.prototype.find;
19506   function childFind(match) {
19507     return function() {
19508       return find.call(this.children, match);
19509     };
19510   }
19511   function childFirst() {
19512     return this.firstElementChild;
19513   }
19514   function selectChild_default(match) {
19515     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
19516   }
19517
19518   // node_modules/d3-selection/src/selection/selectChildren.js
19519   var filter = Array.prototype.filter;
19520   function children() {
19521     return Array.from(this.children);
19522   }
19523   function childrenFilter(match) {
19524     return function() {
19525       return filter.call(this.children, match);
19526     };
19527   }
19528   function selectChildren_default(match) {
19529     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
19530   }
19531
19532   // node_modules/d3-selection/src/selection/filter.js
19533   function filter_default(match) {
19534     if (typeof match !== "function")
19535       match = matcher_default(match);
19536     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19537       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], node, i3 = 0; i3 < n3; ++i3) {
19538         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
19539           subgroup.push(node);
19540         }
19541       }
19542     }
19543     return new Selection(subgroups, this._parents);
19544   }
19545
19546   // node_modules/d3-selection/src/selection/sparse.js
19547   function sparse_default(update) {
19548     return new Array(update.length);
19549   }
19550
19551   // node_modules/d3-selection/src/selection/enter.js
19552   function enter_default() {
19553     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
19554   }
19555   function EnterNode(parent, datum2) {
19556     this.ownerDocument = parent.ownerDocument;
19557     this.namespaceURI = parent.namespaceURI;
19558     this._next = null;
19559     this._parent = parent;
19560     this.__data__ = datum2;
19561   }
19562   EnterNode.prototype = {
19563     constructor: EnterNode,
19564     appendChild: function(child) {
19565       return this._parent.insertBefore(child, this._next);
19566     },
19567     insertBefore: function(child, next) {
19568       return this._parent.insertBefore(child, next);
19569     },
19570     querySelector: function(selector) {
19571       return this._parent.querySelector(selector);
19572     },
19573     querySelectorAll: function(selector) {
19574       return this._parent.querySelectorAll(selector);
19575     }
19576   };
19577
19578   // node_modules/d3-selection/src/constant.js
19579   function constant_default(x2) {
19580     return function() {
19581       return x2;
19582     };
19583   }
19584
19585   // node_modules/d3-selection/src/selection/data.js
19586   function bindIndex(parent, group, enter, update, exit, data) {
19587     var i3 = 0, node, groupLength = group.length, dataLength = data.length;
19588     for (; i3 < dataLength; ++i3) {
19589       if (node = group[i3]) {
19590         node.__data__ = data[i3];
19591         update[i3] = node;
19592       } else {
19593         enter[i3] = new EnterNode(parent, data[i3]);
19594       }
19595     }
19596     for (; i3 < groupLength; ++i3) {
19597       if (node = group[i3]) {
19598         exit[i3] = node;
19599       }
19600     }
19601   }
19602   function bindKey(parent, group, enter, update, exit, data, key) {
19603     var i3, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
19604     for (i3 = 0; i3 < groupLength; ++i3) {
19605       if (node = group[i3]) {
19606         keyValues[i3] = keyValue = key.call(node, node.__data__, i3, group) + "";
19607         if (nodeByKeyValue.has(keyValue)) {
19608           exit[i3] = node;
19609         } else {
19610           nodeByKeyValue.set(keyValue, node);
19611         }
19612       }
19613     }
19614     for (i3 = 0; i3 < dataLength; ++i3) {
19615       keyValue = key.call(parent, data[i3], i3, data) + "";
19616       if (node = nodeByKeyValue.get(keyValue)) {
19617         update[i3] = node;
19618         node.__data__ = data[i3];
19619         nodeByKeyValue.delete(keyValue);
19620       } else {
19621         enter[i3] = new EnterNode(parent, data[i3]);
19622       }
19623     }
19624     for (i3 = 0; i3 < groupLength; ++i3) {
19625       if ((node = group[i3]) && nodeByKeyValue.get(keyValues[i3]) === node) {
19626         exit[i3] = node;
19627       }
19628     }
19629   }
19630   function datum(node) {
19631     return node.__data__;
19632   }
19633   function data_default(value, key) {
19634     if (!arguments.length)
19635       return Array.from(this, datum);
19636     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
19637     if (typeof value !== "function")
19638       value = constant_default(value);
19639     for (var m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19640       var parent = parents[j3], group = groups[j3], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j3, parents)), dataLength = data.length, enterGroup = enter[j3] = new Array(dataLength), updateGroup = update[j3] = new Array(dataLength), exitGroup = exit[j3] = new Array(groupLength);
19641       bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
19642       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
19643         if (previous = enterGroup[i0]) {
19644           if (i0 >= i1)
19645             i1 = i0 + 1;
19646           while (!(next = updateGroup[i1]) && ++i1 < dataLength)
19647             ;
19648           previous._next = next || null;
19649         }
19650       }
19651     }
19652     update = new Selection(update, parents);
19653     update._enter = enter;
19654     update._exit = exit;
19655     return update;
19656   }
19657   function arraylike(data) {
19658     return typeof data === "object" && "length" in data ? data : Array.from(data);
19659   }
19660
19661   // node_modules/d3-selection/src/selection/exit.js
19662   function exit_default() {
19663     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
19664   }
19665
19666   // node_modules/d3-selection/src/selection/join.js
19667   function join_default(onenter, onupdate, onexit) {
19668     var enter = this.enter(), update = this, exit = this.exit();
19669     if (typeof onenter === "function") {
19670       enter = onenter(enter);
19671       if (enter)
19672         enter = enter.selection();
19673     } else {
19674       enter = enter.append(onenter + "");
19675     }
19676     if (onupdate != null) {
19677       update = onupdate(update);
19678       if (update)
19679         update = update.selection();
19680     }
19681     if (onexit == null)
19682       exit.remove();
19683     else
19684       onexit(exit);
19685     return enter && update ? enter.merge(update).order() : update;
19686   }
19687
19688   // node_modules/d3-selection/src/selection/merge.js
19689   function merge_default(context) {
19690     var selection2 = context.selection ? context.selection() : context;
19691     for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m2; ++j3) {
19692       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge2 = merges[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
19693         if (node = group0[i3] || group1[i3]) {
19694           merge2[i3] = node;
19695         }
19696       }
19697     }
19698     for (; j3 < m0; ++j3) {
19699       merges[j3] = groups0[j3];
19700     }
19701     return new Selection(merges, this._parents);
19702   }
19703
19704   // node_modules/d3-selection/src/selection/order.js
19705   function order_default() {
19706     for (var groups = this._groups, j3 = -1, m2 = groups.length; ++j3 < m2; ) {
19707       for (var group = groups[j3], i3 = group.length - 1, next = group[i3], node; --i3 >= 0; ) {
19708         if (node = group[i3]) {
19709           if (next && node.compareDocumentPosition(next) ^ 4)
19710             next.parentNode.insertBefore(node, next);
19711           next = node;
19712         }
19713       }
19714     }
19715     return this;
19716   }
19717
19718   // node_modules/d3-selection/src/selection/sort.js
19719   function sort_default(compare) {
19720     if (!compare)
19721       compare = ascending2;
19722     function compareNode(a2, b2) {
19723       return a2 && b2 ? compare(a2.__data__, b2.__data__) : !a2 - !b2;
19724     }
19725     for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19726       for (var group = groups[j3], n3 = group.length, sortgroup = sortgroups[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
19727         if (node = group[i3]) {
19728           sortgroup[i3] = node;
19729         }
19730       }
19731       sortgroup.sort(compareNode);
19732     }
19733     return new Selection(sortgroups, this._parents).order();
19734   }
19735   function ascending2(a2, b2) {
19736     return a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
19737   }
19738
19739   // node_modules/d3-selection/src/selection/call.js
19740   function call_default() {
19741     var callback = arguments[0];
19742     arguments[0] = this;
19743     callback.apply(null, arguments);
19744     return this;
19745   }
19746
19747   // node_modules/d3-selection/src/selection/nodes.js
19748   function nodes_default() {
19749     return Array.from(this);
19750   }
19751
19752   // node_modules/d3-selection/src/selection/node.js
19753   function node_default() {
19754     for (var groups = this._groups, j3 = 0, m2 = groups.length; j3 < m2; ++j3) {
19755       for (var group = groups[j3], i3 = 0, n3 = group.length; i3 < n3; ++i3) {
19756         var node = group[i3];
19757         if (node)
19758           return node;
19759       }
19760     }
19761     return null;
19762   }
19763
19764   // node_modules/d3-selection/src/selection/size.js
19765   function size_default() {
19766     let size = 0;
19767     for (const node of this)
19768       ++size;
19769     return size;
19770   }
19771
19772   // node_modules/d3-selection/src/selection/empty.js
19773   function empty_default() {
19774     return !this.node();
19775   }
19776
19777   // node_modules/d3-selection/src/selection/each.js
19778   function each_default(callback) {
19779     for (var groups = this._groups, j3 = 0, m2 = groups.length; j3 < m2; ++j3) {
19780       for (var group = groups[j3], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
19781         if (node = group[i3])
19782           callback.call(node, node.__data__, i3, group);
19783       }
19784     }
19785     return this;
19786   }
19787
19788   // node_modules/d3-selection/src/selection/attr.js
19789   function attrRemove(name) {
19790     return function() {
19791       this.removeAttribute(name);
19792     };
19793   }
19794   function attrRemoveNS(fullname) {
19795     return function() {
19796       this.removeAttributeNS(fullname.space, fullname.local);
19797     };
19798   }
19799   function attrConstant(name, value) {
19800     return function() {
19801       this.setAttribute(name, value);
19802     };
19803   }
19804   function attrConstantNS(fullname, value) {
19805     return function() {
19806       this.setAttributeNS(fullname.space, fullname.local, value);
19807     };
19808   }
19809   function attrFunction(name, value) {
19810     return function() {
19811       var v2 = value.apply(this, arguments);
19812       if (v2 == null)
19813         this.removeAttribute(name);
19814       else
19815         this.setAttribute(name, v2);
19816     };
19817   }
19818   function attrFunctionNS(fullname, value) {
19819     return function() {
19820       var v2 = value.apply(this, arguments);
19821       if (v2 == null)
19822         this.removeAttributeNS(fullname.space, fullname.local);
19823       else
19824         this.setAttributeNS(fullname.space, fullname.local, v2);
19825     };
19826   }
19827   function attr_default(name, value) {
19828     var fullname = namespace_default(name);
19829     if (arguments.length < 2) {
19830       var node = this.node();
19831       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
19832     }
19833     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
19834   }
19835
19836   // node_modules/d3-selection/src/window.js
19837   function window_default(node) {
19838     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
19839   }
19840
19841   // node_modules/d3-selection/src/selection/style.js
19842   function styleRemove(name) {
19843     return function() {
19844       this.style.removeProperty(name);
19845     };
19846   }
19847   function styleConstant(name, value, priority) {
19848     return function() {
19849       this.style.setProperty(name, value, priority);
19850     };
19851   }
19852   function styleFunction(name, value, priority) {
19853     return function() {
19854       var v2 = value.apply(this, arguments);
19855       if (v2 == null)
19856         this.style.removeProperty(name);
19857       else
19858         this.style.setProperty(name, v2, priority);
19859     };
19860   }
19861   function style_default(name, value, priority) {
19862     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
19863   }
19864   function styleValue(node, name) {
19865     return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
19866   }
19867
19868   // node_modules/d3-selection/src/selection/property.js
19869   function propertyRemove(name) {
19870     return function() {
19871       delete this[name];
19872     };
19873   }
19874   function propertyConstant(name, value) {
19875     return function() {
19876       this[name] = value;
19877     };
19878   }
19879   function propertyFunction(name, value) {
19880     return function() {
19881       var v2 = value.apply(this, arguments);
19882       if (v2 == null)
19883         delete this[name];
19884       else
19885         this[name] = v2;
19886     };
19887   }
19888   function property_default(name, value) {
19889     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
19890   }
19891
19892   // node_modules/d3-selection/src/selection/classed.js
19893   function classArray(string) {
19894     return string.trim().split(/^|\s+/);
19895   }
19896   function classList(node) {
19897     return node.classList || new ClassList(node);
19898   }
19899   function ClassList(node) {
19900     this._node = node;
19901     this._names = classArray(node.getAttribute("class") || "");
19902   }
19903   ClassList.prototype = {
19904     add: function(name) {
19905       var i3 = this._names.indexOf(name);
19906       if (i3 < 0) {
19907         this._names.push(name);
19908         this._node.setAttribute("class", this._names.join(" "));
19909       }
19910     },
19911     remove: function(name) {
19912       var i3 = this._names.indexOf(name);
19913       if (i3 >= 0) {
19914         this._names.splice(i3, 1);
19915         this._node.setAttribute("class", this._names.join(" "));
19916       }
19917     },
19918     contains: function(name) {
19919       return this._names.indexOf(name) >= 0;
19920     }
19921   };
19922   function classedAdd(node, names) {
19923     var list = classList(node), i3 = -1, n3 = names.length;
19924     while (++i3 < n3)
19925       list.add(names[i3]);
19926   }
19927   function classedRemove(node, names) {
19928     var list = classList(node), i3 = -1, n3 = names.length;
19929     while (++i3 < n3)
19930       list.remove(names[i3]);
19931   }
19932   function classedTrue(names) {
19933     return function() {
19934       classedAdd(this, names);
19935     };
19936   }
19937   function classedFalse(names) {
19938     return function() {
19939       classedRemove(this, names);
19940     };
19941   }
19942   function classedFunction(names, value) {
19943     return function() {
19944       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
19945     };
19946   }
19947   function classed_default(name, value) {
19948     var names = classArray(name + "");
19949     if (arguments.length < 2) {
19950       var list = classList(this.node()), i3 = -1, n3 = names.length;
19951       while (++i3 < n3)
19952         if (!list.contains(names[i3]))
19953           return false;
19954       return true;
19955     }
19956     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
19957   }
19958
19959   // node_modules/d3-selection/src/selection/text.js
19960   function textRemove() {
19961     this.textContent = "";
19962   }
19963   function textConstant(value) {
19964     return function() {
19965       this.textContent = value;
19966     };
19967   }
19968   function textFunction(value) {
19969     return function() {
19970       var v2 = value.apply(this, arguments);
19971       this.textContent = v2 == null ? "" : v2;
19972     };
19973   }
19974   function text_default(value) {
19975     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
19976   }
19977
19978   // node_modules/d3-selection/src/selection/html.js
19979   function htmlRemove() {
19980     this.innerHTML = "";
19981   }
19982   function htmlConstant(value) {
19983     return function() {
19984       this.innerHTML = value;
19985     };
19986   }
19987   function htmlFunction(value) {
19988     return function() {
19989       var v2 = value.apply(this, arguments);
19990       this.innerHTML = v2 == null ? "" : v2;
19991     };
19992   }
19993   function html_default(value) {
19994     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
19995   }
19996
19997   // node_modules/d3-selection/src/selection/raise.js
19998   function raise() {
19999     if (this.nextSibling)
20000       this.parentNode.appendChild(this);
20001   }
20002   function raise_default() {
20003     return this.each(raise);
20004   }
20005
20006   // node_modules/d3-selection/src/selection/lower.js
20007   function lower() {
20008     if (this.previousSibling)
20009       this.parentNode.insertBefore(this, this.parentNode.firstChild);
20010   }
20011   function lower_default() {
20012     return this.each(lower);
20013   }
20014
20015   // node_modules/d3-selection/src/selection/append.js
20016   function append_default(name) {
20017     var create2 = typeof name === "function" ? name : creator_default(name);
20018     return this.select(function() {
20019       return this.appendChild(create2.apply(this, arguments));
20020     });
20021   }
20022
20023   // node_modules/d3-selection/src/selection/insert.js
20024   function constantNull() {
20025     return null;
20026   }
20027   function insert_default(name, before) {
20028     var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
20029     return this.select(function() {
20030       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
20031     });
20032   }
20033
20034   // node_modules/d3-selection/src/selection/remove.js
20035   function remove() {
20036     var parent = this.parentNode;
20037     if (parent)
20038       parent.removeChild(this);
20039   }
20040   function remove_default() {
20041     return this.each(remove);
20042   }
20043
20044   // node_modules/d3-selection/src/selection/clone.js
20045   function selection_cloneShallow() {
20046     var clone = this.cloneNode(false), parent = this.parentNode;
20047     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
20048   }
20049   function selection_cloneDeep() {
20050     var clone = this.cloneNode(true), parent = this.parentNode;
20051     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
20052   }
20053   function clone_default(deep) {
20054     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
20055   }
20056
20057   // node_modules/d3-selection/src/selection/datum.js
20058   function datum_default(value) {
20059     return arguments.length ? this.property("__data__", value) : this.node().__data__;
20060   }
20061
20062   // node_modules/d3-selection/src/selection/on.js
20063   function contextListener(listener) {
20064     return function(event) {
20065       listener.call(this, event, this.__data__);
20066     };
20067   }
20068   function parseTypenames2(typenames) {
20069     return typenames.trim().split(/^|\s+/).map(function(t2) {
20070       var name = "", i3 = t2.indexOf(".");
20071       if (i3 >= 0)
20072         name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
20073       return { type: t2, name };
20074     });
20075   }
20076   function onRemove(typename) {
20077     return function() {
20078       var on = this.__on;
20079       if (!on)
20080         return;
20081       for (var j3 = 0, i3 = -1, m2 = on.length, o2; j3 < m2; ++j3) {
20082         if (o2 = on[j3], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
20083           this.removeEventListener(o2.type, o2.listener, o2.options);
20084         } else {
20085           on[++i3] = o2;
20086         }
20087       }
20088       if (++i3)
20089         on.length = i3;
20090       else
20091         delete this.__on;
20092     };
20093   }
20094   function onAdd(typename, value, options2) {
20095     return function() {
20096       var on = this.__on, o2, listener = contextListener(value);
20097       if (on)
20098         for (var j3 = 0, m2 = on.length; j3 < m2; ++j3) {
20099           if ((o2 = on[j3]).type === typename.type && o2.name === typename.name) {
20100             this.removeEventListener(o2.type, o2.listener, o2.options);
20101             this.addEventListener(o2.type, o2.listener = listener, o2.options = options2);
20102             o2.value = value;
20103             return;
20104           }
20105         }
20106       this.addEventListener(typename.type, listener, options2);
20107       o2 = { type: typename.type, name: typename.name, value, listener, options: options2 };
20108       if (!on)
20109         this.__on = [o2];
20110       else
20111         on.push(o2);
20112     };
20113   }
20114   function on_default(typename, value, options2) {
20115     var typenames = parseTypenames2(typename + ""), i3, n3 = typenames.length, t2;
20116     if (arguments.length < 2) {
20117       var on = this.node().__on;
20118       if (on)
20119         for (var j3 = 0, m2 = on.length, o2; j3 < m2; ++j3) {
20120           for (i3 = 0, o2 = on[j3]; i3 < n3; ++i3) {
20121             if ((t2 = typenames[i3]).type === o2.type && t2.name === o2.name) {
20122               return o2.value;
20123             }
20124           }
20125         }
20126       return;
20127     }
20128     on = value ? onAdd : onRemove;
20129     for (i3 = 0; i3 < n3; ++i3)
20130       this.each(on(typenames[i3], value, options2));
20131     return this;
20132   }
20133
20134   // node_modules/d3-selection/src/selection/dispatch.js
20135   function dispatchEvent(node, type2, params) {
20136     var window2 = window_default(node), event = window2.CustomEvent;
20137     if (typeof event === "function") {
20138       event = new event(type2, params);
20139     } else {
20140       event = window2.document.createEvent("Event");
20141       if (params)
20142         event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
20143       else
20144         event.initEvent(type2, false, false);
20145     }
20146     node.dispatchEvent(event);
20147   }
20148   function dispatchConstant(type2, params) {
20149     return function() {
20150       return dispatchEvent(this, type2, params);
20151     };
20152   }
20153   function dispatchFunction(type2, params) {
20154     return function() {
20155       return dispatchEvent(this, type2, params.apply(this, arguments));
20156     };
20157   }
20158   function dispatch_default2(type2, params) {
20159     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
20160   }
20161
20162   // node_modules/d3-selection/src/selection/iterator.js
20163   function* iterator_default() {
20164     for (var groups = this._groups, j3 = 0, m2 = groups.length; j3 < m2; ++j3) {
20165       for (var group = groups[j3], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
20166         if (node = group[i3])
20167           yield node;
20168       }
20169     }
20170   }
20171
20172   // node_modules/d3-selection/src/selection/index.js
20173   var root = [null];
20174   function Selection(groups, parents) {
20175     this._groups = groups;
20176     this._parents = parents;
20177   }
20178   function selection() {
20179     return new Selection([[document.documentElement]], root);
20180   }
20181   function selection_selection() {
20182     return this;
20183   }
20184   Selection.prototype = selection.prototype = {
20185     constructor: Selection,
20186     select: select_default,
20187     selectAll: selectAll_default,
20188     selectChild: selectChild_default,
20189     selectChildren: selectChildren_default,
20190     filter: filter_default,
20191     data: data_default,
20192     enter: enter_default,
20193     exit: exit_default,
20194     join: join_default,
20195     merge: merge_default,
20196     selection: selection_selection,
20197     order: order_default,
20198     sort: sort_default,
20199     call: call_default,
20200     nodes: nodes_default,
20201     node: node_default,
20202     size: size_default,
20203     empty: empty_default,
20204     each: each_default,
20205     attr: attr_default,
20206     style: style_default,
20207     property: property_default,
20208     classed: classed_default,
20209     text: text_default,
20210     html: html_default,
20211     raise: raise_default,
20212     lower: lower_default,
20213     append: append_default,
20214     insert: insert_default,
20215     remove: remove_default,
20216     clone: clone_default,
20217     datum: datum_default,
20218     on: on_default,
20219     dispatch: dispatch_default2,
20220     [Symbol.iterator]: iterator_default
20221   };
20222   var selection_default = selection;
20223
20224   // node_modules/d3-selection/src/select.js
20225   function select_default2(selector) {
20226     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
20227   }
20228
20229   // node_modules/d3-selection/src/sourceEvent.js
20230   function sourceEvent_default(event) {
20231     let sourceEvent;
20232     while (sourceEvent = event.sourceEvent)
20233       event = sourceEvent;
20234     return event;
20235   }
20236
20237   // node_modules/d3-selection/src/pointer.js
20238   function pointer_default(event, node) {
20239     event = sourceEvent_default(event);
20240     if (node === void 0)
20241       node = event.currentTarget;
20242     if (node) {
20243       var svg2 = node.ownerSVGElement || node;
20244       if (svg2.createSVGPoint) {
20245         var point2 = svg2.createSVGPoint();
20246         point2.x = event.clientX, point2.y = event.clientY;
20247         point2 = point2.matrixTransform(node.getScreenCTM().inverse());
20248         return [point2.x, point2.y];
20249       }
20250       if (node.getBoundingClientRect) {
20251         var rect = node.getBoundingClientRect();
20252         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
20253       }
20254     }
20255     return [event.pageX, event.pageY];
20256   }
20257
20258   // node_modules/d3-selection/src/selectAll.js
20259   function selectAll_default2(selector) {
20260     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
20261   }
20262
20263   // node_modules/d3-drag/src/noevent.js
20264   var nonpassive = { passive: false };
20265   var nonpassivecapture = { capture: true, passive: false };
20266   function nopropagation(event) {
20267     event.stopImmediatePropagation();
20268   }
20269   function noevent_default(event) {
20270     event.preventDefault();
20271     event.stopImmediatePropagation();
20272   }
20273
20274   // node_modules/d3-drag/src/nodrag.js
20275   function nodrag_default(view) {
20276     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
20277     if ("onselectstart" in root3) {
20278       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
20279     } else {
20280       root3.__noselect = root3.style.MozUserSelect;
20281       root3.style.MozUserSelect = "none";
20282     }
20283   }
20284   function yesdrag(view, noclick) {
20285     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
20286     if (noclick) {
20287       selection2.on("click.drag", noevent_default, nonpassivecapture);
20288       setTimeout(function() {
20289         selection2.on("click.drag", null);
20290       }, 0);
20291     }
20292     if ("onselectstart" in root3) {
20293       selection2.on("selectstart.drag", null);
20294     } else {
20295       root3.style.MozUserSelect = root3.__noselect;
20296       delete root3.__noselect;
20297     }
20298   }
20299
20300   // node_modules/d3-drag/src/constant.js
20301   var constant_default2 = (x2) => () => x2;
20302
20303   // node_modules/d3-drag/src/event.js
20304   function DragEvent(type2, {
20305     sourceEvent,
20306     subject,
20307     target,
20308     identifier,
20309     active,
20310     x: x2,
20311     y: y2,
20312     dx,
20313     dy,
20314     dispatch: dispatch14
20315   }) {
20316     Object.defineProperties(this, {
20317       type: { value: type2, enumerable: true, configurable: true },
20318       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
20319       subject: { value: subject, enumerable: true, configurable: true },
20320       target: { value: target, enumerable: true, configurable: true },
20321       identifier: { value: identifier, enumerable: true, configurable: true },
20322       active: { value: active, enumerable: true, configurable: true },
20323       x: { value: x2, enumerable: true, configurable: true },
20324       y: { value: y2, enumerable: true, configurable: true },
20325       dx: { value: dx, enumerable: true, configurable: true },
20326       dy: { value: dy, enumerable: true, configurable: true },
20327       _: { value: dispatch14 }
20328     });
20329   }
20330   DragEvent.prototype.on = function() {
20331     var value = this._.on.apply(this._, arguments);
20332     return value === this._ ? this : value;
20333   };
20334
20335   // node_modules/d3-drag/src/drag.js
20336   function defaultFilter(event) {
20337     return !event.ctrlKey && !event.button;
20338   }
20339   function defaultContainer() {
20340     return this.parentNode;
20341   }
20342   function defaultSubject(event, d2) {
20343     return d2 == null ? { x: event.x, y: event.y } : d2;
20344   }
20345   function defaultTouchable() {
20346     return navigator.maxTouchPoints || "ontouchstart" in this;
20347   }
20348   function drag_default() {
20349     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
20350     function drag(selection2) {
20351       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)");
20352     }
20353     function mousedowned(event, d2) {
20354       if (touchending || !filter2.call(this, event, d2))
20355         return;
20356       var gesture = beforestart(this, container.call(this, event, d2), event, d2, "mouse");
20357       if (!gesture)
20358         return;
20359       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
20360       nodrag_default(event.view);
20361       nopropagation(event);
20362       mousemoving = false;
20363       mousedownx = event.clientX;
20364       mousedowny = event.clientY;
20365       gesture("start", event);
20366     }
20367     function mousemoved(event) {
20368       noevent_default(event);
20369       if (!mousemoving) {
20370         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
20371         mousemoving = dx * dx + dy * dy > clickDistance2;
20372       }
20373       gestures.mouse("drag", event);
20374     }
20375     function mouseupped(event) {
20376       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
20377       yesdrag(event.view, mousemoving);
20378       noevent_default(event);
20379       gestures.mouse("end", event);
20380     }
20381     function touchstarted(event, d2) {
20382       if (!filter2.call(this, event, d2))
20383         return;
20384       var touches = event.changedTouches, c2 = container.call(this, event, d2), n3 = touches.length, i3, gesture;
20385       for (i3 = 0; i3 < n3; ++i3) {
20386         if (gesture = beforestart(this, c2, event, d2, touches[i3].identifier, touches[i3])) {
20387           nopropagation(event);
20388           gesture("start", event, touches[i3]);
20389         }
20390       }
20391     }
20392     function touchmoved(event) {
20393       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
20394       for (i3 = 0; i3 < n3; ++i3) {
20395         if (gesture = gestures[touches[i3].identifier]) {
20396           noevent_default(event);
20397           gesture("drag", event, touches[i3]);
20398         }
20399       }
20400     }
20401     function touchended(event) {
20402       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
20403       if (touchending)
20404         clearTimeout(touchending);
20405       touchending = setTimeout(function() {
20406         touchending = null;
20407       }, 500);
20408       for (i3 = 0; i3 < n3; ++i3) {
20409         if (gesture = gestures[touches[i3].identifier]) {
20410           nopropagation(event);
20411           gesture("end", event, touches[i3]);
20412         }
20413       }
20414     }
20415     function beforestart(that, container2, event, d2, identifier, touch) {
20416       var dispatch14 = listeners.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s2;
20417       if ((s2 = subject.call(that, new DragEvent("beforestart", {
20418         sourceEvent: event,
20419         target: drag,
20420         identifier,
20421         active,
20422         x: p2[0],
20423         y: p2[1],
20424         dx: 0,
20425         dy: 0,
20426         dispatch: dispatch14
20427       }), d2)) == null)
20428         return;
20429       dx = s2.x - p2[0] || 0;
20430       dy = s2.y - p2[1] || 0;
20431       return function gesture(type2, event2, touch2) {
20432         var p02 = p2, n3;
20433         switch (type2) {
20434           case "start":
20435             gestures[identifier] = gesture, n3 = active++;
20436             break;
20437           case "end":
20438             delete gestures[identifier], --active;
20439           case "drag":
20440             p2 = pointer_default(touch2 || event2, container2), n3 = active;
20441             break;
20442         }
20443         dispatch14.call(
20444           type2,
20445           that,
20446           new DragEvent(type2, {
20447             sourceEvent: event2,
20448             subject: s2,
20449             target: drag,
20450             identifier,
20451             active: n3,
20452             x: p2[0] + dx,
20453             y: p2[1] + dy,
20454             dx: p2[0] - p02[0],
20455             dy: p2[1] - p02[1],
20456             dispatch: dispatch14
20457           }),
20458           d2
20459         );
20460       };
20461     }
20462     drag.filter = function(_2) {
20463       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
20464     };
20465     drag.container = function(_2) {
20466       return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
20467     };
20468     drag.subject = function(_2) {
20469       return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
20470     };
20471     drag.touchable = function(_2) {
20472       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : touchable;
20473     };
20474     drag.on = function() {
20475       var value = listeners.on.apply(listeners, arguments);
20476       return value === listeners ? drag : value;
20477     };
20478     drag.clickDistance = function(_2) {
20479       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag) : Math.sqrt(clickDistance2);
20480     };
20481     return drag;
20482   }
20483
20484   // node_modules/d3-color/src/define.js
20485   function define_default(constructor, factory, prototype) {
20486     constructor.prototype = factory.prototype = prototype;
20487     prototype.constructor = constructor;
20488   }
20489   function extend(parent, definition) {
20490     var prototype = Object.create(parent.prototype);
20491     for (var key in definition)
20492       prototype[key] = definition[key];
20493     return prototype;
20494   }
20495
20496   // node_modules/d3-color/src/color.js
20497   function Color() {
20498   }
20499   var darker = 0.7;
20500   var brighter = 1 / darker;
20501   var reI = "\\s*([+-]?\\d+)\\s*";
20502   var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
20503   var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
20504   var reHex = /^#([0-9a-f]{3,8})$/;
20505   var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
20506   var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
20507   var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
20508   var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
20509   var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
20510   var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
20511   var named = {
20512     aliceblue: 15792383,
20513     antiquewhite: 16444375,
20514     aqua: 65535,
20515     aquamarine: 8388564,
20516     azure: 15794175,
20517     beige: 16119260,
20518     bisque: 16770244,
20519     black: 0,
20520     blanchedalmond: 16772045,
20521     blue: 255,
20522     blueviolet: 9055202,
20523     brown: 10824234,
20524     burlywood: 14596231,
20525     cadetblue: 6266528,
20526     chartreuse: 8388352,
20527     chocolate: 13789470,
20528     coral: 16744272,
20529     cornflowerblue: 6591981,
20530     cornsilk: 16775388,
20531     crimson: 14423100,
20532     cyan: 65535,
20533     darkblue: 139,
20534     darkcyan: 35723,
20535     darkgoldenrod: 12092939,
20536     darkgray: 11119017,
20537     darkgreen: 25600,
20538     darkgrey: 11119017,
20539     darkkhaki: 12433259,
20540     darkmagenta: 9109643,
20541     darkolivegreen: 5597999,
20542     darkorange: 16747520,
20543     darkorchid: 10040012,
20544     darkred: 9109504,
20545     darksalmon: 15308410,
20546     darkseagreen: 9419919,
20547     darkslateblue: 4734347,
20548     darkslategray: 3100495,
20549     darkslategrey: 3100495,
20550     darkturquoise: 52945,
20551     darkviolet: 9699539,
20552     deeppink: 16716947,
20553     deepskyblue: 49151,
20554     dimgray: 6908265,
20555     dimgrey: 6908265,
20556     dodgerblue: 2003199,
20557     firebrick: 11674146,
20558     floralwhite: 16775920,
20559     forestgreen: 2263842,
20560     fuchsia: 16711935,
20561     gainsboro: 14474460,
20562     ghostwhite: 16316671,
20563     gold: 16766720,
20564     goldenrod: 14329120,
20565     gray: 8421504,
20566     green: 32768,
20567     greenyellow: 11403055,
20568     grey: 8421504,
20569     honeydew: 15794160,
20570     hotpink: 16738740,
20571     indianred: 13458524,
20572     indigo: 4915330,
20573     ivory: 16777200,
20574     khaki: 15787660,
20575     lavender: 15132410,
20576     lavenderblush: 16773365,
20577     lawngreen: 8190976,
20578     lemonchiffon: 16775885,
20579     lightblue: 11393254,
20580     lightcoral: 15761536,
20581     lightcyan: 14745599,
20582     lightgoldenrodyellow: 16448210,
20583     lightgray: 13882323,
20584     lightgreen: 9498256,
20585     lightgrey: 13882323,
20586     lightpink: 16758465,
20587     lightsalmon: 16752762,
20588     lightseagreen: 2142890,
20589     lightskyblue: 8900346,
20590     lightslategray: 7833753,
20591     lightslategrey: 7833753,
20592     lightsteelblue: 11584734,
20593     lightyellow: 16777184,
20594     lime: 65280,
20595     limegreen: 3329330,
20596     linen: 16445670,
20597     magenta: 16711935,
20598     maroon: 8388608,
20599     mediumaquamarine: 6737322,
20600     mediumblue: 205,
20601     mediumorchid: 12211667,
20602     mediumpurple: 9662683,
20603     mediumseagreen: 3978097,
20604     mediumslateblue: 8087790,
20605     mediumspringgreen: 64154,
20606     mediumturquoise: 4772300,
20607     mediumvioletred: 13047173,
20608     midnightblue: 1644912,
20609     mintcream: 16121850,
20610     mistyrose: 16770273,
20611     moccasin: 16770229,
20612     navajowhite: 16768685,
20613     navy: 128,
20614     oldlace: 16643558,
20615     olive: 8421376,
20616     olivedrab: 7048739,
20617     orange: 16753920,
20618     orangered: 16729344,
20619     orchid: 14315734,
20620     palegoldenrod: 15657130,
20621     palegreen: 10025880,
20622     paleturquoise: 11529966,
20623     palevioletred: 14381203,
20624     papayawhip: 16773077,
20625     peachpuff: 16767673,
20626     peru: 13468991,
20627     pink: 16761035,
20628     plum: 14524637,
20629     powderblue: 11591910,
20630     purple: 8388736,
20631     rebeccapurple: 6697881,
20632     red: 16711680,
20633     rosybrown: 12357519,
20634     royalblue: 4286945,
20635     saddlebrown: 9127187,
20636     salmon: 16416882,
20637     sandybrown: 16032864,
20638     seagreen: 3050327,
20639     seashell: 16774638,
20640     sienna: 10506797,
20641     silver: 12632256,
20642     skyblue: 8900331,
20643     slateblue: 6970061,
20644     slategray: 7372944,
20645     slategrey: 7372944,
20646     snow: 16775930,
20647     springgreen: 65407,
20648     steelblue: 4620980,
20649     tan: 13808780,
20650     teal: 32896,
20651     thistle: 14204888,
20652     tomato: 16737095,
20653     turquoise: 4251856,
20654     violet: 15631086,
20655     wheat: 16113331,
20656     white: 16777215,
20657     whitesmoke: 16119285,
20658     yellow: 16776960,
20659     yellowgreen: 10145074
20660   };
20661   define_default(Color, color, {
20662     copy(channels) {
20663       return Object.assign(new this.constructor(), this, channels);
20664     },
20665     displayable() {
20666       return this.rgb().displayable();
20667     },
20668     hex: color_formatHex,
20669     // Deprecated! Use color.formatHex.
20670     formatHex: color_formatHex,
20671     formatHex8: color_formatHex8,
20672     formatHsl: color_formatHsl,
20673     formatRgb: color_formatRgb,
20674     toString: color_formatRgb
20675   });
20676   function color_formatHex() {
20677     return this.rgb().formatHex();
20678   }
20679   function color_formatHex8() {
20680     return this.rgb().formatHex8();
20681   }
20682   function color_formatHsl() {
20683     return hslConvert(this).formatHsl();
20684   }
20685   function color_formatRgb() {
20686     return this.rgb().formatRgb();
20687   }
20688   function color(format2) {
20689     var m2, l2;
20690     format2 = (format2 + "").trim().toLowerCase();
20691     return (m2 = reHex.exec(format2)) ? (l2 = m2[1].length, m2 = parseInt(m2[1], 16), l2 === 6 ? rgbn(m2) : l2 === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l2 === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l2 === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
20692   }
20693   function rgbn(n3) {
20694     return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
20695   }
20696   function rgba(r2, g3, b2, a2) {
20697     if (a2 <= 0)
20698       r2 = g3 = b2 = NaN;
20699     return new Rgb(r2, g3, b2, a2);
20700   }
20701   function rgbConvert(o2) {
20702     if (!(o2 instanceof Color))
20703       o2 = color(o2);
20704     if (!o2)
20705       return new Rgb();
20706     o2 = o2.rgb();
20707     return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
20708   }
20709   function rgb(r2, g3, b2, opacity) {
20710     return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b2, opacity == null ? 1 : opacity);
20711   }
20712   function Rgb(r2, g3, b2, opacity) {
20713     this.r = +r2;
20714     this.g = +g3;
20715     this.b = +b2;
20716     this.opacity = +opacity;
20717   }
20718   define_default(Rgb, rgb, extend(Color, {
20719     brighter(k2) {
20720       k2 = k2 == null ? brighter : Math.pow(brighter, k2);
20721       return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
20722     },
20723     darker(k2) {
20724       k2 = k2 == null ? darker : Math.pow(darker, k2);
20725       return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
20726     },
20727     rgb() {
20728       return this;
20729     },
20730     clamp() {
20731       return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
20732     },
20733     displayable() {
20734       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);
20735     },
20736     hex: rgb_formatHex,
20737     // Deprecated! Use color.formatHex.
20738     formatHex: rgb_formatHex,
20739     formatHex8: rgb_formatHex8,
20740     formatRgb: rgb_formatRgb,
20741     toString: rgb_formatRgb
20742   }));
20743   function rgb_formatHex() {
20744     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
20745   }
20746   function rgb_formatHex8() {
20747     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
20748   }
20749   function rgb_formatRgb() {
20750     const a2 = clampa(this.opacity);
20751     return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`;
20752   }
20753   function clampa(opacity) {
20754     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
20755   }
20756   function clampi(value) {
20757     return Math.max(0, Math.min(255, Math.round(value) || 0));
20758   }
20759   function hex(value) {
20760     value = clampi(value);
20761     return (value < 16 ? "0" : "") + value.toString(16);
20762   }
20763   function hsla(h2, s2, l2, a2) {
20764     if (a2 <= 0)
20765       h2 = s2 = l2 = NaN;
20766     else if (l2 <= 0 || l2 >= 1)
20767       h2 = s2 = NaN;
20768     else if (s2 <= 0)
20769       h2 = NaN;
20770     return new Hsl(h2, s2, l2, a2);
20771   }
20772   function hslConvert(o2) {
20773     if (o2 instanceof Hsl)
20774       return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
20775     if (!(o2 instanceof Color))
20776       o2 = color(o2);
20777     if (!o2)
20778       return new Hsl();
20779     if (o2 instanceof Hsl)
20780       return o2;
20781     o2 = o2.rgb();
20782     var r2 = o2.r / 255, g3 = o2.g / 255, b2 = o2.b / 255, min3 = Math.min(r2, g3, b2), max3 = Math.max(r2, g3, b2), h2 = NaN, s2 = max3 - min3, l2 = (max3 + min3) / 2;
20783     if (s2) {
20784       if (r2 === max3)
20785         h2 = (g3 - b2) / s2 + (g3 < b2) * 6;
20786       else if (g3 === max3)
20787         h2 = (b2 - r2) / s2 + 2;
20788       else
20789         h2 = (r2 - g3) / s2 + 4;
20790       s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
20791       h2 *= 60;
20792     } else {
20793       s2 = l2 > 0 && l2 < 1 ? 0 : h2;
20794     }
20795     return new Hsl(h2, s2, l2, o2.opacity);
20796   }
20797   function hsl(h2, s2, l2, opacity) {
20798     return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l2, opacity == null ? 1 : opacity);
20799   }
20800   function Hsl(h2, s2, l2, opacity) {
20801     this.h = +h2;
20802     this.s = +s2;
20803     this.l = +l2;
20804     this.opacity = +opacity;
20805   }
20806   define_default(Hsl, hsl, extend(Color, {
20807     brighter(k2) {
20808       k2 = k2 == null ? brighter : Math.pow(brighter, k2);
20809       return new Hsl(this.h, this.s, this.l * k2, this.opacity);
20810     },
20811     darker(k2) {
20812       k2 = k2 == null ? darker : Math.pow(darker, k2);
20813       return new Hsl(this.h, this.s, this.l * k2, this.opacity);
20814     },
20815     rgb() {
20816       var h2 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l2 = this.l, m2 = l2 + (l2 < 0.5 ? l2 : 1 - l2) * s2, m1 = 2 * l2 - m2;
20817       return new Rgb(
20818         hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
20819         hsl2rgb(h2, m1, m2),
20820         hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
20821         this.opacity
20822       );
20823     },
20824     clamp() {
20825       return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
20826     },
20827     displayable() {
20828       return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
20829     },
20830     formatHsl() {
20831       const a2 = clampa(this.opacity);
20832       return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`;
20833     }
20834   }));
20835   function clamph(value) {
20836     value = (value || 0) % 360;
20837     return value < 0 ? value + 360 : value;
20838   }
20839   function clampt(value) {
20840     return Math.max(0, Math.min(1, value || 0));
20841   }
20842   function hsl2rgb(h2, m1, m2) {
20843     return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
20844   }
20845
20846   // node_modules/d3-interpolate/src/basis.js
20847   function basis(t1, v0, v1, v2, v3) {
20848     var t2 = t1 * t1, t3 = t2 * t1;
20849     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;
20850   }
20851   function basis_default(values) {
20852     var n3 = values.length - 1;
20853     return function(t2) {
20854       var i3 = t2 <= 0 ? t2 = 0 : t2 >= 1 ? (t2 = 1, n3 - 1) : Math.floor(t2 * n3), v1 = values[i3], v2 = values[i3 + 1], v0 = i3 > 0 ? values[i3 - 1] : 2 * v1 - v2, v3 = i3 < n3 - 1 ? values[i3 + 2] : 2 * v2 - v1;
20855       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
20856     };
20857   }
20858
20859   // node_modules/d3-interpolate/src/basisClosed.js
20860   function basisClosed_default(values) {
20861     var n3 = values.length;
20862     return function(t2) {
20863       var i3 = Math.floor(((t2 %= 1) < 0 ? ++t2 : t2) * n3), v0 = values[(i3 + n3 - 1) % n3], v1 = values[i3 % n3], v2 = values[(i3 + 1) % n3], v3 = values[(i3 + 2) % n3];
20864       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
20865     };
20866   }
20867
20868   // node_modules/d3-interpolate/src/constant.js
20869   var constant_default3 = (x2) => () => x2;
20870
20871   // node_modules/d3-interpolate/src/color.js
20872   function linear(a2, d2) {
20873     return function(t2) {
20874       return a2 + t2 * d2;
20875     };
20876   }
20877   function exponential(a2, b2, y2) {
20878     return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t2) {
20879       return Math.pow(a2 + t2 * b2, y2);
20880     };
20881   }
20882   function gamma(y2) {
20883     return (y2 = +y2) === 1 ? nogamma : function(a2, b2) {
20884       return b2 - a2 ? exponential(a2, b2, y2) : constant_default3(isNaN(a2) ? b2 : a2);
20885     };
20886   }
20887   function nogamma(a2, b2) {
20888     var d2 = b2 - a2;
20889     return d2 ? linear(a2, d2) : constant_default3(isNaN(a2) ? b2 : a2);
20890   }
20891
20892   // node_modules/d3-interpolate/src/rgb.js
20893   var rgb_default = function rgbGamma(y2) {
20894     var color2 = gamma(y2);
20895     function rgb2(start2, end) {
20896       var r2 = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g3 = color2(start2.g, end.g), b2 = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
20897       return function(t2) {
20898         start2.r = r2(t2);
20899         start2.g = g3(t2);
20900         start2.b = b2(t2);
20901         start2.opacity = opacity(t2);
20902         return start2 + "";
20903       };
20904     }
20905     rgb2.gamma = rgbGamma;
20906     return rgb2;
20907   }(1);
20908   function rgbSpline(spline) {
20909     return function(colors) {
20910       var n3 = colors.length, r2 = new Array(n3), g3 = new Array(n3), b2 = new Array(n3), i3, color2;
20911       for (i3 = 0; i3 < n3; ++i3) {
20912         color2 = rgb(colors[i3]);
20913         r2[i3] = color2.r || 0;
20914         g3[i3] = color2.g || 0;
20915         b2[i3] = color2.b || 0;
20916       }
20917       r2 = spline(r2);
20918       g3 = spline(g3);
20919       b2 = spline(b2);
20920       color2.opacity = 1;
20921       return function(t2) {
20922         color2.r = r2(t2);
20923         color2.g = g3(t2);
20924         color2.b = b2(t2);
20925         return color2 + "";
20926       };
20927     };
20928   }
20929   var rgbBasis = rgbSpline(basis_default);
20930   var rgbBasisClosed = rgbSpline(basisClosed_default);
20931
20932   // node_modules/d3-interpolate/src/numberArray.js
20933   function numberArray_default(a2, b2) {
20934     if (!b2)
20935       b2 = [];
20936     var n3 = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i3;
20937     return function(t2) {
20938       for (i3 = 0; i3 < n3; ++i3)
20939         c2[i3] = a2[i3] * (1 - t2) + b2[i3] * t2;
20940       return c2;
20941     };
20942   }
20943   function isNumberArray(x2) {
20944     return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
20945   }
20946
20947   // node_modules/d3-interpolate/src/array.js
20948   function genericArray(a2, b2) {
20949     var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
20950     for (i3 = 0; i3 < na; ++i3)
20951       x2[i3] = value_default(a2[i3], b2[i3]);
20952     for (; i3 < nb; ++i3)
20953       c2[i3] = b2[i3];
20954     return function(t2) {
20955       for (i3 = 0; i3 < na; ++i3)
20956         c2[i3] = x2[i3](t2);
20957       return c2;
20958     };
20959   }
20960
20961   // node_modules/d3-interpolate/src/date.js
20962   function date_default(a2, b2) {
20963     var d2 = /* @__PURE__ */ new Date();
20964     return a2 = +a2, b2 = +b2, function(t2) {
20965       return d2.setTime(a2 * (1 - t2) + b2 * t2), d2;
20966     };
20967   }
20968
20969   // node_modules/d3-interpolate/src/number.js
20970   function number_default(a2, b2) {
20971     return a2 = +a2, b2 = +b2, function(t2) {
20972       return a2 * (1 - t2) + b2 * t2;
20973     };
20974   }
20975
20976   // node_modules/d3-interpolate/src/object.js
20977   function object_default(a2, b2) {
20978     var i3 = {}, c2 = {}, k2;
20979     if (a2 === null || typeof a2 !== "object")
20980       a2 = {};
20981     if (b2 === null || typeof b2 !== "object")
20982       b2 = {};
20983     for (k2 in b2) {
20984       if (k2 in a2) {
20985         i3[k2] = value_default(a2[k2], b2[k2]);
20986       } else {
20987         c2[k2] = b2[k2];
20988       }
20989     }
20990     return function(t2) {
20991       for (k2 in i3)
20992         c2[k2] = i3[k2](t2);
20993       return c2;
20994     };
20995   }
20996
20997   // node_modules/d3-interpolate/src/string.js
20998   var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
20999   var reB = new RegExp(reA.source, "g");
21000   function zero2(b2) {
21001     return function() {
21002       return b2;
21003     };
21004   }
21005   function one(b2) {
21006     return function(t2) {
21007       return b2(t2) + "";
21008     };
21009   }
21010   function string_default(a2, b2) {
21011     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q2 = [];
21012     a2 = a2 + "", b2 = b2 + "";
21013     while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) {
21014       if ((bs = bm.index) > bi) {
21015         bs = b2.slice(bi, bs);
21016         if (s2[i3])
21017           s2[i3] += bs;
21018         else
21019           s2[++i3] = bs;
21020       }
21021       if ((am = am[0]) === (bm = bm[0])) {
21022         if (s2[i3])
21023           s2[i3] += bm;
21024         else
21025           s2[++i3] = bm;
21026       } else {
21027         s2[++i3] = null;
21028         q2.push({ i: i3, x: number_default(am, bm) });
21029       }
21030       bi = reB.lastIndex;
21031     }
21032     if (bi < b2.length) {
21033       bs = b2.slice(bi);
21034       if (s2[i3])
21035         s2[i3] += bs;
21036       else
21037         s2[++i3] = bs;
21038     }
21039     return s2.length < 2 ? q2[0] ? one(q2[0].x) : zero2(b2) : (b2 = q2.length, function(t2) {
21040       for (var i4 = 0, o2; i4 < b2; ++i4)
21041         s2[(o2 = q2[i4]).i] = o2.x(t2);
21042       return s2.join("");
21043     });
21044   }
21045
21046   // node_modules/d3-interpolate/src/value.js
21047   function value_default(a2, b2) {
21048     var t2 = typeof b2, c2;
21049     return b2 == null || t2 === "boolean" ? constant_default3(b2) : (t2 === "number" ? number_default : t2 === "string" ? (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default : b2 instanceof color ? rgb_default : b2 instanceof Date ? date_default : isNumberArray(b2) ? numberArray_default : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object_default : number_default)(a2, b2);
21050   }
21051
21052   // node_modules/d3-interpolate/src/round.js
21053   function round_default(a2, b2) {
21054     return a2 = +a2, b2 = +b2, function(t2) {
21055       return Math.round(a2 * (1 - t2) + b2 * t2);
21056     };
21057   }
21058
21059   // node_modules/d3-interpolate/src/transform/decompose.js
21060   var degrees2 = 180 / Math.PI;
21061   var identity = {
21062     translateX: 0,
21063     translateY: 0,
21064     rotate: 0,
21065     skewX: 0,
21066     scaleX: 1,
21067     scaleY: 1
21068   };
21069   function decompose_default(a2, b2, c2, d2, e3, f3) {
21070     var scaleX, scaleY, skewX;
21071     if (scaleX = Math.sqrt(a2 * a2 + b2 * b2))
21072       a2 /= scaleX, b2 /= scaleX;
21073     if (skewX = a2 * c2 + b2 * d2)
21074       c2 -= a2 * skewX, d2 -= b2 * skewX;
21075     if (scaleY = Math.sqrt(c2 * c2 + d2 * d2))
21076       c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
21077     if (a2 * d2 < b2 * c2)
21078       a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX;
21079     return {
21080       translateX: e3,
21081       translateY: f3,
21082       rotate: Math.atan2(b2, a2) * degrees2,
21083       skewX: Math.atan(skewX) * degrees2,
21084       scaleX,
21085       scaleY
21086     };
21087   }
21088
21089   // node_modules/d3-interpolate/src/transform/parse.js
21090   var svgNode;
21091   function parseCss(value) {
21092     const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
21093     return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
21094   }
21095   function parseSvg(value) {
21096     if (value == null)
21097       return identity;
21098     if (!svgNode)
21099       svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
21100     svgNode.setAttribute("transform", value);
21101     if (!(value = svgNode.transform.baseVal.consolidate()))
21102       return identity;
21103     value = value.matrix;
21104     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
21105   }
21106
21107   // node_modules/d3-interpolate/src/transform/index.js
21108   function interpolateTransform(parse, pxComma, pxParen, degParen) {
21109     function pop(s2) {
21110       return s2.length ? s2.pop() + " " : "";
21111     }
21112     function translate(xa, ya, xb, yb, s2, q2) {
21113       if (xa !== xb || ya !== yb) {
21114         var i3 = s2.push("translate(", null, pxComma, null, pxParen);
21115         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
21116       } else if (xb || yb) {
21117         s2.push("translate(" + xb + pxComma + yb + pxParen);
21118       }
21119     }
21120     function rotate(a2, b2, s2, q2) {
21121       if (a2 !== b2) {
21122         if (a2 - b2 > 180)
21123           b2 += 360;
21124         else if (b2 - a2 > 180)
21125           a2 += 360;
21126         q2.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b2) });
21127       } else if (b2) {
21128         s2.push(pop(s2) + "rotate(" + b2 + degParen);
21129       }
21130     }
21131     function skewX(a2, b2, s2, q2) {
21132       if (a2 !== b2) {
21133         q2.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b2) });
21134       } else if (b2) {
21135         s2.push(pop(s2) + "skewX(" + b2 + degParen);
21136       }
21137     }
21138     function scale(xa, ya, xb, yb, s2, q2) {
21139       if (xa !== xb || ya !== yb) {
21140         var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
21141         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
21142       } else if (xb !== 1 || yb !== 1) {
21143         s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
21144       }
21145     }
21146     return function(a2, b2) {
21147       var s2 = [], q2 = [];
21148       a2 = parse(a2), b2 = parse(b2);
21149       translate(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q2);
21150       rotate(a2.rotate, b2.rotate, s2, q2);
21151       skewX(a2.skewX, b2.skewX, s2, q2);
21152       scale(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q2);
21153       a2 = b2 = null;
21154       return function(t2) {
21155         var i3 = -1, n3 = q2.length, o2;
21156         while (++i3 < n3)
21157           s2[(o2 = q2[i3]).i] = o2.x(t2);
21158         return s2.join("");
21159       };
21160     };
21161   }
21162   var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
21163   var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
21164
21165   // node_modules/d3-interpolate/src/zoom.js
21166   var epsilon22 = 1e-12;
21167   function cosh(x2) {
21168     return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
21169   }
21170   function sinh(x2) {
21171     return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
21172   }
21173   function tanh(x2) {
21174     return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
21175   }
21176   var zoom_default = function zoomRho(rho, rho2, rho4) {
21177     function zoom(p02, p1) {
21178       var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i3, S2;
21179       if (d2 < epsilon22) {
21180         S2 = Math.log(w1 / w0) / rho;
21181         i3 = function(t2) {
21182           return [
21183             ux0 + t2 * dx,
21184             uy0 + t2 * dy,
21185             w0 * Math.exp(rho * t2 * S2)
21186           ];
21187         };
21188       } else {
21189         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);
21190         S2 = (r1 - r0) / rho;
21191         i3 = function(t2) {
21192           var s2 = t2 * S2, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
21193           return [
21194             ux0 + u2 * dx,
21195             uy0 + u2 * dy,
21196             w0 * coshr0 / cosh(rho * s2 + r0)
21197           ];
21198         };
21199       }
21200       i3.duration = S2 * 1e3 * rho / Math.SQRT2;
21201       return i3;
21202     }
21203     zoom.rho = function(_2) {
21204       var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22;
21205       return zoomRho(_1, _22, _4);
21206     };
21207     return zoom;
21208   }(Math.SQRT2, 2, 4);
21209
21210   // node_modules/d3-interpolate/src/quantize.js
21211   function quantize_default(interpolator, n3) {
21212     var samples = new Array(n3);
21213     for (var i3 = 0; i3 < n3; ++i3)
21214       samples[i3] = interpolator(i3 / (n3 - 1));
21215     return samples;
21216   }
21217
21218   // node_modules/d3-timer/src/timer.js
21219   var frame = 0;
21220   var timeout = 0;
21221   var interval = 0;
21222   var pokeDelay = 1e3;
21223   var taskHead;
21224   var taskTail;
21225   var clockLast = 0;
21226   var clockNow = 0;
21227   var clockSkew = 0;
21228   var clock = typeof performance === "object" && performance.now ? performance : Date;
21229   var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f3) {
21230     setTimeout(f3, 17);
21231   };
21232   function now() {
21233     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
21234   }
21235   function clearNow() {
21236     clockNow = 0;
21237   }
21238   function Timer() {
21239     this._call = this._time = this._next = null;
21240   }
21241   Timer.prototype = timer.prototype = {
21242     constructor: Timer,
21243     restart: function(callback, delay, time) {
21244       if (typeof callback !== "function")
21245         throw new TypeError("callback is not a function");
21246       time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
21247       if (!this._next && taskTail !== this) {
21248         if (taskTail)
21249           taskTail._next = this;
21250         else
21251           taskHead = this;
21252         taskTail = this;
21253       }
21254       this._call = callback;
21255       this._time = time;
21256       sleep();
21257     },
21258     stop: function() {
21259       if (this._call) {
21260         this._call = null;
21261         this._time = Infinity;
21262         sleep();
21263       }
21264     }
21265   };
21266   function timer(callback, delay, time) {
21267     var t2 = new Timer();
21268     t2.restart(callback, delay, time);
21269     return t2;
21270   }
21271   function timerFlush() {
21272     now();
21273     ++frame;
21274     var t2 = taskHead, e3;
21275     while (t2) {
21276       if ((e3 = clockNow - t2._time) >= 0)
21277         t2._call.call(void 0, e3);
21278       t2 = t2._next;
21279     }
21280     --frame;
21281   }
21282   function wake() {
21283     clockNow = (clockLast = clock.now()) + clockSkew;
21284     frame = timeout = 0;
21285     try {
21286       timerFlush();
21287     } finally {
21288       frame = 0;
21289       nap();
21290       clockNow = 0;
21291     }
21292   }
21293   function poke() {
21294     var now3 = clock.now(), delay = now3 - clockLast;
21295     if (delay > pokeDelay)
21296       clockSkew -= delay, clockLast = now3;
21297   }
21298   function nap() {
21299     var t0, t1 = taskHead, t2, time = Infinity;
21300     while (t1) {
21301       if (t1._call) {
21302         if (time > t1._time)
21303           time = t1._time;
21304         t0 = t1, t1 = t1._next;
21305       } else {
21306         t2 = t1._next, t1._next = null;
21307         t1 = t0 ? t0._next = t2 : taskHead = t2;
21308       }
21309     }
21310     taskTail = t0;
21311     sleep(time);
21312   }
21313   function sleep(time) {
21314     if (frame)
21315       return;
21316     if (timeout)
21317       timeout = clearTimeout(timeout);
21318     var delay = time - clockNow;
21319     if (delay > 24) {
21320       if (time < Infinity)
21321         timeout = setTimeout(wake, time - clock.now() - clockSkew);
21322       if (interval)
21323         interval = clearInterval(interval);
21324     } else {
21325       if (!interval)
21326         clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
21327       frame = 1, setFrame(wake);
21328     }
21329   }
21330
21331   // node_modules/d3-timer/src/timeout.js
21332   function timeout_default(callback, delay, time) {
21333     var t2 = new Timer();
21334     delay = delay == null ? 0 : +delay;
21335     t2.restart((elapsed) => {
21336       t2.stop();
21337       callback(elapsed + delay);
21338     }, delay, time);
21339     return t2;
21340   }
21341
21342   // node_modules/d3-transition/src/transition/schedule.js
21343   var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
21344   var emptyTween = [];
21345   var CREATED = 0;
21346   var SCHEDULED = 1;
21347   var STARTING = 2;
21348   var STARTED = 3;
21349   var RUNNING = 4;
21350   var ENDING = 5;
21351   var ENDED = 6;
21352   function schedule_default(node, name, id2, index, group, timing) {
21353     var schedules = node.__transition;
21354     if (!schedules)
21355       node.__transition = {};
21356     else if (id2 in schedules)
21357       return;
21358     create(node, id2, {
21359       name,
21360       index,
21361       // For context during callback.
21362       group,
21363       // For context during callback.
21364       on: emptyOn,
21365       tween: emptyTween,
21366       time: timing.time,
21367       delay: timing.delay,
21368       duration: timing.duration,
21369       ease: timing.ease,
21370       timer: null,
21371       state: CREATED
21372     });
21373   }
21374   function init(node, id2) {
21375     var schedule = get2(node, id2);
21376     if (schedule.state > CREATED)
21377       throw new Error("too late; already scheduled");
21378     return schedule;
21379   }
21380   function set2(node, id2) {
21381     var schedule = get2(node, id2);
21382     if (schedule.state > STARTED)
21383       throw new Error("too late; already running");
21384     return schedule;
21385   }
21386   function get2(node, id2) {
21387     var schedule = node.__transition;
21388     if (!schedule || !(schedule = schedule[id2]))
21389       throw new Error("transition not found");
21390     return schedule;
21391   }
21392   function create(node, id2, self2) {
21393     var schedules = node.__transition, tween;
21394     schedules[id2] = self2;
21395     self2.timer = timer(schedule, 0, self2.time);
21396     function schedule(elapsed) {
21397       self2.state = SCHEDULED;
21398       self2.timer.restart(start2, self2.delay, self2.time);
21399       if (self2.delay <= elapsed)
21400         start2(elapsed - self2.delay);
21401     }
21402     function start2(elapsed) {
21403       var i3, j3, n3, o2;
21404       if (self2.state !== SCHEDULED)
21405         return stop();
21406       for (i3 in schedules) {
21407         o2 = schedules[i3];
21408         if (o2.name !== self2.name)
21409           continue;
21410         if (o2.state === STARTED)
21411           return timeout_default(start2);
21412         if (o2.state === RUNNING) {
21413           o2.state = ENDED;
21414           o2.timer.stop();
21415           o2.on.call("interrupt", node, node.__data__, o2.index, o2.group);
21416           delete schedules[i3];
21417         } else if (+i3 < id2) {
21418           o2.state = ENDED;
21419           o2.timer.stop();
21420           o2.on.call("cancel", node, node.__data__, o2.index, o2.group);
21421           delete schedules[i3];
21422         }
21423       }
21424       timeout_default(function() {
21425         if (self2.state === STARTED) {
21426           self2.state = RUNNING;
21427           self2.timer.restart(tick, self2.delay, self2.time);
21428           tick(elapsed);
21429         }
21430       });
21431       self2.state = STARTING;
21432       self2.on.call("start", node, node.__data__, self2.index, self2.group);
21433       if (self2.state !== STARTING)
21434         return;
21435       self2.state = STARTED;
21436       tween = new Array(n3 = self2.tween.length);
21437       for (i3 = 0, j3 = -1; i3 < n3; ++i3) {
21438         if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
21439           tween[++j3] = o2;
21440         }
21441       }
21442       tween.length = j3 + 1;
21443     }
21444     function tick(elapsed) {
21445       var t2 = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i3 = -1, n3 = tween.length;
21446       while (++i3 < n3) {
21447         tween[i3].call(node, t2);
21448       }
21449       if (self2.state === ENDING) {
21450         self2.on.call("end", node, node.__data__, self2.index, self2.group);
21451         stop();
21452       }
21453     }
21454     function stop() {
21455       self2.state = ENDED;
21456       self2.timer.stop();
21457       delete schedules[id2];
21458       for (var i3 in schedules)
21459         return;
21460       delete node.__transition;
21461     }
21462   }
21463
21464   // node_modules/d3-transition/src/interrupt.js
21465   function interrupt_default(node, name) {
21466     var schedules = node.__transition, schedule, active, empty2 = true, i3;
21467     if (!schedules)
21468       return;
21469     name = name == null ? null : name + "";
21470     for (i3 in schedules) {
21471       if ((schedule = schedules[i3]).name !== name) {
21472         empty2 = false;
21473         continue;
21474       }
21475       active = schedule.state > STARTING && schedule.state < ENDING;
21476       schedule.state = ENDED;
21477       schedule.timer.stop();
21478       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
21479       delete schedules[i3];
21480     }
21481     if (empty2)
21482       delete node.__transition;
21483   }
21484
21485   // node_modules/d3-transition/src/selection/interrupt.js
21486   function interrupt_default2(name) {
21487     return this.each(function() {
21488       interrupt_default(this, name);
21489     });
21490   }
21491
21492   // node_modules/d3-transition/src/transition/tween.js
21493   function tweenRemove(id2, name) {
21494     var tween0, tween1;
21495     return function() {
21496       var schedule = set2(this, id2), tween = schedule.tween;
21497       if (tween !== tween0) {
21498         tween1 = tween0 = tween;
21499         for (var i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
21500           if (tween1[i3].name === name) {
21501             tween1 = tween1.slice();
21502             tween1.splice(i3, 1);
21503             break;
21504           }
21505         }
21506       }
21507       schedule.tween = tween1;
21508     };
21509   }
21510   function tweenFunction(id2, name, value) {
21511     var tween0, tween1;
21512     if (typeof value !== "function")
21513       throw new Error();
21514     return function() {
21515       var schedule = set2(this, id2), tween = schedule.tween;
21516       if (tween !== tween0) {
21517         tween1 = (tween0 = tween).slice();
21518         for (var t2 = { name, value }, i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
21519           if (tween1[i3].name === name) {
21520             tween1[i3] = t2;
21521             break;
21522           }
21523         }
21524         if (i3 === n3)
21525           tween1.push(t2);
21526       }
21527       schedule.tween = tween1;
21528     };
21529   }
21530   function tween_default(name, value) {
21531     var id2 = this._id;
21532     name += "";
21533     if (arguments.length < 2) {
21534       var tween = get2(this.node(), id2).tween;
21535       for (var i3 = 0, n3 = tween.length, t2; i3 < n3; ++i3) {
21536         if ((t2 = tween[i3]).name === name) {
21537           return t2.value;
21538         }
21539       }
21540       return null;
21541     }
21542     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
21543   }
21544   function tweenValue(transition2, name, value) {
21545     var id2 = transition2._id;
21546     transition2.each(function() {
21547       var schedule = set2(this, id2);
21548       (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
21549     });
21550     return function(node) {
21551       return get2(node, id2).value[name];
21552     };
21553   }
21554
21555   // node_modules/d3-transition/src/transition/interpolate.js
21556   function interpolate_default(a2, b2) {
21557     var c2;
21558     return (typeof b2 === "number" ? number_default : b2 instanceof color ? rgb_default : (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default)(a2, b2);
21559   }
21560
21561   // node_modules/d3-transition/src/transition/attr.js
21562   function attrRemove2(name) {
21563     return function() {
21564       this.removeAttribute(name);
21565     };
21566   }
21567   function attrRemoveNS2(fullname) {
21568     return function() {
21569       this.removeAttributeNS(fullname.space, fullname.local);
21570     };
21571   }
21572   function attrConstant2(name, interpolate, value1) {
21573     var string00, string1 = value1 + "", interpolate0;
21574     return function() {
21575       var string0 = this.getAttribute(name);
21576       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21577     };
21578   }
21579   function attrConstantNS2(fullname, interpolate, value1) {
21580     var string00, string1 = value1 + "", interpolate0;
21581     return function() {
21582       var string0 = this.getAttributeNS(fullname.space, fullname.local);
21583       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21584     };
21585   }
21586   function attrFunction2(name, interpolate, value) {
21587     var string00, string10, interpolate0;
21588     return function() {
21589       var string0, value1 = value(this), string1;
21590       if (value1 == null)
21591         return void this.removeAttribute(name);
21592       string0 = this.getAttribute(name);
21593       string1 = value1 + "";
21594       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21595     };
21596   }
21597   function attrFunctionNS2(fullname, interpolate, value) {
21598     var string00, string10, interpolate0;
21599     return function() {
21600       var string0, value1 = value(this), string1;
21601       if (value1 == null)
21602         return void this.removeAttributeNS(fullname.space, fullname.local);
21603       string0 = this.getAttributeNS(fullname.space, fullname.local);
21604       string1 = value1 + "";
21605       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21606     };
21607   }
21608   function attr_default2(name, value) {
21609     var fullname = namespace_default(name), i3 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
21610     return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i3, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i3, value));
21611   }
21612
21613   // node_modules/d3-transition/src/transition/attrTween.js
21614   function attrInterpolate(name, i3) {
21615     return function(t2) {
21616       this.setAttribute(name, i3.call(this, t2));
21617     };
21618   }
21619   function attrInterpolateNS(fullname, i3) {
21620     return function(t2) {
21621       this.setAttributeNS(fullname.space, fullname.local, i3.call(this, t2));
21622     };
21623   }
21624   function attrTweenNS(fullname, value) {
21625     var t0, i0;
21626     function tween() {
21627       var i3 = value.apply(this, arguments);
21628       if (i3 !== i0)
21629         t0 = (i0 = i3) && attrInterpolateNS(fullname, i3);
21630       return t0;
21631     }
21632     tween._value = value;
21633     return tween;
21634   }
21635   function attrTween(name, value) {
21636     var t0, i0;
21637     function tween() {
21638       var i3 = value.apply(this, arguments);
21639       if (i3 !== i0)
21640         t0 = (i0 = i3) && attrInterpolate(name, i3);
21641       return t0;
21642     }
21643     tween._value = value;
21644     return tween;
21645   }
21646   function attrTween_default(name, value) {
21647     var key = "attr." + name;
21648     if (arguments.length < 2)
21649       return (key = this.tween(key)) && key._value;
21650     if (value == null)
21651       return this.tween(key, null);
21652     if (typeof value !== "function")
21653       throw new Error();
21654     var fullname = namespace_default(name);
21655     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
21656   }
21657
21658   // node_modules/d3-transition/src/transition/delay.js
21659   function delayFunction(id2, value) {
21660     return function() {
21661       init(this, id2).delay = +value.apply(this, arguments);
21662     };
21663   }
21664   function delayConstant(id2, value) {
21665     return value = +value, function() {
21666       init(this, id2).delay = value;
21667     };
21668   }
21669   function delay_default(value) {
21670     var id2 = this._id;
21671     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
21672   }
21673
21674   // node_modules/d3-transition/src/transition/duration.js
21675   function durationFunction(id2, value) {
21676     return function() {
21677       set2(this, id2).duration = +value.apply(this, arguments);
21678     };
21679   }
21680   function durationConstant(id2, value) {
21681     return value = +value, function() {
21682       set2(this, id2).duration = value;
21683     };
21684   }
21685   function duration_default(value) {
21686     var id2 = this._id;
21687     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
21688   }
21689
21690   // node_modules/d3-transition/src/transition/ease.js
21691   function easeConstant(id2, value) {
21692     if (typeof value !== "function")
21693       throw new Error();
21694     return function() {
21695       set2(this, id2).ease = value;
21696     };
21697   }
21698   function ease_default(value) {
21699     var id2 = this._id;
21700     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
21701   }
21702
21703   // node_modules/d3-transition/src/transition/easeVarying.js
21704   function easeVarying(id2, value) {
21705     return function() {
21706       var v2 = value.apply(this, arguments);
21707       if (typeof v2 !== "function")
21708         throw new Error();
21709       set2(this, id2).ease = v2;
21710     };
21711   }
21712   function easeVarying_default(value) {
21713     if (typeof value !== "function")
21714       throw new Error();
21715     return this.each(easeVarying(this._id, value));
21716   }
21717
21718   // node_modules/d3-transition/src/transition/filter.js
21719   function filter_default2(match) {
21720     if (typeof match !== "function")
21721       match = matcher_default(match);
21722     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
21723       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], node, i3 = 0; i3 < n3; ++i3) {
21724         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
21725           subgroup.push(node);
21726         }
21727       }
21728     }
21729     return new Transition(subgroups, this._parents, this._name, this._id);
21730   }
21731
21732   // node_modules/d3-transition/src/transition/merge.js
21733   function merge_default2(transition2) {
21734     if (transition2._id !== this._id)
21735       throw new Error();
21736     for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m2; ++j3) {
21737       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge2 = merges[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
21738         if (node = group0[i3] || group1[i3]) {
21739           merge2[i3] = node;
21740         }
21741       }
21742     }
21743     for (; j3 < m0; ++j3) {
21744       merges[j3] = groups0[j3];
21745     }
21746     return new Transition(merges, this._parents, this._name, this._id);
21747   }
21748
21749   // node_modules/d3-transition/src/transition/on.js
21750   function start(name) {
21751     return (name + "").trim().split(/^|\s+/).every(function(t2) {
21752       var i3 = t2.indexOf(".");
21753       if (i3 >= 0)
21754         t2 = t2.slice(0, i3);
21755       return !t2 || t2 === "start";
21756     });
21757   }
21758   function onFunction(id2, name, listener) {
21759     var on0, on1, sit = start(name) ? init : set2;
21760     return function() {
21761       var schedule = sit(this, id2), on = schedule.on;
21762       if (on !== on0)
21763         (on1 = (on0 = on).copy()).on(name, listener);
21764       schedule.on = on1;
21765     };
21766   }
21767   function on_default2(name, listener) {
21768     var id2 = this._id;
21769     return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
21770   }
21771
21772   // node_modules/d3-transition/src/transition/remove.js
21773   function removeFunction(id2) {
21774     return function() {
21775       var parent = this.parentNode;
21776       for (var i3 in this.__transition)
21777         if (+i3 !== id2)
21778           return;
21779       if (parent)
21780         parent.removeChild(this);
21781     };
21782   }
21783   function remove_default2() {
21784     return this.on("end.remove", removeFunction(this._id));
21785   }
21786
21787   // node_modules/d3-transition/src/transition/select.js
21788   function select_default3(select) {
21789     var name = this._name, id2 = this._id;
21790     if (typeof select !== "function")
21791       select = selector_default(select);
21792     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
21793       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
21794         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
21795           if ("__data__" in node)
21796             subnode.__data__ = node.__data__;
21797           subgroup[i3] = subnode;
21798           schedule_default(subgroup[i3], name, id2, i3, subgroup, get2(node, id2));
21799         }
21800       }
21801     }
21802     return new Transition(subgroups, this._parents, name, id2);
21803   }
21804
21805   // node_modules/d3-transition/src/transition/selectAll.js
21806   function selectAll_default3(select) {
21807     var name = this._name, id2 = this._id;
21808     if (typeof select !== "function")
21809       select = selectorAll_default(select);
21810     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m2; ++j3) {
21811       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
21812         if (node = group[i3]) {
21813           for (var children2 = select.call(node, node.__data__, i3, group), child, inherit2 = get2(node, id2), k2 = 0, l2 = children2.length; k2 < l2; ++k2) {
21814             if (child = children2[k2]) {
21815               schedule_default(child, name, id2, k2, children2, inherit2);
21816             }
21817           }
21818           subgroups.push(children2);
21819           parents.push(node);
21820         }
21821       }
21822     }
21823     return new Transition(subgroups, parents, name, id2);
21824   }
21825
21826   // node_modules/d3-transition/src/transition/selection.js
21827   var Selection2 = selection_default.prototype.constructor;
21828   function selection_default2() {
21829     return new Selection2(this._groups, this._parents);
21830   }
21831
21832   // node_modules/d3-transition/src/transition/style.js
21833   function styleNull(name, interpolate) {
21834     var string00, string10, interpolate0;
21835     return function() {
21836       var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
21837       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
21838     };
21839   }
21840   function styleRemove2(name) {
21841     return function() {
21842       this.style.removeProperty(name);
21843     };
21844   }
21845   function styleConstant2(name, interpolate, value1) {
21846     var string00, string1 = value1 + "", interpolate0;
21847     return function() {
21848       var string0 = styleValue(this, name);
21849       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21850     };
21851   }
21852   function styleFunction2(name, interpolate, value) {
21853     var string00, string10, interpolate0;
21854     return function() {
21855       var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
21856       if (value1 == null)
21857         string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
21858       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21859     };
21860   }
21861   function styleMaybeRemove(id2, name) {
21862     var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
21863     return function() {
21864       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
21865       if (on !== on0 || listener0 !== listener)
21866         (on1 = (on0 = on).copy()).on(event, listener0 = listener);
21867       schedule.on = on1;
21868     };
21869   }
21870   function style_default2(name, value, priority) {
21871     var i3 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
21872     return value == null ? this.styleTween(name, styleNull(name, i3)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i3, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i3, value), priority).on("end.style." + name, null);
21873   }
21874
21875   // node_modules/d3-transition/src/transition/styleTween.js
21876   function styleInterpolate(name, i3, priority) {
21877     return function(t2) {
21878       this.style.setProperty(name, i3.call(this, t2), priority);
21879     };
21880   }
21881   function styleTween(name, value, priority) {
21882     var t2, i0;
21883     function tween() {
21884       var i3 = value.apply(this, arguments);
21885       if (i3 !== i0)
21886         t2 = (i0 = i3) && styleInterpolate(name, i3, priority);
21887       return t2;
21888     }
21889     tween._value = value;
21890     return tween;
21891   }
21892   function styleTween_default(name, value, priority) {
21893     var key = "style." + (name += "");
21894     if (arguments.length < 2)
21895       return (key = this.tween(key)) && key._value;
21896     if (value == null)
21897       return this.tween(key, null);
21898     if (typeof value !== "function")
21899       throw new Error();
21900     return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
21901   }
21902
21903   // node_modules/d3-transition/src/transition/text.js
21904   function textConstant2(value) {
21905     return function() {
21906       this.textContent = value;
21907     };
21908   }
21909   function textFunction2(value) {
21910     return function() {
21911       var value1 = value(this);
21912       this.textContent = value1 == null ? "" : value1;
21913     };
21914   }
21915   function text_default2(value) {
21916     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
21917   }
21918
21919   // node_modules/d3-transition/src/transition/textTween.js
21920   function textInterpolate(i3) {
21921     return function(t2) {
21922       this.textContent = i3.call(this, t2);
21923     };
21924   }
21925   function textTween(value) {
21926     var t0, i0;
21927     function tween() {
21928       var i3 = value.apply(this, arguments);
21929       if (i3 !== i0)
21930         t0 = (i0 = i3) && textInterpolate(i3);
21931       return t0;
21932     }
21933     tween._value = value;
21934     return tween;
21935   }
21936   function textTween_default(value) {
21937     var key = "text";
21938     if (arguments.length < 1)
21939       return (key = this.tween(key)) && key._value;
21940     if (value == null)
21941       return this.tween(key, null);
21942     if (typeof value !== "function")
21943       throw new Error();
21944     return this.tween(key, textTween(value));
21945   }
21946
21947   // node_modules/d3-transition/src/transition/transition.js
21948   function transition_default() {
21949     var name = this._name, id0 = this._id, id1 = newId();
21950     for (var groups = this._groups, m2 = groups.length, j3 = 0; j3 < m2; ++j3) {
21951       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
21952         if (node = group[i3]) {
21953           var inherit2 = get2(node, id0);
21954           schedule_default(node, name, id1, i3, group, {
21955             time: inherit2.time + inherit2.delay + inherit2.duration,
21956             delay: 0,
21957             duration: inherit2.duration,
21958             ease: inherit2.ease
21959           });
21960         }
21961       }
21962     }
21963     return new Transition(groups, this._parents, name, id1);
21964   }
21965
21966   // node_modules/d3-transition/src/transition/end.js
21967   function end_default() {
21968     var on0, on1, that = this, id2 = that._id, size = that.size();
21969     return new Promise(function(resolve, reject) {
21970       var cancel = { value: reject }, end = { value: function() {
21971         if (--size === 0)
21972           resolve();
21973       } };
21974       that.each(function() {
21975         var schedule = set2(this, id2), on = schedule.on;
21976         if (on !== on0) {
21977           on1 = (on0 = on).copy();
21978           on1._.cancel.push(cancel);
21979           on1._.interrupt.push(cancel);
21980           on1._.end.push(end);
21981         }
21982         schedule.on = on1;
21983       });
21984       if (size === 0)
21985         resolve();
21986     });
21987   }
21988
21989   // node_modules/d3-transition/src/transition/index.js
21990   var id = 0;
21991   function Transition(groups, parents, name, id2) {
21992     this._groups = groups;
21993     this._parents = parents;
21994     this._name = name;
21995     this._id = id2;
21996   }
21997   function transition(name) {
21998     return selection_default().transition(name);
21999   }
22000   function newId() {
22001     return ++id;
22002   }
22003   var selection_prototype = selection_default.prototype;
22004   Transition.prototype = transition.prototype = {
22005     constructor: Transition,
22006     select: select_default3,
22007     selectAll: selectAll_default3,
22008     selectChild: selection_prototype.selectChild,
22009     selectChildren: selection_prototype.selectChildren,
22010     filter: filter_default2,
22011     merge: merge_default2,
22012     selection: selection_default2,
22013     transition: transition_default,
22014     call: selection_prototype.call,
22015     nodes: selection_prototype.nodes,
22016     node: selection_prototype.node,
22017     size: selection_prototype.size,
22018     empty: selection_prototype.empty,
22019     each: selection_prototype.each,
22020     on: on_default2,
22021     attr: attr_default2,
22022     attrTween: attrTween_default,
22023     style: style_default2,
22024     styleTween: styleTween_default,
22025     text: text_default2,
22026     textTween: textTween_default,
22027     remove: remove_default2,
22028     tween: tween_default,
22029     delay: delay_default,
22030     duration: duration_default,
22031     ease: ease_default,
22032     easeVarying: easeVarying_default,
22033     end: end_default,
22034     [Symbol.iterator]: selection_prototype[Symbol.iterator]
22035   };
22036
22037   // node_modules/d3-ease/src/linear.js
22038   var linear2 = (t2) => +t2;
22039
22040   // node_modules/d3-ease/src/cubic.js
22041   function cubicInOut(t2) {
22042     return ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2;
22043   }
22044
22045   // node_modules/d3-transition/src/selection/transition.js
22046   var defaultTiming = {
22047     time: null,
22048     // Set on use.
22049     delay: 0,
22050     duration: 250,
22051     ease: cubicInOut
22052   };
22053   function inherit(node, id2) {
22054     var timing;
22055     while (!(timing = node.__transition) || !(timing = timing[id2])) {
22056       if (!(node = node.parentNode)) {
22057         throw new Error(`transition ${id2} not found`);
22058       }
22059     }
22060     return timing;
22061   }
22062   function transition_default2(name) {
22063     var id2, timing;
22064     if (name instanceof Transition) {
22065       id2 = name._id, name = name._name;
22066     } else {
22067       id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
22068     }
22069     for (var groups = this._groups, m2 = groups.length, j3 = 0; j3 < m2; ++j3) {
22070       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
22071         if (node = group[i3]) {
22072           schedule_default(node, name, id2, i3, group, timing || inherit(node, id2));
22073         }
22074       }
22075     }
22076     return new Transition(groups, this._parents, name, id2);
22077   }
22078
22079   // node_modules/d3-transition/src/selection/index.js
22080   selection_default.prototype.interrupt = interrupt_default2;
22081   selection_default.prototype.transition = transition_default2;
22082
22083   // node_modules/d3-zoom/src/constant.js
22084   var constant_default4 = (x2) => () => x2;
22085
22086   // node_modules/d3-zoom/src/event.js
22087   function ZoomEvent(type2, {
22088     sourceEvent,
22089     target,
22090     transform: transform2,
22091     dispatch: dispatch14
22092   }) {
22093     Object.defineProperties(this, {
22094       type: { value: type2, enumerable: true, configurable: true },
22095       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
22096       target: { value: target, enumerable: true, configurable: true },
22097       transform: { value: transform2, enumerable: true, configurable: true },
22098       _: { value: dispatch14 }
22099     });
22100   }
22101
22102   // node_modules/d3-zoom/src/transform.js
22103   function Transform(k2, x2, y2) {
22104     this.k = k2;
22105     this.x = x2;
22106     this.y = y2;
22107   }
22108   Transform.prototype = {
22109     constructor: Transform,
22110     scale: function(k2) {
22111       return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
22112     },
22113     translate: function(x2, y2) {
22114       return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
22115     },
22116     apply: function(point2) {
22117       return [point2[0] * this.k + this.x, point2[1] * this.k + this.y];
22118     },
22119     applyX: function(x2) {
22120       return x2 * this.k + this.x;
22121     },
22122     applyY: function(y2) {
22123       return y2 * this.k + this.y;
22124     },
22125     invert: function(location) {
22126       return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
22127     },
22128     invertX: function(x2) {
22129       return (x2 - this.x) / this.k;
22130     },
22131     invertY: function(y2) {
22132       return (y2 - this.y) / this.k;
22133     },
22134     rescaleX: function(x2) {
22135       return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
22136     },
22137     rescaleY: function(y2) {
22138       return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
22139     },
22140     toString: function() {
22141       return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
22142     }
22143   };
22144   var identity2 = new Transform(1, 0, 0);
22145   transform.prototype = Transform.prototype;
22146   function transform(node) {
22147     while (!node.__zoom)
22148       if (!(node = node.parentNode))
22149         return identity2;
22150     return node.__zoom;
22151   }
22152
22153   // node_modules/d3-zoom/src/noevent.js
22154   function nopropagation2(event) {
22155     event.stopImmediatePropagation();
22156   }
22157   function noevent_default2(event) {
22158     event.preventDefault();
22159     event.stopImmediatePropagation();
22160   }
22161
22162   // node_modules/d3-zoom/src/zoom.js
22163   function defaultFilter2(event) {
22164     return (!event.ctrlKey || event.type === "wheel") && !event.button;
22165   }
22166   function defaultExtent() {
22167     var e3 = this;
22168     if (e3 instanceof SVGElement) {
22169       e3 = e3.ownerSVGElement || e3;
22170       if (e3.hasAttribute("viewBox")) {
22171         e3 = e3.viewBox.baseVal;
22172         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
22173       }
22174       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
22175     }
22176     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
22177   }
22178   function defaultTransform() {
22179     return this.__zoom || identity2;
22180   }
22181   function defaultWheelDelta(event) {
22182     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
22183   }
22184   function defaultTouchable2() {
22185     return navigator.maxTouchPoints || "ontouchstart" in this;
22186   }
22187   function defaultConstrain(transform2, extent, translateExtent) {
22188     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];
22189     return transform2.translate(
22190       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
22191       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
22192     );
22193   }
22194   function zoom_default2() {
22195     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;
22196     function zoom(selection2) {
22197       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)");
22198     }
22199     zoom.transform = function(collection, transform2, point2, event) {
22200       var selection2 = collection.selection ? collection.selection() : collection;
22201       selection2.property("__zoom", defaultTransform);
22202       if (collection !== selection2) {
22203         schedule(collection, transform2, point2, event);
22204       } else {
22205         selection2.interrupt().each(function() {
22206           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
22207         });
22208       }
22209     };
22210     zoom.scaleBy = function(selection2, k2, p2, event) {
22211       zoom.scaleTo(selection2, function() {
22212         var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
22213         return k0 * k1;
22214       }, p2, event);
22215     };
22216     zoom.scaleTo = function(selection2, k2, p2, event) {
22217       zoom.transform(selection2, function() {
22218         var e3 = extent.apply(this, arguments), t0 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t0.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
22219         return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
22220       }, p2, event);
22221     };
22222     zoom.translateBy = function(selection2, x2, y2, event) {
22223       zoom.transform(selection2, function() {
22224         return constrain(this.__zoom.translate(
22225           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
22226           typeof y2 === "function" ? y2.apply(this, arguments) : y2
22227         ), extent.apply(this, arguments), translateExtent);
22228       }, null, event);
22229     };
22230     zoom.translateTo = function(selection2, x2, y2, p2, event) {
22231       zoom.transform(selection2, function() {
22232         var e3 = extent.apply(this, arguments), t2 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
22233         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
22234           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
22235           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
22236         ), e3, translateExtent);
22237       }, p2, event);
22238     };
22239     function scale(transform2, k2) {
22240       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
22241       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
22242     }
22243     function translate(transform2, p02, p1) {
22244       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
22245       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
22246     }
22247     function centroid(extent2) {
22248       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
22249     }
22250     function schedule(transition2, transform2, point2, event) {
22251       transition2.on("start.zoom", function() {
22252         gesture(this, arguments).event(event).start();
22253       }).on("interrupt.zoom end.zoom", function() {
22254         gesture(this, arguments).event(event).end();
22255       }).tween("zoom", function() {
22256         var that = this, args = arguments, g3 = gesture(that, args).event(event), e3 = extent.apply(that, args), p2 = point2 == null ? centroid(e3) : typeof point2 === "function" ? point2.apply(that, args) : point2, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = that.__zoom, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
22257         return function(t2) {
22258           if (t2 === 1)
22259             t2 = b2;
22260           else {
22261             var l2 = i3(t2), k2 = w2 / l2[2];
22262             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
22263           }
22264           g3.zoom(null, t2);
22265         };
22266       });
22267     }
22268     function gesture(that, args, clean2) {
22269       return !clean2 && that.__zooming || new Gesture(that, args);
22270     }
22271     function Gesture(that, args) {
22272       this.that = that;
22273       this.args = args;
22274       this.active = 0;
22275       this.sourceEvent = null;
22276       this.extent = extent.apply(that, args);
22277       this.taps = 0;
22278     }
22279     Gesture.prototype = {
22280       event: function(event) {
22281         if (event)
22282           this.sourceEvent = event;
22283         return this;
22284       },
22285       start: function() {
22286         if (++this.active === 1) {
22287           this.that.__zooming = this;
22288           this.emit("start");
22289         }
22290         return this;
22291       },
22292       zoom: function(key, transform2) {
22293         if (this.mouse && key !== "mouse")
22294           this.mouse[1] = transform2.invert(this.mouse[0]);
22295         if (this.touch0 && key !== "touch")
22296           this.touch0[1] = transform2.invert(this.touch0[0]);
22297         if (this.touch1 && key !== "touch")
22298           this.touch1[1] = transform2.invert(this.touch1[0]);
22299         this.that.__zoom = transform2;
22300         this.emit("zoom");
22301         return this;
22302       },
22303       end: function() {
22304         if (--this.active === 0) {
22305           delete this.that.__zooming;
22306           this.emit("end");
22307         }
22308         return this;
22309       },
22310       emit: function(type2) {
22311         var d2 = select_default2(this.that).datum();
22312         listeners.call(
22313           type2,
22314           this.that,
22315           new ZoomEvent(type2, {
22316             sourceEvent: this.sourceEvent,
22317             target: zoom,
22318             type: type2,
22319             transform: this.that.__zoom,
22320             dispatch: listeners
22321           }),
22322           d2
22323         );
22324       }
22325     };
22326     function wheeled(event, ...args) {
22327       if (!filter2.apply(this, arguments))
22328         return;
22329       var g3 = gesture(this, args).event(event), t2 = this.__zoom, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = pointer_default(event);
22330       if (g3.wheel) {
22331         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
22332           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
22333         }
22334         clearTimeout(g3.wheel);
22335       } else if (t2.k === k2)
22336         return;
22337       else {
22338         g3.mouse = [p2, t2.invert(p2)];
22339         interrupt_default(this);
22340         g3.start();
22341       }
22342       noevent_default2(event);
22343       g3.wheel = setTimeout(wheelidled, wheelDelay);
22344       g3.zoom("mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
22345       function wheelidled() {
22346         g3.wheel = null;
22347         g3.end();
22348       }
22349     }
22350     function mousedowned(event, ...args) {
22351       if (touchending || !filter2.apply(this, arguments))
22352         return;
22353       var currentTarget = event.currentTarget, g3 = gesture(this, args, true).event(event), v2 = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p2 = pointer_default(event, currentTarget), x05 = event.clientX, y05 = event.clientY;
22354       nodrag_default(event.view);
22355       nopropagation2(event);
22356       g3.mouse = [p2, this.__zoom.invert(p2)];
22357       interrupt_default(this);
22358       g3.start();
22359       function mousemoved(event2) {
22360         noevent_default2(event2);
22361         if (!g3.moved) {
22362           var dx = event2.clientX - x05, dy = event2.clientY - y05;
22363           g3.moved = dx * dx + dy * dy > clickDistance2;
22364         }
22365         g3.event(event2).zoom("mouse", constrain(translate(g3.that.__zoom, g3.mouse[0] = pointer_default(event2, currentTarget), g3.mouse[1]), g3.extent, translateExtent));
22366       }
22367       function mouseupped(event2) {
22368         v2.on("mousemove.zoom mouseup.zoom", null);
22369         yesdrag(event2.view, g3.moved);
22370         noevent_default2(event2);
22371         g3.event(event2).end();
22372       }
22373     }
22374     function dblclicked(event, ...args) {
22375       if (!filter2.apply(this, arguments))
22376         return;
22377       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);
22378       noevent_default2(event);
22379       if (duration > 0)
22380         select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
22381       else
22382         select_default2(this).call(zoom.transform, t1, p02, event);
22383     }
22384     function touchstarted(event, ...args) {
22385       if (!filter2.apply(this, arguments))
22386         return;
22387       var touches = event.touches, n3 = touches.length, g3 = gesture(this, args, event.changedTouches.length === n3).event(event), started, i3, t2, p2;
22388       nopropagation2(event);
22389       for (i3 = 0; i3 < n3; ++i3) {
22390         t2 = touches[i3], p2 = pointer_default(t2, this);
22391         p2 = [p2, this.__zoom.invert(p2), t2.identifier];
22392         if (!g3.touch0)
22393           g3.touch0 = p2, started = true, g3.taps = 1 + !!touchstarting;
22394         else if (!g3.touch1 && g3.touch0[2] !== p2[2])
22395           g3.touch1 = p2, g3.taps = 0;
22396       }
22397       if (touchstarting)
22398         touchstarting = clearTimeout(touchstarting);
22399       if (started) {
22400         if (g3.taps < 2)
22401           touchfirst = p2[0], touchstarting = setTimeout(function() {
22402             touchstarting = null;
22403           }, touchDelay);
22404         interrupt_default(this);
22405         g3.start();
22406       }
22407     }
22408     function touchmoved(event, ...args) {
22409       if (!this.__zooming)
22410         return;
22411       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2, p2, l2;
22412       noevent_default2(event);
22413       for (i3 = 0; i3 < n3; ++i3) {
22414         t2 = touches[i3], p2 = pointer_default(t2, this);
22415         if (g3.touch0 && g3.touch0[2] === t2.identifier)
22416           g3.touch0[0] = p2;
22417         else if (g3.touch1 && g3.touch1[2] === t2.identifier)
22418           g3.touch1[0] = p2;
22419       }
22420       t2 = g3.that.__zoom;
22421       if (g3.touch1) {
22422         var p02 = g3.touch0[0], l0 = g3.touch0[1], p1 = g3.touch1[0], l1 = g3.touch1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
22423         t2 = scale(t2, Math.sqrt(dp / dl));
22424         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
22425         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
22426       } else if (g3.touch0)
22427         p2 = g3.touch0[0], l2 = g3.touch0[1];
22428       else
22429         return;
22430       g3.zoom("touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
22431     }
22432     function touchended(event, ...args) {
22433       if (!this.__zooming)
22434         return;
22435       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2;
22436       nopropagation2(event);
22437       if (touchending)
22438         clearTimeout(touchending);
22439       touchending = setTimeout(function() {
22440         touchending = null;
22441       }, touchDelay);
22442       for (i3 = 0; i3 < n3; ++i3) {
22443         t2 = touches[i3];
22444         if (g3.touch0 && g3.touch0[2] === t2.identifier)
22445           delete g3.touch0;
22446         else if (g3.touch1 && g3.touch1[2] === t2.identifier)
22447           delete g3.touch1;
22448       }
22449       if (g3.touch1 && !g3.touch0)
22450         g3.touch0 = g3.touch1, delete g3.touch1;
22451       if (g3.touch0)
22452         g3.touch0[1] = this.__zoom.invert(g3.touch0[0]);
22453       else {
22454         g3.end();
22455         if (g3.taps === 2) {
22456           t2 = pointer_default(t2, this);
22457           if (Math.hypot(touchfirst[0] - t2[0], touchfirst[1] - t2[1]) < tapDistance) {
22458             var p2 = select_default2(this).on("dblclick.zoom");
22459             if (p2)
22460               p2.apply(this, arguments);
22461           }
22462         }
22463       }
22464     }
22465     zoom.wheelDelta = function(_2) {
22466       return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta;
22467     };
22468     zoom.filter = function(_2) {
22469       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
22470     };
22471     zoom.touchable = function(_2) {
22472       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
22473     };
22474     zoom.extent = function(_2) {
22475       return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
22476     };
22477     zoom.scaleExtent = function(_2) {
22478       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
22479     };
22480     zoom.translateExtent = function(_2) {
22481       return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
22482     };
22483     zoom.constrain = function(_2) {
22484       return arguments.length ? (constrain = _2, zoom) : constrain;
22485     };
22486     zoom.duration = function(_2) {
22487       return arguments.length ? (duration = +_2, zoom) : duration;
22488     };
22489     zoom.interpolate = function(_2) {
22490       return arguments.length ? (interpolate = _2, zoom) : interpolate;
22491     };
22492     zoom.on = function() {
22493       var value = listeners.on.apply(listeners, arguments);
22494       return value === listeners ? zoom : value;
22495     };
22496     zoom.clickDistance = function(_2) {
22497       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
22498     };
22499     zoom.tapDistance = function(_2) {
22500       return arguments.length ? (tapDistance = +_2, zoom) : tapDistance;
22501     };
22502     return zoom;
22503   }
22504
22505   // modules/geo/raw_mercator.js
22506   function geoRawMercator() {
22507     var project = mercatorRaw;
22508     var k2 = 512 / Math.PI;
22509     var x2 = 0;
22510     var y2 = 0;
22511     var clipExtent = [[0, 0], [0, 0]];
22512     function projection2(point2) {
22513       point2 = project(point2[0] * Math.PI / 180, point2[1] * Math.PI / 180);
22514       return [point2[0] * k2 + x2, y2 - point2[1] * k2];
22515     }
22516     projection2.invert = function(point2) {
22517       point2 = project.invert((point2[0] - x2) / k2, (y2 - point2[1]) / k2);
22518       return point2 && [point2[0] * 180 / Math.PI, point2[1] * 180 / Math.PI];
22519     };
22520     projection2.scale = function(_2) {
22521       if (!arguments.length)
22522         return k2;
22523       k2 = +_2;
22524       return projection2;
22525     };
22526     projection2.translate = function(_2) {
22527       if (!arguments.length)
22528         return [x2, y2];
22529       x2 = +_2[0];
22530       y2 = +_2[1];
22531       return projection2;
22532     };
22533     projection2.clipExtent = function(_2) {
22534       if (!arguments.length)
22535         return clipExtent;
22536       clipExtent = _2;
22537       return projection2;
22538     };
22539     projection2.transform = function(obj) {
22540       if (!arguments.length)
22541         return identity2.translate(x2, y2).scale(k2);
22542       x2 = +obj.x;
22543       y2 = +obj.y;
22544       k2 = +obj.k;
22545       return projection2;
22546     };
22547     projection2.stream = transform_default({
22548       point: function(x3, y3) {
22549         var vec = projection2([x3, y3]);
22550         this.stream.point(vec[0], vec[1]);
22551       }
22552     }).stream;
22553     return projection2;
22554   }
22555
22556   // modules/geo/ortho.js
22557   function geoOrthoNormalizedDotProduct(a2, b2, origin) {
22558     if (geoVecEqual(origin, a2) || geoVecEqual(origin, b2)) {
22559       return 1;
22560     }
22561     return geoVecNormalizedDot(a2, b2, origin);
22562   }
22563   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
22564     var val = Math.abs(dotp);
22565     if (val < epsilon3) {
22566       return 0;
22567     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
22568       return 0;
22569     } else if (val < lowerThreshold || val > upperThreshold) {
22570       return dotp;
22571     } else {
22572       return null;
22573     }
22574   }
22575   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
22576     var score = 0;
22577     var first = isClosed ? 0 : 1;
22578     var last = isClosed ? points.length : points.length - 1;
22579     var coords = points.map(function(p2) {
22580       return p2.coord;
22581     });
22582     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22583     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22584     for (var i3 = first; i3 < last; i3++) {
22585       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
22586       var origin = coords[i3];
22587       var b2 = coords[(i3 + 1) % coords.length];
22588       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold);
22589       if (dotp === null)
22590         continue;
22591       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
22592     }
22593     return score;
22594   }
22595   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
22596     var max3 = -Infinity;
22597     var first = isClosed ? 0 : 1;
22598     var last = isClosed ? coords.length : coords.length - 1;
22599     for (var i3 = first; i3 < last; i3++) {
22600       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
22601       var origin = coords[i3];
22602       var b2 = coords[(i3 + 1) % coords.length];
22603       var normalizedDotP = geoOrthoNormalizedDotProduct(a2, b2, origin);
22604       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
22605       if (angle2 > 45)
22606         angle2 = 90 - angle2;
22607       if (angle2 >= lessThan)
22608         continue;
22609       if (angle2 > max3)
22610         max3 = angle2;
22611     }
22612     if (max3 === -Infinity)
22613       return null;
22614     return max3;
22615   }
22616   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
22617     var score = null;
22618     var first = isClosed ? 0 : 1;
22619     var last = isClosed ? coords.length : coords.length - 1;
22620     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22621     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22622     for (var i3 = first; i3 < last; i3++) {
22623       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
22624       var origin = coords[i3];
22625       var b2 = coords[(i3 + 1) % coords.length];
22626       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
22627       if (dotp === null)
22628         continue;
22629       if (Math.abs(dotp) > 0)
22630         return 1;
22631       score = 0;
22632     }
22633     return score;
22634   }
22635
22636   // modules/util/array.js
22637   function utilArrayIdentical(a2, b2) {
22638     if (a2 === b2)
22639       return true;
22640     var i3 = a2.length;
22641     if (i3 !== b2.length)
22642       return false;
22643     while (i3--) {
22644       if (a2[i3] !== b2[i3])
22645         return false;
22646     }
22647     return true;
22648   }
22649   function utilArrayDifference(a2, b2) {
22650     var other = new Set(b2);
22651     return Array.from(new Set(a2)).filter(function(v2) {
22652       return !other.has(v2);
22653     });
22654   }
22655   function utilArrayIntersection(a2, b2) {
22656     var other = new Set(b2);
22657     return Array.from(new Set(a2)).filter(function(v2) {
22658       return other.has(v2);
22659     });
22660   }
22661   function utilArrayUnion(a2, b2) {
22662     var result = new Set(a2);
22663     b2.forEach(function(v2) {
22664       result.add(v2);
22665     });
22666     return Array.from(result);
22667   }
22668   function utilArrayUniq(a2) {
22669     return Array.from(new Set(a2));
22670   }
22671   function utilArrayChunk(a2, chunkSize) {
22672     if (!chunkSize || chunkSize < 0)
22673       return [a2.slice()];
22674     var result = new Array(Math.ceil(a2.length / chunkSize));
22675     return Array.from(result, function(item, i3) {
22676       return a2.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
22677     });
22678   }
22679   function utilArrayFlatten(a2) {
22680     return a2.reduce(function(acc, val) {
22681       return acc.concat(val);
22682     }, []);
22683   }
22684   function utilArrayGroupBy(a2, key) {
22685     return a2.reduce(function(acc, item) {
22686       var group = typeof key === "function" ? key(item) : item[key];
22687       (acc[group] = acc[group] || []).push(item);
22688       return acc;
22689     }, {});
22690   }
22691   function utilArrayUniqBy(a2, key) {
22692     var seen = /* @__PURE__ */ new Set();
22693     return a2.reduce(function(acc, item) {
22694       var val = typeof key === "function" ? key(item) : item[key];
22695       if (val && !seen.has(val)) {
22696         seen.add(val);
22697         acc.push(item);
22698       }
22699       return acc;
22700     }, []);
22701   }
22702
22703   // modules/util/util.js
22704   var import_diacritics = __toESM(require_diacritics());
22705
22706   // modules/util/svg_paths_rtl_fix.js
22707   var import_alif_toolkit = __toESM(require_lib());
22708   var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
22709   function fixRTLTextForSvg(inputText) {
22710     var ret = "", rtlBuffer = [];
22711     var arabicRegex = /[\u0600-\u06FF]/g;
22712     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
22713     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
22714     var thaanaVowel = /[\u07A6-\u07B0]/;
22715     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
22716     if (arabicRegex.test(inputText)) {
22717       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
22718     }
22719     for (var n3 = 0; n3 < inputText.length; n3++) {
22720       var c2 = inputText[n3];
22721       if (arabicMath.test(c2)) {
22722         ret += rtlBuffer.reverse().join("");
22723         rtlBuffer = [c2];
22724       } else {
22725         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
22726           ret += rtlBuffer.reverse().join("");
22727           rtlBuffer = [];
22728         }
22729         if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
22730           rtlBuffer[rtlBuffer.length - 1] += c2;
22731         } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
22732           rtlBuffer.push(c2);
22733         } else if (c2 === " " && rtlBuffer.length) {
22734           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
22735         } else {
22736           ret += rtlBuffer.reverse().join("") + c2;
22737           rtlBuffer = [];
22738         }
22739       }
22740     }
22741     ret += rtlBuffer.reverse().join("");
22742     return ret;
22743   }
22744
22745   // modules/core/preferences.js
22746   var _storage;
22747   try {
22748     _storage = localStorage;
22749   } catch (e3) {
22750   }
22751   _storage = _storage || (() => {
22752     let s2 = {};
22753     return {
22754       getItem: (k2) => s2[k2],
22755       setItem: (k2, v2) => s2[k2] = v2,
22756       removeItem: (k2) => delete s2[k2]
22757     };
22758   })();
22759   var _listeners = {};
22760   function corePreferences(k2, v2) {
22761     try {
22762       if (v2 === void 0)
22763         return _storage.getItem(k2);
22764       else if (v2 === null)
22765         _storage.removeItem(k2);
22766       else
22767         _storage.setItem(k2, v2);
22768       if (_listeners[k2]) {
22769         _listeners[k2].forEach((handler) => handler(v2));
22770       }
22771       return true;
22772     } catch (e3) {
22773       if (typeof console !== "undefined") {
22774         console.error("localStorage quota exceeded");
22775       }
22776       return false;
22777     }
22778   }
22779   corePreferences.onChange = function(k2, handler) {
22780     _listeners[k2] = _listeners[k2] || [];
22781     _listeners[k2].push(handler);
22782   };
22783
22784   // modules/core/file_fetcher.js
22785   var import_vparse = __toESM(require_vparse());
22786
22787   // config/id.js
22788   var presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
22789   var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
22790   var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
22791   var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
22792   var defaultOsmApiConnections = {
22793     live: {
22794       url: "https://www.openstreetmap.org",
22795       client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
22796       client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q"
22797     },
22798     dev: {
22799       url: "https://api06.dev.openstreetmap.org",
22800       client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw",
22801       client_secret: "OnfWFC-JkZNHyYdr_viNn_h_RTZXRslKcUxllOXqf5g"
22802     }
22803   };
22804   var osmApiConnections = [];
22805   if (false) {
22806     osmApiConnections.push({
22807       url: null,
22808       client_id: null,
22809       client_secret: null
22810     });
22811   } else if (false) {
22812     osmApiConnections.push(defaultOsmApiConnections[null]);
22813   } else {
22814     osmApiConnections.push(defaultOsmApiConnections.live);
22815     osmApiConnections.push(defaultOsmApiConnections.dev);
22816   }
22817   var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
22818   var nominatimApiUrl = "https://nominatim.openstreetmap.org/";
22819
22820   // package.json
22821   var package_default = {
22822     name: "iD",
22823     version: "2.27.1",
22824     description: "A friendly editor for OpenStreetMap",
22825     main: "dist/iD.min.js",
22826     repository: "github:openstreetmap/iD",
22827     homepage: "https://github.com/openstreetmap/iD",
22828     bugs: "https://github.com/openstreetmap/iD/issues",
22829     keywords: [
22830       "editor",
22831       "openstreetmap"
22832     ],
22833     license: "ISC",
22834     scripts: {
22835       all: "run-s clean build dist",
22836       build: "run-s build:css build:data build:js",
22837       "build:css": "node scripts/build_css.js",
22838       "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
22839       "build:stats": "node config/esbuild.config.mjs --stats && esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html && shx rm dist/esbuild.json",
22840       "build:js": "node config/esbuild.config.mjs",
22841       "build:js:watch": "node config/esbuild.config.mjs --watch",
22842       clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
22843       dist: "run-p dist:**",
22844       "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
22845       "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
22846       "dist:min": "node config/esbuild.config.min.mjs",
22847       "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
22848       "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',
22849       "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
22850       "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',
22851       "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg",
22852       "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",
22853       "dist:svg:roentgen": 'svg-sprite --shape-id-generator "roentgen-%s" --shape-dim-width 16 --shape-dim-height 16 --symbol --symbol-dest . --symbol-sprite dist/img/roentgen-sprite.svg svg/roentgen/*.svg',
22854       "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@rapideditor/temaki/icons/*.svg',
22855       imagery: "node scripts/update_imagery.js",
22856       lint: "eslint config scripts test/spec modules --ext js,mjs",
22857       "lint:fix": "eslint scripts test/spec modules --fix",
22858       start: "run-s start:watch",
22859       "start:single-build": "run-p build:js start:server",
22860       "start:watch": "run-p build:js:watch start:server",
22861       "start:server": "node scripts/server.js",
22862       test: "npm-run-all -s lint build test:spec",
22863       "test:spec": "karma start config/karma.conf.js",
22864       translations: "node scripts/update_locales.js"
22865     },
22866     dependencies: {
22867       "@mapbox/geojson-area": "^0.2.2",
22868       "@mapbox/sexagesimal": "1.2.0",
22869       "@mapbox/vector-tile": "^1.3.1",
22870       "@rapideditor/country-coder": "~5.2.0",
22871       "@rapideditor/location-conflation": "~1.2.1",
22872       "@tmcw/togeojson": "^5.8.1",
22873       "@turf/bbox": "^6.0.0",
22874       "@turf/bbox-clip": "^6.0.0",
22875       "abortcontroller-polyfill": "^1.7.5",
22876       "aes-js": "^3.1.2",
22877       "alif-toolkit": "^1.2.9",
22878       "core-js-bundle": "^3.32.0",
22879       diacritics: "1.3.0",
22880       exifr: "^7.1.3",
22881       "fast-deep-equal": "~3.1.1",
22882       "fast-json-stable-stringify": "2.1.0",
22883       "lodash-es": "~4.17.15",
22884       marked: "~7.0.3",
22885       "node-diff3": "~3.1.0",
22886       "osm-auth": "~2.2.0",
22887       pannellum: "2.5.6",
22888       pbf: "^3.2.1",
22889       "polygon-clipping": "~0.15.1",
22890       rbush: "3.0.1",
22891       "whatwg-fetch": "^3.6.17",
22892       "which-polygon": "2.2.1"
22893     },
22894     devDependencies: {
22895       "@fortawesome/fontawesome-svg-core": "~6.4.2",
22896       "@fortawesome/free-brands-svg-icons": "~6.4.2",
22897       "@fortawesome/free-regular-svg-icons": "~6.4.2",
22898       "@fortawesome/free-solid-svg-icons": "~6.4.2",
22899       "@mapbox/maki": "^8.0.1",
22900       "@openstreetmap/id-tagging-schema": "^6.4.1",
22901       "@rapideditor/temaki": "~5.4.0",
22902       "@transifex/api": "^5.4.0",
22903       autoprefixer: "^10.4.15",
22904       chai: "^4.3.7",
22905       chalk: "^4.1.2",
22906       "cldr-core": "^43.0.0",
22907       "cldr-localenames-full": "^43.1.0",
22908       "concat-files": "^0.1.1",
22909       d3: "~7.8.5",
22910       dotenv: "^16.3.1",
22911       "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
22912       esbuild: "^0.19.2",
22913       "esbuild-visualizer": "^0.4.1",
22914       eslint: "^8.47.0",
22915       "fetch-mock": "^9.11.0",
22916       gaze: "^1.1.3",
22917       glob: "^10.3.3",
22918       happen: "^0.3.2",
22919       "js-yaml": "^4.0.0",
22920       "json-stringify-pretty-compact": "^3.0.0",
22921       karma: "^6.4.2",
22922       "karma-chrome-launcher": "^3.2.0",
22923       "karma-coverage": "2.1.1",
22924       "karma-mocha": "^2.0.1",
22925       "karma-remap-istanbul": "^0.6.0",
22926       mapillary_sprite_source: "^1.8.0",
22927       "mapillary-js": "4.1.1",
22928       minimist: "^1.2.8",
22929       mocha: "^10.2.0",
22930       "name-suggestion-index": "~6.0",
22931       "node-fetch": "^2.6.12",
22932       "npm-run-all": "^4.0.0",
22933       "osm-community-index": "~5.5.4",
22934       postcss: "^8.4.28",
22935       "postcss-selector-prepend": "^0.5.0",
22936       shelljs: "^0.8.0",
22937       shx: "^0.3.0",
22938       sinon: "^11.1.2",
22939       "sinon-chai": "^3.7.0",
22940       smash: "0.0",
22941       "static-server": "^2.2.1",
22942       "svg-sprite": "2.0.2",
22943       vparse: "~1.1.0"
22944     },
22945     engines: {
22946       node: ">=16.14"
22947     },
22948     browserslist: [
22949       "> 0.2%, last 6 major versions, Firefox ESR, maintained node versions"
22950     ]
22951   };
22952
22953   // modules/core/file_fetcher.js
22954   var _mainFileFetcher = coreFileFetcher();
22955   function coreFileFetcher() {
22956     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
22957     const v2 = (0, import_vparse.default)(ociVersion);
22958     const ociVersionMinor = `${v2.major}.${v2.minor}`;
22959     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
22960     let _this = {};
22961     let _inflight4 = {};
22962     let _fileMap = {
22963       "address_formats": "data/address_formats.min.json",
22964       "imagery": "data/imagery.min.json",
22965       "intro_graph": "data/intro_graph.min.json",
22966       "keepRight": "data/keepRight.min.json",
22967       "languages": "data/languages.min.json",
22968       "locales": "locales/index.min.json",
22969       "phone_formats": "data/phone_formats.min.json",
22970       "qa_data": "data/qa_data.min.json",
22971       "shortcuts": "data/shortcuts.min.json",
22972       "territory_languages": "data/territory_languages.min.json",
22973       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
22974       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
22975       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
22976       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
22977       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
22978       "discarded": presetsCdnUrl + "dist/discarded.min.json",
22979       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
22980       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
22981       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
22982       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
22983       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.1") + "wikipedia.min.json"
22984     };
22985     let _cachedData = {};
22986     _this.cache = () => _cachedData;
22987     _this.get = (which) => {
22988       if (_cachedData[which]) {
22989         return Promise.resolve(_cachedData[which]);
22990       }
22991       const file = _fileMap[which];
22992       const url = file && _this.asset(file);
22993       if (!url) {
22994         return Promise.reject(`Unknown data file for "${which}"`);
22995       }
22996       if (url.includes("{presets_version}")) {
22997         return _this.get("presets_package").then((result) => {
22998           const presetsVersion2 = result.version;
22999           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
23000         });
23001       } else {
23002         return getUrl(url);
23003       }
23004     };
23005     function getUrl(url, which) {
23006       let prom = _inflight4[url];
23007       if (!prom) {
23008         _inflight4[url] = prom = fetch(url).then((response) => {
23009           if (!response.ok || !response.json) {
23010             throw new Error(response.status + " " + response.statusText);
23011           }
23012           if (response.status === 204 || response.status === 205)
23013             return;
23014           return response.json();
23015         }).then((result) => {
23016           delete _inflight4[url];
23017           if (!result) {
23018             throw new Error(`No data loaded for "${which}"`);
23019           }
23020           _cachedData[which] = result;
23021           return result;
23022         }).catch((err) => {
23023           delete _inflight4[url];
23024           throw err;
23025         });
23026       }
23027       return prom;
23028     }
23029     _this.fileMap = function(val) {
23030       if (!arguments.length)
23031         return _fileMap;
23032       _fileMap = val;
23033       return _this;
23034     };
23035     let _assetPath = "";
23036     _this.assetPath = function(val) {
23037       if (!arguments.length)
23038         return _assetPath;
23039       _assetPath = val;
23040       return _this;
23041     };
23042     let _assetMap = {};
23043     _this.assetMap = function(val) {
23044       if (!arguments.length)
23045         return _assetMap;
23046       _assetMap = val;
23047       return _this;
23048     };
23049     _this.asset = (val) => {
23050       if (/^http(s)?:\/\//i.test(val))
23051         return val;
23052       const filename = _assetPath + val;
23053       return _assetMap[filename] || filename;
23054     };
23055     return _this;
23056   }
23057
23058   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
23059   var import_which_polygon = __toESM(require_which_polygon(), 1);
23060   var borders_default = { type: "FeatureCollection", features: [
23061     { 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]]]] } },
23062     { 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]]]] } },
23063     { 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]]]] } },
23064     { 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]]]] } },
23065     { 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]]]] } },
23066     { 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]]]] } },
23067     { 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]]]] } },
23068     { 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]]]] } },
23069     { 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]]]] } },
23070     { 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]]]] } },
23071     { 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]]]] } },
23072     { 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]]]] } },
23073     { 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]]]] } },
23074     { 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]]]] } },
23075     { 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]]]] } },
23076     { 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]]]] } },
23077     { 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]]]] } },
23078     { 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]]]] } },
23079     { 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]]]] } },
23080     { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
23081     { 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]]]] } },
23082     { type: "Feature", properties: { wikidata: "Q19188", nameEn: "Mainland China", country: "CN", groups: ["030", "142", "UN"], callingCodes: ["86"] }, geometry: { type: "MultiPolygon", coordinates: [[[[125.6131, 53.07229], [125.17522, 53.20225], [124.46078, 53.21881], [123.86158, 53.49391], [123.26989, 53.54843], [122.85966, 53.47395], [122.35063, 53.49565], [121.39213, 53.31888], [120.85633, 53.28499], [120.0451, 52.7359], [120.04049, 52.58773], [120.46454, 52.63811], [120.71673, 52.54099], [120.61346, 52.32447], [120.77337, 52.20805], [120.65907, 51.93544], [120.10963, 51.671], [119.13553, 50.37412], [119.38598, 50.35162], [119.27996, 50.13348], [119.11003, 50.00276], [118.61623, 49.93809], [117.82343, 49.52696], [117.48208, 49.62324], [117.27597, 49.62544], [116.71193, 49.83813], [116.03781, 48.87014], [116.06565, 48.81716], [115.78876, 48.51781], [115.811, 48.25699], [115.52082, 48.15367], [115.57128, 47.91988], [115.94296, 47.67741], [116.21879, 47.88505], [116.4465, 47.83662], [116.67405, 47.89039], [116.9723, 47.87285], [117.37875, 47.63627], [117.50181, 47.77216], [117.80196, 48.01661], [118.03676, 48.00982], [118.11009, 48.04], [118.22677, 48.03853], [118.29654, 48.00246], [118.55766, 47.99277], [118.7564, 47.76947], [119.12343, 47.66458], [119.13995, 47.53997], [119.35892, 47.48104], [119.31964, 47.42617], [119.54918, 47.29505], [119.56019, 47.24874], [119.62403, 47.24575], [119.71209, 47.19192], [119.85518, 46.92196], [119.91242, 46.90091], [119.89261, 46.66423], [119.80455, 46.67631], [119.77373, 46.62947], [119.68127, 46.59015], [119.65265, 46.62342], [119.42827, 46.63783], [119.32827, 46.61433], [119.24978, 46.64761], [119.10448, 46.65516], [119.00541, 46.74273], [118.92616, 46.72765], [118.89974, 46.77139], [118.8337, 46.77742], [118.78747, 46.68689], [118.30534, 46.73519], [117.69554, 46.50991], [117.60748, 46.59771], [117.41782, 46.57862], [117.36609, 46.36335], [116.83166, 46.38637], [116.75551, 46.33083], [116.58612, 46.30211], [116.26678, 45.96479], [116.24012, 45.8778], [116.27366, 45.78637], [116.16989, 45.68603], [115.60329, 45.44717], [114.94546, 45.37377], [114.74612, 45.43585], [114.54801, 45.38337], [114.5166, 45.27189], [113.70918, 44.72891], [112.74662, 44.86297], [112.4164, 45.06858], [111.98695, 45.09074], [111.76275, 44.98032], [111.40498, 44.3461], [111.96289, 43.81596], [111.93776, 43.68709], [111.79758, 43.6637], [111.59087, 43.51207], [111.0149, 43.3289], [110.4327, 42.78293], [110.08401, 42.6411], [109.89402, 42.63111], [109.452, 42.44842], [109.00679, 42.45302], [108.84489, 42.40246], [107.57258, 42.40898], [107.49681, 42.46221], [107.29755, 42.41395], [107.24774, 42.36107], [106.76517, 42.28741], [105.0123, 41.63188], [104.51667, 41.66113], [104.52258, 41.8706], [103.92804, 41.78246], [102.72403, 42.14675], [102.07645, 42.22519], [101.80515, 42.50074], [100.84979, 42.67087], [100.33297, 42.68231], [99.50671, 42.56535], [97.1777, 42.7964], [96.37926, 42.72055], [96.35658, 42.90363], [95.89543, 43.2528], [95.52594, 43.99353], [95.32891, 44.02407], [95.39772, 44.2805], [95.01191, 44.25274], [94.71959, 44.35284], [94.10003, 44.71016], [93.51161, 44.95964], [91.64048, 45.07408], [90.89169, 45.19667], [90.65114, 45.49314], [90.70907, 45.73437], [91.03026, 46.04194], [90.99672, 46.14207], [90.89639, 46.30711], [91.07696, 46.57315], [91.0147, 46.58171], [91.03649, 46.72916], [90.84035, 46.99525], [90.76108, 46.99399], [90.48542, 47.30438], [90.48854, 47.41826], [90.33598, 47.68303], [90.10871, 47.7375], [90.06512, 47.88177], [89.76624, 47.82745], [89.55453, 48.0423], [89.0711, 47.98528], [88.93186, 48.10263], [88.8011, 48.11302], [88.58316, 48.21893], [88.58939, 48.34531], [87.96361, 48.58478], [88.0788, 48.71436], [87.73822, 48.89582], [87.88171, 48.95853], [87.81333, 49.17354], [87.48983, 49.13794], [87.478, 49.07403], [87.28386, 49.11626], [86.87238, 49.12432], [86.73568, 48.99918], [86.75343, 48.70331], [86.38069, 48.46064], [85.73581, 48.3939], [85.5169, 48.05493], [85.61067, 47.49753], [85.69696, 47.2898], [85.54294, 47.06171], [85.22443, 47.04816], [84.93995, 46.87399], [84.73077, 47.01394], [83.92184, 46.98912], [83.04622, 47.19053], [82.21792, 45.56619], [82.58474, 45.40027], [82.51374, 45.1755], [81.73278, 45.3504], [80.11169, 45.03352], [79.8987, 44.89957], [80.38384, 44.63073], [80.40229, 44.23319], [80.40031, 44.10986], [80.75156, 43.44948], [80.69718, 43.32589], [80.77771, 43.30065], [80.78817, 43.14235], [80.62913, 43.141], [80.3735, 43.01557], [80.58999, 42.9011], [80.38169, 42.83142], [80.26886, 42.8366], [80.16892, 42.61137], [80.26841, 42.23797], [80.17807, 42.21166], [80.17842, 42.03211], [79.92977, 42.04113], [78.3732, 41.39603], [78.15757, 41.38565], [78.12873, 41.23091], [77.81287, 41.14307], [77.76206, 41.01574], [77.52723, 41.00227], [77.3693, 41.0375], [77.28004, 41.0033], [76.99302, 41.0696], [76.75681, 40.95354], [76.5261, 40.46114], [76.33659, 40.3482], [75.96168, 40.38064], [75.91361, 40.2948], [75.69663, 40.28642], [75.5854, 40.66874], [75.22834, 40.45382], [75.08243, 40.43945], [74.82013, 40.52197], [74.78168, 40.44886], [74.85996, 40.32857], [74.69875, 40.34668], [74.35063, 40.09742], [74.25533, 40.13191], [73.97049, 40.04378], [73.83006, 39.76136], [73.9051, 39.75073], [73.92354, 39.69565], [73.94683, 39.60733], [73.87018, 39.47879], [73.59831, 39.46425], [73.59241, 39.40843], [73.5004, 39.38402], [73.55396, 39.3543], [73.54572, 39.27567], [73.60638, 39.24534], [73.75823, 39.023], [73.81728, 39.04007], [73.82964, 38.91517], [73.7445, 38.93867], [73.7033, 38.84782], [73.80656, 38.66449], [73.79806, 38.61106], [73.97933, 38.52945], [74.17022, 38.65504], [74.51217, 38.47034], [74.69619, 38.42947], [74.69894, 38.22155], [74.80331, 38.19889], [74.82665, 38.07359], [74.9063, 38.03033], [74.92416, 37.83428], [75.00935, 37.77486], [74.8912, 37.67576], [74.94338, 37.55501], [75.06011, 37.52779], [75.15899, 37.41443], [75.09719, 37.37297], [75.12328, 37.31839], [74.88887, 37.23275], [74.80605, 37.21565], [74.49981, 37.24518], [74.56453, 37.03023], [75.13839, 37.02622], [75.40481, 36.95382], [75.45562, 36.71971], [75.72737, 36.7529], [75.92391, 36.56986], [76.0324, 36.41198], [76.00906, 36.17511], [75.93028, 36.13136], [76.15325, 35.9264], [76.14913, 35.82848], [76.33453, 35.84296], [76.50961, 35.8908], [76.77323, 35.66062], [76.84539, 35.67356], [76.96624, 35.5932], [77.44277, 35.46132], [77.70232, 35.46244], [77.80532, 35.52058], [78.11664, 35.48022], [78.03466, 35.3785], [78.00033, 35.23954], [78.22692, 34.88771], [78.18435, 34.7998], [78.27781, 34.61484], [78.54964, 34.57283], [78.56475, 34.50835], [78.74465, 34.45174], [79.05364, 34.32482], [78.99802, 34.3027], [78.91769, 34.15452], [78.66225, 34.08858], [78.65657, 34.03195], [78.73367, 34.01121], [78.77349, 33.73871], [78.67599, 33.66445], [78.73636, 33.56521], [79.15252, 33.17156], [79.14016, 33.02545], [79.46562, 32.69668], [79.26768, 32.53277], [79.13174, 32.47766], [79.0979, 32.38051], [78.99322, 32.37948], [78.96713, 32.33655], [78.7831, 32.46873], [78.73916, 32.69438], [78.38897, 32.53938], [78.4645, 32.45367], [78.49609, 32.2762], [78.68754, 32.10256], [78.74404, 32.00384], [78.78036, 31.99478], [78.69933, 31.78723], [78.84516, 31.60631], [78.71032, 31.50197], [78.77898, 31.31209], [78.89344, 31.30481], [79.01931, 31.42817], [79.14016, 31.43403], [79.30694, 31.17357], [79.59884, 30.93943], [79.93255, 30.88288], [80.20721, 30.58541], [80.54504, 30.44936], [80.83343, 30.32023], [81.03953, 30.20059], [81.12842, 30.01395], [81.24362, 30.0126], [81.29032, 30.08806], [81.2623, 30.14596], [81.33355, 30.15303], [81.39928, 30.21862], [81.41018, 30.42153], [81.5459, 30.37688], [81.62033, 30.44703], [81.99082, 30.33423], [82.10135, 30.35439], [82.10757, 30.23745], [82.19475, 30.16884], [82.16984, 30.0692], [82.38622, 30.02608], [82.5341, 29.9735], [82.73024, 29.81695], [83.07116, 29.61957], [83.28131, 29.56813], [83.44787, 29.30513], [83.63156, 29.16249], [83.82303, 29.30513], [83.97559, 29.33091], [84.18107, 29.23451], [84.24801, 29.02783], [84.2231, 28.89571], [84.47528, 28.74023], [84.62317, 28.73887], [84.85511, 28.58041], [85.06059, 28.68562], [85.19135, 28.62825], [85.18668, 28.54076], [85.10729, 28.34092], [85.38127, 28.28336], [85.4233, 28.32996], [85.59765, 28.30529], [85.60854, 28.25045], [85.69105, 28.38475], [85.71907, 28.38064], [85.74864, 28.23126], [85.84672, 28.18187], [85.90743, 28.05144], [85.97813, 27.99023], [85.94946, 27.9401], [86.06309, 27.90021], [86.12069, 27.93047], [86.08333, 28.02121], [86.088, 28.09264], [86.18607, 28.17364], [86.22966, 27.9786], [86.42736, 27.91122], [86.51609, 27.96623], [86.56265, 28.09569], [86.74181, 28.10638], [86.75582, 28.04182], [87.03757, 27.94835], [87.11696, 27.84104], [87.56996, 27.84517], [87.72718, 27.80938], [87.82681, 27.95248], [88.13378, 27.88015], [88.1278, 27.95417], [88.25332, 27.9478], [88.54858, 28.06057], [88.63235, 28.12356], [88.83559, 28.01936], [88.88091, 27.85192], [88.77517, 27.45415], [88.82981, 27.38814], [88.91901, 27.32483], [88.93678, 27.33777], [88.96947, 27.30319], [89.00216, 27.32532], [88.95355, 27.4106], [88.97213, 27.51671], [89.0582, 27.60985], [89.12825, 27.62502], [89.59525, 28.16433], [89.79762, 28.23979], [90.13387, 28.19178], [90.58842, 28.02838], [90.69894, 28.07784], [91.20019, 27.98715], [91.25779, 28.07509], [91.46327, 28.0064], [91.48973, 27.93903], [91.5629, 27.84823], [91.6469, 27.76358], [91.84722, 27.76325], [91.87057, 27.7195], [92.27432, 27.89077], [92.32101, 27.79363], [92.42538, 27.80092], [92.7275, 27.98662], [92.73025, 28.05814], [92.65472, 28.07632], [92.67486, 28.15018], [92.93075, 28.25671], [93.14635, 28.37035], [93.18069, 28.50319], [93.44621, 28.67189], [93.72797, 28.68821], [94.35897, 29.01965], [94.2752, 29.11687], [94.69318, 29.31739], [94.81353, 29.17804], [95.0978, 29.14446], [95.11291, 29.09527], [95.2214, 29.10727], [95.26122, 29.07727], [95.3038, 29.13847], [95.41091, 29.13007], [95.50842, 29.13487], [95.72086, 29.20797], [95.75149, 29.32063], [95.84899, 29.31464], [96.05361, 29.38167], [96.31316, 29.18643], [96.18682, 29.11087], [96.20467, 29.02325], [96.3626, 29.10607], [96.61391, 28.72742], [96.40929, 28.51526], [96.48895, 28.42955], [96.6455, 28.61657], [96.85561, 28.4875], [96.88445, 28.39452], [96.98882, 28.32564], [97.1289, 28.3619], [97.34547, 28.21385], [97.41729, 28.29783], [97.47085, 28.2688], [97.50518, 28.49716], [97.56835, 28.55628], [97.70705, 28.5056], [97.79632, 28.33168], [97.90069, 28.3776], [98.15337, 28.12114], [98.13964, 27.9478], [98.32641, 27.51385], [98.42529, 27.55404], [98.43353, 27.67086], [98.69582, 27.56499], [98.7333, 26.85615], [98.77547, 26.61994], [98.72741, 26.36183], [98.67797, 26.24487], [98.7329, 26.17218], [98.66884, 26.09165], [98.63128, 26.15492], [98.57085, 26.11547], [98.60763, 26.01512], [98.70818, 25.86241], [98.63128, 25.79937], [98.54064, 25.85129], [98.40606, 25.61129], [98.31268, 25.55307], [98.25774, 25.6051], [98.16848, 25.62739], [98.18084, 25.56298], [98.12591, 25.50722], [98.14925, 25.41547], [97.92541, 25.20815], [97.83614, 25.2715], [97.77023, 25.11492], [97.72216, 25.08508], [97.72903, 24.91332], [97.79949, 24.85655], [97.76481, 24.8289], [97.73127, 24.83015], [97.70181, 24.84557], [97.64354, 24.79171], [97.56648, 24.76475], [97.56383, 24.75535], [97.5542, 24.74943], [97.54675, 24.74202], [97.56525, 24.72838], [97.56286, 24.54535], [97.52757, 24.43748], [97.60029, 24.4401], [97.66998, 24.45288], [97.7098, 24.35658], [97.65624, 24.33781], [97.66723, 24.30027], [97.71941, 24.29652], [97.76799, 24.26365], [97.72998, 24.2302], [97.72799, 24.18883], [97.75305, 24.16902], [97.72903, 24.12606], [97.62363, 24.00506], [97.5247, 23.94032], [97.64667, 23.84574], [97.72302, 23.89288], [97.79456, 23.94836], [97.79416, 23.95663], [97.84328, 23.97603], [97.86545, 23.97723], [97.88811, 23.97446], [97.8955, 23.97758], [97.89676, 23.97931], [97.89683, 23.98389], [97.88814, 23.98605], [97.88414, 23.99405], [97.88616, 24.00463], [97.90998, 24.02094], [97.93951, 24.01953], [97.98691, 24.03897], [97.99583, 24.04932], [98.04709, 24.07616], [98.05302, 24.07408], [98.05671, 24.07961], [98.0607, 24.07812], [98.06703, 24.08028], [98.07806, 24.07988], [98.20666, 24.11406], [98.54476, 24.13119], [98.59256, 24.08371], [98.85319, 24.13042], [98.87998, 24.15624], [98.89632, 24.10612], [98.67797, 23.9644], [98.68209, 23.80492], [98.79607, 23.77947], [98.82933, 23.72921], [98.81775, 23.694], [98.88396, 23.59555], [98.80294, 23.5345], [98.82877, 23.47908], [98.87683, 23.48995], [98.92104, 23.36946], [98.87573, 23.33038], [98.93958, 23.31414], [98.92515, 23.29535], [98.88597, 23.18656], [99.05975, 23.16382], [99.04601, 23.12215], [99.25741, 23.09025], [99.34127, 23.13099], [99.52214, 23.08218], [99.54218, 22.90014], [99.43537, 22.94086], [99.45654, 22.85726], [99.31243, 22.73893], [99.38247, 22.57544], [99.37972, 22.50188], [99.28771, 22.4105], [99.17318, 22.18025], [99.19176, 22.16983], [99.1552, 22.15874], [99.33166, 22.09656], [99.47585, 22.13345], [99.85351, 22.04183], [99.96612, 22.05965], [99.99084, 21.97053], [99.94003, 21.82782], [99.98654, 21.71064], [100.04956, 21.66843], [100.12679, 21.70539], [100.17486, 21.65306], [100.10757, 21.59945], [100.12542, 21.50365], [100.1625, 21.48704], [100.18447, 21.51898], [100.25863, 21.47043], [100.35201, 21.53176], [100.42892, 21.54325], [100.4811, 21.46148], [100.57861, 21.45637], [100.72143, 21.51898], [100.87265, 21.67396], [101.11744, 21.77659], [101.15156, 21.56129], [101.2124, 21.56422], [101.19349, 21.41959], [101.26912, 21.36482], [101.2229, 21.23271], [101.29326, 21.17254], [101.54563, 21.25668], [101.6068, 21.23329], [101.59491, 21.18621], [101.60886, 21.17947], [101.66977, 21.20004], [101.70548, 21.14911], [101.7622, 21.14813], [101.79266, 21.19025], [101.76745, 21.21571], [101.83887, 21.20983], [101.84412, 21.25291], [101.74014, 21.30967], [101.74224, 21.48276], [101.7727, 21.51794], [101.7475, 21.5873], [101.80001, 21.57461], [101.83257, 21.61562], [101.74555, 21.72852], [101.7791, 21.83019], [101.62566, 21.96574], [101.57525, 22.13026], [101.60675, 22.13513], [101.53638, 22.24794], [101.56789, 22.28876], [101.61306, 22.27515], [101.68973, 22.46843], [101.7685, 22.50337], [101.86828, 22.38397], [101.90714, 22.38688], [101.91344, 22.44417], [101.98487, 22.42766], [102.03633, 22.46164], [102.1245, 22.43372], [102.14099, 22.40092], [102.16621, 22.43336], [102.26428, 22.41321], [102.25339, 22.4607], [102.41061, 22.64184], [102.38415, 22.67919], [102.42618, 22.69212], [102.46665, 22.77108], [102.51802, 22.77969], [102.57095, 22.7036], [102.60675, 22.73376], [102.8636, 22.60735], [102.9321, 22.48659], [103.0722, 22.44775], [103.07843, 22.50097], [103.17961, 22.55705], [103.15782, 22.59873], [103.18895, 22.64471], [103.28079, 22.68063], [103.32282, 22.8127], [103.43179, 22.75816], [103.43646, 22.70648], [103.52675, 22.59155], [103.57812, 22.65764], [103.56255, 22.69499], [103.64506, 22.79979], [103.87904, 22.56683], [103.93286, 22.52703], [103.94513, 22.52553], [103.95191, 22.5134], [103.96352, 22.50584], [103.96783, 22.51173], [103.97384, 22.50634], [103.99247, 22.51958], [104.01088, 22.51823], [104.03734, 22.72945], [104.11384, 22.80363], [104.27084, 22.8457], [104.25683, 22.76534], [104.35593, 22.69353], [104.47225, 22.75813], [104.58122, 22.85571], [104.60457, 22.81841], [104.65283, 22.83419], [104.72755, 22.81984], [104.77114, 22.90017], [104.84942, 22.93631], [104.86765, 22.95178], [104.8334, 23.01484], [104.79478, 23.12934], [104.87382, 23.12854], [104.87992, 23.17141], [104.91435, 23.18666], [104.9486, 23.17235], [104.96532, 23.20463], [104.98712, 23.19176], [105.07002, 23.26248], [105.11672, 23.25247], [105.17276, 23.28679], [105.22569, 23.27249], [105.32376, 23.39684], [105.40782, 23.28107], [105.42805, 23.30824], [105.49966, 23.20669], [105.56037, 23.16806], [105.57594, 23.075], [105.72382, 23.06641], [105.8726, 22.92756], [105.90119, 22.94168], [105.99568, 22.94178], [106.00179, 22.99049], [106.19705, 22.98475], [106.27022, 22.87722], [106.34961, 22.86718], [106.49749, 22.91164], [106.51306, 22.94891], [106.55976, 22.92311], [106.60179, 22.92884], [106.6516, 22.86862], [106.6734, 22.89587], [106.71387, 22.88296], [106.71128, 22.85982], [106.78422, 22.81532], [106.81271, 22.8226], [106.83685, 22.8098], [106.82404, 22.7881], [106.76293, 22.73491], [106.72321, 22.63606], [106.71698, 22.58432], [106.65316, 22.5757], [106.61269, 22.60301], [106.58395, 22.474], [106.55665, 22.46498], [106.57221, 22.37], [106.55976, 22.34841], [106.6516, 22.33977], [106.69986, 22.22309], [106.67495, 22.1885], [106.6983, 22.15102], [106.70142, 22.02409], [106.68274, 21.99811], [106.69276, 21.96013], [106.72551, 21.97923], [106.74345, 22.00965], [106.81038, 21.97934], [106.9178, 21.97357], [106.92714, 21.93459], [106.97228, 21.92592], [106.99252, 21.95191], [107.05634, 21.92303], [107.06101, 21.88982], [107.00964, 21.85948], [107.02615, 21.81981], [107.10771, 21.79879], [107.20734, 21.71493], [107.24625, 21.7077], [107.29296, 21.74674], [107.35834, 21.6672], [107.35989, 21.60063], [107.38636, 21.59774], [107.41593, 21.64839], [107.47197, 21.6672], [107.49532, 21.62958], [107.49065, 21.59774], [107.54047, 21.5934], [107.56537, 21.61945], [107.66967, 21.60787], [107.80355, 21.66141], [107.86114, 21.65128], [107.90006, 21.5905], [107.92652, 21.58906], [107.95232, 21.5388], [107.96774, 21.53601], [107.97074, 21.54072], [107.97383, 21.53961], [107.97932, 21.54503], [108.02926, 21.54997], [108.0569, 21.53604], [108.10003, 21.47338], [108.00365, 17.98159], [111.60491, 13.57105], [118.41371, 24.06775], [118.11703, 24.39734], [118.28244, 24.51231], [118.35291, 24.51645], [118.42453, 24.54644], [118.6333, 24.46259], [119.42295, 25.0886], [119.98511, 25.37624], [119.78816, 26.2348], [120.0693, 26.3959], [120.5128, 26.536], [121.03532, 26.8787], [123.5458, 31.01942], [122.29378, 31.76513], [122.80525, 33.30571], [123.85601, 37.49093], [123.90497, 38.79949], [124.17532, 39.8232], [124.23201, 39.9248], [124.35029, 39.95639], [124.37089, 40.03004], [124.3322, 40.05573], [124.38556, 40.11047], [124.40719, 40.13655], [124.86913, 40.45387], [125.71172, 40.85223], [125.76869, 40.87908], [126.00335, 40.92835], [126.242, 41.15454], [126.53189, 41.35206], [126.60631, 41.65565], [126.90729, 41.79955], [127.17841, 41.59714], [127.29712, 41.49473], [127.92943, 41.44291], [128.02633, 41.42103], [128.03311, 41.39232], [128.12967, 41.37931], [128.18546, 41.41279], [128.20061, 41.40895], [128.30716, 41.60322], [128.15119, 41.74568], [128.04487, 42.01769], [128.94007, 42.03537], [128.96068, 42.06657], [129.15178, 42.17224], [129.22285, 42.26491], [129.22423, 42.3553], [129.28541, 42.41574], [129.42882, 42.44702], [129.54701, 42.37254], [129.60482, 42.44461], [129.72541, 42.43739], [129.75294, 42.59409], [129.77183, 42.69435], [129.7835, 42.76521], [129.80719, 42.79218], [129.83277, 42.86746], [129.85261, 42.96494], [129.8865, 43.00395], [129.95082, 43.01051], [129.96409, 42.97306], [130.12957, 42.98361], [130.09764, 42.91425], [130.26095, 42.9027], [130.23068, 42.80125], [130.2385, 42.71127], [130.41826, 42.6011], [130.44361, 42.54849], [130.50123, 42.61636], [130.55143, 42.52158], [130.62107, 42.58413], [130.56576, 42.68925], [130.40213, 42.70788], [130.44361, 42.76205], [130.66524, 42.84753], [131.02438, 42.86518], [131.02668, 42.91246], [131.135, 42.94114], [131.10274, 43.04734], [131.20414, 43.13654], [131.19031, 43.21385], [131.30324, 43.39498], [131.29402, 43.46695], [131.19492, 43.53047], [131.21105, 43.82383], [131.26176, 43.94011], [131.23583, 43.96085], [131.25484, 44.03131], [131.30365, 44.04262], [131.1108, 44.70266], [130.95639, 44.85154], [131.48415, 44.99513], [131.68466, 45.12374], [131.66852, 45.2196], [131.76532, 45.22609], [131.86903, 45.33636], [131.99417, 45.2567], [132.83978, 45.05916], [132.96373, 45.0212], [133.12293, 45.1332], [133.09279, 45.25693], [133.19419, 45.51913], [133.41083, 45.57723], [133.48457, 45.86203], [133.60442, 45.90053], [133.67569, 45.9759], [133.72695, 46.05576], [133.68047, 46.14697], [133.88097, 46.25066], [133.91496, 46.4274], [133.84104, 46.46681], [134.03538, 46.75668], [134.20016, 47.33458], [134.50898, 47.4812], [134.7671, 47.72051], [134.55508, 47.98651], [134.67098, 48.1564], [134.75328, 48.36763], [134.49516, 48.42884], [132.66989, 47.96491], [132.57309, 47.71741], [131.90448, 47.68011], [131.2635, 47.73325], [131.09871, 47.6852], [130.95985, 47.6957], [130.90915, 47.90623], [130.65103, 48.10052], [130.84462, 48.30942], [130.52147, 48.61745], [130.66946, 48.88251], [130.43232, 48.90844], [130.2355, 48.86741], [129.85416, 49.11067], [129.67598, 49.29596], [129.50685, 49.42398], [129.40398, 49.44194], [129.35317, 49.3481], [129.23232, 49.40353], [129.11153, 49.36813], [128.72896, 49.58676], [127.83476, 49.5748], [127.53516, 49.84306], [127.49299, 50.01251], [127.60515, 50.23503], [127.37384, 50.28393], [127.36009, 50.43787], [127.28765, 50.46585], [127.36335, 50.58306], [127.28165, 50.72075], [127.14586, 50.91152], [126.93135, 51.0841], [126.90369, 51.3238], [126.68349, 51.70607], [126.44606, 51.98254], [126.558, 52.13738], [125.6131, 53.07229]], [[113.56865, 22.20973], [113.57123, 22.20416], [113.60504, 22.20464], [113.63011, 22.10782], [113.57191, 22.07696], [113.54839, 22.10909], [113.54942, 22.14519], [113.54093, 22.15497], [113.52659, 22.18271], [113.53552, 22.20607], [113.53301, 22.21235], [113.53591, 22.21369], [113.54093, 22.21314], [113.54333, 22.21688], [113.5508, 22.21672], [113.56865, 22.20973]], [[114.50148, 22.15017], [113.92195, 22.13873], [113.83338, 22.1826], [113.81621, 22.2163], [113.86771, 22.42972], [114.03113, 22.5065], [114.05438, 22.5026], [114.05729, 22.51104], [114.06272, 22.51617], [114.07267, 22.51855], [114.07817, 22.52997], [114.08606, 22.53276], [114.09048, 22.53716], [114.09692, 22.53435], [114.1034, 22.5352], [114.11181, 22.52878], [114.11656, 22.53415], [114.12665, 22.54003], [114.13823, 22.54319], [114.1482, 22.54091], [114.15123, 22.55163], [114.1597, 22.56041], [114.17247, 22.55944], [114.18338, 22.55444], [114.20655, 22.55706], [114.22185, 22.55343], [114.22888, 22.5436], [114.25154, 22.55977], [114.44998, 22.55977], [114.50148, 22.15017]]]] } },
23083     { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
23084     { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
23085     { 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]]]] } },
23086     { 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]]]] } },
23087     { 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]]]] } },
23088     { 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]]]] } },
23089     { 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]]]] } },
23090     { 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]]]] } },
23091     { 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]]]] } },
23092     { 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]]]] } },
23093     { 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]]]] } },
23094     { 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]]]] } },
23095     { 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]]]] } },
23096     { 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]]]] } },
23097     { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
23098     { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
23099     { 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]]]] } },
23100     { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
23101     { 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]]]] } },
23102     { 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]]]] } },
23103     { 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]]]] } },
23104     { 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]]]] } },
23105     { 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]]]] } },
23106     { 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]]]] } },
23107     { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
23108     { 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]]]] } },
23109     { 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]]]] } },
23110     { 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]]]] } },
23111     { 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]]]] } },
23112     { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
23113     { 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]]]] } },
23114     { 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]]]] } },
23115     { 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]]]] } },
23116     { 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]]]] } },
23117     { 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]]]] } },
23118     { 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]]]] } },
23119     { 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]]]] } },
23120     { 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]]]] } },
23121     { 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]]]] } },
23122     { 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]]]] } },
23123     { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
23124     { 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]]]] } },
23125     { 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]]]] } },
23126     { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
23127     { 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]]]] } },
23128     { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
23129     { 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]]]] } },
23130     { 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]]]] } },
23131     { 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]]]] } },
23132     { 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]]]] } },
23133     { 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]]]] } },
23134     { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
23135     { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
23136     { 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]]]] } },
23137     { 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]]]] } },
23138     { 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]]]] } },
23139     { 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]]]] } },
23140     { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
23141     { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
23142     { 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]]]] } },
23143     { 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]]]] } },
23144     { 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]]]] } },
23145     { 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]]]] } },
23146     { 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]]]] } },
23147     { 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]]]] } },
23148     { 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]]]] } },
23149     { 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]]]] } },
23150     { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
23151     { 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]]]] } },
23152     { 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]]]] } },
23153     { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
23154     { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
23155     { 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]]]] } },
23156     { 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]]]] } },
23157     { 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]]]] } },
23158     { 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]]]] } },
23159     { 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]]]] } },
23160     { 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]]]] } },
23161     { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
23162     { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
23163     { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
23164     { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
23165     { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
23166     { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
23167     { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
23168     { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
23169     { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
23170     { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
23171     { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
23172     { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
23173     { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
23174     { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
23175     { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
23176     { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
23177     { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
23178     { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
23179     { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
23180     { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
23181     { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
23182     { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
23183     { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
23184     { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
23185     { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
23186     { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
23187     { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
23188     { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
23189     { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
23190     { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
23191     { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
23192     { 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]]]] } },
23193     { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
23194     { 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]]]] } },
23195     { 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]]]] } },
23196     { 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]]]] } },
23197     { 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]]]] } },
23198     { 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]]]] } },
23199     { 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]]]] } },
23200     { 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]]]] } },
23201     { 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]]]] } },
23202     { 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]]]] } },
23203     { 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]]]] } },
23204     { 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]]]] } },
23205     { 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]]]] } },
23206     { 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]]]] } },
23207     { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
23208     { 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]]]] } },
23209     { 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]]]] } },
23210     { 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]]]] } },
23211     { 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]]]] } },
23212     { 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]]]] } },
23213     { 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]]]] } },
23214     { 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]]]] } },
23215     { 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]]]] } },
23216     { 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]]]] } },
23217     { 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]]]] } },
23218     { 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]]]] } },
23219     { 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]]]] } },
23220     { 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]]]] } },
23221     { 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]]]] } },
23222     { 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]]]] } },
23223     { 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]]]] } },
23224     { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
23225     { 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]]]] } },
23226     { 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]]]] } },
23227     { 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]]]] } },
23228     { 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]]]] } },
23229     { 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]]]] } },
23230     { 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]]]] } },
23231     { 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]]]] } },
23232     { 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]]]] } },
23233     { 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]]]] } },
23234     { 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]]]] } },
23235     { 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]]]] } },
23236     { 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]]]] } },
23237     { type: "Feature", geometry: { type: "MultiPolygon", coordinates: [[[[8.72809, 47.69282], [8.72617, 47.69651], [8.73671, 47.7169], [8.70543, 47.73121], [8.74251, 47.75168], [8.71778, 47.76571], [8.68985, 47.75686], [8.68022, 47.78599], [8.65292, 47.80066], [8.64425, 47.76398], [8.62408, 47.7626], [8.61657, 47.79998], [8.56415, 47.80633], [8.56814, 47.78001], [8.48868, 47.77215], [8.45771, 47.7493], [8.44807, 47.72426], [8.40569, 47.69855], [8.4211, 47.68407], [8.40473, 47.67499], [8.41346, 47.66676], [8.42264, 47.66667], [8.44711, 47.65379], [8.4667, 47.65747], [8.46605, 47.64103], [8.49656, 47.64709], [8.5322, 47.64687], [8.52801, 47.66059], [8.56141, 47.67088], [8.57683, 47.66158], [8.6052, 47.67258], [8.61113, 47.66332], [8.62884, 47.65098], [8.62049, 47.63757], [8.60412, 47.63735], [8.61471, 47.64514], [8.60701, 47.65271], [8.59545, 47.64298], [8.60348, 47.61204], [8.57586, 47.59537], [8.55756, 47.62394], [8.51686, 47.63476], [8.50747, 47.61897], [8.45578, 47.60121], [8.46637, 47.58389], [8.48949, 47.588], [8.49431, 47.58107], [8.43235, 47.56617], [8.39477, 47.57826], [8.38273, 47.56608], [8.35512, 47.57014], [8.32735, 47.57133], [8.30277, 47.58607], [8.29524, 47.5919], [8.29722, 47.60603], [8.2824, 47.61225], [8.26313, 47.6103], [8.25863, 47.61571], [8.23809, 47.61204], [8.22577, 47.60385], [8.22011, 47.6181], [8.20617, 47.62141], [8.19378, 47.61636], [8.1652, 47.5945], [8.14947, 47.59558], [8.13823, 47.59147], [8.13662, 47.58432], [8.11543, 47.5841], [8.10395, 47.57918], [8.10002, 47.56504], [8.08557, 47.55768], [8.06663, 47.56374], [8.04383, 47.55443], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95682, 47.55789], [7.94494, 47.54511], [7.91251, 47.55031], [7.90673, 47.57674], [7.88664, 47.58854], [7.84412, 47.5841], [7.81901, 47.58798], [7.79486, 47.55691], [7.75261, 47.54599], [7.71961, 47.54219], [7.69642, 47.53297], [7.68101, 47.53232], [7.6656, 47.53752], [7.66174, 47.54554], [7.65083, 47.54662], [7.63338, 47.56256], [7.67655, 47.56435], [7.68904, 47.57133], [7.67115, 47.5871], [7.68486, 47.59601], [7.69385, 47.60099], [7.68229, 47.59905], [7.67395, 47.59212], [7.64599, 47.59695], [7.64213, 47.5944], [7.64309, 47.59151], [7.61929, 47.57683], [7.60459, 47.57869], [7.60523, 47.58519], [7.58945, 47.59017], [7.58386, 47.57536], [7.56684, 47.57785], [7.56548, 47.57617], [7.55689, 47.57232], [7.55652, 47.56779], [7.53634, 47.55553], [7.52831, 47.55347], [7.51723, 47.54578], [7.50873, 47.54546], [7.49691, 47.53821], [7.50588, 47.52856], [7.51904, 47.53515], [7.53199, 47.5284], [7.5229, 47.51644], [7.49804, 47.51798], [7.51076, 47.49651], [7.47534, 47.47932], [7.43356, 47.49712], [7.42923, 47.48628], [7.4583, 47.47216], [7.4462, 47.46264], [7.43088, 47.45846], [7.40308, 47.43638], [7.35603, 47.43432], [7.33526, 47.44186], [7.24669, 47.4205], [7.17026, 47.44312], [7.19583, 47.49455], [7.16249, 47.49025], [7.12781, 47.50371], [7.07425, 47.48863], [7.0231, 47.50522], [6.98425, 47.49432], [7.0024, 47.45264], [6.93953, 47.43388], [6.93744, 47.40714], [6.88542, 47.37262], [6.87959, 47.35335], [7.03125, 47.36996], [7.0564, 47.35134], [7.05305, 47.33304], [6.94316, 47.28747], [6.95108, 47.26428], [6.9508, 47.24338], [6.8489, 47.15933], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.43341, 46.92703], [6.46456, 46.88865], [6.43216, 46.80336], [6.45209, 46.77502], [6.38351, 46.73171], [6.27135, 46.68251], [6.11084, 46.57649], [6.1567, 46.54402], [6.07269, 46.46244], [6.08427, 46.44305], [6.06407, 46.41676], [6.09926, 46.40768], [6.15016, 46.3778], [6.15985, 46.37721], [6.16987, 46.36759], [6.15738, 46.3491], [6.13876, 46.33844], [6.1198, 46.31157], [6.11697, 46.29547], [6.1013, 46.28512], [6.11926, 46.2634], [6.12446, 46.25059], [6.10071, 46.23772], [6.08563, 46.24651], [6.07072, 46.24085], [6.0633, 46.24583], [6.05029, 46.23518], [6.04602, 46.23127], [6.03342, 46.2383], [6.02461, 46.23313], [5.97542, 46.21525], [5.96515, 46.19638], [5.99573, 46.18587], [5.98846, 46.17046], [5.98188, 46.17392], [5.97508, 46.15863], [5.9641, 46.14412], [5.95781, 46.12925], [5.97893, 46.13303], [5.9871, 46.14499], [6.01791, 46.14228], [6.03614, 46.13712], [6.04564, 46.14031], [6.05203, 46.15191], [6.07491, 46.14879], [6.09199, 46.15191], [6.09926, 46.14373], [6.13397, 46.1406], [6.15305, 46.15194], [6.18116, 46.16187], [6.18871, 46.16644], [6.18707, 46.17999], [6.19552, 46.18401], [6.19807, 46.18369], [6.20539, 46.19163], [6.21114, 46.1927], [6.21273, 46.19409], [6.21603, 46.19507], [6.21844, 46.19837], [6.22222, 46.19888], [6.22175, 46.20045], [6.23544, 46.20714], [6.23913, 46.20511], [6.24821, 46.20531], [6.26007, 46.21165], [6.27694, 46.21566], [6.29663, 46.22688], [6.31041, 46.24417], [6.29474, 46.26221], [6.26749, 46.24745], [6.24952, 46.26255], [6.23775, 46.27822], [6.25137, 46.29014], [6.24826, 46.30175], [6.21981, 46.31304], [6.25432, 46.3632], [6.53358, 46.45431], [6.82312, 46.42661], [6.8024, 46.39171], [6.77152, 46.34784], [6.86052, 46.28512], [6.78968, 46.14058], [6.89321, 46.12548], [6.87868, 46.03855], [6.93862, 46.06502], [7.00946, 45.9944], [7.04151, 45.92435], [7.10685, 45.85653], [7.56343, 45.97421], [7.85949, 45.91485], [7.9049, 45.99945], [7.98881, 45.99867], [8.02906, 46.10331], [8.11383, 46.11577], [8.16866, 46.17817], [8.08814, 46.26692], [8.31162, 46.38044], [8.30648, 46.41587], [8.42464, 46.46367], [8.46317, 46.43712], [8.45032, 46.26869], [8.62242, 46.12112], [8.75697, 46.10395], [8.80778, 46.10085], [8.85617, 46.0748], [8.79414, 46.00913], [8.78585, 45.98973], [8.79362, 45.99207], [8.8319, 45.9879], [8.85121, 45.97239], [8.86688, 45.96135], [8.88904, 45.95465], [8.93649, 45.86775], [8.94372, 45.86587], [8.93504, 45.86245], [8.91129, 45.8388], [8.94737, 45.84285], [8.9621, 45.83707], [8.99663, 45.83466], [9.00324, 45.82055], [9.0298, 45.82127], [9.03279, 45.82865], [9.03793, 45.83548], [9.03505, 45.83976], [9.04059, 45.8464], [9.04546, 45.84968], [9.06642, 45.8761], [9.09065, 45.89906], [8.99257, 45.9698], [9.01618, 46.04928], [9.24503, 46.23616], [9.29226, 46.32717], [9.25502, 46.43743], [9.28136, 46.49685], [9.36128, 46.5081], [9.40487, 46.46621], [9.45936, 46.50873], [9.46117, 46.37481], [9.57015, 46.2958], [9.71273, 46.29266], [9.73086, 46.35071], [9.95249, 46.38045], [10.07055, 46.21668], [10.14439, 46.22992], [10.17862, 46.25626], [10.10506, 46.3372], [10.165, 46.41051], [10.03715, 46.44479], [10.10307, 46.61003], [10.23674, 46.63484], [10.25309, 46.57432], [10.46136, 46.53164], [10.49375, 46.62049], [10.44686, 46.64162], [10.40475, 46.63671], [10.38659, 46.67847], [10.47197, 46.85698], [10.48376, 46.93891], [10.36933, 47.00212], [10.30031, 46.92093], [10.24128, 46.93147], [10.22675, 46.86942], [10.10715, 46.84296], [9.98058, 46.91434], [9.88266, 46.93343], [9.87935, 47.01337], [9.60717, 47.06091], [9.55721, 47.04762], [9.54041, 47.06495], [9.47548, 47.05257], [9.47139, 47.06402], [9.51362, 47.08505], [9.52089, 47.10019], [9.51044, 47.13727], [9.48774, 47.17402], [9.4891, 47.19346], [9.50318, 47.22153], [9.52406, 47.24959], [9.53116, 47.27029], [9.54773, 47.2809], [9.55857, 47.29919], [9.58513, 47.31334], [9.59978, 47.34671], [9.62476, 47.36639], [9.65427, 47.36824], [9.66243, 47.37136], [9.6711, 47.37824], [9.67445, 47.38429], [9.67334, 47.39191], [9.6629, 47.39591], [9.65136, 47.40504], [9.65043, 47.41937], [9.6446, 47.43233], [9.64483, 47.43842], [9.65863, 47.44847], [9.65728, 47.45383], [9.6423, 47.45599], [9.62475, 47.45685], [9.62158, 47.45858], [9.60841, 47.47178], [9.60484, 47.46358], [9.60205, 47.46165], [9.59482, 47.46305], [9.58208, 47.48344], [9.56312, 47.49495], [9.55125, 47.53629], [9.25619, 47.65939], [9.18203, 47.65598], [9.17593, 47.65399], [9.1755, 47.65584], [9.1705, 47.65513], [9.15181, 47.66904], [9.13845, 47.66389], [9.09891, 47.67801], [9.02093, 47.6868], [8.94093, 47.65596], [8.89946, 47.64769], [8.87625, 47.65441], [8.87383, 47.67045], [8.85065, 47.68209], [8.86989, 47.70504], [8.82002, 47.71458], [8.80663, 47.73821], [8.77309, 47.72059], [8.76965, 47.7075], [8.79966, 47.70222], [8.79511, 47.67462], [8.75856, 47.68969], [8.72809, 47.69282]], [[8.95861, 45.96485], [8.96668, 45.98436], [8.97741, 45.98317], [8.97604, 45.96151], [8.95861, 45.96485]], [[8.70847, 47.68904], [8.68985, 47.69552], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] }, properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] } },
23238     { 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]]]] } },
23239     { 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]]]] } },
23240     { 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]]]] } },
23241     { 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]]]] } },
23242     { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
23243     { 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]]]] } },
23244     { 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]]]] } },
23245     { 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]]]] } },
23246     { 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]]]] } },
23247     { 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]]]] } },
23248     { 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]]]] } },
23249     { 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]]]] } },
23250     { 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]]]] } },
23251     { 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]]]] } },
23252     { 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]]]] } },
23253     { 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]]]] } },
23254     { 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]]]] } },
23255     { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
23256     { 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]]]] } },
23257     { 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]]]] } },
23258     { 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]]]] } },
23259     { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
23260     { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
23261     { 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]]]] } },
23262     { 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]]]] } },
23263     { 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]]]] } },
23264     { 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]]]] } },
23265     { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
23266     { 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]]]] } },
23267     { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
23268     { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
23269     { 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]]]] } },
23270     { 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]]]] } },
23271     { 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]]]] } },
23272     { 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]]]] } },
23273     { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
23274     { 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]]]] } },
23275     { 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]]]] } },
23276     { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
23277     { 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]]]] } },
23278     { 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]]]] } },
23279     { 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]]]] } },
23280     { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
23281     { 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]]]] } },
23282     { 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]]]] } },
23283     { 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]]]] } },
23284     { 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]]]] } },
23285     { 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]]]] } },
23286     { 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]]]] } },
23287     { 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]]]] } },
23288     { 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]]]] } },
23289     { 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]]]] } },
23290     { 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]]]] } },
23291     { 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]]]] } },
23292     { 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]]]] } },
23293     { 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]]]] } },
23294     { 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]]]] } },
23295     { 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]]]] } },
23296     { 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]]]] } },
23297     { 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]]]] } },
23298     { 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]]]] } },
23299     { 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]]]] } },
23300     { 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]]]] } },
23301     { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
23302     { type: "Feature", geometry: { type: "MultiPolygon", coordinates: [[[[-6.26218, 54.09785], [-6.29003, 54.11278], [-6.32694, 54.09337], [-6.36279, 54.11248], [-6.36605, 54.07234], [-6.47849, 54.06947], [-6.62842, 54.03503], [-6.66264, 54.0666], [-6.6382, 54.17071], [-6.70175, 54.20218], [-6.74575, 54.18788], [-6.81583, 54.22791], [-6.85179, 54.29176], [-6.87775, 54.34682], [-7.02034, 54.4212], [-7.19145, 54.31296], [-7.14908, 54.22732], [-7.25012, 54.20063], [-7.26316, 54.13863], [-7.29493, 54.12013], [-7.29687, 54.1354], [-7.28017, 54.16714], [-7.29157, 54.17191], [-7.34005, 54.14698], [-7.30553, 54.11869], [-7.32834, 54.11475], [-7.44567, 54.1539], [-7.4799, 54.12239], [-7.55812, 54.12239], [-7.69501, 54.20731], [-7.81397, 54.20159], [-7.8596, 54.21779], [-7.87101, 54.29299], [-8.04555, 54.36292], [-8.179, 54.46763], [-8.04538, 54.48941], [-7.99812, 54.54427], [-7.8596, 54.53671], [-7.70315, 54.62077], [-7.93293, 54.66603], [-7.83352, 54.73854], [-7.75041, 54.7103], [-7.64449, 54.75265], [-7.54671, 54.74606], [-7.54508, 54.79401], [-7.47626, 54.83084], [-7.4473, 54.87003], [-7.44404, 54.9403], [-7.40004, 54.94498], [-7.4033, 55.00391], [-7.34464, 55.04688], [-7.2471, 55.06933], [-6.34755, 55.49206], [-7.75229, 55.93854], [-11.75, 54], [-11, 51], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] }, properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] } },
23303     { 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]]]] } },
23304     { 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]]]] } },
23305     { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
23306     { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
23307     { 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]]]] } },
23308     { 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]]]] } },
23309     { 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]]]] } },
23310     { 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]]]] } },
23311     { 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]]]] } },
23312     { 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]]]] } },
23313     { 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]]]] } },
23314     { 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]]]] } },
23315     { 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]]]] } },
23316     { 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]]]] } },
23317     { 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]]]] } },
23318     { 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]]]] } },
23319     { 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]]]] } },
23320     { 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]]]] } },
23321     { 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]]]] } },
23322     { 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]]]] } },
23323     { 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]]]] } },
23324     { 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]]]] } },
23325     { 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]]]] } },
23326     { 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]]]] } },
23327     { 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]]]] } },
23328     { 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]]]] } },
23329     { 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]]]] } },
23330     { 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]]]] } },
23331     { 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]]]] } },
23332     { 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]]]] } },
23333     { 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]]]] } },
23334     { 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]]]] } },
23335     { 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]]]] } },
23336     { 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]]]] } },
23337     { 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]]]] } },
23338     { 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]]]] } },
23339     { 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]]]] } },
23340     { 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]]]] } },
23341     { 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]]]] } },
23342     { 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]]]] } },
23343     { 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]]]] } },
23344     { 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]]]] } },
23345     { 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]]]] } },
23346     { 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]]]] } },
23347     { 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]]]] } },
23348     { 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]]]] } },
23349     { 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]]]] } },
23350     { 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]]]] } },
23351     { 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]]]] } },
23352     { 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]]]] } },
23353     { 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]]]] } },
23354     { 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]]]] } },
23355     { 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]]]] } },
23356     { 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]]]] } },
23357     { 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]]]] } },
23358     { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
23359     { 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]]]] } },
23360     { 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]]]] } },
23361     { 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]]]] } },
23362     { 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]]]] } },
23363     { 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]]]] } },
23364     { 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]]]] } },
23365     { 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]]]] } },
23366     { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
23367     { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
23368     { 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]]]] } },
23369     { 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]]]] } },
23370     { 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]]]] } },
23371     { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
23372     { 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]]]] } },
23373     { 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]]]] } },
23374     { 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]]]] } },
23375     { 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]]]] } },
23376     { 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]]]] } },
23377     { 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]]]] } },
23378     { 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]]]] } },
23379     { 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]]]] } },
23380     { 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]]]] } },
23381     { 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]]]] } },
23382     { 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]]]] } },
23383     { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
23384     { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
23385     { 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]]]] } },
23386     { 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]]]] } },
23387     { 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]]]] } },
23388     { 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]]]] } },
23389     { 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]]]] } },
23390     { 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]]]] } },
23391     { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
23392     { 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]]]] } },
23393     { 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]]]] } },
23394     { 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]]]] } },
23395     { 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]]]] } },
23396     { 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]]]] } },
23397     { 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]]]] } },
23398     { 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]]]] } },
23399     { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
23400     { 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]]]] } },
23401     { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
23402     { 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]]]] } },
23403     { 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]]]] } },
23404     { 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]]]] } },
23405     { 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]]]] } },
23406     { 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]]]] } },
23407     { 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]]]] } },
23408     { 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]]]] } },
23409     { 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]]]] } },
23410     { 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]]]] } },
23411     { 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]]]] } },
23412     { 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]]]] } },
23413     { 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]]]] } },
23414     { 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]]]] } },
23415     { 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]]]] } },
23416     { 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]]]] } },
23417     { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
23418     { 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]]]] } },
23419     { 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]]]] } },
23420     { 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]]]] } },
23421     { 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]]]] } },
23422     { 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]]]] } },
23423     { 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]]]] } },
23424     { 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]]]] } },
23425     { 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]]]] } },
23426     { 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]]]] } },
23427     { 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]]]] } },
23428     { 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]]]] } },
23429     { type: "Feature", properties: { iso1A2: "TW", iso1A3: "TWN", iso1N3: "158", wikidata: "Q865", nameEn: "Taiwan", aliases: ["RC"], groups: ["030", "142"], callingCodes: ["886"] }, geometry: { type: "MultiPolygon", coordinates: [[[[121.8109, 21.77688], [122.26612, 25.98197], [120.5128, 26.536], [120.0693, 26.3959], [119.78816, 26.2348], [119.98511, 25.37624], [119.42295, 25.0886], [118.6333, 24.46259], [118.42453, 24.54644], [118.35291, 24.51645], [118.28244, 24.51231], [118.11703, 24.39734], [120.69238, 21.52331], [121.8109, 21.77688]]]] } },
23430     { 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]]]] } },
23431     { 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]]]] } },
23432     { 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]]]] } },
23433     { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
23434     { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
23435     { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
23436     { 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]]]] } },
23437     { 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]]]] } },
23438     { 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]]]] } },
23439     { 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]]]] } },
23440     { 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]]]] } },
23441     { 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]]]] } },
23442     { 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]]]] } },
23443     { 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]]]] } },
23444     { 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]]]] } },
23445     { 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]]]] } },
23446     { 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]]]] } },
23447     { 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]]]] } },
23448     { 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]]]] } },
23449     { 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]]]] } },
23450     { 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]]]] } },
23451     { 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]]]] } },
23452     { 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]]]] } }
23453   ] };
23454   var borders = borders_default;
23455   var _whichPolygon = {};
23456   var _featuresByCode = {};
23457   var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
23458   function canonicalID(id2) {
23459     const s2 = id2 || "";
23460     if (s2.charAt(0) === ".") {
23461       return s2.toUpperCase();
23462     } else {
23463       return s2.replace(idFilterRegex, "").toUpperCase();
23464     }
23465   }
23466   var levels = [
23467     "subterritory",
23468     "territory",
23469     "subcountryGroup",
23470     "country",
23471     "sharedLandform",
23472     "intermediateRegion",
23473     "subregion",
23474     "region",
23475     "subunion",
23476     "union",
23477     "unitedNations",
23478     "world"
23479   ];
23480   loadDerivedDataAndCaches(borders);
23481   function loadDerivedDataAndCaches(borders2) {
23482     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
23483     let geometryFeatures = [];
23484     for (const feature22 of borders2.features) {
23485       const props = feature22.properties;
23486       props.id = props.iso1A2 || props.m49 || props.wikidata;
23487       loadM49(feature22);
23488       loadTLD(feature22);
23489       loadIsoStatus(feature22);
23490       loadLevel(feature22);
23491       loadGroups(feature22);
23492       loadFlag(feature22);
23493       cacheFeatureByIDs(feature22);
23494       if (feature22.geometry) {
23495         geometryFeatures.push(feature22);
23496       }
23497     }
23498     for (const feature22 of borders2.features) {
23499       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
23500         return _featuresByCode[groupID].properties.id;
23501       });
23502       loadMembersForGroupsOf(feature22);
23503     }
23504     for (const feature22 of borders2.features) {
23505       loadRoadSpeedUnit(feature22);
23506       loadRoadHeightUnit(feature22);
23507       loadDriveSide(feature22);
23508       loadCallingCodes(feature22);
23509       loadGroupGroups(feature22);
23510     }
23511     for (const feature22 of borders2.features) {
23512       feature22.properties.groups.sort((groupID1, groupID2) => {
23513         return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
23514       });
23515       if (feature22.properties.members) {
23516         feature22.properties.members.sort((id1, id2) => {
23517           const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
23518           if (diff === 0) {
23519             return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
23520           }
23521           return diff;
23522         });
23523       }
23524     }
23525     const geometryOnlyCollection = {
23526       type: "FeatureCollection",
23527       features: geometryFeatures
23528     };
23529     _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
23530     function loadGroups(feature22) {
23531       const props = feature22.properties;
23532       if (!props.groups) {
23533         props.groups = [];
23534       }
23535       if (feature22.geometry && props.country) {
23536         props.groups.push(props.country);
23537       }
23538       if (props.m49 !== "001") {
23539         props.groups.push("001");
23540       }
23541     }
23542     function loadM49(feature22) {
23543       const props = feature22.properties;
23544       if (!props.m49 && props.iso1N3) {
23545         props.m49 = props.iso1N3;
23546       }
23547     }
23548     function loadTLD(feature22) {
23549       const props = feature22.properties;
23550       if (props.level === "unitedNations")
23551         return;
23552       if (!props.ccTLD && props.iso1A2) {
23553         props.ccTLD = "." + props.iso1A2.toLowerCase();
23554       }
23555     }
23556     function loadIsoStatus(feature22) {
23557       const props = feature22.properties;
23558       if (!props.isoStatus && props.iso1A2) {
23559         props.isoStatus = "official";
23560       }
23561     }
23562     function loadLevel(feature22) {
23563       const props = feature22.properties;
23564       if (props.level)
23565         return;
23566       if (!props.country) {
23567         props.level = "country";
23568       } else if (!props.iso1A2 || props.isoStatus === "official") {
23569         props.level = "territory";
23570       } else {
23571         props.level = "subterritory";
23572       }
23573     }
23574     function loadGroupGroups(feature22) {
23575       const props = feature22.properties;
23576       if (feature22.geometry || !props.members)
23577         return;
23578       const featureLevelIndex = levels.indexOf(props.level);
23579       let sharedGroups = [];
23580       props.members.forEach((memberID, index) => {
23581         const member = _featuresByCode[memberID];
23582         const memberGroups = member.properties.groups.filter((groupID) => {
23583           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
23584         });
23585         if (index === 0) {
23586           sharedGroups = memberGroups;
23587         } else {
23588           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23589         }
23590       });
23591       props.groups = props.groups.concat(
23592         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
23593       );
23594       for (const groupID of sharedGroups) {
23595         const groupFeature = _featuresByCode[groupID];
23596         if (groupFeature.properties.members.indexOf(props.id) === -1) {
23597           groupFeature.properties.members.push(props.id);
23598         }
23599       }
23600     }
23601     function loadRoadSpeedUnit(feature22) {
23602       const props = feature22.properties;
23603       if (feature22.geometry) {
23604         if (!props.roadSpeedUnit)
23605           props.roadSpeedUnit = "km/h";
23606       } else if (props.members) {
23607         const vals = Array.from(
23608           new Set(
23609             props.members.map((id2) => {
23610               const member = _featuresByCode[id2];
23611               if (member.geometry)
23612                 return member.properties.roadSpeedUnit || "km/h";
23613             }).filter(Boolean)
23614           )
23615         );
23616         if (vals.length === 1)
23617           props.roadSpeedUnit = vals[0];
23618       }
23619     }
23620     function loadRoadHeightUnit(feature22) {
23621       const props = feature22.properties;
23622       if (feature22.geometry) {
23623         if (!props.roadHeightUnit)
23624           props.roadHeightUnit = "m";
23625       } else if (props.members) {
23626         const vals = Array.from(
23627           new Set(
23628             props.members.map((id2) => {
23629               const member = _featuresByCode[id2];
23630               if (member.geometry)
23631                 return member.properties.roadHeightUnit || "m";
23632             }).filter(Boolean)
23633           )
23634         );
23635         if (vals.length === 1)
23636           props.roadHeightUnit = vals[0];
23637       }
23638     }
23639     function loadDriveSide(feature22) {
23640       const props = feature22.properties;
23641       if (feature22.geometry) {
23642         if (!props.driveSide)
23643           props.driveSide = "right";
23644       } else if (props.members) {
23645         const vals = Array.from(
23646           new Set(
23647             props.members.map((id2) => {
23648               const member = _featuresByCode[id2];
23649               if (member.geometry)
23650                 return member.properties.driveSide || "right";
23651             }).filter(Boolean)
23652           )
23653         );
23654         if (vals.length === 1)
23655           props.driveSide = vals[0];
23656       }
23657     }
23658     function loadCallingCodes(feature22) {
23659       const props = feature22.properties;
23660       if (!feature22.geometry && props.members) {
23661         props.callingCodes = Array.from(
23662           new Set(
23663             props.members.reduce((array2, id2) => {
23664               const member = _featuresByCode[id2];
23665               if (member.geometry && member.properties.callingCodes) {
23666                 return array2.concat(member.properties.callingCodes);
23667               }
23668               return array2;
23669             }, [])
23670           )
23671         );
23672       }
23673     }
23674     function loadFlag(feature22) {
23675       if (!feature22.properties.iso1A2)
23676         return;
23677       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23678         return String.fromCodePoint(char.charCodeAt(0) + 127397);
23679       });
23680       feature22.properties.emojiFlag = flag;
23681     }
23682     function loadMembersForGroupsOf(feature22) {
23683       for (const groupID of feature22.properties.groups) {
23684         const groupFeature = _featuresByCode[groupID];
23685         if (!groupFeature.properties.members) {
23686           groupFeature.properties.members = [];
23687         }
23688         groupFeature.properties.members.push(feature22.properties.id);
23689       }
23690     }
23691     function cacheFeatureByIDs(feature22) {
23692       let ids = [];
23693       for (const prop of identifierProps) {
23694         const id2 = feature22.properties[prop];
23695         if (id2) {
23696           ids.push(id2);
23697         }
23698       }
23699       for (const alias of feature22.properties.aliases || []) {
23700         ids.push(alias);
23701       }
23702       for (const id2 of ids) {
23703         const cid = canonicalID(id2);
23704         _featuresByCode[cid] = feature22;
23705       }
23706     }
23707   }
23708   function locArray(loc) {
23709     if (Array.isArray(loc)) {
23710       return loc;
23711     } else if (loc.coordinates) {
23712       return loc.coordinates;
23713     }
23714     return loc.geometry.coordinates;
23715   }
23716   function smallestFeature(loc) {
23717     const query = locArray(loc);
23718     const featureProperties = _whichPolygon(query);
23719     if (!featureProperties)
23720       return null;
23721     return _featuresByCode[featureProperties.id];
23722   }
23723   function countryFeature(loc) {
23724     const feature22 = smallestFeature(loc);
23725     if (!feature22)
23726       return null;
23727     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23728     return _featuresByCode[countryCode] || null;
23729   }
23730   var defaultOpts = {
23731     level: void 0,
23732     maxLevel: void 0,
23733     withProp: void 0
23734   };
23735   function featureForLoc(loc, opts) {
23736     const targetLevel = opts.level || "country";
23737     const maxLevel = opts.maxLevel || "world";
23738     const withProp = opts.withProp;
23739     const targetLevelIndex = levels.indexOf(targetLevel);
23740     if (targetLevelIndex === -1)
23741       return null;
23742     const maxLevelIndex = levels.indexOf(maxLevel);
23743     if (maxLevelIndex === -1)
23744       return null;
23745     if (maxLevelIndex < targetLevelIndex)
23746       return null;
23747     if (targetLevel === "country") {
23748       const fastFeature = countryFeature(loc);
23749       if (fastFeature) {
23750         if (!withProp || fastFeature.properties[withProp]) {
23751           return fastFeature;
23752         }
23753       }
23754     }
23755     const features = featuresContaining(loc);
23756     const match = features.find((feature22) => {
23757       let levelIndex = levels.indexOf(feature22.properties.level);
23758       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
23759       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23760         if (!withProp || feature22.properties[withProp]) {
23761           return feature22;
23762         }
23763       }
23764       return false;
23765     });
23766     return match || null;
23767   }
23768   function featureForID(id2) {
23769     let stringID;
23770     if (typeof id2 === "number") {
23771       stringID = id2.toString();
23772       if (stringID.length === 1) {
23773         stringID = "00" + stringID;
23774       } else if (stringID.length === 2) {
23775         stringID = "0" + stringID;
23776       }
23777     } else {
23778       stringID = canonicalID(id2);
23779     }
23780     return _featuresByCode[stringID] || null;
23781   }
23782   function smallestFeaturesForBbox(bbox2) {
23783     return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
23784   }
23785   function smallestOrMatchingFeature(query) {
23786     if (typeof query === "object") {
23787       return smallestFeature(query);
23788     }
23789     return featureForID(query);
23790   }
23791   function feature(query, opts = defaultOpts) {
23792     if (typeof query === "object") {
23793       return featureForLoc(query, opts);
23794     }
23795     return featureForID(query);
23796   }
23797   function iso1A2Code(query, opts = defaultOpts) {
23798     opts.withProp = "iso1A2";
23799     const match = feature(query, opts);
23800     if (!match)
23801       return null;
23802     return match.properties.iso1A2 || null;
23803   }
23804   function propertiesForQuery(query, property) {
23805     const features = featuresContaining(query, false);
23806     return features.map((feature22) => feature22.properties[property]).filter(Boolean);
23807   }
23808   function iso1A2Codes(query) {
23809     return propertiesForQuery(query, "iso1A2");
23810   }
23811   function featuresContaining(query, strict) {
23812     let matchingFeatures;
23813     if (Array.isArray(query) && query.length === 4) {
23814       matchingFeatures = smallestFeaturesForBbox(query);
23815     } else {
23816       const smallestOrMatching = smallestOrMatchingFeature(query);
23817       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23818     }
23819     if (!matchingFeatures.length)
23820       return [];
23821     let returnFeatures;
23822     if (!strict || typeof query === "object") {
23823       returnFeatures = matchingFeatures.slice();
23824     } else {
23825       returnFeatures = [];
23826     }
23827     for (const feature22 of matchingFeatures) {
23828       const properties = feature22.properties;
23829       for (const groupID of properties.groups) {
23830         const groupFeature = _featuresByCode[groupID];
23831         if (returnFeatures.indexOf(groupFeature) === -1) {
23832           returnFeatures.push(groupFeature);
23833         }
23834       }
23835     }
23836     return returnFeatures;
23837   }
23838   function featuresIn(id2, strict) {
23839     const feature22 = featureForID(id2);
23840     if (!feature22)
23841       return [];
23842     let features = [];
23843     if (!strict) {
23844       features.push(feature22);
23845     }
23846     const properties = feature22.properties;
23847     for (const memberID of properties.members || []) {
23848       features.push(_featuresByCode[memberID]);
23849     }
23850     return features;
23851   }
23852   function aggregateFeature(id2) {
23853     const features = featuresIn(id2, false);
23854     if (features.length === 0)
23855       return null;
23856     let aggregateCoordinates = [];
23857     for (const feature22 of features) {
23858       if (feature22.geometry?.type === "MultiPolygon" && feature22.geometry.coordinates) {
23859         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23860       }
23861     }
23862     return {
23863       type: "Feature",
23864       properties: features[0].properties,
23865       geometry: {
23866         type: "MultiPolygon",
23867         coordinates: aggregateCoordinates
23868       }
23869     };
23870   }
23871   function roadSpeedUnit(query) {
23872     const feature22 = smallestOrMatchingFeature(query);
23873     return feature22 && feature22.properties.roadSpeedUnit || null;
23874   }
23875   function roadHeightUnit(query) {
23876     const feature22 = smallestOrMatchingFeature(query);
23877     return feature22 && feature22.properties.roadHeightUnit || null;
23878   }
23879
23880   // node_modules/@rapideditor/location-conflation/index.mjs
23881   var import_geojson_area = __toESM(require_geojson_area(), 1);
23882   var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
23883   var import_polygon_clipping = __toESM(require_polygon_clipping_umd(), 1);
23884   var import_geojson_precision = __toESM(require_geojson_precision(), 1);
23885   var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
23886   var location_conflation_default = class {
23887     // constructor
23888     //
23889     // `fc`  Optional FeatureCollection of known features
23890     //
23891     // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
23892     // Each feature must have a filename-like `id`, for example: `something.geojson`
23893     //
23894     // {
23895     //   "type": "FeatureCollection"
23896     //   "features": [
23897     //     {
23898     //       "type": "Feature",
23899     //       "id": "philly_metro.geojson",
23900     //       "properties": { … },
23901     //       "geometry": { … }
23902     //     }
23903     //   ]
23904     // }
23905     constructor(fc) {
23906       this._cache = {};
23907       this._strict = true;
23908       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
23909         fc.features.forEach((feature3) => {
23910           feature3.properties = feature3.properties || {};
23911           let props = feature3.properties;
23912           let id2 = feature3.id || props.id;
23913           if (!id2 || !/^\S+\.geojson$/i.test(id2))
23914             return;
23915           id2 = id2.toLowerCase();
23916           feature3.id = id2;
23917           props.id = id2;
23918           if (!props.area) {
23919             const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23920             props.area = Number(area.toFixed(2));
23921           }
23922           this._cache[id2] = feature3;
23923         });
23924       }
23925       let world = _cloneDeep(feature("Q2"));
23926       world.geometry = {
23927         type: "Polygon",
23928         coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
23929       };
23930       world.id = "Q2";
23931       world.properties.id = "Q2";
23932       world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
23933       this._cache.Q2 = world;
23934     }
23935     // validateLocation
23936     // `location`  The location to validate
23937     //
23938     // Pass a `location` value to validate
23939     //
23940     // Returns a result like:
23941     //   {
23942     //     type:     'point', 'geojson', or 'countrycoder'
23943     //     location:  the queried location
23944     //     id:        the stable identifier for the feature
23945     //   }
23946     // or `null` if the location is invalid
23947     //
23948     validateLocation(location) {
23949       if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
23950         const lon = location[0];
23951         const lat = location[1];
23952         const radius = location[2];
23953         if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
23954           const id2 = "[" + location.toString() + "]";
23955           return { type: "point", location, id: id2 };
23956         }
23957       } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
23958         const id2 = location.toLowerCase();
23959         if (this._cache[id2]) {
23960           return { type: "geojson", location, id: id2 };
23961         }
23962       } else if (typeof location === "string" || typeof location === "number") {
23963         const feature3 = feature(location);
23964         if (feature3) {
23965           const id2 = feature3.properties.wikidata;
23966           return { type: "countrycoder", location, id: id2 };
23967         }
23968       }
23969       if (this._strict) {
23970         throw new Error(`validateLocation:  Invalid location: "${location}".`);
23971       } else {
23972         return null;
23973       }
23974     }
23975     // resolveLocation
23976     // `location`  The location to resolve
23977     //
23978     // Pass a `location` value to resolve
23979     //
23980     // Returns a result like:
23981     //   {
23982     //     type:      'point', 'geojson', or 'countrycoder'
23983     //     location:  the queried location
23984     //     id:        a stable identifier for the feature
23985     //     feature:   the resolved GeoJSON feature
23986     //   }
23987     //  or `null` if the location is invalid
23988     //
23989     resolveLocation(location) {
23990       const valid = this.validateLocation(location);
23991       if (!valid)
23992         return null;
23993       const id2 = valid.id;
23994       if (this._cache[id2]) {
23995         return Object.assign(valid, { feature: this._cache[id2] });
23996       }
23997       if (valid.type === "point") {
23998         const lon = location[0];
23999         const lat = location[1];
24000         const radius = location[2] || 25;
24001         const EDGES = 10;
24002         const PRECISION = 3;
24003         const area = Math.PI * radius * radius;
24004         const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
24005           type: "Feature",
24006           id: id2,
24007           properties: { id: id2, area: Number(area.toFixed(2)) },
24008           geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
24009           // km to m
24010         }, PRECISION);
24011         return Object.assign(valid, { feature: feature3 });
24012       } else if (valid.type === "geojson") {
24013       } else if (valid.type === "countrycoder") {
24014         let feature3 = _cloneDeep(feature(id2));
24015         let props = feature3.properties;
24016         if (Array.isArray(props.members)) {
24017           let aggregate = aggregateFeature(id2);
24018           aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
24019           feature3.geometry = aggregate.geometry;
24020         }
24021         if (!props.area) {
24022           const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
24023           props.area = Number(area.toFixed(2));
24024         }
24025         feature3.id = id2;
24026         props.id = id2;
24027         this._cache[id2] = feature3;
24028         return Object.assign(valid, { feature: feature3 });
24029       }
24030       if (this._strict) {
24031         throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
24032       } else {
24033         return null;
24034       }
24035     }
24036     // validateLocationSet
24037     // `locationSet`  the locationSet to validate
24038     //
24039     // Pass a locationSet Object to validate like:
24040     //   {
24041     //     include: [ Array of locations ],
24042     //     exclude: [ Array of locations ]
24043     //   }
24044     //
24045     // Returns a result like:
24046     //   {
24047     //     type:         'locationset'
24048     //     locationSet:  the queried locationSet
24049     //     id:           the stable identifier for the feature
24050     //   }
24051     // or `null` if the locationSet is invalid
24052     //
24053     validateLocationSet(locationSet) {
24054       locationSet = locationSet || {};
24055       const validator = this.validateLocation.bind(this);
24056       let include = (locationSet.include || []).map(validator).filter(Boolean);
24057       let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
24058       if (!include.length) {
24059         if (this._strict) {
24060           throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
24061         } else {
24062           locationSet.include = ["Q2"];
24063           include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
24064         }
24065       }
24066       include.sort(_sortLocations);
24067       let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
24068       if (exclude.length) {
24069         exclude.sort(_sortLocations);
24070         id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
24071       }
24072       return { type: "locationset", locationSet, id: id2 };
24073     }
24074     // resolveLocationSet
24075     // `locationSet`  the locationSet to resolve
24076     //
24077     // Pass a locationSet Object to validate like:
24078     //   {
24079     //     include: [ Array of locations ],
24080     //     exclude: [ Array of locations ]
24081     //   }
24082     //
24083     // Returns a result like:
24084     //   {
24085     //     type:         'locationset'
24086     //     locationSet:  the queried locationSet
24087     //     id:           the stable identifier for the feature
24088     //     feature:      the resolved GeoJSON feature
24089     //   }
24090     // or `null` if the locationSet is invalid
24091     //
24092     resolveLocationSet(locationSet) {
24093       locationSet = locationSet || {};
24094       const valid = this.validateLocationSet(locationSet);
24095       if (!valid)
24096         return null;
24097       const id2 = valid.id;
24098       if (this._cache[id2]) {
24099         return Object.assign(valid, { feature: this._cache[id2] });
24100       }
24101       const resolver = this.resolveLocation.bind(this);
24102       const includes = (locationSet.include || []).map(resolver).filter(Boolean);
24103       const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
24104       if (includes.length === 1 && excludes.length === 0) {
24105         return Object.assign(valid, { feature: includes[0].feature });
24106       }
24107       const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
24108       const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
24109       let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
24110       const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
24111       resultGeoJSON.id = id2;
24112       resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
24113       this._cache[id2] = resultGeoJSON;
24114       return Object.assign(valid, { feature: resultGeoJSON });
24115     }
24116     // strict
24117     //
24118     strict(val) {
24119       if (val === void 0) {
24120         return this._strict;
24121       } else {
24122         this._strict = val;
24123         return this;
24124       }
24125     }
24126     // cache
24127     // convenience method to access the internal cache
24128     cache() {
24129       return this._cache;
24130     }
24131     // stringify
24132     // convenience method to prettyStringify the given object
24133     stringify(obj, options2) {
24134       return (0, import_json_stringify_pretty_compact.default)(obj, options2);
24135     }
24136   };
24137   function _clip(features, which) {
24138     if (!Array.isArray(features) || !features.length)
24139       return null;
24140     const fn = { UNION: import_polygon_clipping.default.union, DIFFERENCE: import_polygon_clipping.default.difference }[which];
24141     const args = features.map((feature3) => feature3.geometry.coordinates);
24142     const coords = fn.apply(null, args);
24143     return {
24144       type: "Feature",
24145       properties: {},
24146       geometry: {
24147         type: whichType(coords),
24148         coordinates: coords
24149       }
24150     };
24151     function whichType(coords2) {
24152       const a2 = Array.isArray(coords2);
24153       const b2 = a2 && Array.isArray(coords2[0]);
24154       const c2 = b2 && Array.isArray(coords2[0][0]);
24155       const d2 = c2 && Array.isArray(coords2[0][0][0]);
24156       return d2 ? "MultiPolygon" : "Polygon";
24157     }
24158   }
24159   function _cloneDeep(obj) {
24160     return JSON.parse(JSON.stringify(obj));
24161   }
24162   function _sortLocations(a2, b2) {
24163     const rank = { countrycoder: 1, geojson: 2, point: 3 };
24164     const aRank = rank[a2.type];
24165     const bRank = rank[b2.type];
24166     return aRank > bRank ? 1 : aRank < bRank ? -1 : a2.id.localeCompare(b2.id);
24167   }
24168
24169   // modules/core/LocationManager.js
24170   var import_which_polygon2 = __toESM(require_which_polygon());
24171   var import_geojson_area2 = __toESM(require_geojson_area());
24172   var _loco = new location_conflation_default();
24173   var LocationManager = class {
24174     /**
24175      * @constructor
24176      */
24177     constructor() {
24178       this._wp = null;
24179       this._resolved = /* @__PURE__ */ new Map();
24180       this._knownLocationSets = /* @__PURE__ */ new Map();
24181       this._locationIncludedIn = /* @__PURE__ */ new Map();
24182       this._locationExcludedIn = /* @__PURE__ */ new Map();
24183       const world = { locationSet: { include: ["Q2"] } };
24184       this._resolveLocationSet(world);
24185       this._rebuildIndex();
24186     }
24187     /**
24188      * _validateLocationSet
24189      * Pass an Object with a `locationSet` property.
24190      * Validates the `locationSet` and sets a `locationSetID` property on the object.
24191      * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
24192      *
24193      * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
24194      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24195      *
24196      * @param  `obj`  Object to check, it should have `locationSet` property
24197      */
24198     _validateLocationSet(obj) {
24199       if (obj.locationSetID)
24200         return;
24201       try {
24202         let locationSet = obj.locationSet;
24203         if (!locationSet) {
24204           throw new Error("object missing locationSet property");
24205         }
24206         if (!locationSet.include) {
24207           locationSet.include = ["Q2"];
24208         }
24209         const locationSetID = _loco.validateLocationSet(locationSet).id;
24210         obj.locationSetID = locationSetID;
24211         if (this._knownLocationSets.has(locationSetID))
24212           return;
24213         let area = 0;
24214         (locationSet.include || []).forEach((location) => {
24215           const locationID = _loco.validateLocation(location).id;
24216           let geojson = this._resolved.get(locationID);
24217           if (!geojson) {
24218             geojson = _loco.resolveLocation(location).feature;
24219             this._resolved.set(locationID, geojson);
24220           }
24221           area += geojson.properties.area;
24222           let s2 = this._locationIncludedIn.get(locationID);
24223           if (!s2) {
24224             s2 = /* @__PURE__ */ new Set();
24225             this._locationIncludedIn.set(locationID, s2);
24226           }
24227           s2.add(locationSetID);
24228         });
24229         (locationSet.exclude || []).forEach((location) => {
24230           const locationID = _loco.validateLocation(location).id;
24231           let geojson = this._resolved.get(locationID);
24232           if (!geojson) {
24233             geojson = _loco.resolveLocation(location).feature;
24234             this._resolved.set(locationID, geojson);
24235           }
24236           area -= geojson.properties.area;
24237           let s2 = this._locationExcludedIn.get(locationID);
24238           if (!s2) {
24239             s2 = /* @__PURE__ */ new Set();
24240             this._locationExcludedIn.set(locationID, s2);
24241           }
24242           s2.add(locationSetID);
24243         });
24244         this._knownLocationSets.set(locationSetID, area);
24245       } catch (err) {
24246         obj.locationSet = { include: ["Q2"] };
24247         obj.locationSetID = "+[Q2]";
24248       }
24249     }
24250     /**
24251      * _resolveLocationSet
24252      * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
24253      * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
24254      *
24255      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24256      *
24257      * @param  `obj`  Object to check, it should have `locationSet` property
24258      */
24259     _resolveLocationSet(obj) {
24260       this._validateLocationSet(obj);
24261       if (this._resolved.has(obj.locationSetID))
24262         return;
24263       try {
24264         const result = _loco.resolveLocationSet(obj.locationSet);
24265         const locationSetID = result.id;
24266         obj.locationSetID = locationSetID;
24267         if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
24268           throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
24269         }
24270         let geojson = JSON.parse(JSON.stringify(result.feature));
24271         geojson.id = locationSetID;
24272         geojson.properties.id = locationSetID;
24273         this._resolved.set(locationSetID, geojson);
24274       } catch (err) {
24275         obj.locationSet = { include: ["Q2"] };
24276         obj.locationSetID = "+[Q2]";
24277       }
24278     }
24279     /**
24280      * _rebuildIndex
24281      * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
24282      */
24283     _rebuildIndex() {
24284       this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
24285     }
24286     /**
24287      * mergeCustomGeoJSON
24288      * Accepts a FeatureCollection-like object containing custom locations
24289      * Each feature must have a filename-like `id`, for example: `something.geojson`
24290      * {
24291      *   "type": "FeatureCollection"
24292      *   "features": [
24293      *     {
24294      *       "type": "Feature",
24295      *       "id": "philly_metro.geojson",
24296      *       "properties": { … },
24297      *       "geometry": { … }
24298      *     }
24299      *   ]
24300      * }
24301      *
24302      * @param  `fc`  FeatureCollection-like Object containing custom locations
24303      */
24304     mergeCustomGeoJSON(fc) {
24305       if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features))
24306         return;
24307       fc.features.forEach((feature3) => {
24308         feature3.properties = feature3.properties || {};
24309         let props = feature3.properties;
24310         let id2 = feature3.id || props.id;
24311         if (!id2 || !/^\S+\.geojson$/i.test(id2))
24312           return;
24313         id2 = id2.toLowerCase();
24314         feature3.id = id2;
24315         props.id = id2;
24316         if (!props.area) {
24317           const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
24318           props.area = Number(area.toFixed(2));
24319         }
24320         _loco._cache[id2] = feature3;
24321       });
24322     }
24323     /**
24324      * mergeLocationSets
24325      * Accepts an Array of Objects containing `locationSet` properties:
24326      * [
24327      *  { id: 'preset1', locationSet: {…} },
24328      *  { id: 'preset2', locationSet: {…} },
24329      *  …
24330      * ]
24331      * After validating, the Objects will be decorated with a `locationSetID` property:
24332      * [
24333      *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
24334      *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
24335      *  …
24336      * ]
24337      *
24338      * @param  `objects`  Objects to check - they should have `locationSet` property
24339      * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
24340      */
24341     mergeLocationSets(objects) {
24342       if (!Array.isArray(objects))
24343         return Promise.reject("nothing to do");
24344       objects.forEach((obj) => this._validateLocationSet(obj));
24345       this._rebuildIndex();
24346       return Promise.resolve(objects);
24347     }
24348     /**
24349      * locationSetID
24350      * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
24351      * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
24352      *
24353      * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
24354      * @return  String locationSetID, e.g. `+[Q30]`
24355      */
24356     locationSetID(locationSet) {
24357       let locationSetID;
24358       try {
24359         locationSetID = _loco.validateLocationSet(locationSet).id;
24360       } catch (err) {
24361         locationSetID = "+[Q2]";
24362       }
24363       return locationSetID;
24364     }
24365     /**
24366      * feature
24367      * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
24368      * A GeoJSON feature:
24369      * {
24370      *   type: 'Feature',
24371      *   id: '+[Q30]',
24372      *   properties: { id: '+[Q30]', area: 21817019.17, … },
24373      *   geometry: { … }
24374      * }
24375      *
24376      * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
24377      * @return  GeoJSON object (fallback to world)
24378      */
24379     feature(locationSetID = "+[Q2]") {
24380       const feature3 = this._resolved.get(locationSetID);
24381       return feature3 || this._resolved.get("+[Q2]");
24382     }
24383     /**
24384      * locationSetsAt
24385      * Find all the locationSets valid at the given location.
24386      * Results include the area (in km²) to facilitate sorting.
24387      *
24388      * Object of locationSetIDs to areas (in km²)
24389      * {
24390      *   "+[Q2]": 511207893.3958111,
24391      *   "+[Q30]": 21817019.17,
24392      *   "+[new_jersey.geojson]": 22390.77,
24393      *   …
24394      * }
24395      *
24396      * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
24397      * @return  Object of locationSetIDs valid at given location
24398      */
24399     locationSetsAt(loc) {
24400       let result = {};
24401       const hits = this._wp(loc, true) || [];
24402       const thiz = this;
24403       hits.forEach((prop) => {
24404         if (prop.id[0] !== "+")
24405           return;
24406         const locationSetID = prop.id;
24407         const area = thiz._knownLocationSets.get(locationSetID);
24408         if (area) {
24409           result[locationSetID] = area;
24410         }
24411       });
24412       hits.forEach((prop) => {
24413         if (prop.id[0] === "+")
24414           return;
24415         const locationID = prop.id;
24416         const included = thiz._locationIncludedIn.get(locationID);
24417         (included || []).forEach((locationSetID) => {
24418           const area = thiz._knownLocationSets.get(locationSetID);
24419           if (area) {
24420             result[locationSetID] = area;
24421           }
24422         });
24423       });
24424       hits.forEach((prop) => {
24425         if (prop.id[0] === "+")
24426           return;
24427         const locationID = prop.id;
24428         const excluded = thiz._locationExcludedIn.get(locationID);
24429         (excluded || []).forEach((locationSetID) => {
24430           delete result[locationSetID];
24431         });
24432       });
24433       return result;
24434     }
24435     // Direct access to the location-conflation resolver
24436     loco() {
24437       return _loco;
24438     }
24439   };
24440   var _sharedLocationManager = new LocationManager();
24441
24442   // node_modules/lodash-es/_freeGlobal.js
24443   var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
24444   var freeGlobal_default = freeGlobal;
24445
24446   // node_modules/lodash-es/_root.js
24447   var freeSelf = typeof self == "object" && self && self.Object === Object && self;
24448   var root2 = freeGlobal_default || freeSelf || Function("return this")();
24449   var root_default = root2;
24450
24451   // node_modules/lodash-es/_Symbol.js
24452   var Symbol2 = root_default.Symbol;
24453   var Symbol_default = Symbol2;
24454
24455   // node_modules/lodash-es/_getRawTag.js
24456   var objectProto = Object.prototype;
24457   var hasOwnProperty = objectProto.hasOwnProperty;
24458   var nativeObjectToString = objectProto.toString;
24459   var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
24460   function getRawTag(value) {
24461     var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
24462     try {
24463       value[symToStringTag] = void 0;
24464       var unmasked = true;
24465     } catch (e3) {
24466     }
24467     var result = nativeObjectToString.call(value);
24468     if (unmasked) {
24469       if (isOwn) {
24470         value[symToStringTag] = tag;
24471       } else {
24472         delete value[symToStringTag];
24473       }
24474     }
24475     return result;
24476   }
24477   var getRawTag_default = getRawTag;
24478
24479   // node_modules/lodash-es/_objectToString.js
24480   var objectProto2 = Object.prototype;
24481   var nativeObjectToString2 = objectProto2.toString;
24482   function objectToString(value) {
24483     return nativeObjectToString2.call(value);
24484   }
24485   var objectToString_default = objectToString;
24486
24487   // node_modules/lodash-es/_baseGetTag.js
24488   var nullTag = "[object Null]";
24489   var undefinedTag = "[object Undefined]";
24490   var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
24491   function baseGetTag(value) {
24492     if (value == null) {
24493       return value === void 0 ? undefinedTag : nullTag;
24494     }
24495     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
24496   }
24497   var baseGetTag_default = baseGetTag;
24498
24499   // node_modules/lodash-es/isObjectLike.js
24500   function isObjectLike(value) {
24501     return value != null && typeof value == "object";
24502   }
24503   var isObjectLike_default = isObjectLike;
24504
24505   // node_modules/lodash-es/isSymbol.js
24506   var symbolTag = "[object Symbol]";
24507   function isSymbol(value) {
24508     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
24509   }
24510   var isSymbol_default = isSymbol;
24511
24512   // node_modules/lodash-es/_arrayMap.js
24513   function arrayMap(array2, iteratee) {
24514     var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
24515     while (++index < length) {
24516       result[index] = iteratee(array2[index], index, array2);
24517     }
24518     return result;
24519   }
24520   var arrayMap_default = arrayMap;
24521
24522   // node_modules/lodash-es/isArray.js
24523   var isArray = Array.isArray;
24524   var isArray_default = isArray;
24525
24526   // node_modules/lodash-es/_baseToString.js
24527   var INFINITY = 1 / 0;
24528   var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
24529   var symbolToString = symbolProto ? symbolProto.toString : void 0;
24530   function baseToString(value) {
24531     if (typeof value == "string") {
24532       return value;
24533     }
24534     if (isArray_default(value)) {
24535       return arrayMap_default(value, baseToString) + "";
24536     }
24537     if (isSymbol_default(value)) {
24538       return symbolToString ? symbolToString.call(value) : "";
24539     }
24540     var result = value + "";
24541     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
24542   }
24543   var baseToString_default = baseToString;
24544
24545   // node_modules/lodash-es/_trimmedEndIndex.js
24546   var reWhitespace = /\s/;
24547   function trimmedEndIndex(string) {
24548     var index = string.length;
24549     while (index-- && reWhitespace.test(string.charAt(index))) {
24550     }
24551     return index;
24552   }
24553   var trimmedEndIndex_default = trimmedEndIndex;
24554
24555   // node_modules/lodash-es/_baseTrim.js
24556   var reTrimStart = /^\s+/;
24557   function baseTrim(string) {
24558     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
24559   }
24560   var baseTrim_default = baseTrim;
24561
24562   // node_modules/lodash-es/isObject.js
24563   function isObject(value) {
24564     var type2 = typeof value;
24565     return value != null && (type2 == "object" || type2 == "function");
24566   }
24567   var isObject_default = isObject;
24568
24569   // node_modules/lodash-es/toNumber.js
24570   var NAN = 0 / 0;
24571   var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
24572   var reIsBinary = /^0b[01]+$/i;
24573   var reIsOctal = /^0o[0-7]+$/i;
24574   var freeParseInt = parseInt;
24575   function toNumber(value) {
24576     if (typeof value == "number") {
24577       return value;
24578     }
24579     if (isSymbol_default(value)) {
24580       return NAN;
24581     }
24582     if (isObject_default(value)) {
24583       var other = typeof value.valueOf == "function" ? value.valueOf() : value;
24584       value = isObject_default(other) ? other + "" : other;
24585     }
24586     if (typeof value != "string") {
24587       return value === 0 ? value : +value;
24588     }
24589     value = baseTrim_default(value);
24590     var isBinary = reIsBinary.test(value);
24591     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
24592   }
24593   var toNumber_default = toNumber;
24594
24595   // node_modules/lodash-es/isFunction.js
24596   var asyncTag = "[object AsyncFunction]";
24597   var funcTag = "[object Function]";
24598   var genTag = "[object GeneratorFunction]";
24599   var proxyTag = "[object Proxy]";
24600   function isFunction(value) {
24601     if (!isObject_default(value)) {
24602       return false;
24603     }
24604     var tag = baseGetTag_default(value);
24605     return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
24606   }
24607   var isFunction_default = isFunction;
24608
24609   // node_modules/lodash-es/_coreJsData.js
24610   var coreJsData = root_default["__core-js_shared__"];
24611   var coreJsData_default = coreJsData;
24612
24613   // node_modules/lodash-es/_isMasked.js
24614   var maskSrcKey = function() {
24615     var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
24616     return uid ? "Symbol(src)_1." + uid : "";
24617   }();
24618   function isMasked(func) {
24619     return !!maskSrcKey && maskSrcKey in func;
24620   }
24621   var isMasked_default = isMasked;
24622
24623   // node_modules/lodash-es/_toSource.js
24624   var funcProto = Function.prototype;
24625   var funcToString = funcProto.toString;
24626   function toSource(func) {
24627     if (func != null) {
24628       try {
24629         return funcToString.call(func);
24630       } catch (e3) {
24631       }
24632       try {
24633         return func + "";
24634       } catch (e3) {
24635       }
24636     }
24637     return "";
24638   }
24639   var toSource_default = toSource;
24640
24641   // node_modules/lodash-es/_baseIsNative.js
24642   var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
24643   var reIsHostCtor = /^\[object .+?Constructor\]$/;
24644   var funcProto2 = Function.prototype;
24645   var objectProto3 = Object.prototype;
24646   var funcToString2 = funcProto2.toString;
24647   var hasOwnProperty2 = objectProto3.hasOwnProperty;
24648   var reIsNative = RegExp(
24649     "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
24650   );
24651   function baseIsNative(value) {
24652     if (!isObject_default(value) || isMasked_default(value)) {
24653       return false;
24654     }
24655     var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
24656     return pattern.test(toSource_default(value));
24657   }
24658   var baseIsNative_default = baseIsNative;
24659
24660   // node_modules/lodash-es/_getValue.js
24661   function getValue(object, key) {
24662     return object == null ? void 0 : object[key];
24663   }
24664   var getValue_default = getValue;
24665
24666   // node_modules/lodash-es/_getNative.js
24667   function getNative(object, key) {
24668     var value = getValue_default(object, key);
24669     return baseIsNative_default(value) ? value : void 0;
24670   }
24671   var getNative_default = getNative;
24672
24673   // node_modules/lodash-es/_WeakMap.js
24674   var WeakMap = getNative_default(root_default, "WeakMap");
24675   var WeakMap_default = WeakMap;
24676
24677   // node_modules/lodash-es/_isIndex.js
24678   var MAX_SAFE_INTEGER = 9007199254740991;
24679   var reIsUint = /^(?:0|[1-9]\d*)$/;
24680   function isIndex(value, length) {
24681     var type2 = typeof value;
24682     length = length == null ? MAX_SAFE_INTEGER : length;
24683     return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
24684   }
24685   var isIndex_default = isIndex;
24686
24687   // node_modules/lodash-es/eq.js
24688   function eq(value, other) {
24689     return value === other || value !== value && other !== other;
24690   }
24691   var eq_default = eq;
24692
24693   // node_modules/lodash-es/isLength.js
24694   var MAX_SAFE_INTEGER2 = 9007199254740991;
24695   function isLength(value) {
24696     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
24697   }
24698   var isLength_default = isLength;
24699
24700   // node_modules/lodash-es/isArrayLike.js
24701   function isArrayLike(value) {
24702     return value != null && isLength_default(value.length) && !isFunction_default(value);
24703   }
24704   var isArrayLike_default = isArrayLike;
24705
24706   // node_modules/lodash-es/_isPrototype.js
24707   var objectProto4 = Object.prototype;
24708   function isPrototype(value) {
24709     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4;
24710     return value === proto;
24711   }
24712   var isPrototype_default = isPrototype;
24713
24714   // node_modules/lodash-es/_baseTimes.js
24715   function baseTimes(n3, iteratee) {
24716     var index = -1, result = Array(n3);
24717     while (++index < n3) {
24718       result[index] = iteratee(index);
24719     }
24720     return result;
24721   }
24722   var baseTimes_default = baseTimes;
24723
24724   // node_modules/lodash-es/_baseIsArguments.js
24725   var argsTag = "[object Arguments]";
24726   function baseIsArguments(value) {
24727     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
24728   }
24729   var baseIsArguments_default = baseIsArguments;
24730
24731   // node_modules/lodash-es/isArguments.js
24732   var objectProto5 = Object.prototype;
24733   var hasOwnProperty3 = objectProto5.hasOwnProperty;
24734   var propertyIsEnumerable = objectProto5.propertyIsEnumerable;
24735   var isArguments = baseIsArguments_default(function() {
24736     return arguments;
24737   }()) ? baseIsArguments_default : function(value) {
24738     return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
24739   };
24740   var isArguments_default = isArguments;
24741
24742   // node_modules/lodash-es/stubFalse.js
24743   function stubFalse() {
24744     return false;
24745   }
24746   var stubFalse_default = stubFalse;
24747
24748   // node_modules/lodash-es/isBuffer.js
24749   var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
24750   var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
24751   var moduleExports = freeModule && freeModule.exports === freeExports;
24752   var Buffer2 = moduleExports ? root_default.Buffer : void 0;
24753   var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
24754   var isBuffer = nativeIsBuffer || stubFalse_default;
24755   var isBuffer_default = isBuffer;
24756
24757   // node_modules/lodash-es/_baseIsTypedArray.js
24758   var argsTag2 = "[object Arguments]";
24759   var arrayTag = "[object Array]";
24760   var boolTag = "[object Boolean]";
24761   var dateTag = "[object Date]";
24762   var errorTag = "[object Error]";
24763   var funcTag2 = "[object Function]";
24764   var mapTag = "[object Map]";
24765   var numberTag = "[object Number]";
24766   var objectTag = "[object Object]";
24767   var regexpTag = "[object RegExp]";
24768   var setTag = "[object Set]";
24769   var stringTag = "[object String]";
24770   var weakMapTag = "[object WeakMap]";
24771   var arrayBufferTag = "[object ArrayBuffer]";
24772   var dataViewTag = "[object DataView]";
24773   var float32Tag = "[object Float32Array]";
24774   var float64Tag = "[object Float64Array]";
24775   var int8Tag = "[object Int8Array]";
24776   var int16Tag = "[object Int16Array]";
24777   var int32Tag = "[object Int32Array]";
24778   var uint8Tag = "[object Uint8Array]";
24779   var uint8ClampedTag = "[object Uint8ClampedArray]";
24780   var uint16Tag = "[object Uint16Array]";
24781   var uint32Tag = "[object Uint32Array]";
24782   var typedArrayTags = {};
24783   typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
24784   typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
24785   function baseIsTypedArray(value) {
24786     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
24787   }
24788   var baseIsTypedArray_default = baseIsTypedArray;
24789
24790   // node_modules/lodash-es/_baseUnary.js
24791   function baseUnary(func) {
24792     return function(value) {
24793       return func(value);
24794     };
24795   }
24796   var baseUnary_default = baseUnary;
24797
24798   // node_modules/lodash-es/_nodeUtil.js
24799   var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
24800   var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
24801   var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
24802   var freeProcess = moduleExports2 && freeGlobal_default.process;
24803   var nodeUtil = function() {
24804     try {
24805       var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
24806       if (types) {
24807         return types;
24808       }
24809       return freeProcess && freeProcess.binding && freeProcess.binding("util");
24810     } catch (e3) {
24811     }
24812   }();
24813   var nodeUtil_default = nodeUtil;
24814
24815   // node_modules/lodash-es/isTypedArray.js
24816   var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
24817   var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
24818   var isTypedArray_default = isTypedArray;
24819
24820   // node_modules/lodash-es/_arrayLikeKeys.js
24821   var objectProto6 = Object.prototype;
24822   var hasOwnProperty4 = objectProto6.hasOwnProperty;
24823   function arrayLikeKeys(value, inherited) {
24824     var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length;
24825     for (var key in value) {
24826       if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
24827       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
24828       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
24829       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
24830       isIndex_default(key, length)))) {
24831         result.push(key);
24832       }
24833     }
24834     return result;
24835   }
24836   var arrayLikeKeys_default = arrayLikeKeys;
24837
24838   // node_modules/lodash-es/_overArg.js
24839   function overArg(func, transform2) {
24840     return function(arg) {
24841       return func(transform2(arg));
24842     };
24843   }
24844   var overArg_default = overArg;
24845
24846   // node_modules/lodash-es/_nativeKeys.js
24847   var nativeKeys = overArg_default(Object.keys, Object);
24848   var nativeKeys_default = nativeKeys;
24849
24850   // node_modules/lodash-es/_baseKeys.js
24851   var objectProto7 = Object.prototype;
24852   var hasOwnProperty5 = objectProto7.hasOwnProperty;
24853   function baseKeys(object) {
24854     if (!isPrototype_default(object)) {
24855       return nativeKeys_default(object);
24856     }
24857     var result = [];
24858     for (var key in Object(object)) {
24859       if (hasOwnProperty5.call(object, key) && key != "constructor") {
24860         result.push(key);
24861       }
24862     }
24863     return result;
24864   }
24865   var baseKeys_default = baseKeys;
24866
24867   // node_modules/lodash-es/keys.js
24868   function keys(object) {
24869     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
24870   }
24871   var keys_default = keys;
24872
24873   // node_modules/lodash-es/_nativeCreate.js
24874   var nativeCreate = getNative_default(Object, "create");
24875   var nativeCreate_default = nativeCreate;
24876
24877   // node_modules/lodash-es/_hashClear.js
24878   function hashClear() {
24879     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
24880     this.size = 0;
24881   }
24882   var hashClear_default = hashClear;
24883
24884   // node_modules/lodash-es/_hashDelete.js
24885   function hashDelete(key) {
24886     var result = this.has(key) && delete this.__data__[key];
24887     this.size -= result ? 1 : 0;
24888     return result;
24889   }
24890   var hashDelete_default = hashDelete;
24891
24892   // node_modules/lodash-es/_hashGet.js
24893   var HASH_UNDEFINED = "__lodash_hash_undefined__";
24894   var objectProto8 = Object.prototype;
24895   var hasOwnProperty6 = objectProto8.hasOwnProperty;
24896   function hashGet(key) {
24897     var data = this.__data__;
24898     if (nativeCreate_default) {
24899       var result = data[key];
24900       return result === HASH_UNDEFINED ? void 0 : result;
24901     }
24902     return hasOwnProperty6.call(data, key) ? data[key] : void 0;
24903   }
24904   var hashGet_default = hashGet;
24905
24906   // node_modules/lodash-es/_hashHas.js
24907   var objectProto9 = Object.prototype;
24908   var hasOwnProperty7 = objectProto9.hasOwnProperty;
24909   function hashHas(key) {
24910     var data = this.__data__;
24911     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key);
24912   }
24913   var hashHas_default = hashHas;
24914
24915   // node_modules/lodash-es/_hashSet.js
24916   var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
24917   function hashSet(key, value) {
24918     var data = this.__data__;
24919     this.size += this.has(key) ? 0 : 1;
24920     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
24921     return this;
24922   }
24923   var hashSet_default = hashSet;
24924
24925   // node_modules/lodash-es/_Hash.js
24926   function Hash(entries) {
24927     var index = -1, length = entries == null ? 0 : entries.length;
24928     this.clear();
24929     while (++index < length) {
24930       var entry = entries[index];
24931       this.set(entry[0], entry[1]);
24932     }
24933   }
24934   Hash.prototype.clear = hashClear_default;
24935   Hash.prototype["delete"] = hashDelete_default;
24936   Hash.prototype.get = hashGet_default;
24937   Hash.prototype.has = hashHas_default;
24938   Hash.prototype.set = hashSet_default;
24939   var Hash_default = Hash;
24940
24941   // node_modules/lodash-es/_listCacheClear.js
24942   function listCacheClear() {
24943     this.__data__ = [];
24944     this.size = 0;
24945   }
24946   var listCacheClear_default = listCacheClear;
24947
24948   // node_modules/lodash-es/_assocIndexOf.js
24949   function assocIndexOf(array2, key) {
24950     var length = array2.length;
24951     while (length--) {
24952       if (eq_default(array2[length][0], key)) {
24953         return length;
24954       }
24955     }
24956     return -1;
24957   }
24958   var assocIndexOf_default = assocIndexOf;
24959
24960   // node_modules/lodash-es/_listCacheDelete.js
24961   var arrayProto = Array.prototype;
24962   var splice = arrayProto.splice;
24963   function listCacheDelete(key) {
24964     var data = this.__data__, index = assocIndexOf_default(data, key);
24965     if (index < 0) {
24966       return false;
24967     }
24968     var lastIndex = data.length - 1;
24969     if (index == lastIndex) {
24970       data.pop();
24971     } else {
24972       splice.call(data, index, 1);
24973     }
24974     --this.size;
24975     return true;
24976   }
24977   var listCacheDelete_default = listCacheDelete;
24978
24979   // node_modules/lodash-es/_listCacheGet.js
24980   function listCacheGet(key) {
24981     var data = this.__data__, index = assocIndexOf_default(data, key);
24982     return index < 0 ? void 0 : data[index][1];
24983   }
24984   var listCacheGet_default = listCacheGet;
24985
24986   // node_modules/lodash-es/_listCacheHas.js
24987   function listCacheHas(key) {
24988     return assocIndexOf_default(this.__data__, key) > -1;
24989   }
24990   var listCacheHas_default = listCacheHas;
24991
24992   // node_modules/lodash-es/_listCacheSet.js
24993   function listCacheSet(key, value) {
24994     var data = this.__data__, index = assocIndexOf_default(data, key);
24995     if (index < 0) {
24996       ++this.size;
24997       data.push([key, value]);
24998     } else {
24999       data[index][1] = value;
25000     }
25001     return this;
25002   }
25003   var listCacheSet_default = listCacheSet;
25004
25005   // node_modules/lodash-es/_ListCache.js
25006   function ListCache(entries) {
25007     var index = -1, length = entries == null ? 0 : entries.length;
25008     this.clear();
25009     while (++index < length) {
25010       var entry = entries[index];
25011       this.set(entry[0], entry[1]);
25012     }
25013   }
25014   ListCache.prototype.clear = listCacheClear_default;
25015   ListCache.prototype["delete"] = listCacheDelete_default;
25016   ListCache.prototype.get = listCacheGet_default;
25017   ListCache.prototype.has = listCacheHas_default;
25018   ListCache.prototype.set = listCacheSet_default;
25019   var ListCache_default = ListCache;
25020
25021   // node_modules/lodash-es/_Map.js
25022   var Map2 = getNative_default(root_default, "Map");
25023   var Map_default = Map2;
25024
25025   // node_modules/lodash-es/_mapCacheClear.js
25026   function mapCacheClear() {
25027     this.size = 0;
25028     this.__data__ = {
25029       "hash": new Hash_default(),
25030       "map": new (Map_default || ListCache_default)(),
25031       "string": new Hash_default()
25032     };
25033   }
25034   var mapCacheClear_default = mapCacheClear;
25035
25036   // node_modules/lodash-es/_isKeyable.js
25037   function isKeyable(value) {
25038     var type2 = typeof value;
25039     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
25040   }
25041   var isKeyable_default = isKeyable;
25042
25043   // node_modules/lodash-es/_getMapData.js
25044   function getMapData(map2, key) {
25045     var data = map2.__data__;
25046     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
25047   }
25048   var getMapData_default = getMapData;
25049
25050   // node_modules/lodash-es/_mapCacheDelete.js
25051   function mapCacheDelete(key) {
25052     var result = getMapData_default(this, key)["delete"](key);
25053     this.size -= result ? 1 : 0;
25054     return result;
25055   }
25056   var mapCacheDelete_default = mapCacheDelete;
25057
25058   // node_modules/lodash-es/_mapCacheGet.js
25059   function mapCacheGet(key) {
25060     return getMapData_default(this, key).get(key);
25061   }
25062   var mapCacheGet_default = mapCacheGet;
25063
25064   // node_modules/lodash-es/_mapCacheHas.js
25065   function mapCacheHas(key) {
25066     return getMapData_default(this, key).has(key);
25067   }
25068   var mapCacheHas_default = mapCacheHas;
25069
25070   // node_modules/lodash-es/_mapCacheSet.js
25071   function mapCacheSet(key, value) {
25072     var data = getMapData_default(this, key), size = data.size;
25073     data.set(key, value);
25074     this.size += data.size == size ? 0 : 1;
25075     return this;
25076   }
25077   var mapCacheSet_default = mapCacheSet;
25078
25079   // node_modules/lodash-es/_MapCache.js
25080   function MapCache(entries) {
25081     var index = -1, length = entries == null ? 0 : entries.length;
25082     this.clear();
25083     while (++index < length) {
25084       var entry = entries[index];
25085       this.set(entry[0], entry[1]);
25086     }
25087   }
25088   MapCache.prototype.clear = mapCacheClear_default;
25089   MapCache.prototype["delete"] = mapCacheDelete_default;
25090   MapCache.prototype.get = mapCacheGet_default;
25091   MapCache.prototype.has = mapCacheHas_default;
25092   MapCache.prototype.set = mapCacheSet_default;
25093   var MapCache_default = MapCache;
25094
25095   // node_modules/lodash-es/toString.js
25096   function toString(value) {
25097     return value == null ? "" : baseToString_default(value);
25098   }
25099   var toString_default = toString;
25100
25101   // node_modules/lodash-es/_arrayPush.js
25102   function arrayPush(array2, values) {
25103     var index = -1, length = values.length, offset = array2.length;
25104     while (++index < length) {
25105       array2[offset + index] = values[index];
25106     }
25107     return array2;
25108   }
25109   var arrayPush_default = arrayPush;
25110
25111   // node_modules/lodash-es/_basePropertyOf.js
25112   function basePropertyOf(object) {
25113     return function(key) {
25114       return object == null ? void 0 : object[key];
25115     };
25116   }
25117   var basePropertyOf_default = basePropertyOf;
25118
25119   // node_modules/lodash-es/_stackClear.js
25120   function stackClear() {
25121     this.__data__ = new ListCache_default();
25122     this.size = 0;
25123   }
25124   var stackClear_default = stackClear;
25125
25126   // node_modules/lodash-es/_stackDelete.js
25127   function stackDelete(key) {
25128     var data = this.__data__, result = data["delete"](key);
25129     this.size = data.size;
25130     return result;
25131   }
25132   var stackDelete_default = stackDelete;
25133
25134   // node_modules/lodash-es/_stackGet.js
25135   function stackGet(key) {
25136     return this.__data__.get(key);
25137   }
25138   var stackGet_default = stackGet;
25139
25140   // node_modules/lodash-es/_stackHas.js
25141   function stackHas(key) {
25142     return this.__data__.has(key);
25143   }
25144   var stackHas_default = stackHas;
25145
25146   // node_modules/lodash-es/_stackSet.js
25147   var LARGE_ARRAY_SIZE = 200;
25148   function stackSet(key, value) {
25149     var data = this.__data__;
25150     if (data instanceof ListCache_default) {
25151       var pairs2 = data.__data__;
25152       if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
25153         pairs2.push([key, value]);
25154         this.size = ++data.size;
25155         return this;
25156       }
25157       data = this.__data__ = new MapCache_default(pairs2);
25158     }
25159     data.set(key, value);
25160     this.size = data.size;
25161     return this;
25162   }
25163   var stackSet_default = stackSet;
25164
25165   // node_modules/lodash-es/_Stack.js
25166   function Stack(entries) {
25167     var data = this.__data__ = new ListCache_default(entries);
25168     this.size = data.size;
25169   }
25170   Stack.prototype.clear = stackClear_default;
25171   Stack.prototype["delete"] = stackDelete_default;
25172   Stack.prototype.get = stackGet_default;
25173   Stack.prototype.has = stackHas_default;
25174   Stack.prototype.set = stackSet_default;
25175   var Stack_default = Stack;
25176
25177   // node_modules/lodash-es/_arrayFilter.js
25178   function arrayFilter(array2, predicate) {
25179     var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
25180     while (++index < length) {
25181       var value = array2[index];
25182       if (predicate(value, index, array2)) {
25183         result[resIndex++] = value;
25184       }
25185     }
25186     return result;
25187   }
25188   var arrayFilter_default = arrayFilter;
25189
25190   // node_modules/lodash-es/stubArray.js
25191   function stubArray() {
25192     return [];
25193   }
25194   var stubArray_default = stubArray;
25195
25196   // node_modules/lodash-es/_getSymbols.js
25197   var objectProto10 = Object.prototype;
25198   var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable;
25199   var nativeGetSymbols = Object.getOwnPropertySymbols;
25200   var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
25201     if (object == null) {
25202       return [];
25203     }
25204     object = Object(object);
25205     return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
25206       return propertyIsEnumerable2.call(object, symbol);
25207     });
25208   };
25209   var getSymbols_default = getSymbols;
25210
25211   // node_modules/lodash-es/_baseGetAllKeys.js
25212   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
25213     var result = keysFunc(object);
25214     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
25215   }
25216   var baseGetAllKeys_default = baseGetAllKeys;
25217
25218   // node_modules/lodash-es/_getAllKeys.js
25219   function getAllKeys(object) {
25220     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
25221   }
25222   var getAllKeys_default = getAllKeys;
25223
25224   // node_modules/lodash-es/_DataView.js
25225   var DataView2 = getNative_default(root_default, "DataView");
25226   var DataView_default = DataView2;
25227
25228   // node_modules/lodash-es/_Promise.js
25229   var Promise2 = getNative_default(root_default, "Promise");
25230   var Promise_default = Promise2;
25231
25232   // node_modules/lodash-es/_Set.js
25233   var Set2 = getNative_default(root_default, "Set");
25234   var Set_default = Set2;
25235
25236   // node_modules/lodash-es/_getTag.js
25237   var mapTag2 = "[object Map]";
25238   var objectTag2 = "[object Object]";
25239   var promiseTag = "[object Promise]";
25240   var setTag2 = "[object Set]";
25241   var weakMapTag2 = "[object WeakMap]";
25242   var dataViewTag2 = "[object DataView]";
25243   var dataViewCtorString = toSource_default(DataView_default);
25244   var mapCtorString = toSource_default(Map_default);
25245   var promiseCtorString = toSource_default(Promise_default);
25246   var setCtorString = toSource_default(Set_default);
25247   var weakMapCtorString = toSource_default(WeakMap_default);
25248   var getTag = baseGetTag_default;
25249   if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
25250     getTag = function(value) {
25251       var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
25252       if (ctorString) {
25253         switch (ctorString) {
25254           case dataViewCtorString:
25255             return dataViewTag2;
25256           case mapCtorString:
25257             return mapTag2;
25258           case promiseCtorString:
25259             return promiseTag;
25260           case setCtorString:
25261             return setTag2;
25262           case weakMapCtorString:
25263             return weakMapTag2;
25264         }
25265       }
25266       return result;
25267     };
25268   }
25269   var getTag_default = getTag;
25270
25271   // node_modules/lodash-es/_Uint8Array.js
25272   var Uint8Array2 = root_default.Uint8Array;
25273   var Uint8Array_default = Uint8Array2;
25274
25275   // node_modules/lodash-es/_setCacheAdd.js
25276   var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
25277   function setCacheAdd(value) {
25278     this.__data__.set(value, HASH_UNDEFINED3);
25279     return this;
25280   }
25281   var setCacheAdd_default = setCacheAdd;
25282
25283   // node_modules/lodash-es/_setCacheHas.js
25284   function setCacheHas(value) {
25285     return this.__data__.has(value);
25286   }
25287   var setCacheHas_default = setCacheHas;
25288
25289   // node_modules/lodash-es/_SetCache.js
25290   function SetCache(values) {
25291     var index = -1, length = values == null ? 0 : values.length;
25292     this.__data__ = new MapCache_default();
25293     while (++index < length) {
25294       this.add(values[index]);
25295     }
25296   }
25297   SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
25298   SetCache.prototype.has = setCacheHas_default;
25299   var SetCache_default = SetCache;
25300
25301   // node_modules/lodash-es/_arraySome.js
25302   function arraySome(array2, predicate) {
25303     var index = -1, length = array2 == null ? 0 : array2.length;
25304     while (++index < length) {
25305       if (predicate(array2[index], index, array2)) {
25306         return true;
25307       }
25308     }
25309     return false;
25310   }
25311   var arraySome_default = arraySome;
25312
25313   // node_modules/lodash-es/_cacheHas.js
25314   function cacheHas(cache, key) {
25315     return cache.has(key);
25316   }
25317   var cacheHas_default = cacheHas;
25318
25319   // node_modules/lodash-es/_equalArrays.js
25320   var COMPARE_PARTIAL_FLAG = 1;
25321   var COMPARE_UNORDERED_FLAG = 2;
25322   function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
25323     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
25324     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
25325       return false;
25326     }
25327     var arrStacked = stack.get(array2);
25328     var othStacked = stack.get(other);
25329     if (arrStacked && othStacked) {
25330       return arrStacked == other && othStacked == array2;
25331     }
25332     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
25333     stack.set(array2, other);
25334     stack.set(other, array2);
25335     while (++index < arrLength) {
25336       var arrValue = array2[index], othValue = other[index];
25337       if (customizer) {
25338         var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
25339       }
25340       if (compared !== void 0) {
25341         if (compared) {
25342           continue;
25343         }
25344         result = false;
25345         break;
25346       }
25347       if (seen) {
25348         if (!arraySome_default(other, function(othValue2, othIndex) {
25349           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
25350             return seen.push(othIndex);
25351           }
25352         })) {
25353           result = false;
25354           break;
25355         }
25356       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
25357         result = false;
25358         break;
25359       }
25360     }
25361     stack["delete"](array2);
25362     stack["delete"](other);
25363     return result;
25364   }
25365   var equalArrays_default = equalArrays;
25366
25367   // node_modules/lodash-es/_mapToArray.js
25368   function mapToArray(map2) {
25369     var index = -1, result = Array(map2.size);
25370     map2.forEach(function(value, key) {
25371       result[++index] = [key, value];
25372     });
25373     return result;
25374   }
25375   var mapToArray_default = mapToArray;
25376
25377   // node_modules/lodash-es/_setToArray.js
25378   function setToArray(set3) {
25379     var index = -1, result = Array(set3.size);
25380     set3.forEach(function(value) {
25381       result[++index] = value;
25382     });
25383     return result;
25384   }
25385   var setToArray_default = setToArray;
25386
25387   // node_modules/lodash-es/_equalByTag.js
25388   var COMPARE_PARTIAL_FLAG2 = 1;
25389   var COMPARE_UNORDERED_FLAG2 = 2;
25390   var boolTag2 = "[object Boolean]";
25391   var dateTag2 = "[object Date]";
25392   var errorTag2 = "[object Error]";
25393   var mapTag3 = "[object Map]";
25394   var numberTag2 = "[object Number]";
25395   var regexpTag2 = "[object RegExp]";
25396   var setTag3 = "[object Set]";
25397   var stringTag2 = "[object String]";
25398   var symbolTag2 = "[object Symbol]";
25399   var arrayBufferTag2 = "[object ArrayBuffer]";
25400   var dataViewTag3 = "[object DataView]";
25401   var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
25402   var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
25403   function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
25404     switch (tag) {
25405       case dataViewTag3:
25406         if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
25407           return false;
25408         }
25409         object = object.buffer;
25410         other = other.buffer;
25411       case arrayBufferTag2:
25412         if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
25413           return false;
25414         }
25415         return true;
25416       case boolTag2:
25417       case dateTag2:
25418       case numberTag2:
25419         return eq_default(+object, +other);
25420       case errorTag2:
25421         return object.name == other.name && object.message == other.message;
25422       case regexpTag2:
25423       case stringTag2:
25424         return object == other + "";
25425       case mapTag3:
25426         var convert = mapToArray_default;
25427       case setTag3:
25428         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
25429         convert || (convert = setToArray_default);
25430         if (object.size != other.size && !isPartial) {
25431           return false;
25432         }
25433         var stacked = stack.get(object);
25434         if (stacked) {
25435           return stacked == other;
25436         }
25437         bitmask |= COMPARE_UNORDERED_FLAG2;
25438         stack.set(object, other);
25439         var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
25440         stack["delete"](object);
25441         return result;
25442       case symbolTag2:
25443         if (symbolValueOf) {
25444           return symbolValueOf.call(object) == symbolValueOf.call(other);
25445         }
25446     }
25447     return false;
25448   }
25449   var equalByTag_default = equalByTag;
25450
25451   // node_modules/lodash-es/_equalObjects.js
25452   var COMPARE_PARTIAL_FLAG3 = 1;
25453   var objectProto11 = Object.prototype;
25454   var hasOwnProperty8 = objectProto11.hasOwnProperty;
25455   function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
25456     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
25457     if (objLength != othLength && !isPartial) {
25458       return false;
25459     }
25460     var index = objLength;
25461     while (index--) {
25462       var key = objProps[index];
25463       if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
25464         return false;
25465       }
25466     }
25467     var objStacked = stack.get(object);
25468     var othStacked = stack.get(other);
25469     if (objStacked && othStacked) {
25470       return objStacked == other && othStacked == object;
25471     }
25472     var result = true;
25473     stack.set(object, other);
25474     stack.set(other, object);
25475     var skipCtor = isPartial;
25476     while (++index < objLength) {
25477       key = objProps[index];
25478       var objValue = object[key], othValue = other[key];
25479       if (customizer) {
25480         var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
25481       }
25482       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
25483         result = false;
25484         break;
25485       }
25486       skipCtor || (skipCtor = key == "constructor");
25487     }
25488     if (result && !skipCtor) {
25489       var objCtor = object.constructor, othCtor = other.constructor;
25490       if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
25491         result = false;
25492       }
25493     }
25494     stack["delete"](object);
25495     stack["delete"](other);
25496     return result;
25497   }
25498   var equalObjects_default = equalObjects;
25499
25500   // node_modules/lodash-es/_baseIsEqualDeep.js
25501   var COMPARE_PARTIAL_FLAG4 = 1;
25502   var argsTag3 = "[object Arguments]";
25503   var arrayTag2 = "[object Array]";
25504   var objectTag3 = "[object Object]";
25505   var objectProto12 = Object.prototype;
25506   var hasOwnProperty9 = objectProto12.hasOwnProperty;
25507   function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
25508     var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
25509     objTag = objTag == argsTag3 ? objectTag3 : objTag;
25510     othTag = othTag == argsTag3 ? objectTag3 : othTag;
25511     var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
25512     if (isSameTag && isBuffer_default(object)) {
25513       if (!isBuffer_default(other)) {
25514         return false;
25515       }
25516       objIsArr = true;
25517       objIsObj = false;
25518     }
25519     if (isSameTag && !objIsObj) {
25520       stack || (stack = new Stack_default());
25521       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
25522     }
25523     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
25524       var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
25525       if (objIsWrapped || othIsWrapped) {
25526         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
25527         stack || (stack = new Stack_default());
25528         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
25529       }
25530     }
25531     if (!isSameTag) {
25532       return false;
25533     }
25534     stack || (stack = new Stack_default());
25535     return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
25536   }
25537   var baseIsEqualDeep_default = baseIsEqualDeep;
25538
25539   // node_modules/lodash-es/_baseIsEqual.js
25540   function baseIsEqual(value, other, bitmask, customizer, stack) {
25541     if (value === other) {
25542       return true;
25543     }
25544     if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
25545       return value !== value && other !== other;
25546     }
25547     return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
25548   }
25549   var baseIsEqual_default = baseIsEqual;
25550
25551   // node_modules/lodash-es/now.js
25552   var now2 = function() {
25553     return root_default.Date.now();
25554   };
25555   var now_default = now2;
25556
25557   // node_modules/lodash-es/debounce.js
25558   var FUNC_ERROR_TEXT = "Expected a function";
25559   var nativeMax = Math.max;
25560   var nativeMin = Math.min;
25561   function debounce(func, wait, options2) {
25562     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
25563     if (typeof func != "function") {
25564       throw new TypeError(FUNC_ERROR_TEXT);
25565     }
25566     wait = toNumber_default(wait) || 0;
25567     if (isObject_default(options2)) {
25568       leading = !!options2.leading;
25569       maxing = "maxWait" in options2;
25570       maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
25571       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
25572     }
25573     function invokeFunc(time) {
25574       var args = lastArgs, thisArg = lastThis;
25575       lastArgs = lastThis = void 0;
25576       lastInvokeTime = time;
25577       result = func.apply(thisArg, args);
25578       return result;
25579     }
25580     function leadingEdge(time) {
25581       lastInvokeTime = time;
25582       timerId = setTimeout(timerExpired, wait);
25583       return leading ? invokeFunc(time) : result;
25584     }
25585     function remainingWait(time) {
25586       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
25587       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
25588     }
25589     function shouldInvoke(time) {
25590       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
25591       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
25592     }
25593     function timerExpired() {
25594       var time = now_default();
25595       if (shouldInvoke(time)) {
25596         return trailingEdge(time);
25597       }
25598       timerId = setTimeout(timerExpired, remainingWait(time));
25599     }
25600     function trailingEdge(time) {
25601       timerId = void 0;
25602       if (trailing && lastArgs) {
25603         return invokeFunc(time);
25604       }
25605       lastArgs = lastThis = void 0;
25606       return result;
25607     }
25608     function cancel() {
25609       if (timerId !== void 0) {
25610         clearTimeout(timerId);
25611       }
25612       lastInvokeTime = 0;
25613       lastArgs = lastCallTime = lastThis = timerId = void 0;
25614     }
25615     function flush() {
25616       return timerId === void 0 ? result : trailingEdge(now_default());
25617     }
25618     function debounced() {
25619       var time = now_default(), isInvoking = shouldInvoke(time);
25620       lastArgs = arguments;
25621       lastThis = this;
25622       lastCallTime = time;
25623       if (isInvoking) {
25624         if (timerId === void 0) {
25625           return leadingEdge(lastCallTime);
25626         }
25627         if (maxing) {
25628           clearTimeout(timerId);
25629           timerId = setTimeout(timerExpired, wait);
25630           return invokeFunc(lastCallTime);
25631         }
25632       }
25633       if (timerId === void 0) {
25634         timerId = setTimeout(timerExpired, wait);
25635       }
25636       return result;
25637     }
25638     debounced.cancel = cancel;
25639     debounced.flush = flush;
25640     return debounced;
25641   }
25642   var debounce_default = debounce;
25643
25644   // node_modules/lodash-es/_escapeHtmlChar.js
25645   var htmlEscapes = {
25646     "&": "&amp;",
25647     "<": "&lt;",
25648     ">": "&gt;",
25649     '"': "&quot;",
25650     "'": "&#39;"
25651   };
25652   var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
25653   var escapeHtmlChar_default = escapeHtmlChar;
25654
25655   // node_modules/lodash-es/escape.js
25656   var reUnescapedHtml = /[&<>"']/g;
25657   var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
25658   function escape2(string) {
25659     string = toString_default(string);
25660     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
25661   }
25662   var escape_default = escape2;
25663
25664   // node_modules/lodash-es/isEqual.js
25665   function isEqual(value, other) {
25666     return baseIsEqual_default(value, other);
25667   }
25668   var isEqual_default = isEqual;
25669
25670   // node_modules/lodash-es/isNumber.js
25671   var numberTag3 = "[object Number]";
25672   function isNumber(value) {
25673     return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag3;
25674   }
25675   var isNumber_default = isNumber;
25676
25677   // node_modules/lodash-es/throttle.js
25678   var FUNC_ERROR_TEXT2 = "Expected a function";
25679   function throttle(func, wait, options2) {
25680     var leading = true, trailing = true;
25681     if (typeof func != "function") {
25682       throw new TypeError(FUNC_ERROR_TEXT2);
25683     }
25684     if (isObject_default(options2)) {
25685       leading = "leading" in options2 ? !!options2.leading : leading;
25686       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
25687     }
25688     return debounce_default(func, wait, {
25689       "leading": leading,
25690       "maxWait": wait,
25691       "trailing": trailing
25692     });
25693   }
25694   var throttle_default = throttle;
25695
25696   // node_modules/lodash-es/_unescapeHtmlChar.js
25697   var htmlUnescapes = {
25698     "&amp;": "&",
25699     "&lt;": "<",
25700     "&gt;": ">",
25701     "&quot;": '"',
25702     "&#39;": "'"
25703   };
25704   var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
25705   var unescapeHtmlChar_default = unescapeHtmlChar;
25706
25707   // node_modules/lodash-es/unescape.js
25708   var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
25709   var reHasEscapedHtml = RegExp(reEscapedHtml.source);
25710   function unescape2(string) {
25711     string = toString_default(string);
25712     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
25713   }
25714   var unescape_default = unescape2;
25715
25716   // modules/util/detect.js
25717   var _detected;
25718   function utilDetect(refresh2) {
25719     if (_detected && !refresh2)
25720       return _detected;
25721     _detected = {};
25722     const ua = navigator.userAgent;
25723     let m2 = null;
25724     m2 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
25725     if (m2 !== null) {
25726       _detected.browser = m2[1];
25727       _detected.version = m2[2];
25728     }
25729     if (!_detected.browser) {
25730       m2 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
25731       if (m2 !== null) {
25732         _detected.browser = "msie";
25733         _detected.version = m2[1];
25734       }
25735     }
25736     if (!_detected.browser) {
25737       m2 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
25738       if (m2 !== null) {
25739         _detected.browser = "Opera";
25740         _detected.version = m2[2];
25741       }
25742     }
25743     if (!_detected.browser) {
25744       m2 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
25745       if (m2 !== null) {
25746         _detected.browser = m2[1];
25747         _detected.version = m2[2];
25748         m2 = ua.match(/version\/([\.\d]+)/i);
25749         if (m2 !== null)
25750           _detected.version = m2[1];
25751       }
25752     }
25753     if (!_detected.browser) {
25754       _detected.browser = navigator.appName;
25755       _detected.version = navigator.appVersion;
25756     }
25757     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
25758     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
25759     if (_detected.browser.toLowerCase() === "msie") {
25760       _detected.ie = true;
25761       _detected.browser = "Internet Explorer";
25762       _detected.support = false;
25763     } else {
25764       _detected.ie = false;
25765       _detected.support = true;
25766     }
25767     _detected.filedrop = window.FileReader && "ondrop" in window;
25768     if (/Win/.test(ua)) {
25769       _detected.os = "win";
25770       _detected.platform = "Windows";
25771     } else if (/Mac/.test(ua)) {
25772       _detected.os = "mac";
25773       _detected.platform = "Macintosh";
25774     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
25775       _detected.os = "linux";
25776       _detected.platform = "Linux";
25777     } else {
25778       _detected.os = "win";
25779       _detected.platform = "Unknown";
25780     }
25781     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
25782     // so assume any "mac" with multitouch is actually iOS
25783     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
25784     _detected.browserLocales = Array.from(new Set(
25785       // remove duplicates
25786       [navigator.language].concat(navigator.languages || []).concat([
25787         // old property for backwards compatibility
25788         navigator.userLanguage
25789       ]).filter(Boolean)
25790     ));
25791     const loc = window.top.location;
25792     let origin = loc.origin;
25793     if (!origin) {
25794       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
25795     }
25796     _detected.host = origin + loc.pathname;
25797     return _detected;
25798   }
25799
25800   // modules/util/aes.js
25801   var import_aes_js = __toESM(require_aes_js());
25802   var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
25803   function utilAesEncrypt(text2, key) {
25804     key = key || DEFAULT_128;
25805     const textBytes = import_aes_js.default.utils.utf8.toBytes(text2);
25806     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
25807     const encryptedBytes = aesCtr.encrypt(textBytes);
25808     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
25809     return encryptedHex;
25810   }
25811   function utilAesDecrypt(encryptedHex, key) {
25812     key = key || DEFAULT_128;
25813     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
25814     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
25815     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
25816     const text2 = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
25817     return text2;
25818   }
25819
25820   // modules/util/clean_tags.js
25821   function utilCleanTags(tags) {
25822     var out = {};
25823     for (var k2 in tags) {
25824       if (!k2)
25825         continue;
25826       var v2 = tags[k2];
25827       if (v2 !== void 0) {
25828         out[k2] = cleanValue(k2, v2);
25829       }
25830     }
25831     return out;
25832     function cleanValue(k3, v3) {
25833       function keepSpaces(k4) {
25834         return /_hours|_times|:conditional$/.test(k4);
25835       }
25836       function skip(k4) {
25837         return /^(description|note|fixme)$/.test(k4);
25838       }
25839       if (skip(k3))
25840         return v3;
25841       var cleaned = v3.split(";").map(function(s2) {
25842         return s2.trim();
25843       }).join(keepSpaces(k3) ? "; " : ";");
25844       if (k3.indexOf("website") !== -1 || k3.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
25845         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
25846       }
25847       return cleaned;
25848     }
25849   }
25850
25851   // modules/util/get_set_value.js
25852   function utilGetSetValue(selection2, value, shouldUpdate) {
25853     function setValue(value2, shouldUpdate2) {
25854       function valueNull() {
25855         delete this.value;
25856       }
25857       function valueConstant() {
25858         if (shouldUpdate2(this.value, value2)) {
25859           this.value = value2;
25860         }
25861       }
25862       function valueFunction() {
25863         var x2 = value2.apply(this, arguments);
25864         if (x2 === null || x2 === void 0) {
25865           delete this.value;
25866         } else if (shouldUpdate2(this.value, x2)) {
25867           this.value = x2;
25868         }
25869       }
25870       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
25871     }
25872     if (arguments.length === 1) {
25873       return selection2.property("value");
25874     }
25875     if (shouldUpdate === void 0) {
25876       shouldUpdate = (a2, b2) => a2 !== b2;
25877     }
25878     return selection2.each(setValue(value, shouldUpdate));
25879   }
25880
25881   // modules/util/keybinding.js
25882   function utilKeybinding(namespace) {
25883     var _keybindings = {};
25884     function testBindings(d3_event, isCapturing) {
25885       var didMatch = false;
25886       var bindings = Object.keys(_keybindings).map(function(id2) {
25887         return _keybindings[id2];
25888       });
25889       var i3, binding;
25890       for (i3 = 0; i3 < bindings.length; i3++) {
25891         binding = bindings[i3];
25892         if (!binding.event.modifiers.shiftKey)
25893           continue;
25894         if (!!binding.capture !== isCapturing)
25895           continue;
25896         if (matches(d3_event, binding, true)) {
25897           binding.callback(d3_event);
25898           didMatch = true;
25899           break;
25900         }
25901       }
25902       if (didMatch)
25903         return;
25904       for (i3 = 0; i3 < bindings.length; i3++) {
25905         binding = bindings[i3];
25906         if (binding.event.modifiers.shiftKey)
25907           continue;
25908         if (!!binding.capture !== isCapturing)
25909           continue;
25910         if (matches(d3_event, binding, false)) {
25911           binding.callback(d3_event);
25912           break;
25913         }
25914       }
25915       function matches(d3_event2, binding2, testShift) {
25916         var event = d3_event2;
25917         var isMatch = false;
25918         var tryKeyCode = true;
25919         if (event.key !== void 0) {
25920           tryKeyCode = event.key.charCodeAt(0) > 127;
25921           isMatch = true;
25922           if (binding2.event.key === void 0) {
25923             isMatch = false;
25924           } else if (Array.isArray(binding2.event.key)) {
25925             if (binding2.event.key.map(function(s2) {
25926               return s2.toLowerCase();
25927             }).indexOf(event.key.toLowerCase()) === -1) {
25928               isMatch = false;
25929             }
25930           } else {
25931             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
25932               isMatch = false;
25933             }
25934           }
25935         }
25936         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
25937           isMatch = event.keyCode === binding2.event.keyCode;
25938         }
25939         if (!isMatch)
25940           return false;
25941         if (!(event.ctrlKey && event.altKey)) {
25942           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
25943             return false;
25944           if (event.altKey !== binding2.event.modifiers.altKey)
25945             return false;
25946         }
25947         if (event.metaKey !== binding2.event.modifiers.metaKey)
25948           return false;
25949         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
25950           return false;
25951         return true;
25952       }
25953     }
25954     function capture(d3_event) {
25955       testBindings(d3_event, true);
25956     }
25957     function bubble(d3_event) {
25958       var tagName = select_default2(d3_event.target).node().tagName;
25959       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
25960         return;
25961       }
25962       testBindings(d3_event, false);
25963     }
25964     function keybinding(selection2) {
25965       selection2 = selection2 || select_default2(document);
25966       selection2.on("keydown.capture." + namespace, capture, true);
25967       selection2.on("keydown.bubble." + namespace, bubble, false);
25968       return keybinding;
25969     }
25970     keybinding.unbind = function(selection2) {
25971       _keybindings = [];
25972       selection2 = selection2 || select_default2(document);
25973       selection2.on("keydown.capture." + namespace, null);
25974       selection2.on("keydown.bubble." + namespace, null);
25975       return keybinding;
25976     };
25977     keybinding.clear = function() {
25978       _keybindings = {};
25979       return keybinding;
25980     };
25981     keybinding.off = function(codes, capture2) {
25982       var arr = utilArrayUniq([].concat(codes));
25983       for (var i3 = 0; i3 < arr.length; i3++) {
25984         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
25985         delete _keybindings[id2];
25986       }
25987       return keybinding;
25988     };
25989     keybinding.on = function(codes, callback, capture2) {
25990       if (typeof callback !== "function") {
25991         return keybinding.off(codes, capture2);
25992       }
25993       var arr = utilArrayUniq([].concat(codes));
25994       for (var i3 = 0; i3 < arr.length; i3++) {
25995         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
25996         var binding = {
25997           id: id2,
25998           capture: capture2,
25999           callback,
26000           event: {
26001             key: void 0,
26002             // preferred
26003             keyCode: 0,
26004             // fallback
26005             modifiers: {
26006               shiftKey: false,
26007               ctrlKey: false,
26008               altKey: false,
26009               metaKey: false
26010             }
26011           }
26012         };
26013         if (_keybindings[id2]) {
26014           console.warn('warning: duplicate keybinding for "' + id2 + '"');
26015         }
26016         _keybindings[id2] = binding;
26017         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
26018         for (var j3 = 0; j3 < matches.length; j3++) {
26019           if (matches[j3] === "++")
26020             matches[j3] = "+";
26021           if (matches[j3] in utilKeybinding.modifierCodes) {
26022             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j3]]];
26023             binding.event.modifiers[prop] = true;
26024           } else {
26025             binding.event.key = utilKeybinding.keys[matches[j3]] || matches[j3];
26026             if (matches[j3] in utilKeybinding.keyCodes) {
26027               binding.event.keyCode = utilKeybinding.keyCodes[matches[j3]];
26028             }
26029           }
26030         }
26031       }
26032       return keybinding;
26033     };
26034     return keybinding;
26035   }
26036   utilKeybinding.modifierCodes = {
26037     // Shift key, ⇧
26038     "\u21E7": 16,
26039     shift: 16,
26040     // CTRL key, on Mac: ⌃
26041     "\u2303": 17,
26042     ctrl: 17,
26043     // ALT key, on Mac: ⌥ (Alt)
26044     "\u2325": 18,
26045     alt: 18,
26046     option: 18,
26047     // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
26048     "\u2318": 91,
26049     meta: 91,
26050     cmd: 91,
26051     "super": 91,
26052     win: 91
26053   };
26054   utilKeybinding.modifierProperties = {
26055     16: "shiftKey",
26056     17: "ctrlKey",
26057     18: "altKey",
26058     91: "metaKey"
26059   };
26060   utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
26061   utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
26062   utilKeybinding.keys = {
26063     // Backspace key, on Mac: ⌫ (Backspace)
26064     "\u232B": "Backspace",
26065     backspace: "Backspace",
26066     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26067     "\u21E5": "Tab",
26068     "\u21C6": "Tab",
26069     tab: "Tab",
26070     // Return key, ↩
26071     "\u21A9": "Enter",
26072     "\u21B5": "Enter",
26073     "\u23CE": "Enter",
26074     "return": "Enter",
26075     enter: "Enter",
26076     "\u2305": "Enter",
26077     // Pause/Break key
26078     "pause": "Pause",
26079     "pause-break": "Pause",
26080     // Caps Lock key, ⇪
26081     "\u21EA": "CapsLock",
26082     caps: "CapsLock",
26083     "caps-lock": "CapsLock",
26084     // Escape key, on Mac: ⎋, on Windows: Esc
26085     "\u238B": ["Escape", "Esc"],
26086     escape: ["Escape", "Esc"],
26087     esc: ["Escape", "Esc"],
26088     // Space key
26089     space: [" ", "Spacebar"],
26090     // Page-Up key, or pgup, on Mac: ↖
26091     "\u2196": "PageUp",
26092     pgup: "PageUp",
26093     "page-up": "PageUp",
26094     // Page-Down key, or pgdown, on Mac: ↘
26095     "\u2198": "PageDown",
26096     pgdown: "PageDown",
26097     "page-down": "PageDown",
26098     // END key, on Mac: ⇟
26099     "\u21DF": "End",
26100     end: "End",
26101     // HOME key, on Mac: ⇞
26102     "\u21DE": "Home",
26103     home: "Home",
26104     // Insert key, or ins
26105     ins: "Insert",
26106     insert: "Insert",
26107     // Delete key, on Mac: ⌦ (Delete)
26108     "\u2326": ["Delete", "Del"],
26109     del: ["Delete", "Del"],
26110     "delete": ["Delete", "Del"],
26111     // Left Arrow Key, or ←
26112     "\u2190": ["ArrowLeft", "Left"],
26113     left: ["ArrowLeft", "Left"],
26114     "arrow-left": ["ArrowLeft", "Left"],
26115     // Up Arrow Key, or ↑
26116     "\u2191": ["ArrowUp", "Up"],
26117     up: ["ArrowUp", "Up"],
26118     "arrow-up": ["ArrowUp", "Up"],
26119     // Right Arrow Key, or →
26120     "\u2192": ["ArrowRight", "Right"],
26121     right: ["ArrowRight", "Right"],
26122     "arrow-right": ["ArrowRight", "Right"],
26123     // Up Arrow Key, or ↓
26124     "\u2193": ["ArrowDown", "Down"],
26125     down: ["ArrowDown", "Down"],
26126     "arrow-down": ["ArrowDown", "Down"],
26127     // odities, stuff for backward compatibility (browsers and code):
26128     // Num-Multiply, or *
26129     "*": ["*", "Multiply"],
26130     star: ["*", "Multiply"],
26131     asterisk: ["*", "Multiply"],
26132     multiply: ["*", "Multiply"],
26133     // Num-Plus or +
26134     "+": ["+", "Add"],
26135     "plus": ["+", "Add"],
26136     // Num-Subtract, or -
26137     "-": ["-", "Subtract"],
26138     subtract: ["-", "Subtract"],
26139     "dash": ["-", "Subtract"],
26140     // Semicolon
26141     semicolon: ";",
26142     // = or equals
26143     equals: "=",
26144     // Comma, or ,
26145     comma: ",",
26146     // Period, or ., or full-stop
26147     period: ".",
26148     "full-stop": ".",
26149     // Slash, or /, or forward-slash
26150     slash: "/",
26151     "forward-slash": "/",
26152     // Tick, or `, or back-quote
26153     tick: "`",
26154     "back-quote": "`",
26155     // Open bracket, or [
26156     "open-bracket": "[",
26157     // Back slash, or \
26158     "back-slash": "\\",
26159     // Close backet, or ]
26160     "close-bracket": "]",
26161     // Apostrophe, or Quote, or '
26162     quote: "'",
26163     apostrophe: "'",
26164     // NUMPAD 0-9
26165     "num-0": "0",
26166     "num-1": "1",
26167     "num-2": "2",
26168     "num-3": "3",
26169     "num-4": "4",
26170     "num-5": "5",
26171     "num-6": "6",
26172     "num-7": "7",
26173     "num-8": "8",
26174     "num-9": "9",
26175     // F1-F25
26176     f1: "F1",
26177     f2: "F2",
26178     f3: "F3",
26179     f4: "F4",
26180     f5: "F5",
26181     f6: "F6",
26182     f7: "F7",
26183     f8: "F8",
26184     f9: "F9",
26185     f10: "F10",
26186     f11: "F11",
26187     f12: "F12",
26188     f13: "F13",
26189     f14: "F14",
26190     f15: "F15",
26191     f16: "F16",
26192     f17: "F17",
26193     f18: "F18",
26194     f19: "F19",
26195     f20: "F20",
26196     f21: "F21",
26197     f22: "F22",
26198     f23: "F23",
26199     f24: "F24",
26200     f25: "F25"
26201   };
26202   utilKeybinding.keyCodes = {
26203     // Backspace key, on Mac: ⌫ (Backspace)
26204     "\u232B": 8,
26205     backspace: 8,
26206     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26207     "\u21E5": 9,
26208     "\u21C6": 9,
26209     tab: 9,
26210     // Return key, ↩
26211     "\u21A9": 13,
26212     "\u21B5": 13,
26213     "\u23CE": 13,
26214     "return": 13,
26215     enter: 13,
26216     "\u2305": 13,
26217     // Pause/Break key
26218     "pause": 19,
26219     "pause-break": 19,
26220     // Caps Lock key, ⇪
26221     "\u21EA": 20,
26222     caps: 20,
26223     "caps-lock": 20,
26224     // Escape key, on Mac: ⎋, on Windows: Esc
26225     "\u238B": 27,
26226     escape: 27,
26227     esc: 27,
26228     // Space key
26229     space: 32,
26230     // Page-Up key, or pgup, on Mac: ↖
26231     "\u2196": 33,
26232     pgup: 33,
26233     "page-up": 33,
26234     // Page-Down key, or pgdown, on Mac: ↘
26235     "\u2198": 34,
26236     pgdown: 34,
26237     "page-down": 34,
26238     // END key, on Mac: ⇟
26239     "\u21DF": 35,
26240     end: 35,
26241     // HOME key, on Mac: ⇞
26242     "\u21DE": 36,
26243     home: 36,
26244     // Insert key, or ins
26245     ins: 45,
26246     insert: 45,
26247     // Delete key, on Mac: ⌦ (Delete)
26248     "\u2326": 46,
26249     del: 46,
26250     "delete": 46,
26251     // Left Arrow Key, or ←
26252     "\u2190": 37,
26253     left: 37,
26254     "arrow-left": 37,
26255     // Up Arrow Key, or ↑
26256     "\u2191": 38,
26257     up: 38,
26258     "arrow-up": 38,
26259     // Right Arrow Key, or →
26260     "\u2192": 39,
26261     right: 39,
26262     "arrow-right": 39,
26263     // Up Arrow Key, or ↓
26264     "\u2193": 40,
26265     down: 40,
26266     "arrow-down": 40,
26267     // odities, printing characters that come out wrong:
26268     // Firefox Equals
26269     "ffequals": 61,
26270     // Num-Multiply, or *
26271     "*": 106,
26272     star: 106,
26273     asterisk: 106,
26274     multiply: 106,
26275     // Num-Plus or +
26276     "+": 107,
26277     "plus": 107,
26278     // Num-Subtract, or -
26279     "-": 109,
26280     subtract: 109,
26281     // Vertical Bar / Pipe
26282     "|": 124,
26283     // Firefox Plus
26284     "ffplus": 171,
26285     // Firefox Minus
26286     "ffminus": 173,
26287     // Semicolon
26288     ";": 186,
26289     semicolon: 186,
26290     // = or equals
26291     "=": 187,
26292     "equals": 187,
26293     // Comma, or ,
26294     ",": 188,
26295     comma: 188,
26296     // Dash / Underscore key
26297     "dash": 189,
26298     // Period, or ., or full-stop
26299     ".": 190,
26300     period: 190,
26301     "full-stop": 190,
26302     // Slash, or /, or forward-slash
26303     "/": 191,
26304     slash: 191,
26305     "forward-slash": 191,
26306     // Tick, or `, or back-quote
26307     "`": 192,
26308     tick: 192,
26309     "back-quote": 192,
26310     // Open bracket, or [
26311     "[": 219,
26312     "open-bracket": 219,
26313     // Back slash, or \
26314     "\\": 220,
26315     "back-slash": 220,
26316     // Close backet, or ]
26317     "]": 221,
26318     "close-bracket": 221,
26319     // Apostrophe, or Quote, or '
26320     "'": 222,
26321     quote: 222,
26322     apostrophe: 222
26323   };
26324   var i = 95;
26325   var n = 0;
26326   while (++i < 106) {
26327     utilKeybinding.keyCodes["num-" + n] = i;
26328     ++n;
26329   }
26330   i = 47;
26331   n = 0;
26332   while (++i < 58) {
26333     utilKeybinding.keyCodes[n] = i;
26334     ++n;
26335   }
26336   i = 111;
26337   n = 1;
26338   while (++i < 136) {
26339     utilKeybinding.keyCodes["f" + n] = i;
26340     ++n;
26341   }
26342   i = 64;
26343   while (++i < 91) {
26344     utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
26345   }
26346
26347   // modules/util/object.js
26348   function utilObjectOmit(obj, omitKeys) {
26349     return Object.keys(obj).reduce(function(result, key) {
26350       if (omitKeys.indexOf(key) === -1) {
26351         result[key] = obj[key];
26352       }
26353       return result;
26354     }, {});
26355   }
26356
26357   // modules/util/rebind.js
26358   function utilRebind(target, source) {
26359     var i3 = 1, n3 = arguments.length, method;
26360     while (++i3 < n3) {
26361       target[method = arguments[i3]] = d3_rebind(target, source, source[method]);
26362     }
26363     return target;
26364   }
26365   function d3_rebind(target, source, method) {
26366     return function() {
26367       var value = method.apply(source, arguments);
26368       return value === source ? target : value;
26369     };
26370   }
26371
26372   // modules/util/session_mutex.js
26373   function utilSessionMutex(name) {
26374     var mutex = {};
26375     var intervalID;
26376     function renew() {
26377       var expires = /* @__PURE__ */ new Date();
26378       expires.setSeconds(expires.getSeconds() + 5);
26379       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
26380     }
26381     mutex.lock = function() {
26382       if (intervalID)
26383         return true;
26384       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
26385       if (cookie)
26386         return false;
26387       renew();
26388       intervalID = window.setInterval(renew, 4e3);
26389       return true;
26390     };
26391     mutex.unlock = function() {
26392       if (!intervalID)
26393         return;
26394       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
26395       clearInterval(intervalID);
26396       intervalID = null;
26397     };
26398     mutex.locked = function() {
26399       return !!intervalID;
26400     };
26401     return mutex;
26402   }
26403
26404   // modules/util/tiler.js
26405   function utilTiler() {
26406     var _size = [256, 256];
26407     var _scale = 256;
26408     var _tileSize = 256;
26409     var _zoomExtent = [0, 20];
26410     var _translate = [_size[0] / 2, _size[1] / 2];
26411     var _margin = 0;
26412     var _skipNullIsland = false;
26413     function clamp3(num, min3, max3) {
26414       return Math.max(min3, Math.min(num, max3));
26415     }
26416     function nearNullIsland(tile) {
26417       var x2 = tile[0];
26418       var y2 = tile[1];
26419       var z2 = tile[2];
26420       if (z2 >= 7) {
26421         var center = Math.pow(2, z2 - 1);
26422         var width = Math.pow(2, z2 - 6);
26423         var min3 = center - width / 2;
26424         var max3 = center + width / 2 - 1;
26425         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
26426       }
26427       return false;
26428     }
26429     function tiler9() {
26430       var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
26431       var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
26432       var tileMin = 0;
26433       var tileMax = Math.pow(2, z0) - 1;
26434       var log2ts = Math.log(_tileSize) * Math.LOG2E;
26435       var k2 = Math.pow(2, z2 - z0 + log2ts);
26436       var origin = [
26437         (_translate[0] - _scale / 2) / k2,
26438         (_translate[1] - _scale / 2) / k2
26439       ];
26440       var cols = range(
26441         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
26442         clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
26443       );
26444       var rows = range(
26445         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
26446         clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
26447       );
26448       var tiles = [];
26449       for (var i3 = 0; i3 < rows.length; i3++) {
26450         var y2 = rows[i3];
26451         for (var j3 = 0; j3 < cols.length; j3++) {
26452           var x2 = cols[j3];
26453           if (i3 >= _margin && i3 <= rows.length - _margin && j3 >= _margin && j3 <= cols.length - _margin) {
26454             tiles.unshift([x2, y2, z0]);
26455           } else {
26456             tiles.push([x2, y2, z0]);
26457           }
26458         }
26459       }
26460       tiles.translate = origin;
26461       tiles.scale = k2;
26462       return tiles;
26463     }
26464     tiler9.getTiles = function(projection2) {
26465       var origin = [
26466         projection2.scale() * Math.PI - projection2.translate()[0],
26467         projection2.scale() * Math.PI - projection2.translate()[1]
26468       ];
26469       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
26470       var tiles = tiler9();
26471       var ts = tiles.scale;
26472       return tiles.map(function(tile) {
26473         if (_skipNullIsland && nearNullIsland(tile)) {
26474           return false;
26475         }
26476         var x2 = tile[0] * ts - origin[0];
26477         var y2 = tile[1] * ts - origin[1];
26478         return {
26479           id: tile.toString(),
26480           xyz: tile,
26481           extent: geoExtent(
26482             projection2.invert([x2, y2 + ts]),
26483             projection2.invert([x2 + ts, y2])
26484           )
26485         };
26486       }).filter(Boolean);
26487     };
26488     tiler9.getGeoJSON = function(projection2) {
26489       var features = tiler9.getTiles(projection2).map(function(tile) {
26490         return {
26491           type: "Feature",
26492           properties: {
26493             id: tile.id,
26494             name: tile.id
26495           },
26496           geometry: {
26497             type: "Polygon",
26498             coordinates: [tile.extent.polygon()]
26499           }
26500         };
26501       });
26502       return {
26503         type: "FeatureCollection",
26504         features
26505       };
26506     };
26507     tiler9.tileSize = function(val) {
26508       if (!arguments.length)
26509         return _tileSize;
26510       _tileSize = val;
26511       return tiler9;
26512     };
26513     tiler9.zoomExtent = function(val) {
26514       if (!arguments.length)
26515         return _zoomExtent;
26516       _zoomExtent = val;
26517       return tiler9;
26518     };
26519     tiler9.size = function(val) {
26520       if (!arguments.length)
26521         return _size;
26522       _size = val;
26523       return tiler9;
26524     };
26525     tiler9.scale = function(val) {
26526       if (!arguments.length)
26527         return _scale;
26528       _scale = val;
26529       return tiler9;
26530     };
26531     tiler9.translate = function(val) {
26532       if (!arguments.length)
26533         return _translate;
26534       _translate = val;
26535       return tiler9;
26536     };
26537     tiler9.margin = function(val) {
26538       if (!arguments.length)
26539         return _margin;
26540       _margin = +val;
26541       return tiler9;
26542     };
26543     tiler9.skipNullIsland = function(val) {
26544       if (!arguments.length)
26545         return _skipNullIsland;
26546       _skipNullIsland = val;
26547       return tiler9;
26548     };
26549     return tiler9;
26550   }
26551
26552   // modules/util/trigger_event.js
26553   function utilTriggerEvent(target, type2, eventProperties) {
26554     target.each(function() {
26555       var evt = document.createEvent("HTMLEvents");
26556       evt.initEvent(type2, true, true);
26557       for (var prop in eventProperties) {
26558         evt[prop] = eventProperties[prop];
26559       }
26560       this.dispatchEvent(evt);
26561     });
26562   }
26563
26564   // modules/core/localizer.js
26565   var _mainLocalizer = coreLocalizer();
26566   var _t = _mainLocalizer.t;
26567   function coreLocalizer() {
26568     let localizer = {};
26569     let _dataLanguages = {};
26570     let _dataLocales = {};
26571     let _localeStrings = {};
26572     let _localeCode = "en-US";
26573     let _localeCodes = ["en-US", "en"];
26574     let _languageCode = "en";
26575     let _textDirection = "ltr";
26576     let _usesMetric = false;
26577     let _languageNames = {};
26578     let _scriptNames = {};
26579     localizer.localeCode = () => _localeCode;
26580     localizer.localeCodes = () => _localeCodes;
26581     localizer.languageCode = () => _languageCode;
26582     localizer.textDirection = () => _textDirection;
26583     localizer.usesMetric = () => _usesMetric;
26584     localizer.languageNames = () => _languageNames;
26585     localizer.scriptNames = () => _scriptNames;
26586     let _preferredLocaleCodes = [];
26587     localizer.preferredLocaleCodes = function(codes) {
26588       if (!arguments.length)
26589         return _preferredLocaleCodes;
26590       if (typeof codes === "string") {
26591         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
26592       } else {
26593         _preferredLocaleCodes = codes;
26594       }
26595       return localizer;
26596     };
26597     var _loadPromise;
26598     localizer.ensureLoaded = () => {
26599       if (_loadPromise)
26600         return _loadPromise;
26601       let filesToFetch = [
26602         "languages",
26603         // load the list of languages
26604         "locales"
26605         // load the list of supported locales
26606       ];
26607       const localeDirs = {
26608         general: "locales",
26609         tagging: presetsCdnUrl + "dist/translations"
26610       };
26611       let fileMap = _mainFileFetcher.fileMap();
26612       for (let scopeId in localeDirs) {
26613         const key = `locales_index_${scopeId}`;
26614         if (!fileMap[key]) {
26615           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
26616         }
26617         filesToFetch.push(key);
26618       }
26619       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
26620         _dataLanguages = results[0];
26621         _dataLocales = results[1];
26622         let indexes = results.slice(2);
26623         let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
26624         _localeCodes = localesToUseFrom(requestedLocales);
26625         _localeCode = _localeCodes[0];
26626         let loadStringsPromises = [];
26627         indexes.forEach((index, i3) => {
26628           const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
26629             return index[locale2] && index[locale2].pct === 1;
26630           });
26631           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
26632             let scopeId = Object.keys(localeDirs)[i3];
26633             let directory = Object.values(localeDirs)[i3];
26634             if (index[code])
26635               loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
26636           });
26637         });
26638         return Promise.all(loadStringsPromises);
26639       }).then(() => {
26640         updateForCurrentLocale();
26641       }).catch((err) => console.error(err));
26642     };
26643     function localesToUseFrom(requestedLocales) {
26644       let supportedLocales = _dataLocales;
26645       let toUse = [];
26646       for (let i3 in requestedLocales) {
26647         let locale2 = requestedLocales[i3];
26648         if (supportedLocales[locale2])
26649           toUse.push(locale2);
26650         if (locale2.includes("-")) {
26651           let langPart = locale2.split("-")[0];
26652           if (supportedLocales[langPart])
26653             toUse.push(langPart);
26654         }
26655       }
26656       return utilArrayUniq(toUse);
26657     }
26658     function updateForCurrentLocale() {
26659       if (!_localeCode)
26660         return;
26661       _languageCode = _localeCode.split("-")[0];
26662       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
26663       const hash = utilStringQs(window.location.hash);
26664       if (hash.rtl === "true") {
26665         _textDirection = "rtl";
26666       } else if (hash.rtl === "false") {
26667         _textDirection = "ltr";
26668       } else {
26669         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
26670       }
26671       let locale2 = _localeCode;
26672       if (locale2.toLowerCase() === "en-us")
26673         locale2 = "en";
26674       _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames;
26675       _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames;
26676       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
26677     }
26678     localizer.loadLocale = (locale2, scopeId, directory) => {
26679       if (locale2.toLowerCase() === "en-us")
26680         locale2 = "en";
26681       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
26682         return Promise.resolve(locale2);
26683       }
26684       let fileMap = _mainFileFetcher.fileMap();
26685       const key = `locale_${scopeId}_${locale2}`;
26686       if (!fileMap[key]) {
26687         fileMap[key] = `${directory}/${locale2}.min.json`;
26688       }
26689       return _mainFileFetcher.get(key).then((d2) => {
26690         if (!_localeStrings[scopeId])
26691           _localeStrings[scopeId] = {};
26692         _localeStrings[scopeId][locale2] = d2[locale2];
26693         return locale2;
26694       });
26695     };
26696     localizer.pluralRule = function(number3) {
26697       return pluralRule(number3, _localeCode);
26698     };
26699     function pluralRule(number3, localeCode) {
26700       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
26701       if (rules) {
26702         return rules.select(number3);
26703       }
26704       if (number3 === 1)
26705         return "one";
26706       return "other";
26707     }
26708     localizer.tInfo = function(origStringId, replacements, locale2) {
26709       let stringId = origStringId.trim();
26710       let scopeId = "general";
26711       if (stringId[0] === "_") {
26712         let split = stringId.split(".");
26713         scopeId = split[0].slice(1);
26714         stringId = split.slice(1).join(".");
26715       }
26716       locale2 = locale2 || _localeCode;
26717       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
26718       let stringsKey = locale2;
26719       if (stringsKey.toLowerCase() === "en-us")
26720         stringsKey = "en";
26721       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
26722       while (result !== void 0 && path.length) {
26723         result = result[path.pop()];
26724       }
26725       if (result !== void 0) {
26726         if (replacements) {
26727           if (typeof result === "object" && Object.keys(result).length) {
26728             const number3 = Object.values(replacements).find(function(value) {
26729               return typeof value === "number";
26730             });
26731             if (number3 !== void 0) {
26732               const rule = pluralRule(number3, locale2);
26733               if (result[rule]) {
26734                 result = result[rule];
26735               } else {
26736                 result = Object.values(result)[0];
26737               }
26738             }
26739           }
26740           if (typeof result === "string") {
26741             for (let key in replacements) {
26742               let value = replacements[key];
26743               if (typeof value === "number") {
26744                 if (value.toLocaleString) {
26745                   value = value.toLocaleString(locale2, {
26746                     style: "decimal",
26747                     useGrouping: true,
26748                     minimumFractionDigits: 0
26749                   });
26750                 } else {
26751                   value = value.toString();
26752                 }
26753               }
26754               const token = `{${key}}`;
26755               const regex = new RegExp(token, "g");
26756               result = result.replace(regex, value);
26757             }
26758           }
26759         }
26760         if (typeof result === "string") {
26761           return {
26762             text: result,
26763             locale: locale2
26764           };
26765         }
26766       }
26767       let index = _localeCodes.indexOf(locale2);
26768       if (index >= 0 && index < _localeCodes.length - 1) {
26769         let fallback = _localeCodes[index + 1];
26770         return localizer.tInfo(origStringId, replacements, fallback);
26771       }
26772       if (replacements && "default" in replacements) {
26773         return {
26774           text: replacements.default,
26775           locale: null
26776         };
26777       }
26778       const missing = `Missing ${locale2} translation: ${origStringId}`;
26779       if (typeof console !== "undefined")
26780         console.error(missing);
26781       return {
26782         text: missing,
26783         locale: "en"
26784       };
26785     };
26786     localizer.hasTextForStringId = function(stringId) {
26787       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
26788     };
26789     localizer.t = function(stringId, replacements, locale2) {
26790       return localizer.tInfo(stringId, replacements, locale2).text;
26791     };
26792     localizer.t.html = function(stringId, replacements, locale2) {
26793       replacements = Object.assign({}, replacements);
26794       for (var k2 in replacements) {
26795         if (typeof replacements[k2] === "string") {
26796           replacements[k2] = escape_default(replacements[k2]);
26797         }
26798         if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
26799           replacements[k2] = replacements[k2].html;
26800         }
26801       }
26802       const info = localizer.tInfo(stringId, replacements, locale2);
26803       if (info.text) {
26804         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
26805       } else {
26806         return "";
26807       }
26808     };
26809     localizer.t.append = function(stringId, replacements, locale2) {
26810       const ret = function(selection2) {
26811         const info = localizer.tInfo(stringId, replacements, locale2);
26812         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
26813       };
26814       ret.stringId = stringId;
26815       return ret;
26816     };
26817     localizer.languageName = (code, options2) => {
26818       if (_languageNames && _languageNames[code]) {
26819         return _languageNames[code];
26820       }
26821       if (options2 && options2.localOnly)
26822         return null;
26823       const langInfo = _dataLanguages[code];
26824       if (langInfo) {
26825         if (langInfo.nativeName) {
26826           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
26827         } else if (langInfo.base && langInfo.script) {
26828           const base = langInfo.base;
26829           if (_languageNames && _languageNames[base]) {
26830             const scriptCode = langInfo.script;
26831             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
26832             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
26833           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
26834             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
26835           }
26836         }
26837       }
26838       return code;
26839     };
26840     localizer.floatFormatter = (locale2) => {
26841       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
26842         return (number3, fractionDigits) => {
26843           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
26844         };
26845       } else {
26846         return (number3, fractionDigits) => number3.toLocaleString(locale2, {
26847           minimumFractionDigits: fractionDigits,
26848           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
26849         });
26850       }
26851     };
26852     localizer.floatParser = (locale2) => {
26853       const polyfill = (string) => +string.trim();
26854       if (!("Intl" in window && "NumberFormat" in Intl))
26855         return polyfill;
26856       const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26857       if (!("formatToParts" in format2))
26858         return polyfill;
26859       const parts = format2.formatToParts(-12345.6);
26860       const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
26861       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
26862       const literalPart = parts.find((d2) => d2.type === "literal");
26863       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
26864       const groupPart = parts.find((d2) => d2.type === "group");
26865       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
26866       const decimalPart = parts.find((d2) => d2.type === "decimal");
26867       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
26868       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
26869       const getIndex = (d2) => index.get(d2);
26870       return (string) => {
26871         string = string.trim();
26872         if (literal)
26873           string = string.replace(literal, "");
26874         if (group)
26875           string = string.replace(group, "");
26876         if (decimal)
26877           string = string.replace(decimal, ".");
26878         string = string.replace(numeral, getIndex);
26879         return string ? +string : NaN;
26880       };
26881     };
26882     localizer.decimalPlaceCounter = (locale2) => {
26883       var literal, group, decimal;
26884       if ("Intl" in window && "NumberFormat" in Intl) {
26885         const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26886         if ("formatToParts" in format2) {
26887           const parts = format2.formatToParts(-12345.6);
26888           const literalPart = parts.find((d2) => d2.type === "literal");
26889           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
26890           const groupPart = parts.find((d2) => d2.type === "group");
26891           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
26892           const decimalPart = parts.find((d2) => d2.type === "decimal");
26893           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
26894         }
26895       }
26896       return (string) => {
26897         string = string.trim();
26898         if (literal)
26899           string = string.replace(literal, "");
26900         if (group)
26901           string = string.replace(group, "");
26902         const parts = string.split(decimal || ".");
26903         return parts && parts[1] && parts[1].length || 0;
26904       };
26905     };
26906     return localizer;
26907   }
26908
26909   // modules/presets/collection.js
26910   function presetCollection(collection) {
26911     const MAXRESULTS = 50;
26912     let _this = {};
26913     let _memo = {};
26914     _this.collection = collection;
26915     _this.item = (id2) => {
26916       if (_memo[id2])
26917         return _memo[id2];
26918       const found = _this.collection.find((d2) => d2.id === id2);
26919       if (found)
26920         _memo[id2] = found;
26921       return found;
26922     };
26923     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
26924     _this.matchGeometry = (geometry) => {
26925       return presetCollection(
26926         _this.collection.filter((d2) => d2.matchGeometry(geometry))
26927       );
26928     };
26929     _this.matchAllGeometry = (geometries) => {
26930       return presetCollection(
26931         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
26932       );
26933     };
26934     _this.matchAnyGeometry = (geometries) => {
26935       return presetCollection(
26936         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
26937       );
26938     };
26939     _this.fallback = (geometry) => {
26940       let id2 = geometry;
26941       if (id2 === "vertex")
26942         id2 = "point";
26943       return _this.item(id2);
26944     };
26945     _this.search = (value, geometry, loc) => {
26946       if (!value)
26947         return _this;
26948       value = value.toLowerCase().trim();
26949       function leading(a2) {
26950         const index = a2.indexOf(value);
26951         return index === 0 || a2[index - 1] === " ";
26952       }
26953       function leadingStrict(a2) {
26954         const index = a2.indexOf(value);
26955         return index === 0;
26956       }
26957       function sortPresets(nameProp, aliasesProp) {
26958         return function sortNames(a2, b2) {
26959           let aCompare = a2[nameProp]();
26960           let bCompare = b2[nameProp]();
26961           if (aliasesProp) {
26962             const findMatchingAlias = (strings) => {
26963               if (strings.some((s2) => s2 === value)) {
26964                 return strings.find((s2) => s2 === value);
26965               } else {
26966                 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
26967               }
26968             };
26969             aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
26970             bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
26971           }
26972           if (value === aCompare)
26973             return -1;
26974           if (value === bCompare)
26975             return 1;
26976           let i3 = b2.originalScore - a2.originalScore;
26977           if (i3 !== 0)
26978             return i3;
26979           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
26980           if (i3 !== 0)
26981             return i3;
26982           return aCompare.length - bCompare.length;
26983         };
26984       }
26985       let pool = _this.collection;
26986       if (Array.isArray(loc)) {
26987         const validHere = _sharedLocationManager.locationSetsAt(loc);
26988         pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
26989       }
26990       const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
26991       const suggestions = pool.filter((a2) => a2.suggestion === true);
26992       const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
26993       const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
26994       const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
26995       const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
26996       const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
26997       const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
26998       const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
26999       const similarName = searchable.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 3).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
27000       const similarSuggestions = suggestions.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 1).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
27001       const similarTerms = searchable.filter((a2) => {
27002         return (a2.terms() || []).some((b2) => {
27003           return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
27004         });
27005       });
27006       let leadingTagKeyValues = [];
27007       if (value.includes("=")) {
27008         leadingTagKeyValues = searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => key + "=" + a2.tags[key] === value)).concat(searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => leading(key + "=" + a2.tags[key]))));
27009       }
27010       let results = leadingNames.concat(
27011         leadingSuggestions,
27012         leadingNamesStripped,
27013         leadingSuggestionsStripped,
27014         leadingTerms,
27015         leadingSuggestionTerms,
27016         leadingTagValues,
27017         similarName,
27018         similarSuggestions,
27019         similarTerms,
27020         leadingTagKeyValues
27021       ).slice(0, MAXRESULTS - 1);
27022       if (geometry) {
27023         if (typeof geometry === "string") {
27024           results.push(_this.fallback(geometry));
27025         } else {
27026           geometry.forEach((geom) => results.push(_this.fallback(geom)));
27027         }
27028       }
27029       return presetCollection(utilArrayUniq(results));
27030     };
27031     return _this;
27032   }
27033
27034   // modules/presets/category.js
27035   function presetCategory(categoryID, category, allPresets) {
27036     let _this = Object.assign({}, category);
27037     let _searchName;
27038     let _searchNameStripped;
27039     _this.id = categoryID;
27040     _this.members = presetCollection(
27041       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
27042     );
27043     _this.geometry = _this.members.collection.reduce((acc, preset) => {
27044       for (let i3 in preset.geometry) {
27045         const geometry = preset.geometry[i3];
27046         if (acc.indexOf(geometry) === -1) {
27047           acc.push(geometry);
27048         }
27049       }
27050       return acc;
27051     }, []);
27052     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27053     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
27054     _this.matchScore = () => -1;
27055     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27056     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27057     _this.terms = () => [];
27058     _this.searchName = () => {
27059       if (!_searchName) {
27060         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27061       }
27062       return _searchName;
27063     };
27064     _this.searchNameStripped = () => {
27065       if (!_searchNameStripped) {
27066         _searchNameStripped = _this.searchName();
27067         if (_searchNameStripped.normalize)
27068           _searchNameStripped = _searchNameStripped.normalize("NFD");
27069         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27070       }
27071       return _searchNameStripped;
27072     };
27073     _this.searchAliases = () => [];
27074     _this.searchAliasesStripped = () => [];
27075     return _this;
27076   }
27077
27078   // modules/presets/field.js
27079   function presetField(fieldID, field, allFields) {
27080     allFields = allFields || {};
27081     let _this = Object.assign({}, field);
27082     _this.id = fieldID;
27083     _this.safeid = utilSafeClassName(fieldID);
27084     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27085     _this.matchAllGeometry = (geometries) => {
27086       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27087     };
27088     _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27089     _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27090     _this.t.append = (scope, options2) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
27091     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
27092     _this.resolveReference = (which) => {
27093       const referenceRegex = /^\{(.*)\}$/;
27094       const match = (field[which] || "").match(referenceRegex);
27095       if (match) {
27096         const field2 = allFields[match[1]];
27097         if (field2) {
27098           return field2;
27099         }
27100         console.error(`Unable to resolve referenced field: ${match[1]}`);
27101       }
27102       return _this;
27103     };
27104     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27105     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27106     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27107     _this.originalTerms = (_this.terms || []).join();
27108     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27109     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27110     return _this;
27111   }
27112
27113   // modules/presets/preset.js
27114   var import_lodash = __toESM(require_lodash());
27115   function presetPreset(presetID, preset, addable, allFields, allPresets) {
27116     allFields = allFields || {};
27117     allPresets = allPresets || {};
27118     let _this = Object.assign({}, preset);
27119     let _addable = addable || false;
27120     let _searchName;
27121     let _searchNameStripped;
27122     let _searchAliases;
27123     let _searchAliasesStripped;
27124     const referenceRegex = /^\{(.*)\}$/;
27125     _this.id = presetID;
27126     _this.safeid = utilSafeClassName(presetID);
27127     _this.originalTerms = (_this.terms || []).join();
27128     _this.originalName = _this.name || "";
27129     _this.originalAliases = (_this.aliases || []).join("\n");
27130     _this.originalScore = _this.matchScore || 1;
27131     _this.originalReference = _this.reference || {};
27132     _this.originalFields = _this.fields || [];
27133     _this.originalMoreFields = _this.moreFields || [];
27134     _this.fields = (loc) => resolveFields("fields", loc);
27135     _this.moreFields = (loc) => resolveFields("moreFields", loc);
27136     _this.tags = _this.tags || {};
27137     _this.addTags = _this.addTags || _this.tags;
27138     _this.removeTags = _this.removeTags || _this.addTags;
27139     _this.geometry = _this.geometry || [];
27140     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27141     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
27142     _this.matchScore = (entityTags) => {
27143       const tags = _this.tags;
27144       let seen = {};
27145       let score = 0;
27146       for (let k2 in tags) {
27147         seen[k2] = true;
27148         if (entityTags[k2] === tags[k2]) {
27149           score += _this.originalScore;
27150         } else if (tags[k2] === "*" && k2 in entityTags) {
27151           score += _this.originalScore / 2;
27152         } else {
27153           return -1;
27154         }
27155       }
27156       const addTags = _this.addTags;
27157       for (let k2 in addTags) {
27158         if (!seen[k2] && entityTags[k2] === addTags[k2]) {
27159           score += _this.originalScore;
27160         }
27161       }
27162       if (_this.searchable === false) {
27163         score *= 0.999;
27164       }
27165       return score;
27166     };
27167     _this.t = (scope, options2) => {
27168       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
27169       return _t(textID, options2);
27170     };
27171     _this.t.append = (scope, options2) => {
27172       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
27173       return _t.append(textID, options2);
27174     };
27175     function resolveReference(which) {
27176       const match = (_this[which] || "").match(referenceRegex);
27177       if (match) {
27178         const preset2 = allPresets[match[1]];
27179         if (preset2) {
27180           return preset2;
27181         }
27182         console.error(`Unable to resolve referenced preset: ${match[1]}`);
27183       }
27184       return _this;
27185     }
27186     _this.name = () => {
27187       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
27188     };
27189     _this.nameLabel = () => {
27190       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
27191     };
27192     _this.subtitle = () => {
27193       if (_this.suggestion) {
27194         let path = presetID.split("/");
27195         path.pop();
27196         return _t("_tagging.presets.presets." + path.join("/") + ".name");
27197       }
27198       return null;
27199     };
27200     _this.subtitleLabel = () => {
27201       if (_this.suggestion) {
27202         let path = presetID.split("/");
27203         path.pop();
27204         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
27205       }
27206       return null;
27207     };
27208     _this.aliases = () => {
27209       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
27210     };
27211     _this.terms = () => {
27212       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27213     };
27214     _this.searchName = () => {
27215       if (!_searchName) {
27216         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27217       }
27218       return _searchName;
27219     };
27220     _this.searchNameStripped = () => {
27221       if (!_searchNameStripped) {
27222         _searchNameStripped = stripDiacritics(_this.searchName());
27223       }
27224       return _searchNameStripped;
27225     };
27226     _this.searchAliases = () => {
27227       if (!_searchAliases) {
27228         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
27229       }
27230       return _searchAliases;
27231     };
27232     _this.searchAliasesStripped = () => {
27233       if (!_searchAliasesStripped) {
27234         _searchAliasesStripped = _this.searchAliases();
27235         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
27236       }
27237       return _searchAliasesStripped;
27238     };
27239     _this.isFallback = () => {
27240       const tagCount = Object.keys(_this.tags).length;
27241       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
27242     };
27243     _this.addable = function(val) {
27244       if (!arguments.length)
27245         return _addable;
27246       _addable = val;
27247       return _this;
27248     };
27249     _this.reference = () => {
27250       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
27251       if (qid) {
27252         return { qid };
27253       }
27254       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
27255       let value = _this.originalReference.value || _this.tags[key];
27256       if (value === "*") {
27257         return { key };
27258       } else {
27259         return { key, value };
27260       }
27261     };
27262     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
27263       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
27264       tags = utilObjectOmit(tags, Object.keys(removeTags));
27265       if (geometry && !skipFieldDefaults) {
27266         _this.fields(loc).forEach((field) => {
27267           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
27268             delete tags[field.key];
27269           }
27270         });
27271       }
27272       delete tags.area;
27273       return tags;
27274     };
27275     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
27276       const addTags = _this.addTags;
27277       tags = Object.assign({}, tags);
27278       for (let k2 in addTags) {
27279         if (addTags[k2] === "*") {
27280           if (_this.tags[k2] || !tags[k2]) {
27281             tags[k2] = "yes";
27282           }
27283         } else {
27284           tags[k2] = addTags[k2];
27285         }
27286       }
27287       if (!addTags.hasOwnProperty("area")) {
27288         delete tags.area;
27289         if (geometry === "area") {
27290           let needsAreaTag = true;
27291           for (let k2 in addTags) {
27292             if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
27293               needsAreaTag = false;
27294               break;
27295             }
27296           }
27297           if (needsAreaTag) {
27298             tags.area = "yes";
27299           }
27300         }
27301       }
27302       if (geometry && !skipFieldDefaults) {
27303         _this.fields(loc).forEach((field) => {
27304           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
27305             tags[field.key] = field.default;
27306           }
27307         });
27308       }
27309       return tags;
27310     };
27311     function resolveFields(which, loc) {
27312       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
27313       let resolved = [];
27314       fieldIDs.forEach((fieldID) => {
27315         const match = fieldID.match(referenceRegex);
27316         if (match !== null) {
27317           resolved = resolved.concat(inheritFields(allPresets[match[1]], which));
27318         } else if (allFields[fieldID]) {
27319           resolved.push(allFields[fieldID]);
27320         } else {
27321           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
27322         }
27323       });
27324       if (!resolved.length) {
27325         const endIndex = _this.id.lastIndexOf("/");
27326         const parentID = endIndex && _this.id.substring(0, endIndex);
27327         if (parentID) {
27328           let parent = allPresets[parentID];
27329           if (loc) {
27330             const validHere = _sharedLocationManager.locationSetsAt(loc);
27331             if (parent?.locationSetID && !validHere[parent.locationSetID]) {
27332               const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
27333               parent = allPresets[candidateIDs.find((candidateID) => {
27334                 const candidate = allPresets[candidateID];
27335                 return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags);
27336               })];
27337             }
27338           }
27339           resolved = inheritFields(parent, which);
27340         }
27341       }
27342       return utilArrayUniq(resolved);
27343       function inheritFields(parent, which2) {
27344         if (!parent)
27345           return [];
27346         if (which2 === "fields") {
27347           return parent.fields().filter(shouldInherit);
27348         } else if (which2 === "moreFields") {
27349           return parent.moreFields();
27350         } else {
27351           return [];
27352         }
27353       }
27354       function shouldInherit(f3) {
27355         if (f3.key && _this.tags[f3.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
27356         f3.type !== "multiCombo" && f3.type !== "semiCombo" && f3.type !== "manyCombo" && f3.type !== "check")
27357           return false;
27358         return true;
27359       }
27360     }
27361     function stripDiacritics(s2) {
27362       if (s2.normalize)
27363         s2 = s2.normalize("NFD");
27364       s2 = s2.replace(/[\u0300-\u036f]/g, "");
27365       return s2;
27366     }
27367     return _this;
27368   }
27369
27370   // modules/presets/index.js
27371   var _mainPresetIndex = presetIndex();
27372   function presetIndex() {
27373     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
27374     const MAXRECENTS = 30;
27375     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
27376     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
27377     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
27378     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
27379     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
27380     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
27381     let _defaults2 = {
27382       point: presetCollection([POINT]),
27383       vertex: presetCollection([POINT]),
27384       line: presetCollection([LINE]),
27385       area: presetCollection([AREA]),
27386       relation: presetCollection([RELATION])
27387     };
27388     let _fields = {};
27389     let _categories = {};
27390     let _universal = [];
27391     let _addablePresetIDs = null;
27392     let _recents;
27393     let _favorites;
27394     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27395     let _loadPromise;
27396     _this.ensureLoaded = () => {
27397       if (_loadPromise)
27398         return _loadPromise;
27399       return _loadPromise = Promise.all([
27400         _mainFileFetcher.get("preset_categories"),
27401         _mainFileFetcher.get("preset_defaults"),
27402         _mainFileFetcher.get("preset_presets"),
27403         _mainFileFetcher.get("preset_fields")
27404       ]).then((vals) => {
27405         _this.merge({
27406           categories: vals[0],
27407           defaults: vals[1],
27408           presets: vals[2],
27409           fields: vals[3]
27410         });
27411         osmSetAreaKeys(_this.areaKeys());
27412         osmSetLineTags(_this.lineTags());
27413         osmSetPointTags(_this.pointTags());
27414         osmSetVertexTags(_this.vertexTags());
27415       });
27416     };
27417     _this.merge = (d2) => {
27418       let newLocationSets = [];
27419       if (d2.fields) {
27420         Object.keys(d2.fields).forEach((fieldID) => {
27421           let f3 = d2.fields[fieldID];
27422           if (f3) {
27423             f3 = presetField(fieldID, f3, _fields);
27424             if (f3.locationSet)
27425               newLocationSets.push(f3);
27426             _fields[fieldID] = f3;
27427           } else {
27428             delete _fields[fieldID];
27429           }
27430         });
27431       }
27432       if (d2.presets) {
27433         Object.keys(d2.presets).forEach((presetID) => {
27434           let p2 = d2.presets[presetID];
27435           if (p2) {
27436             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
27437             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
27438             if (p2.locationSet)
27439               newLocationSets.push(p2);
27440             _presets[presetID] = p2;
27441           } else {
27442             const existing = _presets[presetID];
27443             if (existing && !existing.isFallback()) {
27444               delete _presets[presetID];
27445             }
27446           }
27447         });
27448       }
27449       if (d2.categories) {
27450         Object.keys(d2.categories).forEach((categoryID) => {
27451           let c2 = d2.categories[categoryID];
27452           if (c2) {
27453             c2 = presetCategory(categoryID, c2, _presets);
27454             if (c2.locationSet)
27455               newLocationSets.push(c2);
27456             _categories[categoryID] = c2;
27457           } else {
27458             delete _categories[categoryID];
27459           }
27460         });
27461       }
27462       _this.collection = Object.values(_presets).concat(Object.values(_categories));
27463       if (d2.defaults) {
27464         Object.keys(d2.defaults).forEach((geometry) => {
27465           const def = d2.defaults[geometry];
27466           if (Array.isArray(def)) {
27467             _defaults2[geometry] = presetCollection(
27468               def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
27469             );
27470           } else {
27471             delete _defaults2[geometry];
27472           }
27473         });
27474       }
27475       _universal = Object.values(_fields).filter((field) => field.universal);
27476       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27477       _this.collection.forEach((preset) => {
27478         (preset.geometry || []).forEach((geometry) => {
27479           let g3 = _geometryIndex[geometry];
27480           for (let key in preset.tags) {
27481             g3[key] = g3[key] || {};
27482             let value = preset.tags[key];
27483             (g3[key][value] = g3[key][value] || []).push(preset);
27484           }
27485         });
27486       });
27487       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
27488         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
27489       }
27490       if (newLocationSets.length) {
27491         _sharedLocationManager.mergeLocationSets(newLocationSets);
27492       }
27493       return _this;
27494     };
27495     _this.match = (entity, resolver) => {
27496       return resolver.transient(entity, "presetMatch", () => {
27497         let geometry = entity.geometry(resolver);
27498         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
27499           geometry = "point";
27500         }
27501         const entityExtent = entity.extent(resolver);
27502         return _this.matchTags(entity.tags, geometry, entityExtent.center());
27503       });
27504     };
27505     _this.matchTags = (tags, geometry, loc) => {
27506       const keyIndex = _geometryIndex[geometry];
27507       let bestScore = -1;
27508       let bestMatch;
27509       let matchCandidates = [];
27510       for (let k2 in tags) {
27511         let indexMatches = [];
27512         let valueIndex = keyIndex[k2];
27513         if (!valueIndex)
27514           continue;
27515         let keyValueMatches = valueIndex[tags[k2]];
27516         if (keyValueMatches)
27517           indexMatches.push(...keyValueMatches);
27518         let keyStarMatches = valueIndex["*"];
27519         if (keyStarMatches)
27520           indexMatches.push(...keyStarMatches);
27521         if (indexMatches.length === 0)
27522           continue;
27523         for (let i3 = 0; i3 < indexMatches.length; i3++) {
27524           const candidate = indexMatches[i3];
27525           const score = candidate.matchScore(tags);
27526           if (score === -1) {
27527             continue;
27528           }
27529           matchCandidates.push({ score, candidate });
27530           if (score > bestScore) {
27531             bestScore = score;
27532             bestMatch = candidate;
27533           }
27534         }
27535       }
27536       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
27537         const validHere = _sharedLocationManager.locationSetsAt(loc);
27538         if (!validHere[bestMatch.locationSetID]) {
27539           matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
27540           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
27541             const candidateScore = matchCandidates[i3];
27542             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
27543               bestMatch = candidateScore.candidate;
27544               bestScore = candidateScore.score;
27545               break;
27546             }
27547           }
27548         }
27549       }
27550       if (!bestMatch || bestMatch.isFallback()) {
27551         for (let k2 in tags) {
27552           if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
27553             bestMatch = keyIndex["addr:*"]["*"][0];
27554             break;
27555           }
27556         }
27557       }
27558       return bestMatch || _this.fallback(geometry);
27559     };
27560     _this.allowsVertex = (entity, resolver) => {
27561       if (entity.type !== "node")
27562         return false;
27563       if (Object.keys(entity.tags).length === 0)
27564         return true;
27565       return resolver.transient(entity, "vertexMatch", () => {
27566         if (entity.isOnAddressLine(resolver))
27567           return true;
27568         const geometries = osmNodeGeometriesForTags(entity.tags);
27569         if (geometries.vertex)
27570           return true;
27571         if (geometries.point)
27572           return false;
27573         return true;
27574       });
27575     };
27576     _this.areaKeys = () => {
27577       const ignore = {
27578         barrier: true,
27579         highway: true,
27580         footway: true,
27581         railway: true,
27582         junction: true,
27583         traffic_calming: true,
27584         type: true
27585       };
27586       let areaKeys = {};
27587       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
27588       presets.forEach((p2) => {
27589         const keys2 = p2.tags && Object.keys(p2.tags);
27590         const key = keys2 && keys2.length && keys2[0];
27591         if (!key)
27592           return;
27593         if (ignore[key])
27594           return;
27595         if (p2.geometry.indexOf("area") !== -1) {
27596           areaKeys[key] = areaKeys[key] || {};
27597         }
27598       });
27599       presets.forEach((p2) => {
27600         let key;
27601         for (key in p2.addTags) {
27602           const value = p2.addTags[key];
27603           if (key in areaKeys && // probably an area...
27604           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
27605           value !== "*") {
27606             areaKeys[key][value] = true;
27607           }
27608         }
27609       });
27610       return areaKeys;
27611     };
27612     _this.lineTags = () => {
27613       return _this.collection.filter((lineTags, d2) => {
27614         if (d2.suggestion || d2.replacement || d2.searchable === false)
27615           return lineTags;
27616         const keys2 = d2.tags && Object.keys(d2.tags);
27617         const key = keys2 && keys2.length && keys2[0];
27618         if (!key)
27619           return lineTags;
27620         if (d2.geometry.indexOf("line") !== -1) {
27621           lineTags[key] = lineTags[key] || [];
27622           lineTags[key].push(d2.tags);
27623         }
27624         return lineTags;
27625       }, {});
27626     };
27627     _this.pointTags = () => {
27628       return _this.collection.reduce((pointTags, d2) => {
27629         if (d2.suggestion || d2.replacement || d2.searchable === false)
27630           return pointTags;
27631         const keys2 = d2.tags && Object.keys(d2.tags);
27632         const key = keys2 && keys2.length && keys2[0];
27633         if (!key)
27634           return pointTags;
27635         if (d2.geometry.indexOf("point") !== -1) {
27636           pointTags[key] = pointTags[key] || {};
27637           pointTags[key][d2.tags[key]] = true;
27638         }
27639         return pointTags;
27640       }, {});
27641     };
27642     _this.vertexTags = () => {
27643       return _this.collection.reduce((vertexTags, d2) => {
27644         if (d2.suggestion || d2.replacement || d2.searchable === false)
27645           return vertexTags;
27646         const keys2 = d2.tags && Object.keys(d2.tags);
27647         const key = keys2 && keys2.length && keys2[0];
27648         if (!key)
27649           return vertexTags;
27650         if (d2.geometry.indexOf("vertex") !== -1) {
27651           vertexTags[key] = vertexTags[key] || {};
27652           vertexTags[key][d2.tags[key]] = true;
27653         }
27654         return vertexTags;
27655       }, {});
27656     };
27657     _this.field = (id2) => _fields[id2];
27658     _this.universal = () => _universal;
27659     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
27660       let recents = [];
27661       if (startWithRecents) {
27662         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
27663       }
27664       let defaults;
27665       if (_addablePresetIDs) {
27666         defaults = Array.from(_addablePresetIDs).map(function(id2) {
27667           var preset = _this.item(id2);
27668           if (preset && preset.matchGeometry(geometry))
27669             return preset;
27670           return null;
27671         }).filter(Boolean);
27672       } else {
27673         defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
27674       }
27675       let result = presetCollection(
27676         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
27677       );
27678       if (Array.isArray(loc)) {
27679         const validHere = _sharedLocationManager.locationSetsAt(loc);
27680         result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
27681       }
27682       return result;
27683     };
27684     _this.addablePresetIDs = function(val) {
27685       if (!arguments.length)
27686         return _addablePresetIDs;
27687       if (Array.isArray(val))
27688         val = new Set(val);
27689       _addablePresetIDs = val;
27690       if (_addablePresetIDs) {
27691         _this.collection.forEach((p2) => {
27692           if (p2.addable)
27693             p2.addable(_addablePresetIDs.has(p2.id));
27694         });
27695       } else {
27696         _this.collection.forEach((p2) => {
27697           if (p2.addable)
27698             p2.addable(true);
27699         });
27700       }
27701       return _this;
27702     };
27703     _this.recent = () => {
27704       return presetCollection(
27705         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
27706       );
27707     };
27708     function RibbonItem(preset, source) {
27709       let item = {};
27710       item.preset = preset;
27711       item.source = source;
27712       item.isFavorite = () => item.source === "favorite";
27713       item.isRecent = () => item.source === "recent";
27714       item.matches = (preset2) => item.preset.id === preset2.id;
27715       item.minified = () => ({ pID: item.preset.id });
27716       return item;
27717     }
27718     function ribbonItemForMinified(d2, source) {
27719       if (d2 && d2.pID) {
27720         const preset = _this.item(d2.pID);
27721         if (!preset)
27722           return null;
27723         return RibbonItem(preset, source);
27724       }
27725       return null;
27726     }
27727     _this.getGenericRibbonItems = () => {
27728       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
27729     };
27730     _this.getAddable = () => {
27731       if (!_addablePresetIDs)
27732         return [];
27733       return _addablePresetIDs.map((id2) => {
27734         const preset = _this.item(id2);
27735         if (preset)
27736           return RibbonItem(preset, "addable");
27737         return null;
27738       }).filter(Boolean);
27739     };
27740     function setRecents(items) {
27741       _recents = items;
27742       const minifiedItems = items.map((d2) => d2.minified());
27743       corePreferences("preset_recents", JSON.stringify(minifiedItems));
27744       dispatch14.call("recentsChange");
27745     }
27746     _this.getRecents = () => {
27747       if (!_recents) {
27748         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
27749           let item = ribbonItemForMinified(d2, "recent");
27750           if (item && item.preset.addable())
27751             acc.push(item);
27752           return acc;
27753         }, []);
27754       }
27755       return _recents;
27756     };
27757     _this.addRecent = (preset, besidePreset, after) => {
27758       const recents = _this.getRecents();
27759       const beforeItem = _this.recentMatching(besidePreset);
27760       let toIndex = recents.indexOf(beforeItem);
27761       if (after)
27762         toIndex += 1;
27763       const newItem = RibbonItem(preset, "recent");
27764       recents.splice(toIndex, 0, newItem);
27765       setRecents(recents);
27766     };
27767     _this.removeRecent = (preset) => {
27768       const item = _this.recentMatching(preset);
27769       if (item) {
27770         let items = _this.getRecents();
27771         items.splice(items.indexOf(item), 1);
27772         setRecents(items);
27773       }
27774     };
27775     _this.recentMatching = (preset) => {
27776       const items = _this.getRecents();
27777       for (let i3 in items) {
27778         if (items[i3].matches(preset)) {
27779           return items[i3];
27780         }
27781       }
27782       return null;
27783     };
27784     _this.moveItem = (items, fromIndex, toIndex) => {
27785       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
27786         return null;
27787       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
27788       return items;
27789     };
27790     _this.moveRecent = (item, beforeItem) => {
27791       const recents = _this.getRecents();
27792       const fromIndex = recents.indexOf(item);
27793       const toIndex = recents.indexOf(beforeItem);
27794       const items = _this.moveItem(recents, fromIndex, toIndex);
27795       if (items)
27796         setRecents(items);
27797     };
27798     _this.setMostRecent = (preset) => {
27799       if (preset.searchable === false)
27800         return;
27801       let items = _this.getRecents();
27802       let item = _this.recentMatching(preset);
27803       if (item) {
27804         items.splice(items.indexOf(item), 1);
27805       } else {
27806         item = RibbonItem(preset, "recent");
27807       }
27808       while (items.length >= MAXRECENTS) {
27809         items.pop();
27810       }
27811       items.unshift(item);
27812       setRecents(items);
27813     };
27814     function setFavorites(items) {
27815       _favorites = items;
27816       const minifiedItems = items.map((d2) => d2.minified());
27817       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
27818       dispatch14.call("favoritePreset");
27819     }
27820     _this.addFavorite = (preset, besidePreset, after) => {
27821       const favorites = _this.getFavorites();
27822       const beforeItem = _this.favoriteMatching(besidePreset);
27823       let toIndex = favorites.indexOf(beforeItem);
27824       if (after)
27825         toIndex += 1;
27826       const newItem = RibbonItem(preset, "favorite");
27827       favorites.splice(toIndex, 0, newItem);
27828       setFavorites(favorites);
27829     };
27830     _this.toggleFavorite = (preset) => {
27831       const favs = _this.getFavorites();
27832       const favorite = _this.favoriteMatching(preset);
27833       if (favorite) {
27834         favs.splice(favs.indexOf(favorite), 1);
27835       } else {
27836         if (favs.length === 10) {
27837           favs.pop();
27838         }
27839         favs.push(RibbonItem(preset, "favorite"));
27840       }
27841       setFavorites(favs);
27842     };
27843     _this.removeFavorite = (preset) => {
27844       const item = _this.favoriteMatching(preset);
27845       if (item) {
27846         const items = _this.getFavorites();
27847         items.splice(items.indexOf(item), 1);
27848         setFavorites(items);
27849       }
27850     };
27851     _this.getFavorites = () => {
27852       if (!_favorites) {
27853         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
27854         if (!rawFavorites) {
27855           rawFavorites = [];
27856           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
27857         }
27858         _favorites = rawFavorites.reduce((output, d2) => {
27859           const item = ribbonItemForMinified(d2, "favorite");
27860           if (item && item.preset.addable())
27861             output.push(item);
27862           return output;
27863         }, []);
27864       }
27865       return _favorites;
27866     };
27867     _this.favoriteMatching = (preset) => {
27868       const favs = _this.getFavorites();
27869       for (let index in favs) {
27870         if (favs[index].matches(preset)) {
27871           return favs[index];
27872         }
27873       }
27874       return null;
27875     };
27876     return utilRebind(_this, dispatch14, "on");
27877   }
27878
27879   // modules/util/util.js
27880   function utilTagText(entity) {
27881     var obj = entity && entity.tags || {};
27882     return Object.keys(obj).map(function(k2) {
27883       return k2 + "=" + obj[k2];
27884     }).join(", ");
27885   }
27886   function utilTotalExtent(array2, graph) {
27887     var extent = geoExtent();
27888     var val, entity;
27889     for (var i3 = 0; i3 < array2.length; i3++) {
27890       val = array2[i3];
27891       entity = typeof val === "string" ? graph.hasEntity(val) : val;
27892       if (entity) {
27893         extent._extend(entity.extent(graph));
27894       }
27895     }
27896     return extent;
27897   }
27898   function utilTagDiff(oldTags, newTags) {
27899     var tagDiff = [];
27900     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
27901     keys2.forEach(function(k2) {
27902       var oldVal = oldTags[k2];
27903       var newVal = newTags[k2];
27904       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
27905         tagDiff.push({
27906           type: "-",
27907           key: k2,
27908           oldVal,
27909           newVal,
27910           display: "- " + k2 + "=" + oldVal
27911         });
27912       }
27913       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
27914         tagDiff.push({
27915           type: "+",
27916           key: k2,
27917           oldVal,
27918           newVal,
27919           display: "+ " + k2 + "=" + newVal
27920         });
27921       }
27922     });
27923     return tagDiff;
27924   }
27925   function utilEntitySelector(ids) {
27926     return ids.length ? "." + ids.join(",.") : "nothing";
27927   }
27928   function utilEntityOrMemberSelector(ids, graph) {
27929     var seen = new Set(ids);
27930     ids.forEach(collectShallowDescendants);
27931     return utilEntitySelector(Array.from(seen));
27932     function collectShallowDescendants(id2) {
27933       var entity = graph.hasEntity(id2);
27934       if (!entity || entity.type !== "relation")
27935         return;
27936       entity.members.map(function(member) {
27937         return member.id;
27938       }).forEach(function(id3) {
27939         seen.add(id3);
27940       });
27941     }
27942   }
27943   function utilEntityOrDeepMemberSelector(ids, graph) {
27944     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
27945   }
27946   function utilEntityAndDeepMemberIDs(ids, graph) {
27947     var seen = /* @__PURE__ */ new Set();
27948     ids.forEach(collectDeepDescendants);
27949     return Array.from(seen);
27950     function collectDeepDescendants(id2) {
27951       if (seen.has(id2))
27952         return;
27953       seen.add(id2);
27954       var entity = graph.hasEntity(id2);
27955       if (!entity || entity.type !== "relation")
27956         return;
27957       entity.members.map(function(member) {
27958         return member.id;
27959       }).forEach(collectDeepDescendants);
27960     }
27961   }
27962   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
27963     var idsSet = new Set(ids);
27964     var seen = /* @__PURE__ */ new Set();
27965     var returners = /* @__PURE__ */ new Set();
27966     ids.forEach(collectDeepDescendants);
27967     return utilEntitySelector(Array.from(returners));
27968     function collectDeepDescendants(id2) {
27969       if (seen.has(id2))
27970         return;
27971       seen.add(id2);
27972       if (!idsSet.has(id2)) {
27973         returners.add(id2);
27974       }
27975       var entity = graph.hasEntity(id2);
27976       if (!entity || entity.type !== "relation")
27977         return;
27978       if (skipMultipolgonMembers && entity.isMultipolygon())
27979         return;
27980       entity.members.map(function(member) {
27981         return member.id;
27982       }).forEach(collectDeepDescendants);
27983     }
27984   }
27985   function utilHighlightEntities(ids, highlighted, context) {
27986     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
27987   }
27988   function utilGetAllNodes(ids, graph) {
27989     var seen = /* @__PURE__ */ new Set();
27990     var nodes = /* @__PURE__ */ new Set();
27991     ids.forEach(collectNodes);
27992     return Array.from(nodes);
27993     function collectNodes(id2) {
27994       if (seen.has(id2))
27995         return;
27996       seen.add(id2);
27997       var entity = graph.hasEntity(id2);
27998       if (!entity)
27999         return;
28000       if (entity.type === "node") {
28001         nodes.add(entity);
28002       } else if (entity.type === "way") {
28003         entity.nodes.forEach(collectNodes);
28004       } else {
28005         entity.members.map(function(member) {
28006           return member.id;
28007         }).forEach(collectNodes);
28008       }
28009     }
28010   }
28011   function utilDisplayName(entity) {
28012     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
28013     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
28014     if (name)
28015       return name;
28016     var tags = {
28017       direction: entity.tags.direction,
28018       from: entity.tags.from,
28019       network: entity.tags.cycle_network || entity.tags.network,
28020       ref: entity.tags.ref,
28021       to: entity.tags.to,
28022       via: entity.tags.via
28023     };
28024     var keyComponents = [];
28025     if (tags.network) {
28026       keyComponents.push("network");
28027     }
28028     if (tags.ref) {
28029       keyComponents.push("ref");
28030     }
28031     if (entity.tags.route) {
28032       if (tags.direction) {
28033         keyComponents.push("direction");
28034       } else if (tags.from && tags.to) {
28035         keyComponents.push("from");
28036         keyComponents.push("to");
28037         if (tags.via) {
28038           keyComponents.push("via");
28039         }
28040       }
28041     }
28042     if (keyComponents.length) {
28043       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
28044     }
28045     return name;
28046   }
28047   function utilDisplayNameForPath(entity) {
28048     var name = utilDisplayName(entity);
28049     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
28050     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
28051     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
28052       name = fixRTLTextForSvg(name);
28053     }
28054     return name;
28055   }
28056   function utilDisplayType(id2) {
28057     return {
28058       n: _t("inspector.node"),
28059       w: _t("inspector.way"),
28060       r: _t("inspector.relation")
28061     }[id2.charAt(0)];
28062   }
28063   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
28064     var result;
28065     var displayName = utilDisplayName(entity);
28066     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
28067     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
28068     if (verbose) {
28069       result = [presetName, displayName].filter(Boolean).join(" ");
28070     } else {
28071       result = displayName || presetName;
28072     }
28073     return result || utilDisplayType(entity.id);
28074   }
28075   function utilEntityRoot(entityType) {
28076     return {
28077       node: "n",
28078       way: "w",
28079       relation: "r"
28080     }[entityType];
28081   }
28082   function utilCombinedTags(entityIDs, graph) {
28083     var tags = {};
28084     var tagCounts = {};
28085     var allKeys = /* @__PURE__ */ new Set();
28086     var entities = entityIDs.map(function(entityID) {
28087       return graph.hasEntity(entityID);
28088     }).filter(Boolean);
28089     entities.forEach(function(entity) {
28090       var keys2 = Object.keys(entity.tags).filter(Boolean);
28091       keys2.forEach(function(key2) {
28092         allKeys.add(key2);
28093       });
28094     });
28095     entities.forEach(function(entity) {
28096       allKeys.forEach(function(key2) {
28097         var value = entity.tags[key2];
28098         if (!tags.hasOwnProperty(key2)) {
28099           tags[key2] = value;
28100         } else {
28101           if (!Array.isArray(tags[key2])) {
28102             if (tags[key2] !== value) {
28103               tags[key2] = [tags[key2], value];
28104             }
28105           } else {
28106             if (tags[key2].indexOf(value) === -1) {
28107               tags[key2].push(value);
28108             }
28109           }
28110         }
28111         var tagHash = key2 + "=" + value;
28112         if (!tagCounts[tagHash])
28113           tagCounts[tagHash] = 0;
28114         tagCounts[tagHash] += 1;
28115       });
28116     });
28117     for (var key in tags) {
28118       if (!Array.isArray(tags[key]))
28119         continue;
28120       tags[key] = tags[key].sort(function(val12, val2) {
28121         var key2 = key2;
28122         var count2 = tagCounts[key2 + "=" + val2];
28123         var count1 = tagCounts[key2 + "=" + val12];
28124         if (count2 !== count1) {
28125           return count2 - count1;
28126         }
28127         if (val2 && val12) {
28128           return val12.localeCompare(val2);
28129         }
28130         return val12 ? 1 : -1;
28131       });
28132     }
28133     return tags;
28134   }
28135   function utilStringQs(str2) {
28136     var i3 = 0;
28137     while (i3 < str2.length && (str2[i3] === "?" || str2[i3] === "#"))
28138       i3++;
28139     str2 = str2.slice(i3);
28140     return str2.split("&").reduce(function(obj, pair3) {
28141       var parts = pair3.split("=");
28142       if (parts.length === 2) {
28143         obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
28144       }
28145       return obj;
28146     }, {});
28147   }
28148   function utilQsString(obj, noencode) {
28149     function softEncode(s2) {
28150       return encodeURIComponent(s2).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
28151     }
28152     return Object.keys(obj).sort().map(function(key) {
28153       return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
28154     }).join("&");
28155   }
28156   function utilPrefixDOMProperty(property) {
28157     var prefixes2 = ["webkit", "ms", "moz", "o"];
28158     var i3 = -1;
28159     var n3 = prefixes2.length;
28160     var s2 = document.body;
28161     if (property in s2)
28162       return property;
28163     property = property.slice(0, 1).toUpperCase() + property.slice(1);
28164     while (++i3 < n3) {
28165       if (prefixes2[i3] + property in s2) {
28166         return prefixes2[i3] + property;
28167       }
28168     }
28169     return false;
28170   }
28171   function utilPrefixCSSProperty(property) {
28172     var prefixes2 = ["webkit", "ms", "Moz", "O"];
28173     var i3 = -1;
28174     var n3 = prefixes2.length;
28175     var s2 = document.body.style;
28176     if (property.toLowerCase() in s2) {
28177       return property.toLowerCase();
28178     }
28179     while (++i3 < n3) {
28180       if (prefixes2[i3] + property in s2) {
28181         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
28182       }
28183     }
28184     return false;
28185   }
28186   var transformProperty;
28187   function utilSetTransform(el, x2, y2, scale) {
28188     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
28189     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
28190     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
28191   }
28192   function utilEditDistance(a2, b2) {
28193     a2 = (0, import_diacritics.remove)(a2.toLowerCase());
28194     b2 = (0, import_diacritics.remove)(b2.toLowerCase());
28195     if (a2.length === 0)
28196       return b2.length;
28197     if (b2.length === 0)
28198       return a2.length;
28199     var matrix = [];
28200     var i3, j3;
28201     for (i3 = 0; i3 <= b2.length; i3++) {
28202       matrix[i3] = [i3];
28203     }
28204     for (j3 = 0; j3 <= a2.length; j3++) {
28205       matrix[0][j3] = j3;
28206     }
28207     for (i3 = 1; i3 <= b2.length; i3++) {
28208       for (j3 = 1; j3 <= a2.length; j3++) {
28209         if (b2.charAt(i3 - 1) === a2.charAt(j3 - 1)) {
28210           matrix[i3][j3] = matrix[i3 - 1][j3 - 1];
28211         } else {
28212           matrix[i3][j3] = Math.min(
28213             matrix[i3 - 1][j3 - 1] + 1,
28214             // substitution
28215             Math.min(
28216               matrix[i3][j3 - 1] + 1,
28217               // insertion
28218               matrix[i3 - 1][j3] + 1
28219             )
28220           );
28221         }
28222       }
28223     }
28224     return matrix[b2.length][a2.length];
28225   }
28226   function utilFastMouse(container) {
28227     var rect = container.getBoundingClientRect();
28228     var rectLeft = rect.left;
28229     var rectTop = rect.top;
28230     var clientLeft = +container.clientLeft;
28231     var clientTop = +container.clientTop;
28232     return function(e3) {
28233       return [
28234         e3.clientX - rectLeft - clientLeft,
28235         e3.clientY - rectTop - clientTop
28236       ];
28237     };
28238   }
28239   function utilAsyncMap(inputs, func, callback) {
28240     var remaining = inputs.length;
28241     var results = [];
28242     var errors = [];
28243     inputs.forEach(function(d2, i3) {
28244       func(d2, function done(err, data) {
28245         errors[i3] = err;
28246         results[i3] = data;
28247         remaining--;
28248         if (!remaining)
28249           callback(errors, results);
28250       });
28251     });
28252   }
28253   function utilWrap(index, length) {
28254     if (index < 0) {
28255       index += Math.ceil(-index / length) * length;
28256     }
28257     return index % length;
28258   }
28259   function utilFunctor(value) {
28260     if (typeof value === "function")
28261       return value;
28262     return function() {
28263       return value;
28264     };
28265   }
28266   function utilNoAuto(selection2) {
28267     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
28268     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
28269   }
28270   function utilHashcode(str2) {
28271     var hash = 0;
28272     if (str2.length === 0) {
28273       return hash;
28274     }
28275     for (var i3 = 0; i3 < str2.length; i3++) {
28276       var char = str2.charCodeAt(i3);
28277       hash = (hash << 5) - hash + char;
28278       hash = hash & hash;
28279     }
28280     return hash;
28281   }
28282   function utilSafeClassName(str2) {
28283     return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_");
28284   }
28285   function utilUniqueDomId(val) {
28286     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
28287   }
28288   function utilUnicodeCharsCount(str2) {
28289     return Array.from(str2).length;
28290   }
28291   function utilUnicodeCharsTruncated(str2, limit) {
28292     return Array.from(str2).slice(0, limit).join("");
28293   }
28294   function toNumericID(id2) {
28295     var match = id2.match(/^[cnwr](-?\d+)$/);
28296     if (match) {
28297       return parseInt(match[1], 10);
28298     }
28299     return NaN;
28300   }
28301   function compareNumericIDs(left, right) {
28302     if (isNaN(left) && isNaN(right))
28303       return -1;
28304     if (isNaN(left))
28305       return 1;
28306     if (isNaN(right))
28307       return -1;
28308     if (Math.sign(left) !== Math.sign(right))
28309       return -Math.sign(left);
28310     if (Math.sign(left) < 0)
28311       return Math.sign(right - left);
28312     return Math.sign(left - right);
28313   }
28314   function utilCompareIDs(left, right) {
28315     return compareNumericIDs(toNumericID(left), toNumericID(right));
28316   }
28317   function utilOldestID(ids) {
28318     if (ids.length === 0) {
28319       return void 0;
28320     }
28321     var oldestIDIndex = 0;
28322     var oldestID = toNumericID(ids[0]);
28323     for (var i3 = 1; i3 < ids.length; i3++) {
28324       var num = toNumericID(ids[i3]);
28325       if (compareNumericIDs(oldestID, num) === 1) {
28326         oldestIDIndex = i3;
28327         oldestID = num;
28328       }
28329     }
28330     return ids[oldestIDIndex];
28331   }
28332   function utilCleanOsmString(val, maxChars) {
28333     if (val === void 0 || val === null) {
28334       val = "";
28335     } else {
28336       val = val.toString();
28337     }
28338     val = val.trim();
28339     if (val.normalize)
28340       val = val.normalize("NFC");
28341     return utilUnicodeCharsTruncated(val, maxChars);
28342   }
28343
28344   // modules/osm/entity.js
28345   function osmEntity(attrs) {
28346     if (this instanceof osmEntity)
28347       return;
28348     if (attrs && attrs.type) {
28349       return osmEntity[attrs.type].apply(this, arguments);
28350     } else if (attrs && attrs.id) {
28351       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
28352     }
28353     return new osmEntity().initialize(arguments);
28354   }
28355   osmEntity.id = function(type2) {
28356     return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
28357   };
28358   osmEntity.id.next = {
28359     changeset: -1,
28360     node: -1,
28361     way: -1,
28362     relation: -1
28363   };
28364   osmEntity.id.fromOSM = function(type2, id2) {
28365     return type2[0] + id2;
28366   };
28367   osmEntity.id.toOSM = function(id2) {
28368     var match = id2.match(/^[cnwr](-?\d+)$/);
28369     if (match) {
28370       return match[1];
28371     }
28372     return "";
28373   };
28374   osmEntity.id.type = function(id2) {
28375     return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
28376   };
28377   osmEntity.key = function(entity) {
28378     return entity.id + "v" + (entity.v || 0);
28379   };
28380   var _deprecatedTagValuesByKey;
28381   osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
28382     if (!_deprecatedTagValuesByKey) {
28383       _deprecatedTagValuesByKey = {};
28384       dataDeprecated.forEach(function(d2) {
28385         var oldKeys = Object.keys(d2.old);
28386         if (oldKeys.length === 1) {
28387           var oldKey = oldKeys[0];
28388           var oldValue = d2.old[oldKey];
28389           if (oldValue !== "*") {
28390             if (!_deprecatedTagValuesByKey[oldKey]) {
28391               _deprecatedTagValuesByKey[oldKey] = [oldValue];
28392             } else {
28393               _deprecatedTagValuesByKey[oldKey].push(oldValue);
28394             }
28395           }
28396         }
28397       });
28398     }
28399     return _deprecatedTagValuesByKey;
28400   };
28401   osmEntity.prototype = {
28402     tags: {},
28403     initialize: function(sources) {
28404       for (var i3 = 0; i3 < sources.length; ++i3) {
28405         var source = sources[i3];
28406         for (var prop in source) {
28407           if (Object.prototype.hasOwnProperty.call(source, prop)) {
28408             if (source[prop] === void 0) {
28409               delete this[prop];
28410             } else {
28411               this[prop] = source[prop];
28412             }
28413           }
28414         }
28415       }
28416       if (!this.id && this.type) {
28417         this.id = osmEntity.id(this.type);
28418       }
28419       if (!this.hasOwnProperty("visible")) {
28420         this.visible = true;
28421       }
28422       if (debug) {
28423         Object.freeze(this);
28424         Object.freeze(this.tags);
28425         if (this.loc)
28426           Object.freeze(this.loc);
28427         if (this.nodes)
28428           Object.freeze(this.nodes);
28429         if (this.members)
28430           Object.freeze(this.members);
28431       }
28432       return this;
28433     },
28434     copy: function(resolver, copies) {
28435       if (copies[this.id])
28436         return copies[this.id];
28437       var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
28438       copies[this.id] = copy2;
28439       return copy2;
28440     },
28441     osmId: function() {
28442       return osmEntity.id.toOSM(this.id);
28443     },
28444     isNew: function() {
28445       var osmId = osmEntity.id.toOSM(this.id);
28446       return osmId.length === 0 || osmId[0] === "-";
28447     },
28448     update: function(attrs) {
28449       return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
28450     },
28451     mergeTags: function(tags) {
28452       var merged = Object.assign({}, this.tags);
28453       var changed = false;
28454       for (var k2 in tags) {
28455         var t1 = merged[k2];
28456         var t2 = tags[k2];
28457         if (!t1) {
28458           changed = true;
28459           merged[k2] = t2;
28460         } else if (t1 !== t2) {
28461           changed = true;
28462           merged[k2] = utilUnicodeCharsTruncated(
28463             utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
28464             255
28465             // avoid exceeding character limit; see also context.maxCharsForTagValue()
28466           );
28467         }
28468       }
28469       return changed ? this.update({ tags: merged }) : this;
28470     },
28471     intersects: function(extent, resolver) {
28472       return this.extent(resolver).intersects(extent);
28473     },
28474     hasNonGeometryTags: function() {
28475       return Object.keys(this.tags).some(function(k2) {
28476         return k2 !== "area";
28477       });
28478     },
28479     hasParentRelations: function(resolver) {
28480       return resolver.parentRelations(this).length > 0;
28481     },
28482     hasInterestingTags: function() {
28483       return Object.keys(this.tags).some(osmIsInterestingTag);
28484     },
28485     isHighwayIntersection: function() {
28486       return false;
28487     },
28488     isDegenerate: function() {
28489       return true;
28490     },
28491     deprecatedTags: function(dataDeprecated) {
28492       var tags = this.tags;
28493       if (Object.keys(tags).length === 0)
28494         return [];
28495       var deprecated = [];
28496       dataDeprecated.forEach(function(d2) {
28497         var oldKeys = Object.keys(d2.old);
28498         if (d2.replace) {
28499           var hasExistingValues = Object.keys(d2.replace).some(function(replaceKey) {
28500             if (!tags[replaceKey] || d2.old[replaceKey])
28501               return false;
28502             var replaceValue = d2.replace[replaceKey];
28503             if (replaceValue === "*")
28504               return false;
28505             if (replaceValue === tags[replaceKey])
28506               return false;
28507             return true;
28508           });
28509           if (hasExistingValues)
28510             return;
28511         }
28512         var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
28513           if (!tags[oldKey])
28514             return false;
28515           if (d2.old[oldKey] === "*")
28516             return true;
28517           if (d2.old[oldKey] === tags[oldKey])
28518             return true;
28519           var vals = tags[oldKey].split(";").filter(Boolean);
28520           if (vals.length === 0) {
28521             return false;
28522           } else if (vals.length > 1) {
28523             return vals.indexOf(d2.old[oldKey]) !== -1;
28524           } else {
28525             if (tags[oldKey] === d2.old[oldKey]) {
28526               if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
28527                 var replaceKeys = Object.keys(d2.replace);
28528                 return !replaceKeys.every(function(replaceKey) {
28529                   return tags[replaceKey] === d2.replace[replaceKey];
28530                 });
28531               } else {
28532                 return true;
28533               }
28534             }
28535           }
28536           return false;
28537         });
28538         if (matchesDeprecatedTags) {
28539           deprecated.push(d2);
28540         }
28541       });
28542       return deprecated;
28543     }
28544   };
28545
28546   // modules/osm/lanes.js
28547   function osmLanes(entity) {
28548     if (entity.type !== "way")
28549       return null;
28550     if (!entity.tags.highway)
28551       return null;
28552     var tags = entity.tags;
28553     var isOneWay = entity.isOneWay();
28554     var laneCount = getLaneCount(tags, isOneWay);
28555     var maxspeed = parseMaxspeed(tags);
28556     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
28557     var forward = laneDirections.forward;
28558     var backward = laneDirections.backward;
28559     var bothways = laneDirections.bothways;
28560     var turnLanes = {};
28561     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
28562     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
28563     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
28564     var maxspeedLanes = {};
28565     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
28566     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
28567     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
28568     var psvLanes = {};
28569     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
28570     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
28571     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
28572     var busLanes = {};
28573     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
28574     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
28575     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
28576     var taxiLanes = {};
28577     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
28578     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
28579     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
28580     var hovLanes = {};
28581     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
28582     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
28583     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
28584     var hgvLanes = {};
28585     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
28586     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
28587     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
28588     var bicyclewayLanes = {};
28589     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
28590     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
28591     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
28592     var lanesObj = {
28593       forward: [],
28594       backward: [],
28595       unspecified: []
28596     };
28597     mapToLanesObj(lanesObj, turnLanes, "turnLane");
28598     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
28599     mapToLanesObj(lanesObj, psvLanes, "psv");
28600     mapToLanesObj(lanesObj, busLanes, "bus");
28601     mapToLanesObj(lanesObj, taxiLanes, "taxi");
28602     mapToLanesObj(lanesObj, hovLanes, "hov");
28603     mapToLanesObj(lanesObj, hgvLanes, "hgv");
28604     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
28605     return {
28606       metadata: {
28607         count: laneCount,
28608         oneway: isOneWay,
28609         forward,
28610         backward,
28611         bothways,
28612         turnLanes,
28613         maxspeed,
28614         maxspeedLanes,
28615         psvLanes,
28616         busLanes,
28617         taxiLanes,
28618         hovLanes,
28619         hgvLanes,
28620         bicyclewayLanes
28621       },
28622       lanes: lanesObj
28623     };
28624   }
28625   function getLaneCount(tags, isOneWay) {
28626     var count;
28627     if (tags.lanes) {
28628       count = parseInt(tags.lanes, 10);
28629       if (count > 0) {
28630         return count;
28631       }
28632     }
28633     switch (tags.highway) {
28634       case "trunk":
28635       case "motorway":
28636         count = isOneWay ? 2 : 4;
28637         break;
28638       default:
28639         count = isOneWay ? 1 : 2;
28640         break;
28641     }
28642     return count;
28643   }
28644   function parseMaxspeed(tags) {
28645     var maxspeed = tags.maxspeed;
28646     if (!maxspeed)
28647       return;
28648     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
28649     if (!maxspeedRegex.test(maxspeed))
28650       return;
28651     return parseInt(maxspeed, 10);
28652   }
28653   function parseLaneDirections(tags, isOneWay, laneCount) {
28654     var forward = parseInt(tags["lanes:forward"], 10);
28655     var backward = parseInt(tags["lanes:backward"], 10);
28656     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
28657     if (parseInt(tags.oneway, 10) === -1) {
28658       forward = 0;
28659       bothways = 0;
28660       backward = laneCount;
28661     } else if (isOneWay) {
28662       forward = laneCount;
28663       bothways = 0;
28664       backward = 0;
28665     } else if (isNaN(forward) && isNaN(backward)) {
28666       backward = Math.floor((laneCount - bothways) / 2);
28667       forward = laneCount - bothways - backward;
28668     } else if (isNaN(forward)) {
28669       if (backward > laneCount - bothways) {
28670         backward = laneCount - bothways;
28671       }
28672       forward = laneCount - bothways - backward;
28673     } else if (isNaN(backward)) {
28674       if (forward > laneCount - bothways) {
28675         forward = laneCount - bothways;
28676       }
28677       backward = laneCount - bothways - forward;
28678     }
28679     return {
28680       forward,
28681       backward,
28682       bothways
28683     };
28684   }
28685   function parseTurnLanes(tag) {
28686     if (!tag)
28687       return;
28688     var validValues = [
28689       "left",
28690       "slight_left",
28691       "sharp_left",
28692       "through",
28693       "right",
28694       "slight_right",
28695       "sharp_right",
28696       "reverse",
28697       "merge_to_left",
28698       "merge_to_right",
28699       "none"
28700     ];
28701     return tag.split("|").map(function(s2) {
28702       if (s2 === "")
28703         s2 = "none";
28704       return s2.split(";").map(function(d2) {
28705         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
28706       });
28707     });
28708   }
28709   function parseMaxspeedLanes(tag, maxspeed) {
28710     if (!tag)
28711       return;
28712     return tag.split("|").map(function(s2) {
28713       if (s2 === "none")
28714         return s2;
28715       var m2 = parseInt(s2, 10);
28716       if (s2 === "" || m2 === maxspeed)
28717         return null;
28718       return isNaN(m2) ? "unknown" : m2;
28719     });
28720   }
28721   function parseMiscLanes(tag) {
28722     if (!tag)
28723       return;
28724     var validValues = [
28725       "yes",
28726       "no",
28727       "designated"
28728     ];
28729     return tag.split("|").map(function(s2) {
28730       if (s2 === "")
28731         s2 = "no";
28732       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
28733     });
28734   }
28735   function parseBicycleWay(tag) {
28736     if (!tag)
28737       return;
28738     var validValues = [
28739       "yes",
28740       "no",
28741       "designated",
28742       "lane"
28743     ];
28744     return tag.split("|").map(function(s2) {
28745       if (s2 === "")
28746         s2 = "no";
28747       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
28748     });
28749   }
28750   function mapToLanesObj(lanesObj, data, key) {
28751     if (data.forward) {
28752       data.forward.forEach(function(l2, i3) {
28753         if (!lanesObj.forward[i3])
28754           lanesObj.forward[i3] = {};
28755         lanesObj.forward[i3][key] = l2;
28756       });
28757     }
28758     if (data.backward) {
28759       data.backward.forEach(function(l2, i3) {
28760         if (!lanesObj.backward[i3])
28761           lanesObj.backward[i3] = {};
28762         lanesObj.backward[i3][key] = l2;
28763       });
28764     }
28765     if (data.unspecified) {
28766       data.unspecified.forEach(function(l2, i3) {
28767         if (!lanesObj.unspecified[i3])
28768           lanesObj.unspecified[i3] = {};
28769         lanesObj.unspecified[i3][key] = l2;
28770       });
28771     }
28772   }
28773
28774   // modules/osm/way.js
28775   function osmWay() {
28776     if (!(this instanceof osmWay)) {
28777       return new osmWay().initialize(arguments);
28778     } else if (arguments.length) {
28779       this.initialize(arguments);
28780     }
28781   }
28782   osmEntity.way = osmWay;
28783   osmWay.prototype = Object.create(osmEntity.prototype);
28784   Object.assign(osmWay.prototype, {
28785     type: "way",
28786     nodes: [],
28787     copy: function(resolver, copies) {
28788       if (copies[this.id])
28789         return copies[this.id];
28790       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
28791       var nodes = this.nodes.map(function(id2) {
28792         return resolver.entity(id2).copy(resolver, copies).id;
28793       });
28794       copy2 = copy2.update({ nodes });
28795       copies[this.id] = copy2;
28796       return copy2;
28797     },
28798     extent: function(resolver) {
28799       return resolver.transient(this, "extent", function() {
28800         var extent = geoExtent();
28801         for (var i3 = 0; i3 < this.nodes.length; i3++) {
28802           var node = resolver.hasEntity(this.nodes[i3]);
28803           if (node) {
28804             extent._extend(node.extent());
28805           }
28806         }
28807         return extent;
28808       });
28809     },
28810     first: function() {
28811       return this.nodes[0];
28812     },
28813     last: function() {
28814       return this.nodes[this.nodes.length - 1];
28815     },
28816     contains: function(node) {
28817       return this.nodes.indexOf(node) >= 0;
28818     },
28819     affix: function(node) {
28820       if (this.nodes[0] === node)
28821         return "prefix";
28822       if (this.nodes[this.nodes.length - 1] === node)
28823         return "suffix";
28824     },
28825     layer: function() {
28826       if (isFinite(this.tags.layer)) {
28827         return Math.max(-10, Math.min(+this.tags.layer, 10));
28828       }
28829       if (this.tags.covered === "yes")
28830         return -1;
28831       if (this.tags.location === "overground")
28832         return 1;
28833       if (this.tags.location === "underground")
28834         return -1;
28835       if (this.tags.location === "underwater")
28836         return -10;
28837       if (this.tags.power === "line")
28838         return 10;
28839       if (this.tags.power === "minor_line")
28840         return 10;
28841       if (this.tags.aerialway)
28842         return 10;
28843       if (this.tags.bridge)
28844         return 1;
28845       if (this.tags.cutting)
28846         return -1;
28847       if (this.tags.tunnel)
28848         return -1;
28849       if (this.tags.waterway)
28850         return -1;
28851       if (this.tags.man_made === "pipeline")
28852         return -10;
28853       if (this.tags.boundary)
28854         return -10;
28855       return 0;
28856     },
28857     // the approximate width of the line based on its tags except its `width` tag
28858     impliedLineWidthMeters: function() {
28859       var averageWidths = {
28860         highway: {
28861           // width is for single lane
28862           motorway: 5,
28863           motorway_link: 5,
28864           trunk: 4.5,
28865           trunk_link: 4.5,
28866           primary: 4,
28867           secondary: 4,
28868           tertiary: 4,
28869           primary_link: 4,
28870           secondary_link: 4,
28871           tertiary_link: 4,
28872           unclassified: 4,
28873           road: 4,
28874           living_street: 4,
28875           bus_guideway: 4,
28876           pedestrian: 4,
28877           residential: 3.5,
28878           service: 3.5,
28879           track: 3,
28880           cycleway: 2.5,
28881           bridleway: 2,
28882           corridor: 2,
28883           steps: 2,
28884           path: 1.5,
28885           footway: 1.5
28886         },
28887         railway: {
28888           // width includes ties and rail bed, not just track gauge
28889           rail: 2.5,
28890           light_rail: 2.5,
28891           tram: 2.5,
28892           subway: 2.5,
28893           monorail: 2.5,
28894           funicular: 2.5,
28895           disused: 2.5,
28896           preserved: 2.5,
28897           miniature: 1.5,
28898           narrow_gauge: 1.5
28899         },
28900         waterway: {
28901           river: 50,
28902           canal: 25,
28903           stream: 5,
28904           tidal_channel: 5,
28905           fish_pass: 2.5,
28906           drain: 2.5,
28907           ditch: 1.5
28908         }
28909       };
28910       for (var key in averageWidths) {
28911         if (this.tags[key] && averageWidths[key][this.tags[key]]) {
28912           var width = averageWidths[key][this.tags[key]];
28913           if (key === "highway") {
28914             var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
28915             if (!laneCount)
28916               laneCount = this.isOneWay() ? 1 : 2;
28917             return width * laneCount;
28918           }
28919           return width;
28920         }
28921       }
28922       return null;
28923     },
28924     isOneWay: function() {
28925       var values = {
28926         "yes": true,
28927         "1": true,
28928         "-1": true,
28929         "reversible": true,
28930         "alternating": true,
28931         "no": false,
28932         "0": false
28933       };
28934       if (values[this.tags.oneway] !== void 0) {
28935         return values[this.tags.oneway];
28936       }
28937       for (var key in this.tags) {
28938         if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
28939           return true;
28940         }
28941       }
28942       return false;
28943     },
28944     // Some identifier for tag that implies that this way is "sided",
28945     // i.e. the right side is the 'inside' (e.g. the right side of a
28946     // natural=cliff is lower).
28947     sidednessIdentifier: function() {
28948       for (const realKey in this.tags) {
28949         const value = this.tags[realKey];
28950         const key = osmRemoveLifecyclePrefix(realKey);
28951         if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
28952           if (osmRightSideIsInsideTags[key][value] === true) {
28953             return key;
28954           } else {
28955             return osmRightSideIsInsideTags[key][value];
28956           }
28957         }
28958       }
28959       return null;
28960     },
28961     isSided: function() {
28962       if (this.tags.two_sided === "yes") {
28963         return false;
28964       }
28965       return this.sidednessIdentifier() !== null;
28966     },
28967     lanes: function() {
28968       return osmLanes(this);
28969     },
28970     isClosed: function() {
28971       return this.nodes.length > 1 && this.first() === this.last();
28972     },
28973     isConvex: function(resolver) {
28974       if (!this.isClosed() || this.isDegenerate())
28975         return null;
28976       var nodes = utilArrayUniq(resolver.childNodes(this));
28977       var coords = nodes.map(function(n3) {
28978         return n3.loc;
28979       });
28980       var curr = 0;
28981       var prev = 0;
28982       for (var i3 = 0; i3 < coords.length; i3++) {
28983         var o2 = coords[(i3 + 1) % coords.length];
28984         var a2 = coords[i3];
28985         var b2 = coords[(i3 + 2) % coords.length];
28986         var res = geoVecCross(a2, b2, o2);
28987         curr = res > 0 ? 1 : res < 0 ? -1 : 0;
28988         if (curr === 0) {
28989           continue;
28990         } else if (prev && curr !== prev) {
28991           return false;
28992         }
28993         prev = curr;
28994       }
28995       return true;
28996     },
28997     // returns an object with the tag that implies this is an area, if any
28998     tagSuggestingArea: function() {
28999       return osmTagSuggestingArea(this.tags);
29000     },
29001     isArea: function() {
29002       if (this.tags.area === "yes")
29003         return true;
29004       if (!this.isClosed() || this.tags.area === "no")
29005         return false;
29006       return this.tagSuggestingArea() !== null;
29007     },
29008     isDegenerate: function() {
29009       return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
29010     },
29011     areAdjacent: function(n1, n22) {
29012       for (var i3 = 0; i3 < this.nodes.length; i3++) {
29013         if (this.nodes[i3] === n1) {
29014           if (this.nodes[i3 - 1] === n22)
29015             return true;
29016           if (this.nodes[i3 + 1] === n22)
29017             return true;
29018         }
29019       }
29020       return false;
29021     },
29022     geometry: function(graph) {
29023       return graph.transient(this, "geometry", function() {
29024         return this.isArea() ? "area" : "line";
29025       });
29026     },
29027     // returns an array of objects representing the segments between the nodes in this way
29028     segments: function(graph) {
29029       function segmentExtent(graph2) {
29030         var n1 = graph2.hasEntity(this.nodes[0]);
29031         var n22 = graph2.hasEntity(this.nodes[1]);
29032         return n1 && n22 && geoExtent([
29033           [
29034             Math.min(n1.loc[0], n22.loc[0]),
29035             Math.min(n1.loc[1], n22.loc[1])
29036           ],
29037           [
29038             Math.max(n1.loc[0], n22.loc[0]),
29039             Math.max(n1.loc[1], n22.loc[1])
29040           ]
29041         ]);
29042       }
29043       return graph.transient(this, "segments", function() {
29044         var segments = [];
29045         for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
29046           segments.push({
29047             id: this.id + "-" + i3,
29048             wayId: this.id,
29049             index: i3,
29050             nodes: [this.nodes[i3], this.nodes[i3 + 1]],
29051             extent: segmentExtent
29052           });
29053         }
29054         return segments;
29055       });
29056     },
29057     // If this way is not closed, append the beginning node to the end of the nodelist to close it.
29058     close: function() {
29059       if (this.isClosed() || !this.nodes.length)
29060         return this;
29061       var nodes = this.nodes.slice();
29062       nodes = nodes.filter(noRepeatNodes);
29063       nodes.push(nodes[0]);
29064       return this.update({ nodes });
29065     },
29066     // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
29067     unclose: function() {
29068       if (!this.isClosed())
29069         return this;
29070       var nodes = this.nodes.slice();
29071       var connector = this.first();
29072       var i3 = nodes.length - 1;
29073       while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29074         nodes.splice(i3, 1);
29075         i3 = nodes.length - 1;
29076       }
29077       nodes = nodes.filter(noRepeatNodes);
29078       return this.update({ nodes });
29079     },
29080     // Adds a node (id) in front of the node which is currently at position index.
29081     // If index is undefined, the node will be added to the end of the way for linear ways,
29082     //   or just before the final connecting node for circular ways.
29083     // Consecutive duplicates are eliminated including existing ones.
29084     // Circularity is always preserved when adding a node.
29085     addNode: function(id2, index) {
29086       var nodes = this.nodes.slice();
29087       var isClosed = this.isClosed();
29088       var max3 = isClosed ? nodes.length - 1 : nodes.length;
29089       if (index === void 0) {
29090         index = max3;
29091       }
29092       if (index < 0 || index > max3) {
29093         throw new RangeError("index " + index + " out of range 0.." + max3);
29094       }
29095       if (isClosed) {
29096         var connector = this.first();
29097         var i3 = 1;
29098         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29099           nodes.splice(i3, 1);
29100           if (index > i3)
29101             index--;
29102         }
29103         i3 = nodes.length - 1;
29104         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29105           nodes.splice(i3, 1);
29106           if (index > i3)
29107             index--;
29108           i3 = nodes.length - 1;
29109         }
29110       }
29111       nodes.splice(index, 0, id2);
29112       nodes = nodes.filter(noRepeatNodes);
29113       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29114         nodes.push(nodes[0]);
29115       }
29116       return this.update({ nodes });
29117     },
29118     // Replaces the node which is currently at position index with the given node (id).
29119     // Consecutive duplicates are eliminated including existing ones.
29120     // Circularity is preserved when updating a node.
29121     updateNode: function(id2, index) {
29122       var nodes = this.nodes.slice();
29123       var isClosed = this.isClosed();
29124       var max3 = nodes.length - 1;
29125       if (index === void 0 || index < 0 || index > max3) {
29126         throw new RangeError("index " + index + " out of range 0.." + max3);
29127       }
29128       if (isClosed) {
29129         var connector = this.first();
29130         var i3 = 1;
29131         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29132           nodes.splice(i3, 1);
29133           if (index > i3)
29134             index--;
29135         }
29136         i3 = nodes.length - 1;
29137         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29138           nodes.splice(i3, 1);
29139           if (index === i3)
29140             index = 0;
29141           i3 = nodes.length - 1;
29142         }
29143       }
29144       nodes.splice(index, 1, id2);
29145       nodes = nodes.filter(noRepeatNodes);
29146       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29147         nodes.push(nodes[0]);
29148       }
29149       return this.update({ nodes });
29150     },
29151     // Replaces each occurrence of node id needle with replacement.
29152     // Consecutive duplicates are eliminated including existing ones.
29153     // Circularity is preserved.
29154     replaceNode: function(needleID, replacementID) {
29155       var nodes = this.nodes.slice();
29156       var isClosed = this.isClosed();
29157       for (var i3 = 0; i3 < nodes.length; i3++) {
29158         if (nodes[i3] === needleID) {
29159           nodes[i3] = replacementID;
29160         }
29161       }
29162       nodes = nodes.filter(noRepeatNodes);
29163       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29164         nodes.push(nodes[0]);
29165       }
29166       return this.update({ nodes });
29167     },
29168     // Removes each occurrence of node id.
29169     // Consecutive duplicates are eliminated including existing ones.
29170     // Circularity is preserved.
29171     removeNode: function(id2) {
29172       var nodes = this.nodes.slice();
29173       var isClosed = this.isClosed();
29174       nodes = nodes.filter(function(node) {
29175         return node !== id2;
29176       }).filter(noRepeatNodes);
29177       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29178         nodes.push(nodes[0]);
29179       }
29180       return this.update({ nodes });
29181     },
29182     asJXON: function(changeset_id) {
29183       var r2 = {
29184         way: {
29185           "@id": this.osmId(),
29186           "@version": this.version || 0,
29187           nd: this.nodes.map(function(id2) {
29188             return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
29189           }, this),
29190           tag: Object.keys(this.tags).map(function(k2) {
29191             return { keyAttributes: { k: k2, v: this.tags[k2] } };
29192           }, this)
29193         }
29194       };
29195       if (changeset_id) {
29196         r2.way["@changeset"] = changeset_id;
29197       }
29198       return r2;
29199     },
29200     asGeoJSON: function(resolver) {
29201       return resolver.transient(this, "GeoJSON", function() {
29202         var coordinates = resolver.childNodes(this).map(function(n3) {
29203           return n3.loc;
29204         });
29205         if (this.isArea() && this.isClosed()) {
29206           return {
29207             type: "Polygon",
29208             coordinates: [coordinates]
29209           };
29210         } else {
29211           return {
29212             type: "LineString",
29213             coordinates
29214           };
29215         }
29216       });
29217     },
29218     area: function(resolver) {
29219       return resolver.transient(this, "area", function() {
29220         var nodes = resolver.childNodes(this);
29221         var json = {
29222           type: "Polygon",
29223           coordinates: [nodes.map(function(n3) {
29224             return n3.loc;
29225           })]
29226         };
29227         if (!this.isClosed() && nodes.length) {
29228           json.coordinates[0].push(nodes[0].loc);
29229         }
29230         var area = area_default(json);
29231         if (area > 2 * Math.PI) {
29232           json.coordinates[0] = json.coordinates[0].reverse();
29233           area = area_default(json);
29234         }
29235         return isNaN(area) ? 0 : area;
29236       });
29237     }
29238   });
29239   function noRepeatNodes(node, i3, arr) {
29240     return i3 === 0 || node !== arr[i3 - 1];
29241   }
29242
29243   // modules/osm/multipolygon.js
29244   function osmOldMultipolygonOuterMemberOfRelation(entity, graph) {
29245     if (entity.type !== "relation" || !entity.isMultipolygon() || Object.keys(entity.tags).filter(osmIsInterestingTag).length > 1) {
29246       return false;
29247     }
29248     var outerMember;
29249     for (var memberIndex in entity.members) {
29250       var member = entity.members[memberIndex];
29251       if (!member.role || member.role === "outer") {
29252         if (outerMember)
29253           return false;
29254         if (member.type !== "way")
29255           return false;
29256         if (!graph.hasEntity(member.id))
29257           return false;
29258         outerMember = graph.entity(member.id);
29259         if (Object.keys(outerMember.tags).filter(osmIsInterestingTag).length === 0) {
29260           return false;
29261         }
29262       }
29263     }
29264     return outerMember;
29265   }
29266   function osmIsOldMultipolygonOuterMember(entity, graph) {
29267     if (entity.type !== "way" || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) {
29268       return false;
29269     }
29270     var parents = graph.parentRelations(entity);
29271     if (parents.length !== 1)
29272       return false;
29273     var parent = parents[0];
29274     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29275       return false;
29276     }
29277     var members = parent.members, member;
29278     for (var i3 = 0; i3 < members.length; i3++) {
29279       member = members[i3];
29280       if (member.id === entity.id && member.role && member.role !== "outer") {
29281         return false;
29282       }
29283       if (member.id !== entity.id && (!member.role || member.role === "outer")) {
29284         return false;
29285       }
29286     }
29287     return parent;
29288   }
29289   function osmOldMultipolygonOuterMember(entity, graph) {
29290     if (entity.type !== "way")
29291       return false;
29292     var parents = graph.parentRelations(entity);
29293     if (parents.length !== 1)
29294       return false;
29295     var parent = parents[0];
29296     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29297       return false;
29298     }
29299     var members = parent.members, member, outerMember;
29300     for (var i3 = 0; i3 < members.length; i3++) {
29301       member = members[i3];
29302       if (!member.role || member.role === "outer") {
29303         if (outerMember)
29304           return false;
29305         outerMember = member;
29306       }
29307     }
29308     if (!outerMember)
29309       return false;
29310     var outerEntity = graph.hasEntity(outerMember.id);
29311     if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) {
29312       return false;
29313     }
29314     return outerEntity;
29315   }
29316   function osmJoinWays(toJoin, graph) {
29317     function resolve(member) {
29318       return graph.childNodes(graph.entity(member.id));
29319     }
29320     function reverse(item2) {
29321       var action = actionReverse(item2.id, { reverseOneway: true });
29322       sequences.actions.push(action);
29323       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
29324     }
29325     toJoin = toJoin.filter(function(member) {
29326       return member.type === "way" && graph.hasEntity(member.id);
29327     });
29328     var i3;
29329     var joinAsMembers = true;
29330     for (i3 = 0; i3 < toJoin.length; i3++) {
29331       if (toJoin[i3] instanceof osmWay) {
29332         joinAsMembers = false;
29333         break;
29334       }
29335     }
29336     var sequences = [];
29337     sequences.actions = [];
29338     while (toJoin.length) {
29339       var item = toJoin.shift();
29340       var currWays = [item];
29341       var currNodes = resolve(item).slice();
29342       while (toJoin.length) {
29343         var start2 = currNodes[0];
29344         var end = currNodes[currNodes.length - 1];
29345         var fn = null;
29346         var nodes = null;
29347         for (i3 = 0; i3 < toJoin.length; i3++) {
29348           item = toJoin[i3];
29349           nodes = resolve(item);
29350           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
29351             currWays[0] = reverse(currWays[0]);
29352             currNodes.reverse();
29353             start2 = currNodes[0];
29354             end = currNodes[currNodes.length - 1];
29355           }
29356           if (nodes[0] === end) {
29357             fn = currNodes.push;
29358             nodes = nodes.slice(1);
29359             break;
29360           } else if (nodes[nodes.length - 1] === end) {
29361             fn = currNodes.push;
29362             nodes = nodes.slice(0, -1).reverse();
29363             item = reverse(item);
29364             break;
29365           } else if (nodes[nodes.length - 1] === start2) {
29366             fn = currNodes.unshift;
29367             nodes = nodes.slice(0, -1);
29368             break;
29369           } else if (nodes[0] === start2) {
29370             fn = currNodes.unshift;
29371             nodes = nodes.slice(1).reverse();
29372             item = reverse(item);
29373             break;
29374           } else {
29375             fn = nodes = null;
29376           }
29377         }
29378         if (!nodes) {
29379           break;
29380         }
29381         fn.apply(currWays, [item]);
29382         fn.apply(currNodes, nodes);
29383         toJoin.splice(i3, 1);
29384       }
29385       currWays.nodes = currNodes;
29386       sequences.push(currWays);
29387     }
29388     return sequences;
29389   }
29390
29391   // modules/actions/add_member.js
29392   function actionAddMember(relationId, member, memberIndex, insertPair) {
29393     return function action(graph) {
29394       var relation = graph.entity(relationId);
29395       var isPTv2 = /stop|platform/.test(member.role);
29396       if ((isNaN(memberIndex) || insertPair) && member.type === "way" && !isPTv2) {
29397         graph = addWayMember(relation, graph);
29398       } else {
29399         if (isPTv2 && isNaN(memberIndex)) {
29400           memberIndex = 0;
29401         }
29402         graph = graph.replace(relation.addMember(member, memberIndex));
29403       }
29404       return graph;
29405     };
29406     function addWayMember(relation, graph) {
29407       var groups, tempWay, insertPairIsReversed, item, i3, j3, k2;
29408       var PTv2members = [];
29409       var members = [];
29410       for (i3 = 0; i3 < relation.members.length; i3++) {
29411         var m2 = relation.members[i3];
29412         if (/stop|platform/.test(m2.role)) {
29413           PTv2members.push(m2);
29414         } else {
29415           members.push(m2);
29416         }
29417       }
29418       relation = relation.update({ members });
29419       if (insertPair) {
29420         tempWay = osmWay({ id: "wTemp", nodes: insertPair.nodes });
29421         graph = graph.replace(tempWay);
29422         var tempMember = { id: tempWay.id, type: "way", role: member.role };
29423         var tempRelation = relation.replaceMember({ id: insertPair.originalID }, tempMember, true);
29424         groups = utilArrayGroupBy(tempRelation.members, "type");
29425         groups.way = groups.way || [];
29426         var originalWay = graph.entity(insertPair.originalID);
29427         var insertedWay = graph.entity(insertPair.insertedID);
29428         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];
29429       } else {
29430         groups = utilArrayGroupBy(relation.members, "type");
29431         groups.way = groups.way || [];
29432         groups.way.push(member);
29433       }
29434       members = withIndex(groups.way);
29435       var joined = osmJoinWays(members, graph);
29436       for (i3 = 0; i3 < joined.length; i3++) {
29437         var segment = joined[i3];
29438         var nodes = segment.nodes.slice();
29439         var startIndex = segment[0].index;
29440         for (j3 = 0; j3 < members.length; j3++) {
29441           if (members[j3].index === startIndex) {
29442             break;
29443           }
29444         }
29445         for (k2 = 0; k2 < segment.length; k2++) {
29446           item = segment[k2];
29447           var way = graph.entity(item.id);
29448           if (tempWay && item.id === tempWay.id) {
29449             var reverse = nodes[0].id !== insertPair.nodes[0] ^ insertPairIsReversed;
29450             if (reverse) {
29451               item.pair = [
29452                 { id: insertPair.insertedID, type: "way", role: item.role },
29453                 { id: insertPair.originalID, type: "way", role: item.role }
29454               ];
29455             } else {
29456               item.pair = [
29457                 { id: insertPair.originalID, type: "way", role: item.role },
29458                 { id: insertPair.insertedID, type: "way", role: item.role }
29459               ];
29460             }
29461           }
29462           if (k2 > 0) {
29463             if (j3 + k2 >= members.length || item.index !== members[j3 + k2].index) {
29464               moveMember(members, item.index, j3 + k2);
29465             }
29466           }
29467           nodes.splice(0, way.nodes.length - 1);
29468         }
29469       }
29470       if (tempWay) {
29471         graph = graph.remove(tempWay);
29472       }
29473       var wayMembers = [];
29474       for (i3 = 0; i3 < members.length; i3++) {
29475         item = members[i3];
29476         if (item.index === -1)
29477           continue;
29478         if (item.pair) {
29479           wayMembers.push(item.pair[0]);
29480           wayMembers.push(item.pair[1]);
29481         } else {
29482           wayMembers.push(utilObjectOmit(item, ["index"]));
29483         }
29484       }
29485       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
29486       return graph.replace(relation.update({ members: newMembers }));
29487       function moveMember(arr, findIndex, toIndex) {
29488         var i4;
29489         for (i4 = 0; i4 < arr.length; i4++) {
29490           if (arr[i4].index === findIndex) {
29491             break;
29492           }
29493         }
29494         var item2 = Object.assign({}, arr[i4]);
29495         arr[i4].index = -1;
29496         item2.index = toIndex;
29497         arr.splice(toIndex, 0, item2);
29498       }
29499       function withIndex(arr) {
29500         var result = new Array(arr.length);
29501         for (var i4 = 0; i4 < arr.length; i4++) {
29502           result[i4] = Object.assign({}, arr[i4]);
29503           result[i4].index = i4;
29504         }
29505         return result;
29506       }
29507     }
29508   }
29509
29510   // modules/actions/add_midpoint.js
29511   function actionAddMidpoint(midpoint, node) {
29512     return function(graph) {
29513       graph = graph.replace(node.move(midpoint.loc));
29514       var parents = utilArrayIntersection(
29515         graph.parentWays(graph.entity(midpoint.edge[0])),
29516         graph.parentWays(graph.entity(midpoint.edge[1]))
29517       );
29518       parents.forEach(function(way) {
29519         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
29520           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
29521             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
29522             return;
29523           }
29524         }
29525       });
29526       return graph;
29527     };
29528   }
29529
29530   // modules/actions/add_vertex.js
29531   function actionAddVertex(wayId, nodeId, index) {
29532     return function(graph) {
29533       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
29534     };
29535   }
29536
29537   // modules/actions/change_member.js
29538   function actionChangeMember(relationId, member, memberIndex) {
29539     return function(graph) {
29540       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
29541     };
29542   }
29543
29544   // modules/actions/change_preset.js
29545   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
29546     return function action(graph) {
29547       var entity = graph.entity(entityID);
29548       var geometry = entity.geometry(graph);
29549       var tags = entity.tags;
29550       const loc = entity.extent(graph).center();
29551       var preserveKeys;
29552       if (newPreset) {
29553         preserveKeys = [];
29554         if (newPreset.addTags) {
29555           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
29556         }
29557         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
29558           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f3) => f3.matchGeometry(geometry)).map((f3) => f3.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
29559         }
29560       }
29561       if (oldPreset)
29562         tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
29563       if (newPreset)
29564         tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
29565       return graph.replace(entity.update({ tags }));
29566     };
29567   }
29568
29569   // modules/actions/change_tags.js
29570   function actionChangeTags(entityId, tags) {
29571     return function(graph) {
29572       var entity = graph.entity(entityId);
29573       return graph.replace(entity.update({ tags }));
29574     };
29575   }
29576
29577   // modules/osm/node.js
29578   var cardinal = {
29579     north: 0,
29580     n: 0,
29581     northnortheast: 22,
29582     nne: 22,
29583     northeast: 45,
29584     ne: 45,
29585     eastnortheast: 67,
29586     ene: 67,
29587     east: 90,
29588     e: 90,
29589     eastsoutheast: 112,
29590     ese: 112,
29591     southeast: 135,
29592     se: 135,
29593     southsoutheast: 157,
29594     sse: 157,
29595     south: 180,
29596     s: 180,
29597     southsouthwest: 202,
29598     ssw: 202,
29599     southwest: 225,
29600     sw: 225,
29601     westsouthwest: 247,
29602     wsw: 247,
29603     west: 270,
29604     w: 270,
29605     westnorthwest: 292,
29606     wnw: 292,
29607     northwest: 315,
29608     nw: 315,
29609     northnorthwest: 337,
29610     nnw: 337
29611   };
29612   function osmNode() {
29613     if (!(this instanceof osmNode)) {
29614       return new osmNode().initialize(arguments);
29615     } else if (arguments.length) {
29616       this.initialize(arguments);
29617     }
29618   }
29619   osmEntity.node = osmNode;
29620   osmNode.prototype = Object.create(osmEntity.prototype);
29621   Object.assign(osmNode.prototype, {
29622     type: "node",
29623     loc: [9999, 9999],
29624     extent: function() {
29625       return new geoExtent(this.loc);
29626     },
29627     geometry: function(graph) {
29628       return graph.transient(this, "geometry", function() {
29629         return graph.isPoi(this) ? "point" : "vertex";
29630       });
29631     },
29632     move: function(loc) {
29633       return this.update({ loc });
29634     },
29635     isDegenerate: function() {
29636       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);
29637     },
29638     // Inspect tags and geometry to determine which direction(s) this node/vertex points
29639     directions: function(resolver, projection2) {
29640       var val;
29641       var i3;
29642       if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
29643         val = "all";
29644       } else {
29645         val = (this.tags.direction || "").toLowerCase();
29646         var re3 = /:direction$/i;
29647         var keys2 = Object.keys(this.tags);
29648         for (i3 = 0; i3 < keys2.length; i3++) {
29649           if (re3.test(keys2[i3])) {
29650             val = this.tags[keys2[i3]].toLowerCase();
29651             break;
29652           }
29653         }
29654       }
29655       if (val === "")
29656         return [];
29657       var values = val.split(";");
29658       var results = [];
29659       values.forEach(function(v2) {
29660         if (cardinal[v2] !== void 0) {
29661           v2 = cardinal[v2];
29662         }
29663         if (v2 !== "" && !isNaN(+v2)) {
29664           results.push(+v2);
29665           return;
29666         }
29667         var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
29668         var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
29669         if (!lookForward && !lookBackward)
29670           return;
29671         var nodeIds = {};
29672         resolver.parentWays(this).forEach(function(parent) {
29673           var nodes = parent.nodes;
29674           for (i3 = 0; i3 < nodes.length; i3++) {
29675             if (nodes[i3] === this.id) {
29676               if (lookForward && i3 > 0) {
29677                 nodeIds[nodes[i3 - 1]] = true;
29678               }
29679               if (lookBackward && i3 < nodes.length - 1) {
29680                 nodeIds[nodes[i3 + 1]] = true;
29681               }
29682             }
29683           }
29684         }, this);
29685         Object.keys(nodeIds).forEach(function(nodeId) {
29686           results.push(
29687             geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
29688           );
29689         }, this);
29690       }, this);
29691       return utilArrayUniq(results);
29692     },
29693     isCrossing: function() {
29694       return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
29695     },
29696     isEndpoint: function(resolver) {
29697       return resolver.transient(this, "isEndpoint", function() {
29698         var id2 = this.id;
29699         return resolver.parentWays(this).filter(function(parent) {
29700           return !parent.isClosed() && !!parent.affix(id2);
29701         }).length > 0;
29702       });
29703     },
29704     isConnected: function(resolver) {
29705       return resolver.transient(this, "isConnected", function() {
29706         var parents = resolver.parentWays(this);
29707         if (parents.length > 1) {
29708           for (var i3 in parents) {
29709             if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags())
29710               return true;
29711           }
29712         } else if (parents.length === 1) {
29713           var way = parents[0];
29714           var nodes = way.nodes.slice();
29715           if (way.isClosed()) {
29716             nodes.pop();
29717           }
29718           return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
29719         }
29720         return false;
29721       });
29722     },
29723     parentIntersectionWays: function(resolver) {
29724       return resolver.transient(this, "parentIntersectionWays", function() {
29725         return resolver.parentWays(this).filter(function(parent) {
29726           return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
29727         });
29728       });
29729     },
29730     isIntersection: function(resolver) {
29731       return this.parentIntersectionWays(resolver).length > 1;
29732     },
29733     isHighwayIntersection: function(resolver) {
29734       return resolver.transient(this, "isHighwayIntersection", function() {
29735         return resolver.parentWays(this).filter(function(parent) {
29736           return parent.tags.highway && parent.geometry(resolver) === "line";
29737         }).length > 1;
29738       });
29739     },
29740     isOnAddressLine: function(resolver) {
29741       return resolver.transient(this, "isOnAddressLine", function() {
29742         return resolver.parentWays(this).filter(function(parent) {
29743           return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
29744         }).length > 0;
29745       });
29746     },
29747     asJXON: function(changeset_id) {
29748       var r2 = {
29749         node: {
29750           "@id": this.osmId(),
29751           "@lon": this.loc[0],
29752           "@lat": this.loc[1],
29753           "@version": this.version || 0,
29754           tag: Object.keys(this.tags).map(function(k2) {
29755             return { keyAttributes: { k: k2, v: this.tags[k2] } };
29756           }, this)
29757         }
29758       };
29759       if (changeset_id)
29760         r2.node["@changeset"] = changeset_id;
29761       return r2;
29762     },
29763     asGeoJSON: function() {
29764       return {
29765         type: "Point",
29766         coordinates: this.loc
29767       };
29768     }
29769   });
29770
29771   // modules/actions/circularize.js
29772   function actionCircularize(wayId, projection2, maxAngle) {
29773     maxAngle = (maxAngle || 20) * Math.PI / 180;
29774     var action = function(graph, t2) {
29775       if (t2 === null || !isFinite(t2))
29776         t2 = 1;
29777       t2 = Math.min(Math.max(+t2, 0), 1);
29778       var way = graph.entity(wayId);
29779       var origNodes = {};
29780       graph.childNodes(way).forEach(function(node2) {
29781         if (!origNodes[node2.id])
29782           origNodes[node2.id] = node2;
29783       });
29784       if (!way.isConvex(graph)) {
29785         graph = action.makeConvex(graph);
29786       }
29787       var nodes = utilArrayUniq(graph.childNodes(way));
29788       var keyNodes = nodes.filter(function(n3) {
29789         return graph.parentWays(n3).length !== 1;
29790       });
29791       var points = nodes.map(function(n3) {
29792         return projection2(n3.loc);
29793       });
29794       var keyPoints = keyNodes.map(function(n3) {
29795         return projection2(n3.loc);
29796       });
29797       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
29798       var radius = median(points, function(p2) {
29799         return geoVecLength(centroid, p2);
29800       });
29801       var sign2 = area_default3(points) > 0 ? 1 : -1;
29802       var ids, i3, j3, k2;
29803       if (!keyNodes.length) {
29804         keyNodes = [nodes[0]];
29805         keyPoints = [points[0]];
29806       }
29807       if (keyNodes.length === 1) {
29808         var index = nodes.indexOf(keyNodes[0]);
29809         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
29810         keyNodes.push(nodes[oppositeIndex]);
29811         keyPoints.push(points[oppositeIndex]);
29812       }
29813       for (i3 = 0; i3 < keyPoints.length; i3++) {
29814         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
29815         var startNode = keyNodes[i3];
29816         var endNode = keyNodes[nextKeyNodeIndex];
29817         var startNodeIndex = nodes.indexOf(startNode);
29818         var endNodeIndex = nodes.indexOf(endNode);
29819         var numberNewPoints = -1;
29820         var indexRange = endNodeIndex - startNodeIndex;
29821         var nearNodes = {};
29822         var inBetweenNodes = [];
29823         var startAngle, endAngle, totalAngle, eachAngle;
29824         var angle2, loc, node, origNode;
29825         if (indexRange < 0) {
29826           indexRange += nodes.length;
29827         }
29828         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
29829         keyPoints[i3] = [
29830           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
29831           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
29832         ];
29833         loc = projection2.invert(keyPoints[i3]);
29834         node = keyNodes[i3];
29835         origNode = origNodes[node.id];
29836         node = node.move(geoVecInterp(origNode.loc, loc, t2));
29837         graph = graph.replace(node);
29838         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
29839         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
29840         totalAngle = endAngle - startAngle;
29841         if (totalAngle * sign2 > 0) {
29842           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
29843         }
29844         do {
29845           numberNewPoints++;
29846           eachAngle = totalAngle / (indexRange + numberNewPoints);
29847         } while (Math.abs(eachAngle) > maxAngle);
29848         for (j3 = 1; j3 < indexRange; j3++) {
29849           angle2 = startAngle + j3 * eachAngle;
29850           loc = projection2.invert([
29851             centroid[0] + Math.cos(angle2) * radius,
29852             centroid[1] + Math.sin(angle2) * radius
29853           ]);
29854           node = nodes[(j3 + startNodeIndex) % nodes.length];
29855           origNode = origNodes[node.id];
29856           nearNodes[node.id] = angle2;
29857           node = node.move(geoVecInterp(origNode.loc, loc, t2));
29858           graph = graph.replace(node);
29859         }
29860         for (j3 = 0; j3 < numberNewPoints; j3++) {
29861           angle2 = startAngle + (indexRange + j3) * eachAngle;
29862           loc = projection2.invert([
29863             centroid[0] + Math.cos(angle2) * radius,
29864             centroid[1] + Math.sin(angle2) * radius
29865           ]);
29866           var min3 = Infinity;
29867           for (var nodeId in nearNodes) {
29868             var nearAngle = nearNodes[nodeId];
29869             var dist = Math.abs(nearAngle - angle2);
29870             if (dist < min3) {
29871               min3 = dist;
29872               origNode = origNodes[nodeId];
29873             }
29874           }
29875           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
29876           graph = graph.replace(node);
29877           nodes.splice(endNodeIndex + j3, 0, node);
29878           inBetweenNodes.push(node.id);
29879         }
29880         if (indexRange === 1 && inBetweenNodes.length) {
29881           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
29882           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
29883           var wayDirection1 = endIndex1 - startIndex1;
29884           if (wayDirection1 < -1) {
29885             wayDirection1 = 1;
29886           }
29887           var parentWays = graph.parentWays(keyNodes[i3]);
29888           for (j3 = 0; j3 < parentWays.length; j3++) {
29889             var sharedWay = parentWays[j3];
29890             if (sharedWay === way)
29891               continue;
29892             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
29893               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
29894               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
29895               var wayDirection2 = endIndex2 - startIndex2;
29896               var insertAt = endIndex2;
29897               if (wayDirection2 < -1) {
29898                 wayDirection2 = 1;
29899               }
29900               if (wayDirection1 !== wayDirection2) {
29901                 inBetweenNodes.reverse();
29902                 insertAt = startIndex2;
29903               }
29904               for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
29905                 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
29906               }
29907               graph = graph.replace(sharedWay);
29908             }
29909           }
29910         }
29911       }
29912       ids = nodes.map(function(n3) {
29913         return n3.id;
29914       });
29915       ids.push(ids[0]);
29916       way = way.update({ nodes: ids });
29917       graph = graph.replace(way);
29918       return graph;
29919     };
29920     action.makeConvex = function(graph) {
29921       var way = graph.entity(wayId);
29922       var nodes = utilArrayUniq(graph.childNodes(way));
29923       var points = nodes.map(function(n3) {
29924         return projection2(n3.loc);
29925       });
29926       var sign2 = area_default3(points) > 0 ? 1 : -1;
29927       var hull = hull_default(points);
29928       var i3, j3;
29929       if (sign2 === -1) {
29930         nodes.reverse();
29931         points.reverse();
29932       }
29933       for (i3 = 0; i3 < hull.length - 1; i3++) {
29934         var startIndex = points.indexOf(hull[i3]);
29935         var endIndex = points.indexOf(hull[i3 + 1]);
29936         var indexRange = endIndex - startIndex;
29937         if (indexRange < 0) {
29938           indexRange += nodes.length;
29939         }
29940         for (j3 = 1; j3 < indexRange; j3++) {
29941           var point2 = geoVecInterp(hull[i3], hull[i3 + 1], j3 / indexRange);
29942           var node = nodes[(j3 + startIndex) % nodes.length].move(projection2.invert(point2));
29943           graph = graph.replace(node);
29944         }
29945       }
29946       return graph;
29947     };
29948     action.disabled = function(graph) {
29949       if (!graph.entity(wayId).isClosed()) {
29950         return "not_closed";
29951       }
29952       var way = graph.entity(wayId);
29953       var nodes = utilArrayUniq(graph.childNodes(way));
29954       var points = nodes.map(function(n3) {
29955         return projection2(n3.loc);
29956       });
29957       var hull = hull_default(points);
29958       var epsilonAngle = Math.PI / 180;
29959       if (hull.length !== points.length || hull.length < 3) {
29960         return false;
29961       }
29962       var centroid = centroid_default2(points);
29963       var radius = geoVecLengthSquare(centroid, points[0]);
29964       var i3, actualPoint;
29965       for (i3 = 0; i3 < hull.length; i3++) {
29966         actualPoint = hull[i3];
29967         var actualDist = geoVecLengthSquare(actualPoint, centroid);
29968         var diff = Math.abs(actualDist - radius);
29969         if (diff > 0.05 * radius) {
29970           return false;
29971         }
29972       }
29973       for (i3 = 0; i3 < hull.length; i3++) {
29974         actualPoint = hull[i3];
29975         var nextPoint = hull[(i3 + 1) % hull.length];
29976         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
29977         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
29978         var angle2 = endAngle - startAngle;
29979         if (angle2 < 0) {
29980           angle2 = -angle2;
29981         }
29982         if (angle2 > Math.PI) {
29983           angle2 = 2 * Math.PI - angle2;
29984         }
29985         if (angle2 > maxAngle + epsilonAngle) {
29986           return false;
29987         }
29988       }
29989       return "already_circular";
29990     };
29991     action.transitionable = true;
29992     return action;
29993   }
29994
29995   // modules/actions/delete_way.js
29996   function actionDeleteWay(wayID) {
29997     function canDeleteNode(node, graph) {
29998       if (graph.parentWays(node).length || graph.parentRelations(node).length)
29999         return false;
30000       var geometries = osmNodeGeometriesForTags(node.tags);
30001       if (geometries.point)
30002         return false;
30003       if (geometries.vertex)
30004         return true;
30005       return !node.hasInterestingTags();
30006     }
30007     var action = function(graph) {
30008       var way = graph.entity(wayID);
30009       graph.parentRelations(way).forEach(function(parent) {
30010         parent = parent.removeMembersWithID(wayID);
30011         graph = graph.replace(parent);
30012         if (parent.isDegenerate()) {
30013           graph = actionDeleteRelation(parent.id)(graph);
30014         }
30015       });
30016       new Set(way.nodes).forEach(function(nodeID) {
30017         graph = graph.replace(way.removeNode(nodeID));
30018         var node = graph.entity(nodeID);
30019         if (canDeleteNode(node, graph)) {
30020           graph = graph.remove(node);
30021         }
30022       });
30023       return graph.remove(way);
30024     };
30025     return action;
30026   }
30027
30028   // modules/actions/delete_multiple.js
30029   function actionDeleteMultiple(ids) {
30030     var actions = {
30031       way: actionDeleteWay,
30032       node: actionDeleteNode,
30033       relation: actionDeleteRelation
30034     };
30035     var action = function(graph) {
30036       ids.forEach(function(id2) {
30037         if (graph.hasEntity(id2)) {
30038           graph = actions[graph.entity(id2).type](id2)(graph);
30039         }
30040       });
30041       return graph;
30042     };
30043     return action;
30044   }
30045
30046   // modules/actions/delete_relation.js
30047   function actionDeleteRelation(relationID, allowUntaggedMembers) {
30048     function canDeleteEntity(entity, graph) {
30049       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
30050     }
30051     var action = function(graph) {
30052       var relation = graph.entity(relationID);
30053       graph.parentRelations(relation).forEach(function(parent) {
30054         parent = parent.removeMembersWithID(relationID);
30055         graph = graph.replace(parent);
30056         if (parent.isDegenerate()) {
30057           graph = actionDeleteRelation(parent.id)(graph);
30058         }
30059       });
30060       var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
30061         return m2.id;
30062       }));
30063       memberIDs.forEach(function(memberID) {
30064         graph = graph.replace(relation.removeMembersWithID(memberID));
30065         var entity = graph.entity(memberID);
30066         if (canDeleteEntity(entity, graph)) {
30067           graph = actionDeleteMultiple([memberID])(graph);
30068         }
30069       });
30070       return graph.remove(relation);
30071     };
30072     return action;
30073   }
30074
30075   // modules/actions/delete_node.js
30076   function actionDeleteNode(nodeId) {
30077     var action = function(graph) {
30078       var node = graph.entity(nodeId);
30079       graph.parentWays(node).forEach(function(parent) {
30080         parent = parent.removeNode(nodeId);
30081         graph = graph.replace(parent);
30082         if (parent.isDegenerate()) {
30083           graph = actionDeleteWay(parent.id)(graph);
30084         }
30085       });
30086       graph.parentRelations(node).forEach(function(parent) {
30087         parent = parent.removeMembersWithID(nodeId);
30088         graph = graph.replace(parent);
30089         if (parent.isDegenerate()) {
30090           graph = actionDeleteRelation(parent.id)(graph);
30091         }
30092       });
30093       return graph.remove(node);
30094     };
30095     return action;
30096   }
30097
30098   // modules/actions/connect.js
30099   function actionConnect(nodeIDs) {
30100     var action = function(graph) {
30101       var survivor;
30102       var node;
30103       var parents;
30104       var i3, j3;
30105       nodeIDs.reverse();
30106       var interestingIDs = [];
30107       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30108         node = graph.entity(nodeIDs[i3]);
30109         if (node.hasInterestingTags()) {
30110           if (!node.isNew()) {
30111             interestingIDs.push(node.id);
30112           }
30113         }
30114       }
30115       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
30116       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30117         node = graph.entity(nodeIDs[i3]);
30118         if (node.id === survivor.id)
30119           continue;
30120         parents = graph.parentWays(node);
30121         for (j3 = 0; j3 < parents.length; j3++) {
30122           graph = graph.replace(parents[j3].replaceNode(node.id, survivor.id));
30123         }
30124         parents = graph.parentRelations(node);
30125         for (j3 = 0; j3 < parents.length; j3++) {
30126           graph = graph.replace(parents[j3].replaceMember(node, survivor));
30127         }
30128         survivor = survivor.mergeTags(node.tags);
30129         graph = actionDeleteNode(node.id)(graph);
30130       }
30131       graph = graph.replace(survivor);
30132       parents = graph.parentWays(survivor);
30133       for (i3 = 0; i3 < parents.length; i3++) {
30134         if (parents[i3].isDegenerate()) {
30135           graph = actionDeleteWay(parents[i3].id)(graph);
30136         }
30137       }
30138       return graph;
30139     };
30140     action.disabled = function(graph) {
30141       var seen = {};
30142       var restrictionIDs = [];
30143       var survivor;
30144       var node, way;
30145       var relations, relation, role;
30146       var i3, j3, k2;
30147       survivor = graph.entity(utilOldestID(nodeIDs));
30148       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30149         node = graph.entity(nodeIDs[i3]);
30150         relations = graph.parentRelations(node);
30151         for (j3 = 0; j3 < relations.length; j3++) {
30152           relation = relations[j3];
30153           role = relation.memberById(node.id).role || "";
30154           if (relation.hasFromViaTo()) {
30155             restrictionIDs.push(relation.id);
30156           }
30157           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
30158             return "relation";
30159           } else {
30160             seen[relation.id] = role;
30161           }
30162         }
30163       }
30164       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30165         node = graph.entity(nodeIDs[i3]);
30166         var parents = graph.parentWays(node);
30167         for (j3 = 0; j3 < parents.length; j3++) {
30168           var parent = parents[j3];
30169           relations = graph.parentRelations(parent);
30170           for (k2 = 0; k2 < relations.length; k2++) {
30171             relation = relations[k2];
30172             if (relation.hasFromViaTo()) {
30173               restrictionIDs.push(relation.id);
30174             }
30175           }
30176         }
30177       }
30178       restrictionIDs = utilArrayUniq(restrictionIDs);
30179       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
30180         relation = graph.entity(restrictionIDs[i3]);
30181         if (!relation.isComplete(graph))
30182           continue;
30183         var memberWays = relation.members.filter(function(m2) {
30184           return m2.type === "way";
30185         }).map(function(m2) {
30186           return graph.entity(m2.id);
30187         });
30188         memberWays = utilArrayUniq(memberWays);
30189         var f3 = relation.memberByRole("from");
30190         var t2 = relation.memberByRole("to");
30191         var isUturn = f3.id === t2.id;
30192         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
30193         for (j3 = 0; j3 < relation.members.length; j3++) {
30194           collectNodes(relation.members[j3], nodes);
30195         }
30196         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
30197         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
30198         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
30199         nodes.from = nodes.from.filter(filter2);
30200         nodes.via = nodes.via.filter(filter2);
30201         nodes.to = nodes.to.filter(filter2);
30202         var connectFrom = false;
30203         var connectVia = false;
30204         var connectTo = false;
30205         var connectKeyFrom = false;
30206         var connectKeyTo = false;
30207         for (j3 = 0; j3 < nodeIDs.length; j3++) {
30208           var n3 = nodeIDs[j3];
30209           if (nodes.from.indexOf(n3) !== -1) {
30210             connectFrom = true;
30211           }
30212           if (nodes.via.indexOf(n3) !== -1) {
30213             connectVia = true;
30214           }
30215           if (nodes.to.indexOf(n3) !== -1) {
30216             connectTo = true;
30217           }
30218           if (nodes.keyfrom.indexOf(n3) !== -1) {
30219             connectKeyFrom = true;
30220           }
30221           if (nodes.keyto.indexOf(n3) !== -1) {
30222             connectKeyTo = true;
30223           }
30224         }
30225         if (connectFrom && connectTo && !isUturn) {
30226           return "restriction";
30227         }
30228         if (connectFrom && connectVia) {
30229           return "restriction";
30230         }
30231         if (connectTo && connectVia) {
30232           return "restriction";
30233         }
30234         if (connectKeyFrom || connectKeyTo) {
30235           if (nodeIDs.length !== 2) {
30236             return "restriction";
30237           }
30238           var n0 = null;
30239           var n1 = null;
30240           for (j3 = 0; j3 < memberWays.length; j3++) {
30241             way = memberWays[j3];
30242             if (way.contains(nodeIDs[0])) {
30243               n0 = nodeIDs[0];
30244             }
30245             if (way.contains(nodeIDs[1])) {
30246               n1 = nodeIDs[1];
30247             }
30248           }
30249           if (n0 && n1) {
30250             var ok = false;
30251             for (j3 = 0; j3 < memberWays.length; j3++) {
30252               way = memberWays[j3];
30253               if (way.areAdjacent(n0, n1)) {
30254                 ok = true;
30255                 break;
30256               }
30257             }
30258             if (!ok) {
30259               return "restriction";
30260             }
30261           }
30262         }
30263         for (j3 = 0; j3 < memberWays.length; j3++) {
30264           way = memberWays[j3].update({});
30265           for (k2 = 0; k2 < nodeIDs.length; k2++) {
30266             if (nodeIDs[k2] === survivor.id)
30267               continue;
30268             if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
30269               way = way.removeNode(nodeIDs[k2]);
30270             } else {
30271               way = way.replaceNode(nodeIDs[k2], survivor.id);
30272             }
30273           }
30274           if (way.isDegenerate()) {
30275             return "restriction";
30276           }
30277         }
30278       }
30279       return false;
30280       function hasDuplicates(n4, i4, arr) {
30281         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
30282       }
30283       function keyNodeFilter(froms, tos) {
30284         return function(n4) {
30285           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
30286         };
30287       }
30288       function collectNodes(member, collection) {
30289         var entity = graph.hasEntity(member.id);
30290         if (!entity)
30291           return;
30292         var role2 = member.role || "";
30293         if (!collection[role2]) {
30294           collection[role2] = [];
30295         }
30296         if (member.type === "node") {
30297           collection[role2].push(member.id);
30298           if (role2 === "via") {
30299             collection.keyfrom.push(member.id);
30300             collection.keyto.push(member.id);
30301           }
30302         } else if (member.type === "way") {
30303           collection[role2].push.apply(collection[role2], entity.nodes);
30304           if (role2 === "from" || role2 === "via") {
30305             collection.keyfrom.push(entity.first());
30306             collection.keyfrom.push(entity.last());
30307           }
30308           if (role2 === "to" || role2 === "via") {
30309             collection.keyto.push(entity.first());
30310             collection.keyto.push(entity.last());
30311           }
30312         }
30313       }
30314     };
30315     return action;
30316   }
30317
30318   // modules/actions/copy_entities.js
30319   function actionCopyEntities(ids, fromGraph) {
30320     var _copies = {};
30321     var action = function(graph) {
30322       ids.forEach(function(id3) {
30323         fromGraph.entity(id3).copy(fromGraph, _copies);
30324       });
30325       for (var id2 in _copies) {
30326         graph = graph.replace(_copies[id2]);
30327       }
30328       return graph;
30329     };
30330     action.copies = function() {
30331       return _copies;
30332     };
30333     return action;
30334   }
30335
30336   // modules/actions/delete_member.js
30337   function actionDeleteMember(relationId, memberIndex) {
30338     return function(graph) {
30339       var relation = graph.entity(relationId).removeMember(memberIndex);
30340       graph = graph.replace(relation);
30341       if (relation.isDegenerate()) {
30342         graph = actionDeleteRelation(relation.id)(graph);
30343       }
30344       return graph;
30345     };
30346   }
30347
30348   // modules/actions/discard_tags.js
30349   function actionDiscardTags(difference, discardTags) {
30350     discardTags = discardTags || {};
30351     return (graph) => {
30352       difference.modified().forEach(checkTags);
30353       difference.created().forEach(checkTags);
30354       return graph;
30355       function checkTags(entity) {
30356         const keys2 = Object.keys(entity.tags);
30357         let didDiscard = false;
30358         let tags = {};
30359         for (let i3 = 0; i3 < keys2.length; i3++) {
30360           const k2 = keys2[i3];
30361           if (discardTags[k2] || !entity.tags[k2]) {
30362             didDiscard = true;
30363           } else {
30364             tags[k2] = entity.tags[k2];
30365           }
30366         }
30367         if (didDiscard) {
30368           graph = graph.replace(entity.update({ tags }));
30369         }
30370       }
30371     };
30372   }
30373
30374   // modules/actions/disconnect.js
30375   function actionDisconnect(nodeId, newNodeId) {
30376     var wayIds;
30377     var disconnectableRelationTypes = {
30378       "associatedStreet": true,
30379       "enforcement": true,
30380       "site": true
30381     };
30382     var action = function(graph) {
30383       var node = graph.entity(nodeId);
30384       var connections = action.connections(graph);
30385       connections.forEach(function(connection) {
30386         var way = graph.entity(connection.wayID);
30387         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
30388         graph = graph.replace(newNode);
30389         if (connection.index === 0 && way.isArea()) {
30390           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
30391         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
30392           graph = graph.replace(way.unclose().addNode(newNode.id));
30393         } else {
30394           graph = graph.replace(way.updateNode(newNode.id, connection.index));
30395         }
30396       });
30397       return graph;
30398     };
30399     action.connections = function(graph) {
30400       var candidates = [];
30401       var keeping = false;
30402       var parentWays = graph.parentWays(graph.entity(nodeId));
30403       var way, waynode;
30404       for (var i3 = 0; i3 < parentWays.length; i3++) {
30405         way = parentWays[i3];
30406         if (wayIds && wayIds.indexOf(way.id) === -1) {
30407           keeping = true;
30408           continue;
30409         }
30410         if (way.isArea() && way.nodes[0] === nodeId) {
30411           candidates.push({ wayID: way.id, index: 0 });
30412         } else {
30413           for (var j3 = 0; j3 < way.nodes.length; j3++) {
30414             waynode = way.nodes[j3];
30415             if (waynode === nodeId) {
30416               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j3 === way.nodes.length - 1) {
30417                 continue;
30418               }
30419               candidates.push({ wayID: way.id, index: j3 });
30420             }
30421           }
30422         }
30423       }
30424       return keeping ? candidates : candidates.slice(1);
30425     };
30426     action.disabled = function(graph) {
30427       var connections = action.connections(graph);
30428       if (connections.length === 0)
30429         return "not_connected";
30430       var parentWays = graph.parentWays(graph.entity(nodeId));
30431       var seenRelationIds = {};
30432       var sharedRelation;
30433       parentWays.forEach(function(way) {
30434         var relations = graph.parentRelations(way);
30435         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
30436           if (relation.id in seenRelationIds) {
30437             if (wayIds) {
30438               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
30439                 sharedRelation = relation;
30440               }
30441             } else {
30442               sharedRelation = relation;
30443             }
30444           } else {
30445             seenRelationIds[relation.id] = way.id;
30446           }
30447         });
30448       });
30449       if (sharedRelation)
30450         return "relation";
30451     };
30452     action.limitWays = function(val) {
30453       if (!arguments.length)
30454         return wayIds;
30455       wayIds = val;
30456       return action;
30457     };
30458     return action;
30459   }
30460
30461   // modules/actions/extract.js
30462   function actionExtract(entityID, projection2) {
30463     var extractedNodeID;
30464     var action = function(graph) {
30465       var entity = graph.entity(entityID);
30466       if (entity.type === "node") {
30467         return extractFromNode(entity, graph);
30468       }
30469       return extractFromWayOrRelation(entity, graph);
30470     };
30471     function extractFromNode(node, graph) {
30472       extractedNodeID = node.id;
30473       var replacement = osmNode({ loc: node.loc });
30474       graph = graph.replace(replacement);
30475       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
30476         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
30477       }, graph);
30478       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
30479         return accGraph.replace(parentRel.replaceMember(node, replacement));
30480       }, graph);
30481     }
30482     function extractFromWayOrRelation(entity, graph) {
30483       var fromGeometry = entity.geometry(graph);
30484       var keysToCopyAndRetain = ["source", "wheelchair"];
30485       var keysToRetain = ["area"];
30486       var buildingKeysToRetain = ["architect", "building", "height", "layer"];
30487       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
30488       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
30489       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
30490         extractedLoc = entity.extent(graph).center();
30491       }
30492       var indoorAreaValues = {
30493         area: true,
30494         corridor: true,
30495         elevator: true,
30496         level: true,
30497         room: true
30498       };
30499       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
30500       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
30501       var entityTags = Object.assign({}, entity.tags);
30502       var pointTags = {};
30503       for (var key in entityTags) {
30504         if (entity.type === "relation" && key === "type") {
30505           continue;
30506         }
30507         if (keysToRetain.indexOf(key) !== -1) {
30508           continue;
30509         }
30510         if (isBuilding) {
30511           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
30512             continue;
30513         }
30514         if (isIndoorArea && key === "indoor") {
30515           continue;
30516         }
30517         pointTags[key] = entityTags[key];
30518         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
30519           continue;
30520         } else if (isIndoorArea && key === "level") {
30521           continue;
30522         }
30523         delete entityTags[key];
30524       }
30525       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
30526         entityTags.area = "yes";
30527       }
30528       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
30529       graph = graph.replace(replacement);
30530       extractedNodeID = replacement.id;
30531       return graph.replace(entity.update({ tags: entityTags }));
30532     }
30533     action.getExtractedNodeID = function() {
30534       return extractedNodeID;
30535     };
30536     return action;
30537   }
30538
30539   // modules/actions/join.js
30540   function actionJoin(ids) {
30541     function groupEntitiesByGeometry(graph) {
30542       var entities = ids.map(function(id2) {
30543         return graph.entity(id2);
30544       });
30545       return Object.assign(
30546         { line: [] },
30547         utilArrayGroupBy(entities, function(entity) {
30548           return entity.geometry(graph);
30549         })
30550       );
30551     }
30552     var action = function(graph) {
30553       var ways = ids.map(graph.entity, graph);
30554       var survivorID = utilOldestID(ways.map((way) => way.id));
30555       ways.sort(function(a2, b2) {
30556         var aSided = a2.isSided();
30557         var bSided = b2.isSided();
30558         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
30559       });
30560       var sequences = osmJoinWays(ways, graph);
30561       var joined = sequences[0];
30562       graph = sequences.actions.reduce(function(g3, action2) {
30563         return action2(g3);
30564       }, graph);
30565       var survivor = graph.entity(survivorID);
30566       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
30567         return n3.id;
30568       }) });
30569       graph = graph.replace(survivor);
30570       joined.forEach(function(way) {
30571         if (way.id === survivorID)
30572           return;
30573         graph.parentRelations(way).forEach(function(parent) {
30574           graph = graph.replace(parent.replaceMember(way, survivor));
30575         });
30576         survivor = survivor.mergeTags(way.tags);
30577         graph = graph.replace(survivor);
30578         graph = actionDeleteWay(way.id)(graph);
30579       });
30580       function checkForSimpleMultipolygon() {
30581         if (!survivor.isClosed())
30582           return;
30583         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
30584           return multipolygon2.members.length === 1;
30585         });
30586         if (multipolygons.length !== 1)
30587           return;
30588         var multipolygon = multipolygons[0];
30589         for (var key in survivor.tags) {
30590           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
30591           multipolygon.tags[key] !== survivor.tags[key])
30592             return;
30593         }
30594         survivor = survivor.mergeTags(multipolygon.tags);
30595         graph = graph.replace(survivor);
30596         graph = actionDeleteRelation(
30597           multipolygon.id,
30598           true
30599           /* allow untagged members */
30600         )(graph);
30601         var tags = Object.assign({}, survivor.tags);
30602         if (survivor.geometry(graph) !== "area") {
30603           tags.area = "yes";
30604         }
30605         delete tags.type;
30606         survivor = survivor.update({ tags });
30607         graph = graph.replace(survivor);
30608       }
30609       checkForSimpleMultipolygon();
30610       return graph;
30611     };
30612     action.resultingWayNodesLength = function(graph) {
30613       return ids.reduce(function(count, id2) {
30614         return count + graph.entity(id2).nodes.length;
30615       }, 0) - ids.length - 1;
30616     };
30617     action.disabled = function(graph) {
30618       var geometries = groupEntitiesByGeometry(graph);
30619       if (ids.length < 2 || ids.length !== geometries.line.length) {
30620         return "not_eligible";
30621       }
30622       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
30623       if (joined.length > 1) {
30624         return "not_adjacent";
30625       }
30626       var i3;
30627       var sortedParentRelations = function(id2) {
30628         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id - b2.id);
30629       };
30630       var relsA = sortedParentRelations(ids[0]);
30631       for (i3 = 1; i3 < ids.length; i3++) {
30632         var relsB = sortedParentRelations(ids[i3]);
30633         if (!utilArrayIdentical(relsA, relsB)) {
30634           return "conflicting_relations";
30635         }
30636       }
30637       for (i3 = 0; i3 < ids.length - 1; i3++) {
30638         for (var j3 = i3 + 1; j3 < ids.length; j3++) {
30639           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
30640             return e3.loc;
30641           });
30642           var path2 = graph.childNodes(graph.entity(ids[j3])).map(function(e3) {
30643             return e3.loc;
30644           });
30645           var intersections = geoPathIntersections(path1, path2);
30646           var common = utilArrayIntersection(
30647             joined[0].nodes.map(function(n3) {
30648               return n3.loc.toString();
30649             }),
30650             intersections.map(function(n3) {
30651               return n3.toString();
30652             })
30653           );
30654           if (common.length !== intersections.length) {
30655             return "paths_intersect";
30656           }
30657         }
30658       }
30659       var nodeIds = joined[0].nodes.map(function(n3) {
30660         return n3.id;
30661       }).slice(1, -1);
30662       var relation;
30663       var tags = {};
30664       var conflicting = false;
30665       joined[0].forEach(function(way) {
30666         var parents = graph.parentRelations(way);
30667         parents.forEach(function(parent) {
30668           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
30669             return nodeIds.indexOf(m2.id) >= 0;
30670           })) {
30671             relation = parent;
30672           }
30673         });
30674         for (var k2 in way.tags) {
30675           if (!(k2 in tags)) {
30676             tags[k2] = way.tags[k2];
30677           } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
30678             conflicting = true;
30679           }
30680         }
30681       });
30682       if (relation) {
30683         return relation.isRestriction() ? "restriction" : "connectivity";
30684       }
30685       if (conflicting) {
30686         return "conflicting_tags";
30687       }
30688     };
30689     return action;
30690   }
30691
30692   // modules/actions/merge.js
30693   function actionMerge(ids) {
30694     function groupEntitiesByGeometry(graph) {
30695       var entities = ids.map(function(id2) {
30696         return graph.entity(id2);
30697       });
30698       return Object.assign(
30699         { point: [], area: [], line: [], relation: [] },
30700         utilArrayGroupBy(entities, function(entity) {
30701           return entity.geometry(graph);
30702         })
30703       );
30704     }
30705     var action = function(graph) {
30706       var geometries = groupEntitiesByGeometry(graph);
30707       var target = geometries.area[0] || geometries.line[0];
30708       var points = geometries.point;
30709       points.forEach(function(point2) {
30710         target = target.mergeTags(point2.tags);
30711         graph = graph.replace(target);
30712         graph.parentRelations(point2).forEach(function(parent) {
30713           graph = graph.replace(parent.replaceMember(point2, target));
30714         });
30715         var nodes = utilArrayUniq(graph.childNodes(target));
30716         var removeNode = point2;
30717         if (!point2.isNew()) {
30718           var inserted = false;
30719           var canBeReplaced = function(node2) {
30720             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
30721           };
30722           var replaceNode = function(node2) {
30723             graph = graph.replace(point2.update({ tags: node2.tags, loc: node2.loc }));
30724             target = target.replaceNode(node2.id, point2.id);
30725             graph = graph.replace(target);
30726             removeNode = node2;
30727             inserted = true;
30728           };
30729           var i3;
30730           var node;
30731           for (i3 = 0; i3 < nodes.length; i3++) {
30732             node = nodes[i3];
30733             if (canBeReplaced(node) && node.isNew()) {
30734               replaceNode(node);
30735               break;
30736             }
30737           }
30738           if (!inserted && point2.hasInterestingTags()) {
30739             for (i3 = 0; i3 < nodes.length; i3++) {
30740               node = nodes[i3];
30741               if (canBeReplaced(node) && !node.hasInterestingTags()) {
30742                 replaceNode(node);
30743                 break;
30744               }
30745             }
30746             if (!inserted) {
30747               for (i3 = 0; i3 < nodes.length; i3++) {
30748                 node = nodes[i3];
30749                 if (canBeReplaced(node) && utilCompareIDs(point2.id, node.id) < 0) {
30750                   replaceNode(node);
30751                   break;
30752                 }
30753               }
30754             }
30755           }
30756         }
30757         graph = graph.remove(removeNode);
30758       });
30759       if (target.tags.area === "yes") {
30760         var tags = Object.assign({}, target.tags);
30761         delete tags.area;
30762         if (osmTagSuggestingArea(tags)) {
30763           target = target.update({ tags });
30764           graph = graph.replace(target);
30765         }
30766       }
30767       return graph;
30768     };
30769     action.disabled = function(graph) {
30770       var geometries = groupEntitiesByGeometry(graph);
30771       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
30772         return "not_eligible";
30773       }
30774     };
30775     return action;
30776   }
30777
30778   // modules/actions/merge_nodes.js
30779   function actionMergeNodes(nodeIDs, loc) {
30780     function chooseLoc(graph) {
30781       if (!nodeIDs.length)
30782         return null;
30783       var sum = [0, 0];
30784       var interestingCount = 0;
30785       var interestingLoc;
30786       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30787         var node = graph.entity(nodeIDs[i3]);
30788         if (node.hasInterestingTags()) {
30789           interestingLoc = ++interestingCount === 1 ? node.loc : null;
30790         }
30791         sum = geoVecAdd(sum, node.loc);
30792       }
30793       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
30794     }
30795     var action = function(graph) {
30796       if (nodeIDs.length < 2)
30797         return graph;
30798       var toLoc = loc;
30799       if (!toLoc) {
30800         toLoc = chooseLoc(graph);
30801       }
30802       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30803         var node = graph.entity(nodeIDs[i3]);
30804         if (node.loc !== toLoc) {
30805           graph = graph.replace(node.move(toLoc));
30806         }
30807       }
30808       return actionConnect(nodeIDs)(graph);
30809     };
30810     action.disabled = function(graph) {
30811       if (nodeIDs.length < 2)
30812         return "not_eligible";
30813       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30814         var entity = graph.entity(nodeIDs[i3]);
30815         if (entity.type !== "node")
30816           return "not_eligible";
30817       }
30818       return actionConnect(nodeIDs).disabled(graph);
30819     };
30820     return action;
30821   }
30822
30823   // modules/osm/changeset.js
30824   function osmChangeset() {
30825     if (!(this instanceof osmChangeset)) {
30826       return new osmChangeset().initialize(arguments);
30827     } else if (arguments.length) {
30828       this.initialize(arguments);
30829     }
30830   }
30831   osmEntity.changeset = osmChangeset;
30832   osmChangeset.prototype = Object.create(osmEntity.prototype);
30833   Object.assign(osmChangeset.prototype, {
30834     type: "changeset",
30835     extent: function() {
30836       return new geoExtent();
30837     },
30838     geometry: function() {
30839       return "changeset";
30840     },
30841     asJXON: function() {
30842       return {
30843         osm: {
30844           changeset: {
30845             tag: Object.keys(this.tags).map(function(k2) {
30846               return { "@k": k2, "@v": this.tags[k2] };
30847             }, this),
30848             "@version": 0.6,
30849             "@generator": "iD"
30850           }
30851         }
30852       };
30853     },
30854     // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
30855     // XML. Returns a string.
30856     osmChangeJXON: function(changes) {
30857       var changeset_id = this.id;
30858       function nest(x2, order) {
30859         var groups = {};
30860         for (var i3 = 0; i3 < x2.length; i3++) {
30861           var tagName = Object.keys(x2[i3])[0];
30862           if (!groups[tagName])
30863             groups[tagName] = [];
30864           groups[tagName].push(x2[i3][tagName]);
30865         }
30866         var ordered = {};
30867         order.forEach(function(o2) {
30868           if (groups[o2])
30869             ordered[o2] = groups[o2];
30870         });
30871         return ordered;
30872       }
30873       function sort(changes2) {
30874         function resolve(item) {
30875           return relations.find(function(relation2) {
30876             return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
30877           });
30878         }
30879         function isNew(item) {
30880           return !sorted[item["@id"]] && !processing.find(function(proc) {
30881             return proc["@id"] === item["@id"];
30882           });
30883         }
30884         var processing = [];
30885         var sorted = {};
30886         var relations = changes2.relation;
30887         if (!relations)
30888           return changes2;
30889         for (var i3 = 0; i3 < relations.length; i3++) {
30890           var relation = relations[i3];
30891           if (!sorted[relation["@id"]]) {
30892             processing.push(relation);
30893           }
30894           while (processing.length > 0) {
30895             var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
30896             if (deps.length === 0) {
30897               sorted[next["@id"]] = next;
30898               processing.shift();
30899             } else {
30900               processing = deps.concat(processing);
30901             }
30902           }
30903         }
30904         changes2.relation = Object.values(sorted);
30905         return changes2;
30906       }
30907       function rep2(entity) {
30908         return entity.asJXON(changeset_id);
30909       }
30910       return {
30911         osmChange: {
30912           "@version": 0.6,
30913           "@generator": "iD",
30914           "create": sort(nest(changes.created.map(rep2), ["node", "way", "relation"])),
30915           "modify": nest(changes.modified.map(rep2), ["node", "way", "relation"]),
30916           "delete": Object.assign(nest(changes.deleted.map(rep2), ["relation", "way", "node"]), { "@if-unused": true })
30917         }
30918       };
30919     },
30920     asGeoJSON: function() {
30921       return {};
30922     }
30923   });
30924
30925   // modules/osm/note.js
30926   function osmNote() {
30927     if (!(this instanceof osmNote)) {
30928       return new osmNote().initialize(arguments);
30929     } else if (arguments.length) {
30930       this.initialize(arguments);
30931     }
30932   }
30933   osmNote.id = function() {
30934     return osmNote.id.next--;
30935   };
30936   osmNote.id.next = -1;
30937   Object.assign(osmNote.prototype, {
30938     type: "note",
30939     initialize: function(sources) {
30940       for (var i3 = 0; i3 < sources.length; ++i3) {
30941         var source = sources[i3];
30942         for (var prop in source) {
30943           if (Object.prototype.hasOwnProperty.call(source, prop)) {
30944             if (source[prop] === void 0) {
30945               delete this[prop];
30946             } else {
30947               this[prop] = source[prop];
30948             }
30949           }
30950         }
30951       }
30952       if (!this.id) {
30953         this.id = osmNote.id().toString();
30954       }
30955       return this;
30956     },
30957     extent: function() {
30958       return new geoExtent(this.loc);
30959     },
30960     update: function(attrs) {
30961       return osmNote(this, attrs);
30962     },
30963     isNew: function() {
30964       return this.id < 0;
30965     },
30966     move: function(loc) {
30967       return this.update({ loc });
30968     }
30969   });
30970
30971   // modules/osm/relation.js
30972   function osmRelation() {
30973     if (!(this instanceof osmRelation)) {
30974       return new osmRelation().initialize(arguments);
30975     } else if (arguments.length) {
30976       this.initialize(arguments);
30977     }
30978   }
30979   osmEntity.relation = osmRelation;
30980   osmRelation.prototype = Object.create(osmEntity.prototype);
30981   osmRelation.creationOrder = function(a2, b2) {
30982     var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
30983     var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
30984     if (aId < 0 || bId < 0)
30985       return aId - bId;
30986     return bId - aId;
30987   };
30988   Object.assign(osmRelation.prototype, {
30989     type: "relation",
30990     members: [],
30991     copy: function(resolver, copies) {
30992       if (copies[this.id])
30993         return copies[this.id];
30994       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
30995       var members = this.members.map(function(member) {
30996         return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
30997       });
30998       copy2 = copy2.update({ members });
30999       copies[this.id] = copy2;
31000       return copy2;
31001     },
31002     extent: function(resolver, memo) {
31003       return resolver.transient(this, "extent", function() {
31004         if (memo && memo[this.id])
31005           return geoExtent();
31006         memo = memo || {};
31007         memo[this.id] = true;
31008         var extent = geoExtent();
31009         for (var i3 = 0; i3 < this.members.length; i3++) {
31010           var member = resolver.hasEntity(this.members[i3].id);
31011           if (member) {
31012             extent._extend(member.extent(resolver, memo));
31013           }
31014         }
31015         return extent;
31016       });
31017     },
31018     geometry: function(graph) {
31019       return graph.transient(this, "geometry", function() {
31020         return this.isMultipolygon() ? "area" : "relation";
31021       });
31022     },
31023     isDegenerate: function() {
31024       return this.members.length === 0;
31025     },
31026     // Return an array of members, each extended with an 'index' property whose value
31027     // is the member index.
31028     indexedMembers: function() {
31029       var result = new Array(this.members.length);
31030       for (var i3 = 0; i3 < this.members.length; i3++) {
31031         result[i3] = Object.assign({}, this.members[i3], { index: i3 });
31032       }
31033       return result;
31034     },
31035     // Return the first member with the given role. A copy of the member object
31036     // is returned, extended with an 'index' property whose value is the member index.
31037     memberByRole: function(role) {
31038       for (var i3 = 0; i3 < this.members.length; i3++) {
31039         if (this.members[i3].role === role) {
31040           return Object.assign({}, this.members[i3], { index: i3 });
31041         }
31042       }
31043     },
31044     // Same as memberByRole, but returns all members with the given role
31045     membersByRole: function(role) {
31046       var result = [];
31047       for (var i3 = 0; i3 < this.members.length; i3++) {
31048         if (this.members[i3].role === role) {
31049           result.push(Object.assign({}, this.members[i3], { index: i3 }));
31050         }
31051       }
31052       return result;
31053     },
31054     // Return the first member with the given id. A copy of the member object
31055     // is returned, extended with an 'index' property whose value is the member index.
31056     memberById: function(id2) {
31057       for (var i3 = 0; i3 < this.members.length; i3++) {
31058         if (this.members[i3].id === id2) {
31059           return Object.assign({}, this.members[i3], { index: i3 });
31060         }
31061       }
31062     },
31063     // Return the first member with the given id and role. A copy of the member object
31064     // is returned, extended with an 'index' property whose value is the member index.
31065     memberByIdAndRole: function(id2, role) {
31066       for (var i3 = 0; i3 < this.members.length; i3++) {
31067         if (this.members[i3].id === id2 && this.members[i3].role === role) {
31068           return Object.assign({}, this.members[i3], { index: i3 });
31069         }
31070       }
31071     },
31072     addMember: function(member, index) {
31073       var members = this.members.slice();
31074       members.splice(index === void 0 ? members.length : index, 0, member);
31075       return this.update({ members });
31076     },
31077     updateMember: function(member, index) {
31078       var members = this.members.slice();
31079       members.splice(index, 1, Object.assign({}, members[index], member));
31080       return this.update({ members });
31081     },
31082     removeMember: function(index) {
31083       var members = this.members.slice();
31084       members.splice(index, 1);
31085       return this.update({ members });
31086     },
31087     removeMembersWithID: function(id2) {
31088       var members = this.members.filter(function(m2) {
31089         return m2.id !== id2;
31090       });
31091       return this.update({ members });
31092     },
31093     moveMember: function(fromIndex, toIndex) {
31094       var members = this.members.slice();
31095       members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
31096       return this.update({ members });
31097     },
31098     // Wherever a member appears with id `needle.id`, replace it with a member
31099     // with id `replacement.id`, type `replacement.type`, and the original role,
31100     // By default, adding a duplicate member (by id and role) is prevented.
31101     // Return an updated relation.
31102     replaceMember: function(needle, replacement, keepDuplicates) {
31103       if (!this.memberById(needle.id))
31104         return this;
31105       var members = [];
31106       for (var i3 = 0; i3 < this.members.length; i3++) {
31107         var member = this.members[i3];
31108         if (member.id !== needle.id) {
31109           members.push(member);
31110         } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
31111           members.push({ id: replacement.id, type: replacement.type, role: member.role });
31112         }
31113       }
31114       return this.update({ members });
31115     },
31116     asJXON: function(changeset_id) {
31117       var r2 = {
31118         relation: {
31119           "@id": this.osmId(),
31120           "@version": this.version || 0,
31121           member: this.members.map(function(member) {
31122             return {
31123               keyAttributes: {
31124                 type: member.type,
31125                 role: member.role,
31126                 ref: osmEntity.id.toOSM(member.id)
31127               }
31128             };
31129           }, this),
31130           tag: Object.keys(this.tags).map(function(k2) {
31131             return { keyAttributes: { k: k2, v: this.tags[k2] } };
31132           }, this)
31133         }
31134       };
31135       if (changeset_id) {
31136         r2.relation["@changeset"] = changeset_id;
31137       }
31138       return r2;
31139     },
31140     asGeoJSON: function(resolver) {
31141       return resolver.transient(this, "GeoJSON", function() {
31142         if (this.isMultipolygon()) {
31143           return {
31144             type: "MultiPolygon",
31145             coordinates: this.multipolygon(resolver)
31146           };
31147         } else {
31148           return {
31149             type: "FeatureCollection",
31150             properties: this.tags,
31151             features: this.members.map(function(member) {
31152               return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
31153             })
31154           };
31155         }
31156       });
31157     },
31158     area: function(resolver) {
31159       return resolver.transient(this, "area", function() {
31160         return area_default(this.asGeoJSON(resolver));
31161       });
31162     },
31163     isMultipolygon: function() {
31164       return this.tags.type === "multipolygon";
31165     },
31166     isComplete: function(resolver) {
31167       for (var i3 = 0; i3 < this.members.length; i3++) {
31168         if (!resolver.hasEntity(this.members[i3].id)) {
31169           return false;
31170         }
31171       }
31172       return true;
31173     },
31174     hasFromViaTo: function() {
31175       return this.members.some(function(m2) {
31176         return m2.role === "from";
31177       }) && this.members.some(function(m2) {
31178         return m2.role === "via";
31179       }) && this.members.some(function(m2) {
31180         return m2.role === "to";
31181       });
31182     },
31183     isRestriction: function() {
31184       return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
31185     },
31186     isValidRestriction: function() {
31187       if (!this.isRestriction())
31188         return false;
31189       var froms = this.members.filter(function(m2) {
31190         return m2.role === "from";
31191       });
31192       var vias = this.members.filter(function(m2) {
31193         return m2.role === "via";
31194       });
31195       var tos = this.members.filter(function(m2) {
31196         return m2.role === "to";
31197       });
31198       if (froms.length !== 1 && this.tags.restriction !== "no_entry")
31199         return false;
31200       if (froms.some(function(m2) {
31201         return m2.type !== "way";
31202       }))
31203         return false;
31204       if (tos.length !== 1 && this.tags.restriction !== "no_exit")
31205         return false;
31206       if (tos.some(function(m2) {
31207         return m2.type !== "way";
31208       }))
31209         return false;
31210       if (vias.length === 0)
31211         return false;
31212       if (vias.length > 1 && vias.some(function(m2) {
31213         return m2.type !== "way";
31214       }))
31215         return false;
31216       return true;
31217     },
31218     isConnectivity: function() {
31219       return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
31220     },
31221     // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
31222     // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
31223     //
31224     // This corresponds to the structure needed for rendering a multipolygon path using a
31225     // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
31226     //
31227     // In the case of invalid geometries, this function will still return a result which
31228     // includes the nodes of all way members, but some Nds may be unclosed and some inner
31229     // rings not matched with the intended outer ring.
31230     //
31231     multipolygon: function(resolver) {
31232       var outers = this.members.filter(function(m2) {
31233         return "outer" === (m2.role || "outer");
31234       });
31235       var inners = this.members.filter(function(m2) {
31236         return "inner" === m2.role;
31237       });
31238       outers = osmJoinWays(outers, resolver);
31239       inners = osmJoinWays(inners, resolver);
31240       var sequenceToLineString = function(sequence) {
31241         if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
31242           sequence.nodes.push(sequence.nodes[0]);
31243         }
31244         return sequence.nodes.map(function(node) {
31245           return node.loc;
31246         });
31247       };
31248       outers = outers.map(sequenceToLineString);
31249       inners = inners.map(sequenceToLineString);
31250       var result = outers.map(function(o3) {
31251         return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
31252       });
31253       function findOuter(inner2) {
31254         var o3, outer;
31255         for (o3 = 0; o3 < outers.length; o3++) {
31256           outer = outers[o3];
31257           if (geoPolygonContainsPolygon(outer, inner2)) {
31258             return o3;
31259           }
31260         }
31261         for (o3 = 0; o3 < outers.length; o3++) {
31262           outer = outers[o3];
31263           if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
31264             return o3;
31265           }
31266         }
31267       }
31268       for (var i3 = 0; i3 < inners.length; i3++) {
31269         var inner = inners[i3];
31270         if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
31271           inner = inner.reverse();
31272         }
31273         var o2 = findOuter(inners[i3]);
31274         if (o2 !== void 0) {
31275           result[o2].push(inners[i3]);
31276         } else {
31277           result.push([inners[i3]]);
31278         }
31279       }
31280       return result;
31281     }
31282   });
31283
31284   // modules/osm/qa_item.js
31285   var QAItem = class _QAItem {
31286     constructor(loc, service, itemType, id2, props) {
31287       this.loc = loc;
31288       this.service = service.title;
31289       this.itemType = itemType;
31290       this.id = id2 ? id2 : `${_QAItem.id()}`;
31291       this.update(props);
31292       if (service && typeof service.getIcon === "function") {
31293         this.icon = service.getIcon(itemType);
31294       }
31295     }
31296     update(props) {
31297       const { loc, service, itemType, id: id2 } = this;
31298       Object.keys(props).forEach((prop) => this[prop] = props[prop]);
31299       this.loc = loc;
31300       this.service = service;
31301       this.itemType = itemType;
31302       this.id = id2;
31303       return this;
31304     }
31305     // Generic handling for newly created QAItems
31306     static id() {
31307       return this.nextId--;
31308     }
31309   };
31310   QAItem.nextId = -1;
31311
31312   // modules/actions/split.js
31313   function actionSplit(nodeIds, newWayIds) {
31314     if (typeof nodeIds === "string")
31315       nodeIds = [nodeIds];
31316     var _wayIDs;
31317     var _keepHistoryOn = "longest";
31318     var _createdWayIDs = [];
31319     function dist(graph, nA, nB) {
31320       var locA = graph.entity(nA).loc;
31321       var locB = graph.entity(nB).loc;
31322       var epsilon3 = 1e-6;
31323       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
31324     }
31325     function splitArea(nodes, idxA, graph) {
31326       var lengths = new Array(nodes.length);
31327       var length;
31328       var i3;
31329       var best = 0;
31330       var idxB;
31331       function wrap2(index) {
31332         return utilWrap(index, nodes.length);
31333       }
31334       length = 0;
31335       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
31336         length += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
31337         lengths[i3] = length;
31338       }
31339       length = 0;
31340       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
31341         length += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
31342         if (length < lengths[i3]) {
31343           lengths[i3] = length;
31344         }
31345       }
31346       for (i3 = 0; i3 < nodes.length; i3++) {
31347         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
31348         if (cost > best) {
31349           idxB = i3;
31350           best = cost;
31351         }
31352       }
31353       return idxB;
31354     }
31355     function totalLengthBetweenNodes(graph, nodes) {
31356       var totalLength = 0;
31357       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
31358         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
31359       }
31360       return totalLength;
31361     }
31362     function split(graph, nodeId, wayA, newWayId) {
31363       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
31364       var origNodes = wayA.nodes.slice();
31365       var nodesA;
31366       var nodesB;
31367       var isArea = wayA.isArea();
31368       var isOuter = osmIsOldMultipolygonOuterMember(wayA, graph);
31369       if (wayA.isClosed()) {
31370         var nodes = wayA.nodes.slice(0, -1);
31371         var idxA = nodes.indexOf(nodeId);
31372         var idxB = splitArea(nodes, idxA, graph);
31373         if (idxB < idxA) {
31374           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
31375           nodesB = nodes.slice(idxB, idxA + 1);
31376         } else {
31377           nodesA = nodes.slice(idxA, idxB + 1);
31378           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
31379         }
31380       } else {
31381         var idx = wayA.nodes.indexOf(nodeId, 1);
31382         nodesA = wayA.nodes.slice(0, idx + 1);
31383         nodesB = wayA.nodes.slice(idx);
31384       }
31385       var lengthA = totalLengthBetweenNodes(graph, nodesA);
31386       var lengthB = totalLengthBetweenNodes(graph, nodesB);
31387       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
31388         wayA = wayA.update({ nodes: nodesB });
31389         wayB = wayB.update({ nodes: nodesA });
31390         var temp = lengthA;
31391         lengthA = lengthB;
31392         lengthB = temp;
31393       } else {
31394         wayA = wayA.update({ nodes: nodesA });
31395         wayB = wayB.update({ nodes: nodesB });
31396       }
31397       if (wayA.tags.step_count) {
31398         var stepCount = Number(wayA.tags.step_count);
31399         if (stepCount && // ensure a number
31400         isFinite(stepCount) && // ensure positive
31401         stepCount > 0 && // ensure integer
31402         Math.round(stepCount) === stepCount) {
31403           var tagsA = Object.assign({}, wayA.tags);
31404           var tagsB = Object.assign({}, wayB.tags);
31405           var ratioA = lengthA / (lengthA + lengthB);
31406           var countA = Math.round(stepCount * ratioA);
31407           tagsA.step_count = countA.toString();
31408           tagsB.step_count = (stepCount - countA).toString();
31409           wayA = wayA.update({ tags: tagsA });
31410           wayB = wayB.update({ tags: tagsB });
31411         }
31412       }
31413       graph = graph.replace(wayA);
31414       graph = graph.replace(wayB);
31415       graph.parentRelations(wayA).forEach(function(relation) {
31416         var member;
31417         if (relation.hasFromViaTo()) {
31418           var f3 = relation.memberByRole("from");
31419           var v2 = relation.membersByRole("via");
31420           var t2 = relation.memberByRole("to");
31421           var i3;
31422           if (f3.id === wayA.id || t2.id === wayA.id) {
31423             var keepB = false;
31424             if (v2.length === 1 && v2[0].type === "node") {
31425               keepB = wayB.contains(v2[0].id);
31426             } else {
31427               for (i3 = 0; i3 < v2.length; i3++) {
31428                 if (v2[i3].type === "way") {
31429                   var wayVia = graph.hasEntity(v2[i3].id);
31430                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
31431                     keepB = true;
31432                     break;
31433                   }
31434                 }
31435               }
31436             }
31437             if (keepB) {
31438               relation = relation.replaceMember(wayA, wayB);
31439               graph = graph.replace(relation);
31440             }
31441           } else {
31442             for (i3 = 0; i3 < v2.length; i3++) {
31443               if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
31444                 member = {
31445                   id: wayB.id,
31446                   type: "way",
31447                   role: "via"
31448                 };
31449                 graph = actionAddMember(relation.id, member, v2[i3].index + 1)(graph);
31450                 break;
31451               }
31452             }
31453           }
31454         } else {
31455           if (relation === isOuter) {
31456             graph = graph.replace(relation.mergeTags(wayA.tags));
31457             graph = graph.replace(wayA.update({ tags: {} }));
31458             graph = graph.replace(wayB.update({ tags: {} }));
31459           }
31460           member = {
31461             id: wayB.id,
31462             type: "way",
31463             role: relation.memberById(wayA.id).role
31464           };
31465           var insertPair = {
31466             originalID: wayA.id,
31467             insertedID: wayB.id,
31468             nodes: origNodes
31469           };
31470           graph = actionAddMember(relation.id, member, void 0, insertPair)(graph);
31471         }
31472       });
31473       if (!isOuter && isArea) {
31474         var multipolygon = osmRelation({
31475           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
31476           members: [
31477             { id: wayA.id, role: "outer", type: "way" },
31478             { id: wayB.id, role: "outer", type: "way" }
31479           ]
31480         });
31481         graph = graph.replace(multipolygon);
31482         graph = graph.replace(wayA.update({ tags: {} }));
31483         graph = graph.replace(wayB.update({ tags: {} }));
31484       }
31485       _createdWayIDs.push(wayB.id);
31486       return graph;
31487     }
31488     var action = function(graph) {
31489       _createdWayIDs = [];
31490       var newWayIndex = 0;
31491       for (var i3 = 0; i3 < nodeIds.length; i3++) {
31492         var nodeId = nodeIds[i3];
31493         var candidates = action.waysForNode(nodeId, graph);
31494         for (var j3 = 0; j3 < candidates.length; j3++) {
31495           graph = split(graph, nodeId, candidates[j3], newWayIds && newWayIds[newWayIndex]);
31496           newWayIndex += 1;
31497         }
31498       }
31499       return graph;
31500     };
31501     action.getCreatedWayIDs = function() {
31502       return _createdWayIDs;
31503     };
31504     action.waysForNode = function(nodeId, graph) {
31505       var node = graph.entity(nodeId);
31506       var splittableParents = graph.parentWays(node).filter(isSplittable);
31507       if (!_wayIDs) {
31508         var hasLine = splittableParents.some(function(parent) {
31509           return parent.geometry(graph) === "line";
31510         });
31511         if (hasLine) {
31512           return splittableParents.filter(function(parent) {
31513             return parent.geometry(graph) === "line";
31514           });
31515         }
31516       }
31517       return splittableParents;
31518       function isSplittable(parent) {
31519         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
31520           return false;
31521         if (parent.isClosed())
31522           return true;
31523         for (var i3 = 1; i3 < parent.nodes.length - 1; i3++) {
31524           if (parent.nodes[i3] === nodeId)
31525             return true;
31526         }
31527         return false;
31528       }
31529     };
31530     action.ways = function(graph) {
31531       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
31532         return action.waysForNode(nodeId, graph);
31533       })));
31534     };
31535     action.disabled = function(graph) {
31536       for (var i3 = 0; i3 < nodeIds.length; i3++) {
31537         var nodeId = nodeIds[i3];
31538         var candidates = action.waysForNode(nodeId, graph);
31539         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
31540           return "not_eligible";
31541         }
31542       }
31543     };
31544     action.limitWays = function(val) {
31545       if (!arguments.length)
31546         return _wayIDs;
31547       _wayIDs = val;
31548       return action;
31549     };
31550     action.keepHistoryOn = function(val) {
31551       if (!arguments.length)
31552         return _keepHistoryOn;
31553       _keepHistoryOn = val;
31554       return action;
31555     };
31556     return action;
31557   }
31558
31559   // modules/core/graph.js
31560   function coreGraph(other, mutable) {
31561     if (!(this instanceof coreGraph))
31562       return new coreGraph(other, mutable);
31563     if (other instanceof coreGraph) {
31564       var base = other.base();
31565       this.entities = Object.assign(Object.create(base.entities), other.entities);
31566       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
31567       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
31568     } else {
31569       this.entities = /* @__PURE__ */ Object.create({});
31570       this._parentWays = /* @__PURE__ */ Object.create({});
31571       this._parentRels = /* @__PURE__ */ Object.create({});
31572       this.rebase(other || [], [this]);
31573     }
31574     this.transients = {};
31575     this._childNodes = {};
31576     this.frozen = !mutable;
31577   }
31578   coreGraph.prototype = {
31579     hasEntity: function(id2) {
31580       return this.entities[id2];
31581     },
31582     entity: function(id2) {
31583       var entity = this.entities[id2];
31584       if (!entity) {
31585         entity = this.entities.__proto__[id2];
31586       }
31587       if (!entity) {
31588         throw new Error("entity " + id2 + " not found");
31589       }
31590       return entity;
31591     },
31592     geometry: function(id2) {
31593       return this.entity(id2).geometry(this);
31594     },
31595     transient: function(entity, key, fn) {
31596       var id2 = entity.id;
31597       var transients = this.transients[id2] || (this.transients[id2] = {});
31598       if (transients[key] !== void 0) {
31599         return transients[key];
31600       }
31601       transients[key] = fn.call(entity);
31602       return transients[key];
31603     },
31604     parentWays: function(entity) {
31605       var parents = this._parentWays[entity.id];
31606       var result = [];
31607       if (parents) {
31608         parents.forEach(function(id2) {
31609           result.push(this.entity(id2));
31610         }, this);
31611       }
31612       return result;
31613     },
31614     isPoi: function(entity) {
31615       var parents = this._parentWays[entity.id];
31616       return !parents || parents.size === 0;
31617     },
31618     isShared: function(entity) {
31619       var parents = this._parentWays[entity.id];
31620       return parents && parents.size > 1;
31621     },
31622     parentRelations: function(entity) {
31623       var parents = this._parentRels[entity.id];
31624       var result = [];
31625       if (parents) {
31626         parents.forEach(function(id2) {
31627           result.push(this.entity(id2));
31628         }, this);
31629       }
31630       return result;
31631     },
31632     parentMultipolygons: function(entity) {
31633       return this.parentRelations(entity).filter(function(relation) {
31634         return relation.isMultipolygon();
31635       });
31636     },
31637     childNodes: function(entity) {
31638       if (this._childNodes[entity.id])
31639         return this._childNodes[entity.id];
31640       if (!entity.nodes)
31641         return [];
31642       var nodes = [];
31643       for (var i3 = 0; i3 < entity.nodes.length; i3++) {
31644         nodes[i3] = this.entity(entity.nodes[i3]);
31645       }
31646       if (debug)
31647         Object.freeze(nodes);
31648       this._childNodes[entity.id] = nodes;
31649       return this._childNodes[entity.id];
31650     },
31651     base: function() {
31652       return {
31653         "entities": Object.getPrototypeOf(this.entities),
31654         "parentWays": Object.getPrototypeOf(this._parentWays),
31655         "parentRels": Object.getPrototypeOf(this._parentRels)
31656       };
31657     },
31658     // Unlike other graph methods, rebase mutates in place. This is because it
31659     // is used only during the history operation that merges newly downloaded
31660     // data into each state. To external consumers, it should appear as if the
31661     // graph always contained the newly downloaded data.
31662     rebase: function(entities, stack, force) {
31663       var base = this.base();
31664       var i3, j3, k2, id2;
31665       for (i3 = 0; i3 < entities.length; i3++) {
31666         var entity = entities[i3];
31667         if (!entity.visible || !force && base.entities[entity.id])
31668           continue;
31669         base.entities[entity.id] = entity;
31670         this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
31671         if (entity.type === "way") {
31672           for (j3 = 0; j3 < entity.nodes.length; j3++) {
31673             id2 = entity.nodes[j3];
31674             for (k2 = 1; k2 < stack.length; k2++) {
31675               var ents = stack[k2].entities;
31676               if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
31677                 delete ents[id2];
31678               }
31679             }
31680           }
31681         }
31682       }
31683       for (i3 = 0; i3 < stack.length; i3++) {
31684         stack[i3]._updateRebased();
31685       }
31686     },
31687     _updateRebased: function() {
31688       var base = this.base();
31689       Object.keys(this._parentWays).forEach(function(child) {
31690         if (base.parentWays[child]) {
31691           base.parentWays[child].forEach(function(id2) {
31692             if (!this.entities.hasOwnProperty(id2)) {
31693               this._parentWays[child].add(id2);
31694             }
31695           }, this);
31696         }
31697       }, this);
31698       Object.keys(this._parentRels).forEach(function(child) {
31699         if (base.parentRels[child]) {
31700           base.parentRels[child].forEach(function(id2) {
31701             if (!this.entities.hasOwnProperty(id2)) {
31702               this._parentRels[child].add(id2);
31703             }
31704           }, this);
31705         }
31706       }, this);
31707       this.transients = {};
31708     },
31709     // Updates calculated properties (parentWays, parentRels) for the specified change
31710     _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
31711       parentWays = parentWays || this._parentWays;
31712       parentRels = parentRels || this._parentRels;
31713       var type2 = entity && entity.type || oldentity && oldentity.type;
31714       var removed, added, i3;
31715       if (type2 === "way") {
31716         if (oldentity && entity) {
31717           removed = utilArrayDifference(oldentity.nodes, entity.nodes);
31718           added = utilArrayDifference(entity.nodes, oldentity.nodes);
31719         } else if (oldentity) {
31720           removed = oldentity.nodes;
31721           added = [];
31722         } else if (entity) {
31723           removed = [];
31724           added = entity.nodes;
31725         }
31726         for (i3 = 0; i3 < removed.length; i3++) {
31727           parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
31728           parentWays[removed[i3]].delete(oldentity.id);
31729         }
31730         for (i3 = 0; i3 < added.length; i3++) {
31731           parentWays[added[i3]] = new Set(parentWays[added[i3]]);
31732           parentWays[added[i3]].add(entity.id);
31733         }
31734       } else if (type2 === "relation") {
31735         var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
31736           return m2.id;
31737         }) : [];
31738         var entityMemberIDs = entity ? entity.members.map(function(m2) {
31739           return m2.id;
31740         }) : [];
31741         if (oldentity && entity) {
31742           removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
31743           added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
31744         } else if (oldentity) {
31745           removed = oldentityMemberIDs;
31746           added = [];
31747         } else if (entity) {
31748           removed = [];
31749           added = entityMemberIDs;
31750         }
31751         for (i3 = 0; i3 < removed.length; i3++) {
31752           parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
31753           parentRels[removed[i3]].delete(oldentity.id);
31754         }
31755         for (i3 = 0; i3 < added.length; i3++) {
31756           parentRels[added[i3]] = new Set(parentRels[added[i3]]);
31757           parentRels[added[i3]].add(entity.id);
31758         }
31759       }
31760     },
31761     replace: function(entity) {
31762       if (this.entities[entity.id] === entity)
31763         return this;
31764       return this.update(function() {
31765         this._updateCalculated(this.entities[entity.id], entity);
31766         this.entities[entity.id] = entity;
31767       });
31768     },
31769     remove: function(entity) {
31770       return this.update(function() {
31771         this._updateCalculated(entity, void 0);
31772         this.entities[entity.id] = void 0;
31773       });
31774     },
31775     revert: function(id2) {
31776       var baseEntity = this.base().entities[id2];
31777       var headEntity = this.entities[id2];
31778       if (headEntity === baseEntity)
31779         return this;
31780       return this.update(function() {
31781         this._updateCalculated(headEntity, baseEntity);
31782         delete this.entities[id2];
31783       });
31784     },
31785     update: function() {
31786       var graph = this.frozen ? coreGraph(this, true) : this;
31787       for (var i3 = 0; i3 < arguments.length; i3++) {
31788         arguments[i3].call(graph, graph);
31789       }
31790       if (this.frozen)
31791         graph.frozen = true;
31792       return graph;
31793     },
31794     // Obliterates any existing entities
31795     load: function(entities) {
31796       var base = this.base();
31797       this.entities = Object.create(base.entities);
31798       for (var i3 in entities) {
31799         this.entities[i3] = entities[i3];
31800         this._updateCalculated(base.entities[i3], this.entities[i3]);
31801       }
31802       return this;
31803     }
31804   };
31805
31806   // modules/osm/intersection.js
31807   function osmTurn(turn) {
31808     if (!(this instanceof osmTurn)) {
31809       return new osmTurn(turn);
31810     }
31811     Object.assign(this, turn);
31812   }
31813   function osmIntersection(graph, startVertexId, maxDistance) {
31814     maxDistance = maxDistance || 30;
31815     var vgraph = coreGraph();
31816     var i3, j3, k2;
31817     function memberOfRestriction(entity) {
31818       return graph.parentRelations(entity).some(function(r2) {
31819         return r2.isRestriction();
31820       });
31821     }
31822     function isRoad(way2) {
31823       if (way2.isArea() || way2.isDegenerate())
31824         return false;
31825       var roads = {
31826         "motorway": true,
31827         "motorway_link": true,
31828         "trunk": true,
31829         "trunk_link": true,
31830         "primary": true,
31831         "primary_link": true,
31832         "secondary": true,
31833         "secondary_link": true,
31834         "tertiary": true,
31835         "tertiary_link": true,
31836         "residential": true,
31837         "unclassified": true,
31838         "living_street": true,
31839         "service": true,
31840         "road": true,
31841         "track": true
31842       };
31843       return roads[way2.tags.highway];
31844     }
31845     var startNode = graph.entity(startVertexId);
31846     var checkVertices = [startNode];
31847     var checkWays;
31848     var vertices = [];
31849     var vertexIds = [];
31850     var vertex;
31851     var ways = [];
31852     var wayIds = [];
31853     var way;
31854     var nodes = [];
31855     var node;
31856     var parents = [];
31857     var parent;
31858     var actions = [];
31859     while (checkVertices.length) {
31860       vertex = checkVertices.pop();
31861       checkWays = graph.parentWays(vertex);
31862       var hasWays = false;
31863       for (i3 = 0; i3 < checkWays.length; i3++) {
31864         way = checkWays[i3];
31865         if (!isRoad(way) && !memberOfRestriction(way))
31866           continue;
31867         ways.push(way);
31868         hasWays = true;
31869         nodes = utilArrayUniq(graph.childNodes(way));
31870         for (j3 = 0; j3 < nodes.length; j3++) {
31871           node = nodes[j3];
31872           if (node === vertex)
31873             continue;
31874           if (vertices.indexOf(node) !== -1)
31875             continue;
31876           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
31877             continue;
31878           var hasParents = false;
31879           parents = graph.parentWays(node);
31880           for (k2 = 0; k2 < parents.length; k2++) {
31881             parent = parents[k2];
31882             if (parent === way)
31883               continue;
31884             if (ways.indexOf(parent) !== -1)
31885               continue;
31886             if (!isRoad(parent))
31887               continue;
31888             hasParents = true;
31889             break;
31890           }
31891           if (hasParents) {
31892             checkVertices.push(node);
31893           }
31894         }
31895       }
31896       if (hasWays) {
31897         vertices.push(vertex);
31898       }
31899     }
31900     vertices = utilArrayUniq(vertices);
31901     ways = utilArrayUniq(ways);
31902     ways.forEach(function(way2) {
31903       graph.childNodes(way2).forEach(function(node2) {
31904         vgraph = vgraph.replace(node2);
31905       });
31906       vgraph = vgraph.replace(way2);
31907       graph.parentRelations(way2).forEach(function(relation) {
31908         if (relation.isRestriction()) {
31909           if (relation.isValidRestriction(graph)) {
31910             vgraph = vgraph.replace(relation);
31911           } else if (relation.isComplete(graph)) {
31912             actions.push(actionDeleteRelation(relation.id));
31913           }
31914         }
31915       });
31916     });
31917     ways.forEach(function(w2) {
31918       var way2 = vgraph.entity(w2.id);
31919       if (way2.tags.oneway === "-1") {
31920         var action = actionReverse(way2.id, { reverseOneway: true });
31921         actions.push(action);
31922         vgraph = action(vgraph);
31923       }
31924     });
31925     var origCount = osmEntity.id.next.way;
31926     vertices.forEach(function(v2) {
31927       var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
31928       if (!splitAll.disabled(vgraph)) {
31929         splitAll.ways(vgraph).forEach(function(way2) {
31930           var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
31931           actions.push(splitOne);
31932           vgraph = splitOne(vgraph);
31933         });
31934       }
31935     });
31936     osmEntity.id.next.way = origCount;
31937     vertexIds = vertices.map(function(v2) {
31938       return v2.id;
31939     });
31940     vertices = [];
31941     ways = [];
31942     vertexIds.forEach(function(id2) {
31943       var vertex2 = vgraph.entity(id2);
31944       var parents2 = vgraph.parentWays(vertex2);
31945       vertices.push(vertex2);
31946       ways = ways.concat(parents2);
31947     });
31948     vertices = utilArrayUniq(vertices);
31949     ways = utilArrayUniq(ways);
31950     vertexIds = vertices.map(function(v2) {
31951       return v2.id;
31952     });
31953     wayIds = ways.map(function(w2) {
31954       return w2.id;
31955     });
31956     function withMetadata(way2, vertexIds2) {
31957       var __oneWay = way2.isOneWay();
31958       var __first = vertexIds2.indexOf(way2.first()) !== -1;
31959       var __last = vertexIds2.indexOf(way2.last()) !== -1;
31960       var __via = __first && __last;
31961       var __from = __first && !__oneWay || __last;
31962       var __to = __first || __last && !__oneWay;
31963       return way2.update({
31964         __first,
31965         __last,
31966         __from,
31967         __via,
31968         __to,
31969         __oneWay
31970       });
31971     }
31972     ways = [];
31973     wayIds.forEach(function(id2) {
31974       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
31975       vgraph = vgraph.replace(way2);
31976       ways.push(way2);
31977     });
31978     var keepGoing;
31979     var removeWayIds = [];
31980     var removeVertexIds = [];
31981     do {
31982       keepGoing = false;
31983       checkVertices = vertexIds.slice();
31984       for (i3 = 0; i3 < checkVertices.length; i3++) {
31985         var vertexId = checkVertices[i3];
31986         vertex = vgraph.hasEntity(vertexId);
31987         if (!vertex) {
31988           if (vertexIds.indexOf(vertexId) !== -1) {
31989             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
31990           }
31991           removeVertexIds.push(vertexId);
31992           continue;
31993         }
31994         parents = vgraph.parentWays(vertex);
31995         if (parents.length < 3) {
31996           if (vertexIds.indexOf(vertexId) !== -1) {
31997             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
31998           }
31999         }
32000         if (parents.length === 2) {
32001           var a2 = parents[0];
32002           var b2 = parents[1];
32003           var aIsLeaf = a2 && !a2.__via;
32004           var bIsLeaf = b2 && !b2.__via;
32005           var leaf, survivor;
32006           if (aIsLeaf && !bIsLeaf) {
32007             leaf = a2;
32008             survivor = b2;
32009           } else if (!aIsLeaf && bIsLeaf) {
32010             leaf = b2;
32011             survivor = a2;
32012           }
32013           if (leaf && survivor) {
32014             survivor = withMetadata(survivor, vertexIds);
32015             vgraph = vgraph.replace(survivor).remove(leaf);
32016             removeWayIds.push(leaf.id);
32017             keepGoing = true;
32018           }
32019         }
32020         parents = vgraph.parentWays(vertex);
32021         if (parents.length < 2) {
32022           if (vertexIds.indexOf(vertexId) !== -1) {
32023             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32024           }
32025           removeVertexIds.push(vertexId);
32026           keepGoing = true;
32027         }
32028         if (parents.length < 1) {
32029           vgraph = vgraph.remove(vertex);
32030         }
32031       }
32032     } while (keepGoing);
32033     vertices = vertices.filter(function(vertex2) {
32034       return removeVertexIds.indexOf(vertex2.id) === -1;
32035     }).map(function(vertex2) {
32036       return vgraph.entity(vertex2.id);
32037     });
32038     ways = ways.filter(function(way2) {
32039       return removeWayIds.indexOf(way2.id) === -1;
32040     }).map(function(way2) {
32041       return vgraph.entity(way2.id);
32042     });
32043     var intersection = {
32044       graph: vgraph,
32045       actions,
32046       vertices,
32047       ways
32048     };
32049     intersection.turns = function(fromWayId, maxViaWay) {
32050       if (!fromWayId)
32051         return [];
32052       if (!maxViaWay)
32053         maxViaWay = 0;
32054       var vgraph2 = intersection.graph;
32055       var keyVertexIds = intersection.vertices.map(function(v2) {
32056         return v2.id;
32057       });
32058       var start2 = vgraph2.entity(fromWayId);
32059       if (!start2 || !(start2.__from || start2.__via))
32060         return [];
32061       var maxPathLength = maxViaWay * 2 + 3;
32062       var turns = [];
32063       step(start2);
32064       return turns;
32065       function step(entity, currPath, currRestrictions, matchedRestriction) {
32066         currPath = (currPath || []).slice();
32067         if (currPath.length >= maxPathLength)
32068           return;
32069         currPath.push(entity.id);
32070         currRestrictions = (currRestrictions || []).slice();
32071         if (entity.type === "node") {
32072           stepNode(entity, currPath, currRestrictions);
32073         } else {
32074           stepWay(entity, currPath, currRestrictions, matchedRestriction);
32075         }
32076       }
32077       function stepNode(entity, currPath, currRestrictions) {
32078         var i4, j4;
32079         var parents2 = vgraph2.parentWays(entity);
32080         var nextWays = [];
32081         for (i4 = 0; i4 < parents2.length; i4++) {
32082           var way2 = parents2[i4];
32083           if (way2.__oneWay && way2.nodes[0] !== entity.id)
32084             continue;
32085           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
32086             continue;
32087           var restrict = null;
32088           for (j4 = 0; j4 < currRestrictions.length; j4++) {
32089             var restriction = currRestrictions[j4];
32090             var f3 = restriction.memberByRole("from");
32091             var v2 = restriction.membersByRole("via");
32092             var t2 = restriction.memberByRole("to");
32093             var isNo = /^no_/.test(restriction.tags.restriction);
32094             var isOnly = /^only_/.test(restriction.tags.restriction);
32095             if (!(isNo || isOnly)) {
32096               continue;
32097             }
32098             var matchesFrom = f3.id === fromWayId;
32099             var matchesViaTo = false;
32100             var isAlongOnlyPath = false;
32101             if (t2.id === way2.id) {
32102               if (v2.length === 1 && v2[0].type === "node") {
32103                 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
32104               } else {
32105                 var pathVias = [];
32106                 for (k2 = 2; k2 < currPath.length; k2 += 2) {
32107                   pathVias.push(currPath[k2]);
32108                 }
32109                 var restrictionVias = [];
32110                 for (k2 = 0; k2 < v2.length; k2++) {
32111                   if (v2[k2].type === "way") {
32112                     restrictionVias.push(v2[k2].id);
32113                   }
32114                 }
32115                 var diff = utilArrayDifference(pathVias, restrictionVias);
32116                 matchesViaTo = !diff.length;
32117               }
32118             } else if (isOnly) {
32119               for (k2 = 0; k2 < v2.length; k2++) {
32120                 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
32121                   isAlongOnlyPath = true;
32122                   break;
32123                 }
32124               }
32125             }
32126             if (matchesViaTo) {
32127               if (isOnly) {
32128                 restrict = { id: restriction.id, direct: matchesFrom, from: f3.id, only: true, end: true };
32129               } else {
32130                 restrict = { id: restriction.id, direct: matchesFrom, from: f3.id, no: true, end: true };
32131               }
32132             } else {
32133               if (isAlongOnlyPath) {
32134                 restrict = { id: restriction.id, direct: false, from: f3.id, only: true, end: false };
32135               } else if (isOnly) {
32136                 restrict = { id: restriction.id, direct: false, from: f3.id, no: true, end: true };
32137               }
32138             }
32139             if (restrict && restrict.direct)
32140               break;
32141           }
32142           nextWays.push({ way: way2, restrict });
32143         }
32144         nextWays.forEach(function(nextWay) {
32145           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
32146         });
32147       }
32148       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
32149         var i4;
32150         if (currPath.length >= 3) {
32151           var turnPath = currPath.slice();
32152           if (matchedRestriction && matchedRestriction.direct === false) {
32153             for (i4 = 0; i4 < turnPath.length; i4++) {
32154               if (turnPath[i4] === matchedRestriction.from) {
32155                 turnPath = turnPath.slice(i4);
32156                 break;
32157               }
32158             }
32159           }
32160           var turn = pathToTurn(turnPath);
32161           if (turn) {
32162             if (matchedRestriction) {
32163               turn.restrictionID = matchedRestriction.id;
32164               turn.no = matchedRestriction.no;
32165               turn.only = matchedRestriction.only;
32166               turn.direct = matchedRestriction.direct;
32167             }
32168             turns.push(osmTurn(turn));
32169           }
32170           if (currPath[0] === currPath[2])
32171             return;
32172         }
32173         if (matchedRestriction && matchedRestriction.end)
32174           return;
32175         var n1 = vgraph2.entity(entity.first());
32176         var n22 = vgraph2.entity(entity.last());
32177         var dist = geoSphericalDistance(n1.loc, n22.loc);
32178         var nextNodes = [];
32179         if (currPath.length > 1) {
32180           if (dist > maxDistance)
32181             return;
32182           if (!entity.__via)
32183             return;
32184         }
32185         if (!entity.__oneWay && // bidirectional..
32186         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
32187         currPath.indexOf(n1.id) === -1) {
32188           nextNodes.push(n1);
32189         }
32190         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
32191         currPath.indexOf(n22.id) === -1) {
32192           nextNodes.push(n22);
32193         }
32194         nextNodes.forEach(function(nextNode) {
32195           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
32196             if (!r2.isRestriction())
32197               return false;
32198             var f3 = r2.memberByRole("from");
32199             if (!f3 || f3.id !== entity.id)
32200               return false;
32201             var isOnly = /^only_/.test(r2.tags.restriction);
32202             if (!isOnly)
32203               return true;
32204             var isOnlyVia = false;
32205             var v2 = r2.membersByRole("via");
32206             if (v2.length === 1 && v2[0].type === "node") {
32207               isOnlyVia = v2[0].id === nextNode.id;
32208             } else {
32209               for (var i5 = 0; i5 < v2.length; i5++) {
32210                 if (v2[i5].type !== "way")
32211                   continue;
32212                 var viaWay = vgraph2.entity(v2[i5].id);
32213                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
32214                   isOnlyVia = true;
32215                   break;
32216                 }
32217               }
32218             }
32219             return isOnlyVia;
32220           });
32221           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
32222         });
32223       }
32224       function pathToTurn(path) {
32225         if (path.length < 3)
32226           return;
32227         var fromWayId2, fromNodeId, fromVertexId;
32228         var toWayId, toNodeId, toVertexId;
32229         var viaWayIds, viaNodeId, isUturn;
32230         fromWayId2 = path[0];
32231         toWayId = path[path.length - 1];
32232         if (path.length === 3 && fromWayId2 === toWayId) {
32233           var way2 = vgraph2.entity(fromWayId2);
32234           if (way2.__oneWay)
32235             return null;
32236           isUturn = true;
32237           viaNodeId = fromVertexId = toVertexId = path[1];
32238           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
32239         } else {
32240           isUturn = false;
32241           fromVertexId = path[1];
32242           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
32243           toVertexId = path[path.length - 2];
32244           toNodeId = adjacentNode(toWayId, toVertexId);
32245           if (path.length === 3) {
32246             viaNodeId = path[1];
32247           } else {
32248             viaWayIds = path.filter(function(entityId) {
32249               return entityId[0] === "w";
32250             });
32251             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
32252           }
32253         }
32254         return {
32255           key: path.join("_"),
32256           path,
32257           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
32258           via: { node: viaNodeId, ways: viaWayIds },
32259           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
32260           u: isUturn
32261         };
32262         function adjacentNode(wayId, affixId) {
32263           var nodes2 = vgraph2.entity(wayId).nodes;
32264           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
32265         }
32266       }
32267     };
32268     return intersection;
32269   }
32270   function osmInferRestriction(graph, turn, projection2) {
32271     var fromWay = graph.entity(turn.from.way);
32272     var fromNode = graph.entity(turn.from.node);
32273     var fromVertex = graph.entity(turn.from.vertex);
32274     var toWay = graph.entity(turn.to.way);
32275     var toNode = graph.entity(turn.to.node);
32276     var toVertex = graph.entity(turn.to.vertex);
32277     var fromOneWay = fromWay.tags.oneway === "yes";
32278     var toOneWay = toWay.tags.oneway === "yes";
32279     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
32280     while (angle2 < 0) {
32281       angle2 += 360;
32282     }
32283     if (fromNode === toNode) {
32284       return "no_u_turn";
32285     }
32286     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
32287       return "no_u_turn";
32288     }
32289     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
32290       return "no_u_turn";
32291     }
32292     if (angle2 < 158) {
32293       return "no_right_turn";
32294     }
32295     if (angle2 > 202) {
32296       return "no_left_turn";
32297     }
32298     return "no_straight_on";
32299   }
32300
32301   // modules/actions/merge_polygon.js
32302   function actionMergePolygon(ids, newRelationId) {
32303     function groupEntities(graph) {
32304       var entities = ids.map(function(id2) {
32305         return graph.entity(id2);
32306       });
32307       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
32308         if (entity.type === "way" && entity.isClosed()) {
32309           return "closedWay";
32310         } else if (entity.type === "relation" && entity.isMultipolygon()) {
32311           return "multipolygon";
32312         } else {
32313           return "other";
32314         }
32315       });
32316       return Object.assign(
32317         { closedWay: [], multipolygon: [], other: [] },
32318         geometryGroups
32319       );
32320     }
32321     var action = function(graph) {
32322       var entities = groupEntities(graph);
32323       var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
32324         return polygons2.concat(osmJoinWays(m2.members, graph));
32325       }, []).concat(entities.closedWay.map(function(d2) {
32326         var member = [{ id: d2.id }];
32327         member.nodes = graph.childNodes(d2);
32328         return member;
32329       }));
32330       var contained = polygons.map(function(w2, i3) {
32331         return polygons.map(function(d2, n3) {
32332           if (i3 === n3)
32333             return null;
32334           return geoPolygonContainsPolygon(
32335             d2.nodes.map(function(n4) {
32336               return n4.loc;
32337             }),
32338             w2.nodes.map(function(n4) {
32339               return n4.loc;
32340             })
32341           );
32342         });
32343       });
32344       var members = [];
32345       var outer = true;
32346       while (polygons.length) {
32347         extractUncontained(polygons);
32348         polygons = polygons.filter(isContained);
32349         contained = contained.filter(isContained).map(filterContained);
32350       }
32351       function isContained(d2, i3) {
32352         return contained[i3].some(function(val) {
32353           return val;
32354         });
32355       }
32356       function filterContained(d2) {
32357         return d2.filter(isContained);
32358       }
32359       function extractUncontained(polygons2) {
32360         polygons2.forEach(function(d2, i3) {
32361           if (!isContained(d2, i3)) {
32362             d2.forEach(function(member) {
32363               members.push({
32364                 type: "way",
32365                 id: member.id,
32366                 role: outer ? "outer" : "inner"
32367               });
32368             });
32369           }
32370         });
32371         outer = !outer;
32372       }
32373       var relation;
32374       if (entities.multipolygon.length > 0) {
32375         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
32376         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
32377       } else {
32378         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
32379       }
32380       entities.multipolygon.forEach(function(m2) {
32381         if (m2.id !== relation.id) {
32382           relation = relation.mergeTags(m2.tags);
32383           graph = graph.remove(m2);
32384         }
32385       });
32386       entities.closedWay.forEach(function(way) {
32387         function isThisOuter(m2) {
32388           return m2.id === way.id && m2.role !== "inner";
32389         }
32390         if (members.some(isThisOuter)) {
32391           relation = relation.mergeTags(way.tags);
32392           graph = graph.replace(way.update({ tags: {} }));
32393         }
32394       });
32395       return graph.replace(relation.update({
32396         members,
32397         tags: utilObjectOmit(relation.tags, ["area"])
32398       }));
32399     };
32400     action.disabled = function(graph) {
32401       var entities = groupEntities(graph);
32402       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
32403         return "not_eligible";
32404       }
32405       if (!entities.multipolygon.every(function(r2) {
32406         return r2.isComplete(graph);
32407       })) {
32408         return "incomplete_relation";
32409       }
32410       if (!entities.multipolygon.length) {
32411         var sharedMultipolygons = [];
32412         entities.closedWay.forEach(function(way, i3) {
32413           if (i3 === 0) {
32414             sharedMultipolygons = graph.parentMultipolygons(way);
32415           } else {
32416             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
32417           }
32418         });
32419         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
32420           return relation.members.length === entities.closedWay.length;
32421         });
32422         if (sharedMultipolygons.length) {
32423           return "not_eligible";
32424         }
32425       } else if (entities.closedWay.some(function(way) {
32426         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
32427       })) {
32428         return "not_eligible";
32429       }
32430     };
32431     return action;
32432   }
32433
32434   // modules/actions/merge_remote_changes.js
32435   var import_fast_deep_equal = __toESM(require_fast_deep_equal());
32436
32437   // node_modules/node-diff3/index.mjs
32438   function LCS(buffer1, buffer2) {
32439     let equivalenceClasses = {};
32440     for (let j3 = 0; j3 < buffer2.length; j3++) {
32441       const item = buffer2[j3];
32442       if (equivalenceClasses[item]) {
32443         equivalenceClasses[item].push(j3);
32444       } else {
32445         equivalenceClasses[item] = [j3];
32446       }
32447     }
32448     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
32449     let candidates = [NULLRESULT];
32450     for (let i3 = 0; i3 < buffer1.length; i3++) {
32451       const item = buffer1[i3];
32452       const buffer2indices = equivalenceClasses[item] || [];
32453       let r2 = 0;
32454       let c2 = candidates[0];
32455       for (let jx = 0; jx < buffer2indices.length; jx++) {
32456         const j3 = buffer2indices[jx];
32457         let s2;
32458         for (s2 = r2; s2 < candidates.length; s2++) {
32459           if (candidates[s2].buffer2index < j3 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j3)) {
32460             break;
32461           }
32462         }
32463         if (s2 < candidates.length) {
32464           const newCandidate = { buffer1index: i3, buffer2index: j3, chain: candidates[s2] };
32465           if (r2 === candidates.length) {
32466             candidates.push(c2);
32467           } else {
32468             candidates[r2] = c2;
32469           }
32470           r2 = s2 + 1;
32471           c2 = newCandidate;
32472           if (r2 === candidates.length) {
32473             break;
32474           }
32475         }
32476       }
32477       candidates[r2] = c2;
32478     }
32479     return candidates[candidates.length - 1];
32480   }
32481   function diffIndices(buffer1, buffer2) {
32482     const lcs = LCS(buffer1, buffer2);
32483     let result = [];
32484     let tail1 = buffer1.length;
32485     let tail2 = buffer2.length;
32486     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
32487       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
32488       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
32489       tail1 = candidate.buffer1index;
32490       tail2 = candidate.buffer2index;
32491       if (mismatchLength1 || mismatchLength2) {
32492         result.push({
32493           buffer1: [tail1 + 1, mismatchLength1],
32494           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
32495           buffer2: [tail2 + 1, mismatchLength2],
32496           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
32497         });
32498       }
32499     }
32500     result.reverse();
32501     return result;
32502   }
32503   function diff3MergeRegions(a2, o2, b2) {
32504     let hunks = [];
32505     function addHunk(h2, ab) {
32506       hunks.push({
32507         ab,
32508         oStart: h2.buffer1[0],
32509         oLength: h2.buffer1[1],
32510         // length of o to remove
32511         abStart: h2.buffer2[0],
32512         abLength: h2.buffer2[1]
32513         // length of a/b to insert
32514         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
32515       });
32516     }
32517     diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
32518     diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
32519     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
32520     let results = [];
32521     let currOffset = 0;
32522     function advanceTo(endOffset) {
32523       if (endOffset > currOffset) {
32524         results.push({
32525           stable: true,
32526           buffer: "o",
32527           bufferStart: currOffset,
32528           bufferLength: endOffset - currOffset,
32529           bufferContent: o2.slice(currOffset, endOffset)
32530         });
32531         currOffset = endOffset;
32532       }
32533     }
32534     while (hunks.length) {
32535       let hunk = hunks.shift();
32536       let regionStart = hunk.oStart;
32537       let regionEnd = hunk.oStart + hunk.oLength;
32538       let regionHunks = [hunk];
32539       advanceTo(regionStart);
32540       while (hunks.length) {
32541         const nextHunk = hunks[0];
32542         const nextHunkStart = nextHunk.oStart;
32543         if (nextHunkStart > regionEnd)
32544           break;
32545         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
32546         regionHunks.push(hunks.shift());
32547       }
32548       if (regionHunks.length === 1) {
32549         if (hunk.abLength > 0) {
32550           const buffer = hunk.ab === "a" ? a2 : b2;
32551           results.push({
32552             stable: true,
32553             buffer: hunk.ab,
32554             bufferStart: hunk.abStart,
32555             bufferLength: hunk.abLength,
32556             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
32557           });
32558         }
32559       } else {
32560         let bounds = {
32561           a: [a2.length, -1, o2.length, -1],
32562           b: [b2.length, -1, o2.length, -1]
32563         };
32564         while (regionHunks.length) {
32565           hunk = regionHunks.shift();
32566           const oStart = hunk.oStart;
32567           const oEnd = oStart + hunk.oLength;
32568           const abStart = hunk.abStart;
32569           const abEnd = abStart + hunk.abLength;
32570           let b3 = bounds[hunk.ab];
32571           b3[0] = Math.min(abStart, b3[0]);
32572           b3[1] = Math.max(abEnd, b3[1]);
32573           b3[2] = Math.min(oStart, b3[2]);
32574           b3[3] = Math.max(oEnd, b3[3]);
32575         }
32576         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
32577         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
32578         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
32579         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
32580         let result = {
32581           stable: false,
32582           aStart,
32583           aLength: aEnd - aStart,
32584           aContent: a2.slice(aStart, aEnd),
32585           oStart: regionStart,
32586           oLength: regionEnd - regionStart,
32587           oContent: o2.slice(regionStart, regionEnd),
32588           bStart,
32589           bLength: bEnd - bStart,
32590           bContent: b2.slice(bStart, bEnd)
32591         };
32592         results.push(result);
32593       }
32594       currOffset = regionEnd;
32595     }
32596     advanceTo(o2.length);
32597     return results;
32598   }
32599   function diff3Merge(a2, o2, b2, options2) {
32600     let defaults = {
32601       excludeFalseConflicts: true,
32602       stringSeparator: /\s+/
32603     };
32604     options2 = Object.assign(defaults, options2);
32605     if (typeof a2 === "string")
32606       a2 = a2.split(options2.stringSeparator);
32607     if (typeof o2 === "string")
32608       o2 = o2.split(options2.stringSeparator);
32609     if (typeof b2 === "string")
32610       b2 = b2.split(options2.stringSeparator);
32611     let results = [];
32612     const regions = diff3MergeRegions(a2, o2, b2);
32613     let okBuffer = [];
32614     function flushOk() {
32615       if (okBuffer.length) {
32616         results.push({ ok: okBuffer });
32617       }
32618       okBuffer = [];
32619     }
32620     function isFalseConflict(a3, b3) {
32621       if (a3.length !== b3.length)
32622         return false;
32623       for (let i3 = 0; i3 < a3.length; i3++) {
32624         if (a3[i3] !== b3[i3])
32625           return false;
32626       }
32627       return true;
32628     }
32629     regions.forEach((region) => {
32630       if (region.stable) {
32631         okBuffer.push(...region.bufferContent);
32632       } else {
32633         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
32634           okBuffer.push(...region.aContent);
32635         } else {
32636           flushOk();
32637           results.push({
32638             conflict: {
32639               a: region.aContent,
32640               aIndex: region.aStart,
32641               o: region.oContent,
32642               oIndex: region.oStart,
32643               b: region.bContent,
32644               bIndex: region.bStart
32645             }
32646           });
32647         }
32648       }
32649     });
32650     flushOk();
32651     return results;
32652   }
32653
32654   // modules/actions/merge_remote_changes.js
32655   var import_lodash2 = __toESM(require_lodash());
32656   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
32657     discardTags = discardTags || {};
32658     var _option = "safe";
32659     var _conflicts = [];
32660     function user(d2) {
32661       return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash2.escape)(d2);
32662     }
32663     function mergeLocation(remote, target) {
32664       function pointEqual(a2, b2) {
32665         var epsilon3 = 1e-6;
32666         return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
32667       }
32668       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
32669         return target;
32670       }
32671       if (_option === "force_remote") {
32672         return target.update({ loc: remote.loc });
32673       }
32674       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
32675       return target;
32676     }
32677     function mergeNodes(base, remote, target) {
32678       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
32679         return target;
32680       }
32681       if (_option === "force_remote") {
32682         return target.update({ nodes: remote.nodes });
32683       }
32684       var ccount = _conflicts.length;
32685       var o2 = base.nodes || [];
32686       var a2 = target.nodes || [];
32687       var b2 = remote.nodes || [];
32688       var nodes = [];
32689       var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
32690       for (var i3 = 0; i3 < hunks.length; i3++) {
32691         var hunk = hunks[i3];
32692         if (hunk.ok) {
32693           nodes.push.apply(nodes, hunk.ok);
32694         } else {
32695           var c2 = hunk.conflict;
32696           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
32697             nodes.push.apply(nodes, c2.b);
32698           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
32699             nodes.push.apply(nodes, c2.a);
32700           } else {
32701             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
32702             break;
32703           }
32704         }
32705       }
32706       return _conflicts.length === ccount ? target.update({ nodes }) : target;
32707     }
32708     function mergeChildren(targetWay, children2, updates, graph) {
32709       function isUsed(node2, targetWay2) {
32710         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
32711           return way.id !== targetWay2.id;
32712         });
32713         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
32714       }
32715       var ccount = _conflicts.length;
32716       for (var i3 = 0; i3 < children2.length; i3++) {
32717         var id3 = children2[i3];
32718         var node = graph.hasEntity(id3);
32719         if (targetWay.nodes.indexOf(id3) === -1) {
32720           if (node && !isUsed(node, targetWay)) {
32721             updates.removeIds.push(id3);
32722           }
32723           continue;
32724         }
32725         var local = localGraph.hasEntity(id3);
32726         var remote = remoteGraph.hasEntity(id3);
32727         var target;
32728         if (_option === "force_remote" && remote && remote.visible) {
32729           updates.replacements.push(remote);
32730         } else if (_option === "force_local" && local) {
32731           target = osmEntity(local);
32732           if (remote) {
32733             target = target.update({ version: remote.version });
32734           }
32735           updates.replacements.push(target);
32736         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
32737           target = osmEntity(local, { version: remote.version });
32738           if (remote.visible) {
32739             target = mergeLocation(remote, target);
32740           } else {
32741             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32742           }
32743           if (_conflicts.length !== ccount)
32744             break;
32745           updates.replacements.push(target);
32746         }
32747       }
32748       return targetWay;
32749     }
32750     function updateChildren(updates, graph) {
32751       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
32752         graph = graph.replace(updates.replacements[i3]);
32753       }
32754       if (updates.removeIds.length) {
32755         graph = actionDeleteMultiple(updates.removeIds)(graph);
32756       }
32757       return graph;
32758     }
32759     function mergeMembers(remote, target) {
32760       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
32761         return target;
32762       }
32763       if (_option === "force_remote") {
32764         return target.update({ members: remote.members });
32765       }
32766       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
32767       return target;
32768     }
32769     function mergeTags(base, remote, target) {
32770       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
32771         return target;
32772       }
32773       if (_option === "force_remote") {
32774         return target.update({ tags: remote.tags });
32775       }
32776       var ccount = _conflicts.length;
32777       var o2 = base.tags || {};
32778       var a2 = target.tags || {};
32779       var b2 = remote.tags || {};
32780       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
32781         return !discardTags[k3];
32782       });
32783       var tags = Object.assign({}, a2);
32784       var changed = false;
32785       for (var i3 = 0; i3 < keys2.length; i3++) {
32786         var k2 = keys2[i3];
32787         if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
32788           if (o2[k2] !== a2[k2]) {
32789             _conflicts.push(_t.html(
32790               "merge_remote_changes.conflict.tags",
32791               { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
32792             ));
32793           } else {
32794             if (b2.hasOwnProperty(k2)) {
32795               tags[k2] = b2[k2];
32796             } else {
32797               delete tags[k2];
32798             }
32799             changed = true;
32800           }
32801         }
32802       }
32803       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
32804     }
32805     var action = function(graph) {
32806       var updates = { replacements: [], removeIds: [] };
32807       var base = graph.base().entities[id2];
32808       var local = localGraph.entity(id2);
32809       var remote = remoteGraph.entity(id2);
32810       var target = osmEntity(local, { version: remote.version });
32811       if (!remote.visible) {
32812         if (_option === "force_remote") {
32813           return actionDeleteMultiple([id2])(graph);
32814         } else if (_option === "force_local") {
32815           if (target.type === "way") {
32816             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
32817             graph = updateChildren(updates, graph);
32818           }
32819           return graph.replace(target);
32820         } else {
32821           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32822           return graph;
32823         }
32824       }
32825       if (target.type === "node") {
32826         target = mergeLocation(remote, target);
32827       } else if (target.type === "way") {
32828         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
32829         target = mergeNodes(base, remote, target);
32830         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
32831       } else if (target.type === "relation") {
32832         target = mergeMembers(remote, target);
32833       }
32834       target = mergeTags(base, remote, target);
32835       if (!_conflicts.length) {
32836         graph = updateChildren(updates, graph).replace(target);
32837       }
32838       return graph;
32839     };
32840     action.withOption = function(opt) {
32841       _option = opt;
32842       return action;
32843     };
32844     action.conflicts = function() {
32845       return _conflicts;
32846     };
32847     return action;
32848   }
32849
32850   // modules/actions/move.js
32851   function actionMove(moveIDs, tryDelta, projection2, cache) {
32852     var _delta = tryDelta;
32853     function setupCache(graph) {
32854       function canMove(nodeID) {
32855         if (moveIDs.indexOf(nodeID) !== -1)
32856           return true;
32857         var parents = graph.parentWays(graph.entity(nodeID));
32858         if (parents.length < 3)
32859           return true;
32860         var parentsMoving = parents.every(function(way) {
32861           return cache.moving[way.id];
32862         });
32863         if (!parentsMoving)
32864           delete cache.moving[nodeID];
32865         return parentsMoving;
32866       }
32867       function cacheEntities(ids) {
32868         for (var i3 = 0; i3 < ids.length; i3++) {
32869           var id2 = ids[i3];
32870           if (cache.moving[id2])
32871             continue;
32872           cache.moving[id2] = true;
32873           var entity = graph.hasEntity(id2);
32874           if (!entity)
32875             continue;
32876           if (entity.type === "node") {
32877             cache.nodes.push(id2);
32878             cache.startLoc[id2] = entity.loc;
32879           } else if (entity.type === "way") {
32880             cache.ways.push(id2);
32881             cacheEntities(entity.nodes);
32882           } else {
32883             cacheEntities(entity.members.map(function(member) {
32884               return member.id;
32885             }));
32886           }
32887         }
32888       }
32889       function cacheIntersections(ids) {
32890         function isEndpoint(way2, id3) {
32891           return !way2.isClosed() && !!way2.affix(id3);
32892         }
32893         for (var i3 = 0; i3 < ids.length; i3++) {
32894           var id2 = ids[i3];
32895           var childNodes = graph.childNodes(graph.entity(id2));
32896           for (var j3 = 0; j3 < childNodes.length; j3++) {
32897             var node = childNodes[j3];
32898             var parents = graph.parentWays(node);
32899             if (parents.length !== 2)
32900               continue;
32901             var moved = graph.entity(id2);
32902             var unmoved = null;
32903             for (var k2 = 0; k2 < parents.length; k2++) {
32904               var way = parents[k2];
32905               if (!cache.moving[way.id]) {
32906                 unmoved = way;
32907                 break;
32908               }
32909             }
32910             if (!unmoved)
32911               continue;
32912             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
32913               continue;
32914             if (moved.isArea() || unmoved.isArea())
32915               continue;
32916             cache.intersections.push({
32917               nodeId: node.id,
32918               movedId: moved.id,
32919               unmovedId: unmoved.id,
32920               movedIsEP: isEndpoint(moved, node.id),
32921               unmovedIsEP: isEndpoint(unmoved, node.id)
32922             });
32923           }
32924         }
32925       }
32926       if (!cache) {
32927         cache = {};
32928       }
32929       if (!cache.ok) {
32930         cache.moving = {};
32931         cache.intersections = [];
32932         cache.replacedVertex = {};
32933         cache.startLoc = {};
32934         cache.nodes = [];
32935         cache.ways = [];
32936         cacheEntities(moveIDs);
32937         cacheIntersections(cache.ways);
32938         cache.nodes = cache.nodes.filter(canMove);
32939         cache.ok = true;
32940       }
32941     }
32942     function replaceMovedVertex(nodeId, wayId, graph, delta) {
32943       var way = graph.entity(wayId);
32944       var moved = graph.entity(nodeId);
32945       var movedIndex = way.nodes.indexOf(nodeId);
32946       var len, prevIndex, nextIndex;
32947       if (way.isClosed()) {
32948         len = way.nodes.length - 1;
32949         prevIndex = (movedIndex + len - 1) % len;
32950         nextIndex = (movedIndex + len + 1) % len;
32951       } else {
32952         len = way.nodes.length;
32953         prevIndex = movedIndex - 1;
32954         nextIndex = movedIndex + 1;
32955       }
32956       var prev = graph.hasEntity(way.nodes[prevIndex]);
32957       var next = graph.hasEntity(way.nodes[nextIndex]);
32958       if (!prev || !next)
32959         return graph;
32960       var key = wayId + "_" + nodeId;
32961       var orig = cache.replacedVertex[key];
32962       if (!orig) {
32963         orig = osmNode();
32964         cache.replacedVertex[key] = orig;
32965         cache.startLoc[orig.id] = cache.startLoc[nodeId];
32966       }
32967       var start2, end;
32968       if (delta) {
32969         start2 = projection2(cache.startLoc[nodeId]);
32970         end = projection2.invert(geoVecAdd(start2, delta));
32971       } else {
32972         end = cache.startLoc[nodeId];
32973       }
32974       orig = orig.move(end);
32975       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
32976       if (angle2 > 175 && angle2 < 185)
32977         return graph;
32978       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
32979       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
32980       var d1 = geoPathLength(p1);
32981       var d2 = geoPathLength(p2);
32982       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
32983       if (way.isClosed() && insertAt === 0)
32984         insertAt = len;
32985       way = way.addNode(orig.id, insertAt);
32986       return graph.replace(orig).replace(way);
32987     }
32988     function removeDuplicateVertices(wayId, graph) {
32989       var way = graph.entity(wayId);
32990       var epsilon3 = 1e-6;
32991       var prev, curr;
32992       function isInteresting(node, graph2) {
32993         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
32994       }
32995       for (var i3 = 0; i3 < way.nodes.length; i3++) {
32996         curr = graph.entity(way.nodes[i3]);
32997         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
32998           if (!isInteresting(prev, graph)) {
32999             way = way.removeNode(prev.id);
33000             graph = graph.replace(way).remove(prev);
33001           } else if (!isInteresting(curr, graph)) {
33002             way = way.removeNode(curr.id);
33003             graph = graph.replace(way).remove(curr);
33004           }
33005         }
33006         prev = curr;
33007       }
33008       return graph;
33009     }
33010     function unZorroIntersection(intersection, graph) {
33011       var vertex = graph.entity(intersection.nodeId);
33012       var way1 = graph.entity(intersection.movedId);
33013       var way2 = graph.entity(intersection.unmovedId);
33014       var isEP1 = intersection.movedIsEP;
33015       var isEP2 = intersection.unmovedIsEP;
33016       if (isEP1 && isEP2)
33017         return graph;
33018       var nodes1 = graph.childNodes(way1).filter(function(n3) {
33019         return n3 !== vertex;
33020       });
33021       var nodes2 = graph.childNodes(way2).filter(function(n3) {
33022         return n3 !== vertex;
33023       });
33024       if (way1.isClosed() && way1.first() === vertex.id)
33025         nodes1.push(nodes1[0]);
33026       if (way2.isClosed() && way2.first() === vertex.id)
33027         nodes2.push(nodes2[0]);
33028       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
33029       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
33030       var loc;
33031       if (!isEP1 && !isEP2) {
33032         var epsilon3 = 1e-6, maxIter = 10;
33033         for (var i3 = 0; i3 < maxIter; i3++) {
33034           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
33035           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
33036           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
33037           if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
33038             break;
33039         }
33040       } else if (!isEP1) {
33041         loc = edge1.loc;
33042       } else {
33043         loc = edge2.loc;
33044       }
33045       graph = graph.replace(vertex.move(loc));
33046       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
33047         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
33048         graph = graph.replace(way1);
33049       }
33050       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
33051         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
33052         graph = graph.replace(way2);
33053       }
33054       return graph;
33055     }
33056     function cleanupIntersections(graph) {
33057       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33058         var obj = cache.intersections[i3];
33059         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
33060         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
33061         graph = unZorroIntersection(obj, graph);
33062         graph = removeDuplicateVertices(obj.movedId, graph);
33063         graph = removeDuplicateVertices(obj.unmovedId, graph);
33064       }
33065       return graph;
33066     }
33067     function limitDelta(graph) {
33068       function moveNode(loc) {
33069         return geoVecAdd(projection2(loc), _delta);
33070       }
33071       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33072         var obj = cache.intersections[i3];
33073         if (obj.movedIsEP && obj.unmovedIsEP)
33074           continue;
33075         if (!obj.movedIsEP)
33076           continue;
33077         var node = graph.entity(obj.nodeId);
33078         var start2 = projection2(node.loc);
33079         var end = geoVecAdd(start2, _delta);
33080         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
33081         var movedPath = movedNodes.map(function(n3) {
33082           return moveNode(n3.loc);
33083         });
33084         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
33085         var unmovedPath = unmovedNodes.map(function(n3) {
33086           return projection2(n3.loc);
33087         });
33088         var hits = geoPathIntersections(movedPath, unmovedPath);
33089         for (var j3 = 0; i3 < hits.length; i3++) {
33090           if (geoVecEqual(hits[j3], end))
33091             continue;
33092           var edge = geoChooseEdge(unmovedNodes, end, projection2);
33093           _delta = geoVecSubtract(projection2(edge.loc), start2);
33094         }
33095       }
33096     }
33097     var action = function(graph) {
33098       if (_delta[0] === 0 && _delta[1] === 0)
33099         return graph;
33100       setupCache(graph);
33101       if (cache.intersections.length) {
33102         limitDelta(graph);
33103       }
33104       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
33105         var node = graph.entity(cache.nodes[i3]);
33106         var start2 = projection2(node.loc);
33107         var end = geoVecAdd(start2, _delta);
33108         graph = graph.replace(node.move(projection2.invert(end)));
33109       }
33110       if (cache.intersections.length) {
33111         graph = cleanupIntersections(graph);
33112       }
33113       return graph;
33114     };
33115     action.delta = function() {
33116       return _delta;
33117     };
33118     return action;
33119   }
33120
33121   // modules/actions/move_member.js
33122   function actionMoveMember(relationId, fromIndex, toIndex) {
33123     return function(graph) {
33124       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
33125     };
33126   }
33127
33128   // modules/actions/move_node.js
33129   function actionMoveNode(nodeID, toLoc) {
33130     var action = function(graph, t2) {
33131       if (t2 === null || !isFinite(t2))
33132         t2 = 1;
33133       t2 = Math.min(Math.max(+t2, 0), 1);
33134       var node = graph.entity(nodeID);
33135       return graph.replace(
33136         node.move(geoVecInterp(node.loc, toLoc, t2))
33137       );
33138     };
33139     action.transitionable = true;
33140     return action;
33141   }
33142
33143   // modules/actions/noop.js
33144   function actionNoop() {
33145     return function(graph) {
33146       return graph;
33147     };
33148   }
33149
33150   // modules/actions/orthogonalize.js
33151   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
33152     var epsilon3 = ep || 1e-4;
33153     var threshold = degThresh || 13;
33154     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
33155     var upperThreshold = Math.cos(threshold * Math.PI / 180);
33156     var action = function(graph, t2) {
33157       if (t2 === null || !isFinite(t2))
33158         t2 = 1;
33159       t2 = Math.min(Math.max(+t2, 0), 1);
33160       var way = graph.entity(wayID);
33161       way = way.removeNode("");
33162       if (way.tags.nonsquare) {
33163         var tags = Object.assign({}, way.tags);
33164         delete tags.nonsquare;
33165         way = way.update({ tags });
33166       }
33167       graph = graph.replace(way);
33168       var isClosed = way.isClosed();
33169       var nodes = graph.childNodes(way).slice();
33170       if (isClosed)
33171         nodes.pop();
33172       if (vertexID !== void 0) {
33173         nodes = nodeSubset(nodes, vertexID, isClosed);
33174         if (nodes.length !== 3)
33175           return graph;
33176       }
33177       var nodeCount = {};
33178       var points = [];
33179       var corner = { i: 0, dotp: 1 };
33180       var node, point2, loc, score, motions, i3, j3;
33181       for (i3 = 0; i3 < nodes.length; i3++) {
33182         node = nodes[i3];
33183         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
33184         points.push({ id: node.id, coord: projection2(node.loc) });
33185       }
33186       if (points.length === 3) {
33187         for (i3 = 0; i3 < 1e3; i3++) {
33188           motions = points.map(calcMotion);
33189           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
33190           score = corner.dotp;
33191           if (score < epsilon3) {
33192             break;
33193           }
33194         }
33195         node = graph.entity(nodes[corner.i].id);
33196         loc = projection2.invert(points[corner.i].coord);
33197         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33198       } else {
33199         var straights = [];
33200         var simplified = [];
33201         for (i3 = 0; i3 < points.length; i3++) {
33202           point2 = points[i3];
33203           var dotp = 0;
33204           if (isClosed || i3 > 0 && i3 < points.length - 1) {
33205             var a2 = points[(i3 - 1 + points.length) % points.length];
33206             var b2 = points[(i3 + 1) % points.length];
33207             dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point2.coord));
33208           }
33209           if (dotp > upperThreshold) {
33210             straights.push(point2);
33211           } else {
33212             simplified.push(point2);
33213           }
33214         }
33215         var bestPoints = clonePoints(simplified);
33216         var originalPoints = clonePoints(simplified);
33217         score = Infinity;
33218         for (i3 = 0; i3 < 1e3; i3++) {
33219           motions = simplified.map(calcMotion);
33220           for (j3 = 0; j3 < motions.length; j3++) {
33221             simplified[j3].coord = geoVecAdd(simplified[j3].coord, motions[j3]);
33222           }
33223           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
33224           if (newScore < score) {
33225             bestPoints = clonePoints(simplified);
33226             score = newScore;
33227           }
33228           if (score < epsilon3) {
33229             break;
33230           }
33231         }
33232         var bestCoords = bestPoints.map(function(p2) {
33233           return p2.coord;
33234         });
33235         if (isClosed)
33236           bestCoords.push(bestCoords[0]);
33237         for (i3 = 0; i3 < bestPoints.length; i3++) {
33238           point2 = bestPoints[i3];
33239           if (!geoVecEqual(originalPoints[i3].coord, point2.coord)) {
33240             node = graph.entity(point2.id);
33241             loc = projection2.invert(point2.coord);
33242             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33243           }
33244         }
33245         for (i3 = 0; i3 < straights.length; i3++) {
33246           point2 = straights[i3];
33247           if (nodeCount[point2.id] > 1)
33248             continue;
33249           node = graph.entity(point2.id);
33250           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
33251             graph = actionDeleteNode(node.id)(graph);
33252           } else {
33253             var choice = geoVecProject(point2.coord, bestCoords);
33254             if (choice) {
33255               loc = projection2.invert(choice.target);
33256               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33257             }
33258           }
33259         }
33260       }
33261       return graph;
33262       function clonePoints(array2) {
33263         return array2.map(function(p2) {
33264           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
33265         });
33266       }
33267       function calcMotion(point3, i4, array2) {
33268         if (!isClosed && (i4 === 0 || i4 === array2.length - 1))
33269           return [0, 0];
33270         if (nodeCount[array2[i4].id] > 1)
33271           return [0, 0];
33272         var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
33273         var origin = point3.coord;
33274         var b3 = array2[(i4 + 1) % array2.length].coord;
33275         var p2 = geoVecSubtract(a3, origin);
33276         var q2 = geoVecSubtract(b3, origin);
33277         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
33278         p2 = geoVecNormalize(p2);
33279         q2 = geoVecNormalize(q2);
33280         var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
33281         var val = Math.abs(dotp2);
33282         if (val < lowerThreshold) {
33283           corner.i = i4;
33284           corner.dotp = val;
33285           var vec = geoVecNormalize(geoVecAdd(p2, q2));
33286           return geoVecScale(vec, 0.1 * dotp2 * scale);
33287         }
33288         return [0, 0];
33289       }
33290     };
33291     function nodeSubset(nodes, vertexID2, isClosed) {
33292       var first = isClosed ? 0 : 1;
33293       var last = isClosed ? nodes.length : nodes.length - 1;
33294       for (var i3 = first; i3 < last; i3++) {
33295         if (nodes[i3].id === vertexID2) {
33296           return [
33297             nodes[(i3 - 1 + nodes.length) % nodes.length],
33298             nodes[i3],
33299             nodes[(i3 + 1) % nodes.length]
33300           ];
33301         }
33302       }
33303       return [];
33304     }
33305     action.disabled = function(graph) {
33306       var way = graph.entity(wayID);
33307       way = way.removeNode("");
33308       graph = graph.replace(way);
33309       var isClosed = way.isClosed();
33310       var nodes = graph.childNodes(way).slice();
33311       if (isClosed)
33312         nodes.pop();
33313       var allowStraightAngles = false;
33314       if (vertexID !== void 0) {
33315         allowStraightAngles = true;
33316         nodes = nodeSubset(nodes, vertexID, isClosed);
33317         if (nodes.length !== 3)
33318           return "end_vertex";
33319       }
33320       var coords = nodes.map(function(n3) {
33321         return projection2(n3.loc);
33322       });
33323       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
33324       if (score === null) {
33325         return "not_squarish";
33326       } else if (score === 0) {
33327         return "square_enough";
33328       } else {
33329         return false;
33330       }
33331     };
33332     action.transitionable = true;
33333     return action;
33334   }
33335
33336   // modules/actions/restrict_turn.js
33337   function actionRestrictTurn(turn, restrictionType, restrictionID) {
33338     return function(graph) {
33339       var fromWay = graph.entity(turn.from.way);
33340       var toWay = graph.entity(turn.to.way);
33341       var viaNode = turn.via.node && graph.entity(turn.via.node);
33342       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
33343         return graph.entity(id2);
33344       });
33345       var members = [];
33346       members.push({ id: fromWay.id, type: "way", role: "from" });
33347       if (viaNode) {
33348         members.push({ id: viaNode.id, type: "node", role: "via" });
33349       } else if (viaWays) {
33350         viaWays.forEach(function(viaWay) {
33351           members.push({ id: viaWay.id, type: "way", role: "via" });
33352         });
33353       }
33354       members.push({ id: toWay.id, type: "way", role: "to" });
33355       return graph.replace(osmRelation({
33356         id: restrictionID,
33357         tags: {
33358           type: "restriction",
33359           restriction: restrictionType
33360         },
33361         members
33362       }));
33363     };
33364   }
33365
33366   // modules/actions/revert.js
33367   function actionRevert(id2) {
33368     var action = function(graph) {
33369       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
33370       if (entity && !base) {
33371         if (entity.type === "node") {
33372           graph.parentWays(entity).forEach(function(parent) {
33373             parent = parent.removeNode(id2);
33374             graph = graph.replace(parent);
33375             if (parent.isDegenerate()) {
33376               graph = actionDeleteWay(parent.id)(graph);
33377             }
33378           });
33379         }
33380         graph.parentRelations(entity).forEach(function(parent) {
33381           parent = parent.removeMembersWithID(id2);
33382           graph = graph.replace(parent);
33383           if (parent.isDegenerate()) {
33384             graph = actionDeleteRelation(parent.id)(graph);
33385           }
33386         });
33387       }
33388       return graph.revert(id2);
33389     };
33390     return action;
33391   }
33392
33393   // modules/actions/rotate.js
33394   function actionRotate(rotateIds, pivot, angle2, projection2) {
33395     var action = function(graph) {
33396       return graph.update(function(graph2) {
33397         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
33398           var point2 = geoRotate([projection2(node.loc)], angle2, pivot)[0];
33399           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33400         });
33401       });
33402     };
33403     return action;
33404   }
33405
33406   // modules/actions/scale.js
33407   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
33408     return function(graph) {
33409       return graph.update(function(graph2) {
33410         let point2, radial;
33411         utilGetAllNodes(ids, graph2).forEach(function(node) {
33412           point2 = projection2(node.loc);
33413           radial = [
33414             point2[0] - pivotLoc[0],
33415             point2[1] - pivotLoc[1]
33416           ];
33417           point2 = [
33418             pivotLoc[0] + scaleFactor * radial[0],
33419             pivotLoc[1] + scaleFactor * radial[1]
33420           ];
33421           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33422         });
33423       });
33424     };
33425   }
33426
33427   // modules/actions/straighten_nodes.js
33428   function actionStraightenNodes(nodeIDs, projection2) {
33429     function positionAlongWay(a2, o2, b2) {
33430       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33431     }
33432     function getEndpoints(points) {
33433       var ssr = geoGetSmallestSurroundingRectangle(points);
33434       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33435       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33436       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33437       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33438       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33439       if (isLong) {
33440         return [p1, q1];
33441       }
33442       return [p2, q2];
33443     }
33444     var action = function(graph, t2) {
33445       if (t2 === null || !isFinite(t2))
33446         t2 = 1;
33447       t2 = Math.min(Math.max(+t2, 0), 1);
33448       var nodes = nodeIDs.map(function(id2) {
33449         return graph.entity(id2);
33450       });
33451       var points = nodes.map(function(n3) {
33452         return projection2(n3.loc);
33453       });
33454       var endpoints = getEndpoints(points);
33455       var startPoint = endpoints[0];
33456       var endPoint = endpoints[1];
33457       for (var i3 = 0; i3 < points.length; i3++) {
33458         var node = nodes[i3];
33459         var point2 = points[i3];
33460         var u2 = positionAlongWay(point2, startPoint, endPoint);
33461         var point22 = geoVecInterp(startPoint, endPoint, u2);
33462         var loc2 = projection2.invert(point22);
33463         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33464       }
33465       return graph;
33466     };
33467     action.disabled = function(graph) {
33468       var nodes = nodeIDs.map(function(id2) {
33469         return graph.entity(id2);
33470       });
33471       var points = nodes.map(function(n3) {
33472         return projection2(n3.loc);
33473       });
33474       var endpoints = getEndpoints(points);
33475       var startPoint = endpoints[0];
33476       var endPoint = endpoints[1];
33477       var maxDistance = 0;
33478       for (var i3 = 0; i3 < points.length; i3++) {
33479         var point2 = points[i3];
33480         var u2 = positionAlongWay(point2, startPoint, endPoint);
33481         var p2 = geoVecInterp(startPoint, endPoint, u2);
33482         var dist = geoVecLength(p2, point2);
33483         if (!isNaN(dist) && dist > maxDistance) {
33484           maxDistance = dist;
33485         }
33486       }
33487       if (maxDistance < 1e-4) {
33488         return "straight_enough";
33489       }
33490     };
33491     action.transitionable = true;
33492     return action;
33493   }
33494
33495   // modules/actions/straighten_way.js
33496   function actionStraightenWay(selectedIDs, projection2) {
33497     function positionAlongWay(a2, o2, b2) {
33498       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33499     }
33500     function allNodes(graph) {
33501       var nodes = [];
33502       var startNodes = [];
33503       var endNodes = [];
33504       var remainingWays = [];
33505       var selectedWays = selectedIDs.filter(function(w2) {
33506         return graph.entity(w2).type === "way";
33507       });
33508       var selectedNodes = selectedIDs.filter(function(n3) {
33509         return graph.entity(n3).type === "node";
33510       });
33511       for (var i3 = 0; i3 < selectedWays.length; i3++) {
33512         var way = graph.entity(selectedWays[i3]);
33513         nodes = way.nodes.slice(0);
33514         remainingWays.push(nodes);
33515         startNodes.push(nodes[0]);
33516         endNodes.push(nodes[nodes.length - 1]);
33517       }
33518       startNodes = startNodes.filter(function(n3) {
33519         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
33520       });
33521       endNodes = endNodes.filter(function(n3) {
33522         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
33523       });
33524       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
33525       var nextWay = [];
33526       nodes = [];
33527       var getNextWay = function(currNode2, remainingWays2) {
33528         return remainingWays2.filter(function(way2) {
33529           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
33530         })[0];
33531       };
33532       while (remainingWays.length) {
33533         nextWay = getNextWay(currNode, remainingWays);
33534         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
33535         if (nextWay[0] !== currNode) {
33536           nextWay.reverse();
33537         }
33538         nodes = nodes.concat(nextWay);
33539         currNode = nodes[nodes.length - 1];
33540       }
33541       if (selectedNodes.length === 2) {
33542         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
33543         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
33544         var sortedStartEnd = [startNodeIdx, endNodeIdx];
33545         sortedStartEnd.sort(function(a2, b2) {
33546           return a2 - b2;
33547         });
33548         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
33549       }
33550       return nodes.map(function(n3) {
33551         return graph.entity(n3);
33552       });
33553     }
33554     function shouldKeepNode(node, graph) {
33555       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
33556     }
33557     var action = function(graph, t2) {
33558       if (t2 === null || !isFinite(t2))
33559         t2 = 1;
33560       t2 = Math.min(Math.max(+t2, 0), 1);
33561       var nodes = allNodes(graph);
33562       var points = nodes.map(function(n3) {
33563         return projection2(n3.loc);
33564       });
33565       var startPoint = points[0];
33566       var endPoint = points[points.length - 1];
33567       var toDelete = [];
33568       var i3;
33569       for (i3 = 1; i3 < points.length - 1; i3++) {
33570         var node = nodes[i3];
33571         var point2 = points[i3];
33572         if (t2 < 1 || shouldKeepNode(node, graph)) {
33573           var u2 = positionAlongWay(point2, startPoint, endPoint);
33574           var p2 = geoVecInterp(startPoint, endPoint, u2);
33575           var loc2 = projection2.invert(p2);
33576           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33577         } else {
33578           if (toDelete.indexOf(node) === -1) {
33579             toDelete.push(node);
33580           }
33581         }
33582       }
33583       for (i3 = 0; i3 < toDelete.length; i3++) {
33584         graph = actionDeleteNode(toDelete[i3].id)(graph);
33585       }
33586       return graph;
33587     };
33588     action.disabled = function(graph) {
33589       var nodes = allNodes(graph);
33590       var points = nodes.map(function(n3) {
33591         return projection2(n3.loc);
33592       });
33593       var startPoint = points[0];
33594       var endPoint = points[points.length - 1];
33595       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
33596       var i3;
33597       if (threshold === 0) {
33598         return "too_bendy";
33599       }
33600       var maxDistance = 0;
33601       for (i3 = 1; i3 < points.length - 1; i3++) {
33602         var point2 = points[i3];
33603         var u2 = positionAlongWay(point2, startPoint, endPoint);
33604         var p2 = geoVecInterp(startPoint, endPoint, u2);
33605         var dist = geoVecLength(p2, point2);
33606         if (isNaN(dist) || dist > threshold) {
33607           return "too_bendy";
33608         } else if (dist > maxDistance) {
33609           maxDistance = dist;
33610         }
33611       }
33612       var keepingAllNodes = nodes.every(function(node, i4) {
33613         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
33614       });
33615       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
33616       keepingAllNodes) {
33617         return "straight_enough";
33618       }
33619     };
33620     action.transitionable = true;
33621     return action;
33622   }
33623
33624   // modules/actions/unrestrict_turn.js
33625   function actionUnrestrictTurn(turn) {
33626     return function(graph) {
33627       return actionDeleteRelation(turn.restrictionID)(graph);
33628     };
33629   }
33630
33631   // modules/actions/reflect.js
33632   function actionReflect(reflectIds, projection2) {
33633     var _useLongAxis = true;
33634     var action = function(graph, t2) {
33635       if (t2 === null || !isFinite(t2))
33636         t2 = 1;
33637       t2 = Math.min(Math.max(+t2, 0), 1);
33638       var nodes = utilGetAllNodes(reflectIds, graph);
33639       var points = nodes.map(function(n3) {
33640         return projection2(n3.loc);
33641       });
33642       var ssr = geoGetSmallestSurroundingRectangle(points);
33643       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33644       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33645       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33646       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33647       var p3, q3;
33648       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33649       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
33650         p3 = p1;
33651         q3 = q1;
33652       } else {
33653         p3 = p2;
33654         q3 = q2;
33655       }
33656       var dx = q3[0] - p3[0];
33657       var dy = q3[1] - p3[1];
33658       var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
33659       var b2 = 2 * dx * dy / (dx * dx + dy * dy);
33660       for (var i3 = 0; i3 < nodes.length; i3++) {
33661         var node = nodes[i3];
33662         var c2 = projection2(node.loc);
33663         var c22 = [
33664           a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
33665           b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
33666         ];
33667         var loc2 = projection2.invert(c22);
33668         node = node.move(geoVecInterp(node.loc, loc2, t2));
33669         graph = graph.replace(node);
33670       }
33671       return graph;
33672     };
33673     action.useLongAxis = function(val) {
33674       if (!arguments.length)
33675         return _useLongAxis;
33676       _useLongAxis = val;
33677       return action;
33678     };
33679     action.transitionable = true;
33680     return action;
33681   }
33682
33683   // modules/actions/upgrade_tags.js
33684   function actionUpgradeTags(entityId, oldTags, replaceTags) {
33685     return function(graph) {
33686       var entity = graph.entity(entityId);
33687       var tags = Object.assign({}, entity.tags);
33688       var transferValue;
33689       var semiIndex;
33690       for (var oldTagKey in oldTags) {
33691         if (!(oldTagKey in tags))
33692           continue;
33693         if (oldTags[oldTagKey] === "*") {
33694           transferValue = tags[oldTagKey];
33695           delete tags[oldTagKey];
33696         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
33697           delete tags[oldTagKey];
33698         } else {
33699           var vals = tags[oldTagKey].split(";").filter(Boolean);
33700           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
33701           if (vals.length === 1 || oldIndex === -1) {
33702             delete tags[oldTagKey];
33703           } else {
33704             if (replaceTags && replaceTags[oldTagKey]) {
33705               semiIndex = oldIndex;
33706             }
33707             vals.splice(oldIndex, 1);
33708             tags[oldTagKey] = vals.join(";");
33709           }
33710         }
33711       }
33712       if (replaceTags) {
33713         for (var replaceKey in replaceTags) {
33714           var replaceValue = replaceTags[replaceKey];
33715           if (replaceValue === "*") {
33716             if (tags[replaceKey] && tags[replaceKey] !== "no") {
33717               continue;
33718             } else {
33719               tags[replaceKey] = "yes";
33720             }
33721           } else if (replaceValue === "$1") {
33722             tags[replaceKey] = transferValue;
33723           } else {
33724             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
33725               var existingVals = tags[replaceKey].split(";").filter(Boolean);
33726               if (existingVals.indexOf(replaceValue) === -1) {
33727                 existingVals.splice(semiIndex, 0, replaceValue);
33728                 tags[replaceKey] = existingVals.join(";");
33729               }
33730             } else {
33731               tags[replaceKey] = replaceValue;
33732             }
33733           }
33734         }
33735       }
33736       return graph.replace(entity.update({ tags }));
33737     };
33738   }
33739
33740   // modules/behavior/edit.js
33741   function behaviorEdit(context) {
33742     function behavior() {
33743       context.map().minzoom(context.minEditableZoom());
33744     }
33745     behavior.off = function() {
33746       context.map().minzoom(0);
33747     };
33748     return behavior;
33749   }
33750
33751   // modules/behavior/hover.js
33752   function behaviorHover(context) {
33753     var dispatch14 = dispatch_default("hover");
33754     var _selection = select_default2(null);
33755     var _newNodeId = null;
33756     var _initialNodeID = null;
33757     var _altDisables;
33758     var _ignoreVertex;
33759     var _targets = [];
33760     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33761     function keydown(d3_event) {
33762       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33763         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
33764         _selection.classed("hover-disabled", true);
33765         dispatch14.call("hover", this, null);
33766       }
33767     }
33768     function keyup(d3_event) {
33769       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33770         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
33771         _selection.classed("hover-disabled", false);
33772         dispatch14.call("hover", this, _targets);
33773       }
33774     }
33775     function behavior(selection2) {
33776       _selection = selection2;
33777       _targets = [];
33778       if (_initialNodeID) {
33779         _newNodeId = _initialNodeID;
33780         _initialNodeID = null;
33781       } else {
33782         _newNodeId = null;
33783       }
33784       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
33785       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
33786       function eventTarget(d3_event) {
33787         var datum2 = d3_event.target && d3_event.target.__data__;
33788         if (typeof datum2 !== "object")
33789           return null;
33790         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
33791           return datum2.properties.entity;
33792         }
33793         return datum2;
33794       }
33795       function pointerover(d3_event) {
33796         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
33797           return;
33798         var target = eventTarget(d3_event);
33799         if (target && _targets.indexOf(target) === -1) {
33800           _targets.push(target);
33801           updateHover(d3_event, _targets);
33802         }
33803       }
33804       function pointerout(d3_event) {
33805         var target = eventTarget(d3_event);
33806         var index = _targets.indexOf(target);
33807         if (index !== -1) {
33808           _targets.splice(index);
33809           updateHover(d3_event, _targets);
33810         }
33811       }
33812       function allowsVertex(d2) {
33813         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33814       }
33815       function modeAllowsHover(target) {
33816         var mode = context.mode();
33817         if (mode.id === "add-point") {
33818           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
33819         }
33820         return true;
33821       }
33822       function updateHover(d3_event, targets) {
33823         _selection.selectAll(".hover").classed("hover", false);
33824         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33825         var mode = context.mode();
33826         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
33827           var node = targets.find(function(target) {
33828             return target instanceof osmEntity && target.type === "node";
33829           });
33830           _newNodeId = node && node.id;
33831         }
33832         targets = targets.filter(function(datum3) {
33833           if (datum3 instanceof osmEntity) {
33834             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
33835           }
33836           return true;
33837         });
33838         var selector = "";
33839         for (var i3 in targets) {
33840           var datum2 = targets[i3];
33841           if (datum2.__featurehash__) {
33842             selector += ", .data" + datum2.__featurehash__;
33843           } else if (datum2 instanceof QAItem) {
33844             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
33845           } else if (datum2 instanceof osmNote) {
33846             selector += ", .note-" + datum2.id;
33847           } else if (datum2 instanceof osmEntity) {
33848             selector += ", ." + datum2.id;
33849             if (datum2.type === "relation") {
33850               for (var j3 in datum2.members) {
33851                 selector += ", ." + datum2.members[j3].id;
33852               }
33853             }
33854           }
33855         }
33856         var suppressed = _altDisables && d3_event && d3_event.altKey;
33857         if (selector.trim().length) {
33858           selector = selector.slice(1);
33859           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
33860         }
33861         dispatch14.call("hover", this, !suppressed && targets);
33862       }
33863     }
33864     behavior.off = function(selection2) {
33865       selection2.selectAll(".hover").classed("hover", false);
33866       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33867       selection2.classed("hover-disabled", false);
33868       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
33869       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
33870     };
33871     behavior.altDisables = function(val) {
33872       if (!arguments.length)
33873         return _altDisables;
33874       _altDisables = val;
33875       return behavior;
33876     };
33877     behavior.ignoreVertex = function(val) {
33878       if (!arguments.length)
33879         return _ignoreVertex;
33880       _ignoreVertex = val;
33881       return behavior;
33882     };
33883     behavior.initialNodeID = function(nodeId) {
33884       _initialNodeID = nodeId;
33885       return behavior;
33886     };
33887     return utilRebind(behavior, dispatch14, "on");
33888   }
33889
33890   // modules/behavior/draw.js
33891   var _disableSpace = false;
33892   var _lastSpace = null;
33893   function behaviorDraw(context) {
33894     var dispatch14 = dispatch_default(
33895       "move",
33896       "down",
33897       "downcancel",
33898       "click",
33899       "clickWay",
33900       "clickNode",
33901       "undo",
33902       "cancel",
33903       "finish"
33904     );
33905     var keybinding = utilKeybinding("draw");
33906     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
33907     var _edit = behaviorEdit(context);
33908     var _closeTolerance = 4;
33909     var _tolerance = 12;
33910     var _mouseLeave = false;
33911     var _lastMouse = null;
33912     var _lastPointerUpEvent;
33913     var _downPointer;
33914     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33915     function datum2(d3_event) {
33916       var mode = context.mode();
33917       var isNote = mode && mode.id.indexOf("note") !== -1;
33918       if (d3_event.altKey || isNote)
33919         return {};
33920       var element;
33921       if (d3_event.type === "keydown") {
33922         element = _lastMouse && _lastMouse.target;
33923       } else {
33924         element = d3_event.target;
33925       }
33926       var d2 = element.__data__;
33927       return d2 && d2.properties && d2.properties.target ? d2 : {};
33928     }
33929     function pointerdown(d3_event) {
33930       if (_downPointer)
33931         return;
33932       var pointerLocGetter = utilFastMouse(this);
33933       _downPointer = {
33934         id: d3_event.pointerId || "mouse",
33935         pointerLocGetter,
33936         downTime: +/* @__PURE__ */ new Date(),
33937         downLoc: pointerLocGetter(d3_event)
33938       };
33939       dispatch14.call("down", this, d3_event, datum2(d3_event));
33940     }
33941     function pointerup(d3_event) {
33942       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
33943         return;
33944       var downPointer = _downPointer;
33945       _downPointer = null;
33946       _lastPointerUpEvent = d3_event;
33947       if (downPointer.isCancelled)
33948         return;
33949       var t2 = +/* @__PURE__ */ new Date();
33950       var p2 = downPointer.pointerLocGetter(d3_event);
33951       var dist = geoVecLength(downPointer.downLoc, p2);
33952       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
33953         select_default2(window).on("click.draw-block", function() {
33954           d3_event.stopPropagation();
33955         }, true);
33956         context.map().dblclickZoomEnable(false);
33957         window.setTimeout(function() {
33958           context.map().dblclickZoomEnable(true);
33959           select_default2(window).on("click.draw-block", null);
33960         }, 500);
33961         click(d3_event, p2);
33962       }
33963     }
33964     function pointermove(d3_event) {
33965       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
33966         var p2 = _downPointer.pointerLocGetter(d3_event);
33967         var dist = geoVecLength(_downPointer.downLoc, p2);
33968         if (dist >= _closeTolerance) {
33969           _downPointer.isCancelled = true;
33970           dispatch14.call("downcancel", this);
33971         }
33972       }
33973       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
33974         return;
33975       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
33976         return;
33977       _lastMouse = d3_event;
33978       dispatch14.call("move", this, d3_event, datum2(d3_event));
33979     }
33980     function pointercancel(d3_event) {
33981       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
33982         if (!_downPointer.isCancelled) {
33983           dispatch14.call("downcancel", this);
33984         }
33985         _downPointer = null;
33986       }
33987     }
33988     function mouseenter() {
33989       _mouseLeave = false;
33990     }
33991     function mouseleave() {
33992       _mouseLeave = true;
33993     }
33994     function allowsVertex(d2) {
33995       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33996     }
33997     function click(d3_event, loc) {
33998       var d2 = datum2(d3_event);
33999       var target = d2 && d2.properties && d2.properties.entity;
34000       var mode = context.mode();
34001       if (target && target.type === "node" && allowsVertex(target)) {
34002         dispatch14.call("clickNode", this, target, d2);
34003         return;
34004       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
34005         var choice = geoChooseEdge(
34006           context.graph().childNodes(target),
34007           loc,
34008           context.projection,
34009           context.activeID()
34010         );
34011         if (choice) {
34012           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
34013           dispatch14.call("clickWay", this, choice.loc, edge, d2);
34014           return;
34015         }
34016       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
34017         var locLatLng = context.projection.invert(loc);
34018         dispatch14.call("click", this, locLatLng, d2);
34019       }
34020     }
34021     function space(d3_event) {
34022       d3_event.preventDefault();
34023       d3_event.stopPropagation();
34024       var currSpace = context.map().mouse();
34025       if (_disableSpace && _lastSpace) {
34026         var dist = geoVecLength(_lastSpace, currSpace);
34027         if (dist > _tolerance) {
34028           _disableSpace = false;
34029         }
34030       }
34031       if (_disableSpace || _mouseLeave || !_lastMouse)
34032         return;
34033       _lastSpace = currSpace;
34034       _disableSpace = true;
34035       select_default2(window).on("keyup.space-block", function() {
34036         d3_event.preventDefault();
34037         d3_event.stopPropagation();
34038         _disableSpace = false;
34039         select_default2(window).on("keyup.space-block", null);
34040       });
34041       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
34042       context.projection(context.map().center());
34043       click(d3_event, loc);
34044     }
34045     function backspace(d3_event) {
34046       d3_event.preventDefault();
34047       dispatch14.call("undo");
34048     }
34049     function del(d3_event) {
34050       d3_event.preventDefault();
34051       dispatch14.call("cancel");
34052     }
34053     function ret(d3_event) {
34054       d3_event.preventDefault();
34055       dispatch14.call("finish");
34056     }
34057     function behavior(selection2) {
34058       context.install(_hover);
34059       context.install(_edit);
34060       _downPointer = null;
34061       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
34062       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
34063       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
34064       select_default2(document).call(keybinding);
34065       return behavior;
34066     }
34067     behavior.off = function(selection2) {
34068       context.ui().sidebar.hover.cancel();
34069       context.uninstall(_hover);
34070       context.uninstall(_edit);
34071       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
34072       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
34073       select_default2(document).call(keybinding.unbind);
34074     };
34075     behavior.hover = function() {
34076       return _hover;
34077     };
34078     return utilRebind(behavior, dispatch14, "on");
34079   }
34080
34081   // modules/behavior/breathe.js
34082   var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
34083
34084   // node_modules/d3-scale/src/init.js
34085   function initRange(domain2, range3) {
34086     switch (arguments.length) {
34087       case 0:
34088         break;
34089       case 1:
34090         this.range(domain2);
34091         break;
34092       default:
34093         this.range(range3).domain(domain2);
34094         break;
34095     }
34096     return this;
34097   }
34098
34099   // node_modules/d3-scale/src/constant.js
34100   function constants(x2) {
34101     return function() {
34102       return x2;
34103     };
34104   }
34105
34106   // node_modules/d3-scale/src/number.js
34107   function number2(x2) {
34108     return +x2;
34109   }
34110
34111   // node_modules/d3-scale/src/continuous.js
34112   var unit = [0, 1];
34113   function identity3(x2) {
34114     return x2;
34115   }
34116   function normalize(a2, b2) {
34117     return (b2 -= a2 = +a2) ? function(x2) {
34118       return (x2 - a2) / b2;
34119     } : constants(isNaN(b2) ? NaN : 0.5);
34120   }
34121   function clamper(a2, b2) {
34122     var t2;
34123     if (a2 > b2)
34124       t2 = a2, a2 = b2, b2 = t2;
34125     return function(x2) {
34126       return Math.max(a2, Math.min(b2, x2));
34127     };
34128   }
34129   function bimap(domain2, range3, interpolate) {
34130     var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
34131     if (d1 < d0)
34132       d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
34133     else
34134       d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
34135     return function(x2) {
34136       return r0(d0(x2));
34137     };
34138   }
34139   function polymap(domain2, range3, interpolate) {
34140     var j3 = Math.min(domain2.length, range3.length) - 1, d2 = new Array(j3), r2 = new Array(j3), i3 = -1;
34141     if (domain2[j3] < domain2[0]) {
34142       domain2 = domain2.slice().reverse();
34143       range3 = range3.slice().reverse();
34144     }
34145     while (++i3 < j3) {
34146       d2[i3] = normalize(domain2[i3], domain2[i3 + 1]);
34147       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
34148     }
34149     return function(x2) {
34150       var i4 = bisect_default(domain2, x2, 1, j3) - 1;
34151       return r2[i4](d2[i4](x2));
34152     };
34153   }
34154   function copy(source, target) {
34155     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
34156   }
34157   function transformer2() {
34158     var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
34159     function rescale() {
34160       var n3 = Math.min(domain2.length, range3.length);
34161       if (clamp3 !== identity3)
34162         clamp3 = clamper(domain2[0], domain2[n3 - 1]);
34163       piecewise = n3 > 2 ? polymap : bimap;
34164       output = input = null;
34165       return scale;
34166     }
34167     function scale(x2) {
34168       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
34169     }
34170     scale.invert = function(y2) {
34171       return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y2)));
34172     };
34173     scale.domain = function(_2) {
34174       return arguments.length ? (domain2 = Array.from(_2, number2), rescale()) : domain2.slice();
34175     };
34176     scale.range = function(_2) {
34177       return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
34178     };
34179     scale.rangeRound = function(_2) {
34180       return range3 = Array.from(_2), interpolate = round_default, rescale();
34181     };
34182     scale.clamp = function(_2) {
34183       return arguments.length ? (clamp3 = _2 ? true : identity3, rescale()) : clamp3 !== identity3;
34184     };
34185     scale.interpolate = function(_2) {
34186       return arguments.length ? (interpolate = _2, rescale()) : interpolate;
34187     };
34188     scale.unknown = function(_2) {
34189       return arguments.length ? (unknown = _2, scale) : unknown;
34190     };
34191     return function(t2, u2) {
34192       transform2 = t2, untransform = u2;
34193       return rescale();
34194     };
34195   }
34196   function continuous() {
34197     return transformer2()(identity3, identity3);
34198   }
34199
34200   // node_modules/d3-format/src/formatDecimal.js
34201   function formatDecimal_default(x2) {
34202     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
34203   }
34204   function formatDecimalParts(x2, p2) {
34205     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0)
34206       return null;
34207     var i3, coefficient = x2.slice(0, i3);
34208     return [
34209       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
34210       +x2.slice(i3 + 1)
34211     ];
34212   }
34213
34214   // node_modules/d3-format/src/exponent.js
34215   function exponent_default(x2) {
34216     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
34217   }
34218
34219   // node_modules/d3-format/src/formatGroup.js
34220   function formatGroup_default(grouping, thousands) {
34221     return function(value, width) {
34222       var i3 = value.length, t2 = [], j3 = 0, g3 = grouping[0], length = 0;
34223       while (i3 > 0 && g3 > 0) {
34224         if (length + g3 + 1 > width)
34225           g3 = Math.max(1, width - length);
34226         t2.push(value.substring(i3 -= g3, i3 + g3));
34227         if ((length += g3 + 1) > width)
34228           break;
34229         g3 = grouping[j3 = (j3 + 1) % grouping.length];
34230       }
34231       return t2.reverse().join(thousands);
34232     };
34233   }
34234
34235   // node_modules/d3-format/src/formatNumerals.js
34236   function formatNumerals_default(numerals) {
34237     return function(value) {
34238       return value.replace(/[0-9]/g, function(i3) {
34239         return numerals[+i3];
34240       });
34241     };
34242   }
34243
34244   // node_modules/d3-format/src/formatSpecifier.js
34245   var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
34246   function formatSpecifier(specifier) {
34247     if (!(match = re.exec(specifier)))
34248       throw new Error("invalid format: " + specifier);
34249     var match;
34250     return new FormatSpecifier({
34251       fill: match[1],
34252       align: match[2],
34253       sign: match[3],
34254       symbol: match[4],
34255       zero: match[5],
34256       width: match[6],
34257       comma: match[7],
34258       precision: match[8] && match[8].slice(1),
34259       trim: match[9],
34260       type: match[10]
34261     });
34262   }
34263   formatSpecifier.prototype = FormatSpecifier.prototype;
34264   function FormatSpecifier(specifier) {
34265     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
34266     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
34267     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
34268     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
34269     this.zero = !!specifier.zero;
34270     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
34271     this.comma = !!specifier.comma;
34272     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
34273     this.trim = !!specifier.trim;
34274     this.type = specifier.type === void 0 ? "" : specifier.type + "";
34275   }
34276   FormatSpecifier.prototype.toString = function() {
34277     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;
34278   };
34279
34280   // node_modules/d3-format/src/formatTrim.js
34281   function formatTrim_default(s2) {
34282     out:
34283       for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
34284         switch (s2[i3]) {
34285           case ".":
34286             i0 = i1 = i3;
34287             break;
34288           case "0":
34289             if (i0 === 0)
34290               i0 = i3;
34291             i1 = i3;
34292             break;
34293           default:
34294             if (!+s2[i3])
34295               break out;
34296             if (i0 > 0)
34297               i0 = 0;
34298             break;
34299         }
34300       }
34301     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
34302   }
34303
34304   // node_modules/d3-format/src/formatPrefixAuto.js
34305   var prefixExponent;
34306   function formatPrefixAuto_default(x2, p2) {
34307     var d2 = formatDecimalParts(x2, p2);
34308     if (!d2)
34309       return x2 + "";
34310     var coefficient = d2[0], exponent = d2[1], i3 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n3 = coefficient.length;
34311     return i3 === n3 ? coefficient : i3 > n3 ? coefficient + new Array(i3 - n3 + 1).join("0") : i3 > 0 ? coefficient.slice(0, i3) + "." + coefficient.slice(i3) : "0." + new Array(1 - i3).join("0") + formatDecimalParts(x2, Math.max(0, p2 + i3 - 1))[0];
34312   }
34313
34314   // node_modules/d3-format/src/formatRounded.js
34315   function formatRounded_default(x2, p2) {
34316     var d2 = formatDecimalParts(x2, p2);
34317     if (!d2)
34318       return x2 + "";
34319     var coefficient = d2[0], exponent = d2[1];
34320     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");
34321   }
34322
34323   // node_modules/d3-format/src/formatTypes.js
34324   var formatTypes_default = {
34325     "%": (x2, p2) => (x2 * 100).toFixed(p2),
34326     "b": (x2) => Math.round(x2).toString(2),
34327     "c": (x2) => x2 + "",
34328     "d": formatDecimal_default,
34329     "e": (x2, p2) => x2.toExponential(p2),
34330     "f": (x2, p2) => x2.toFixed(p2),
34331     "g": (x2, p2) => x2.toPrecision(p2),
34332     "o": (x2) => Math.round(x2).toString(8),
34333     "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
34334     "r": formatRounded_default,
34335     "s": formatPrefixAuto_default,
34336     "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
34337     "x": (x2) => Math.round(x2).toString(16)
34338   };
34339
34340   // node_modules/d3-format/src/identity.js
34341   function identity_default3(x2) {
34342     return x2;
34343   }
34344
34345   // node_modules/d3-format/src/locale.js
34346   var map = Array.prototype.map;
34347   var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34348   function locale_default(locale2) {
34349     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 + "";
34350     function newFormat(specifier) {
34351       specifier = formatSpecifier(specifier);
34352       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, type2 = specifier.type;
34353       if (type2 === "n")
34354         comma = true, type2 = "g";
34355       else if (!formatTypes_default[type2])
34356         precision2 === void 0 && (precision2 = 12), trim = true, type2 = "g";
34357       if (zero3 || fill === "0" && align === "=")
34358         zero3 = true, fill = "0", align = "=";
34359       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34360       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34361       precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
34362       function format2(value) {
34363         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
34364         if (type2 === "c") {
34365           valueSuffix = formatType(value) + valueSuffix;
34366           value = "";
34367         } else {
34368           value = +value;
34369           var valueNegative = value < 0 || 1 / value < 0;
34370           value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
34371           if (trim)
34372             value = formatTrim_default(value);
34373           if (valueNegative && +value === 0 && sign2 !== "+")
34374             valueNegative = false;
34375           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34376           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34377           if (maybeSuffix) {
34378             i3 = -1, n3 = value.length;
34379             while (++i3 < n3) {
34380               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
34381                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
34382                 value = value.slice(0, i3);
34383                 break;
34384               }
34385             }
34386           }
34387         }
34388         if (comma && !zero3)
34389           value = group(value, Infinity);
34390         var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
34391         if (comma && zero3)
34392           value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34393         switch (align) {
34394           case "<":
34395             value = valuePrefix + value + valueSuffix + padding;
34396             break;
34397           case "=":
34398             value = valuePrefix + padding + value + valueSuffix;
34399             break;
34400           case "^":
34401             value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
34402             break;
34403           default:
34404             value = padding + valuePrefix + value + valueSuffix;
34405             break;
34406         }
34407         return numerals(value);
34408       }
34409       format2.toString = function() {
34410         return specifier + "";
34411       };
34412       return format2;
34413     }
34414     function formatPrefix2(specifier, value) {
34415       var f3 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
34416       return function(value2) {
34417         return f3(k2 * value2) + prefix;
34418       };
34419     }
34420     return {
34421       format: newFormat,
34422       formatPrefix: formatPrefix2
34423     };
34424   }
34425
34426   // node_modules/d3-format/src/defaultLocale.js
34427   var locale;
34428   var format;
34429   var formatPrefix;
34430   defaultLocale({
34431     thousands: ",",
34432     grouping: [3],
34433     currency: ["$", ""]
34434   });
34435   function defaultLocale(definition) {
34436     locale = locale_default(definition);
34437     format = locale.format;
34438     formatPrefix = locale.formatPrefix;
34439     return locale;
34440   }
34441
34442   // node_modules/d3-format/src/precisionFixed.js
34443   function precisionFixed_default(step) {
34444     return Math.max(0, -exponent_default(Math.abs(step)));
34445   }
34446
34447   // node_modules/d3-format/src/precisionPrefix.js
34448   function precisionPrefix_default(step, value) {
34449     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34450   }
34451
34452   // node_modules/d3-format/src/precisionRound.js
34453   function precisionRound_default(step, max3) {
34454     step = Math.abs(step), max3 = Math.abs(max3) - step;
34455     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34456   }
34457
34458   // node_modules/d3-scale/src/tickFormat.js
34459   function tickFormat(start2, stop, count, specifier) {
34460     var step = tickStep(start2, stop, count), precision2;
34461     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34462     switch (specifier.type) {
34463       case "s": {
34464         var value = Math.max(Math.abs(start2), Math.abs(stop));
34465         if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
34466           specifier.precision = precision2;
34467         return formatPrefix(specifier, value);
34468       }
34469       case "":
34470       case "e":
34471       case "g":
34472       case "p":
34473       case "r": {
34474         if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
34475           specifier.precision = precision2 - (specifier.type === "e");
34476         break;
34477       }
34478       case "f":
34479       case "%": {
34480         if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
34481           specifier.precision = precision2 - (specifier.type === "%") * 2;
34482         break;
34483       }
34484     }
34485     return format(specifier);
34486   }
34487
34488   // node_modules/d3-scale/src/linear.js
34489   function linearish(scale) {
34490     var domain2 = scale.domain;
34491     scale.ticks = function(count) {
34492       var d2 = domain2();
34493       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
34494     };
34495     scale.tickFormat = function(count, specifier) {
34496       var d2 = domain2();
34497       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
34498     };
34499     scale.nice = function(count) {
34500       if (count == null)
34501         count = 10;
34502       var d2 = domain2();
34503       var i0 = 0;
34504       var i1 = d2.length - 1;
34505       var start2 = d2[i0];
34506       var stop = d2[i1];
34507       var prestep;
34508       var step;
34509       var maxIter = 10;
34510       if (stop < start2) {
34511         step = start2, start2 = stop, stop = step;
34512         step = i0, i0 = i1, i1 = step;
34513       }
34514       while (maxIter-- > 0) {
34515         step = tickIncrement(start2, stop, count);
34516         if (step === prestep) {
34517           d2[i0] = start2;
34518           d2[i1] = stop;
34519           return domain2(d2);
34520         } else if (step > 0) {
34521           start2 = Math.floor(start2 / step) * step;
34522           stop = Math.ceil(stop / step) * step;
34523         } else if (step < 0) {
34524           start2 = Math.ceil(start2 * step) / step;
34525           stop = Math.floor(stop * step) / step;
34526         } else {
34527           break;
34528         }
34529         prestep = step;
34530       }
34531       return scale;
34532     };
34533     return scale;
34534   }
34535   function linear3() {
34536     var scale = continuous();
34537     scale.copy = function() {
34538       return copy(scale, linear3());
34539     };
34540     initRange.apply(scale, arguments);
34541     return linearish(scale);
34542   }
34543
34544   // node_modules/d3-scale/src/quantize.js
34545   function quantize() {
34546     var x05 = 0, x12 = 1, n3 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
34547     function scale(x2) {
34548       return x2 != null && x2 <= x2 ? range3[bisect_default(domain2, x2, 0, n3)] : unknown;
34549     }
34550     function rescale() {
34551       var i3 = -1;
34552       domain2 = new Array(n3);
34553       while (++i3 < n3)
34554         domain2[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
34555       return scale;
34556     }
34557     scale.domain = function(_2) {
34558       return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34559     };
34560     scale.range = function(_2) {
34561       return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
34562     };
34563     scale.invertExtent = function(y2) {
34564       var i3 = range3.indexOf(y2);
34565       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain2[0]] : i3 >= n3 ? [domain2[n3 - 1], x12] : [domain2[i3 - 1], domain2[i3]];
34566     };
34567     scale.unknown = function(_2) {
34568       return arguments.length ? (unknown = _2, scale) : scale;
34569     };
34570     scale.thresholds = function() {
34571       return domain2.slice();
34572     };
34573     scale.copy = function() {
34574       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34575     };
34576     return initRange.apply(linearish(scale), arguments);
34577   }
34578
34579   // modules/behavior/breathe.js
34580   function behaviorBreathe() {
34581     var duration = 800;
34582     var steps = 4;
34583     var selector = ".selected.shadow, .selected .shadow";
34584     var _selected = select_default2(null);
34585     var _classed = "";
34586     var _params = {};
34587     var _done = false;
34588     var _timer;
34589     function ratchetyInterpolator(a2, b2, steps2, units) {
34590       a2 = Number(a2);
34591       b2 = Number(b2);
34592       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
34593       return function(t2) {
34594         return String(sample(t2)) + (units || "");
34595       };
34596     }
34597     function reset(selection2) {
34598       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
34599     }
34600     function setAnimationParams(transition2, fromTo) {
34601       var toFrom = fromTo === "from" ? "to" : "from";
34602       transition2.styleTween("stroke-opacity", function(d2) {
34603         return ratchetyInterpolator(
34604           _params[d2.id][toFrom].opacity,
34605           _params[d2.id][fromTo].opacity,
34606           steps
34607         );
34608       }).styleTween("stroke-width", function(d2) {
34609         return ratchetyInterpolator(
34610           _params[d2.id][toFrom].width,
34611           _params[d2.id][fromTo].width,
34612           steps,
34613           "px"
34614         );
34615       }).styleTween("fill-opacity", function(d2) {
34616         return ratchetyInterpolator(
34617           _params[d2.id][toFrom].opacity,
34618           _params[d2.id][fromTo].opacity,
34619           steps
34620         );
34621       }).styleTween("r", function(d2) {
34622         return ratchetyInterpolator(
34623           _params[d2.id][toFrom].width,
34624           _params[d2.id][fromTo].width,
34625           steps,
34626           "px"
34627         );
34628       });
34629     }
34630     function calcAnimationParams(selection2) {
34631       selection2.call(reset).each(function(d2) {
34632         var s2 = select_default2(this);
34633         var tag = s2.node().tagName;
34634         var p2 = { "from": {}, "to": {} };
34635         var opacity;
34636         var width;
34637         if (tag === "circle") {
34638           opacity = Number(s2.style("fill-opacity") || 0.5);
34639           width = Number(s2.style("r") || 15.5);
34640         } else {
34641           opacity = Number(s2.style("stroke-opacity") || 0.7);
34642           width = Number(s2.style("stroke-width") || 10);
34643         }
34644         p2.tag = tag;
34645         p2.from.opacity = opacity * 0.6;
34646         p2.to.opacity = opacity * 1.25;
34647         p2.from.width = width * 0.7;
34648         p2.to.width = width * (tag === "circle" ? 1.5 : 1);
34649         _params[d2.id] = p2;
34650       });
34651     }
34652     function run(surface, fromTo) {
34653       var toFrom = fromTo === "from" ? "to" : "from";
34654       var currSelected = surface.selectAll(selector);
34655       var currClassed = surface.attr("class");
34656       if (_done || currSelected.empty()) {
34657         _selected.call(reset);
34658         _selected = select_default2(null);
34659         return;
34660       }
34661       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
34662         _selected.call(reset);
34663         _classed = currClassed;
34664         _selected = currSelected.call(calcAnimationParams);
34665       }
34666       var didCallNextRun = false;
34667       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
34668         if (!didCallNextRun) {
34669           surface.call(run, toFrom);
34670           didCallNextRun = true;
34671         }
34672         if (!select_default2(this).classed("selected")) {
34673           reset(select_default2(this));
34674         }
34675       });
34676     }
34677     function behavior(surface) {
34678       _done = false;
34679       _timer = timer(function() {
34680         if (surface.selectAll(selector).empty()) {
34681           return false;
34682         }
34683         surface.call(run, "from");
34684         _timer.stop();
34685         return true;
34686       }, 20);
34687     }
34688     behavior.restartIfNeeded = function(surface) {
34689       if (_selected.empty()) {
34690         surface.call(run, "from");
34691         if (_timer) {
34692           _timer.stop();
34693         }
34694       }
34695     };
34696     behavior.off = function() {
34697       _done = true;
34698       if (_timer) {
34699         _timer.stop();
34700       }
34701       _selected.interrupt().call(reset);
34702     };
34703     return behavior;
34704   }
34705
34706   // modules/behavior/operation.js
34707   function behaviorOperation(context) {
34708     var _operation;
34709     function keypress(d3_event) {
34710       if (!context.map().withinEditableZoom())
34711         return;
34712       if (_operation.availableForKeypress && !_operation.availableForKeypress())
34713         return;
34714       d3_event.preventDefault();
34715       var disabled = _operation.disabled();
34716       if (disabled) {
34717         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
34718       } else {
34719         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
34720         if (_operation.point)
34721           _operation.point(null);
34722         _operation();
34723       }
34724     }
34725     function behavior() {
34726       if (_operation && _operation.available()) {
34727         context.keybinding().on(_operation.keys, keypress);
34728       }
34729       return behavior;
34730     }
34731     behavior.off = function() {
34732       context.keybinding().off(_operation.keys);
34733     };
34734     behavior.which = function(_2) {
34735       if (!arguments.length)
34736         return _operation;
34737       _operation = _2;
34738       return behavior;
34739     };
34740     return behavior;
34741   }
34742
34743   // modules/operations/circularize.js
34744   function operationCircularize(context, selectedIDs) {
34745     var _extent;
34746     var _actions = selectedIDs.map(getAction).filter(Boolean);
34747     var _amount = _actions.length === 1 ? "single" : "multiple";
34748     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
34749       return n3.loc;
34750     });
34751     function getAction(entityID) {
34752       var entity = context.entity(entityID);
34753       if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
34754         return null;
34755       if (!_extent) {
34756         _extent = entity.extent(context.graph());
34757       } else {
34758         _extent = _extent.extend(entity.extent(context.graph()));
34759       }
34760       return actionCircularize(entityID, context.projection);
34761     }
34762     var operation = function() {
34763       if (!_actions.length)
34764         return;
34765       var combinedAction = function(graph, t2) {
34766         _actions.forEach(function(action) {
34767           if (!action.disabled(graph)) {
34768             graph = action(graph, t2);
34769           }
34770         });
34771         return graph;
34772       };
34773       combinedAction.transitionable = true;
34774       context.perform(combinedAction, operation.annotation());
34775       window.setTimeout(function() {
34776         context.validator().validate();
34777       }, 300);
34778     };
34779     operation.available = function() {
34780       return _actions.length && selectedIDs.length === _actions.length;
34781     };
34782     operation.disabled = function() {
34783       if (!_actions.length)
34784         return "";
34785       var actionDisableds = _actions.map(function(action) {
34786         return action.disabled(context.graph());
34787       }).filter(Boolean);
34788       if (actionDisableds.length === _actions.length) {
34789         if (new Set(actionDisableds).size > 1) {
34790           return "multiple_blockers";
34791         }
34792         return actionDisableds[0];
34793       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
34794         return "too_large";
34795       } else if (someMissing()) {
34796         return "not_downloaded";
34797       } else if (selectedIDs.some(context.hasHiddenConnections)) {
34798         return "connected_to_hidden";
34799       }
34800       return false;
34801       function someMissing() {
34802         if (context.inIntro())
34803           return false;
34804         var osm = context.connection();
34805         if (osm) {
34806           var missing = _coords.filter(function(loc) {
34807             return !osm.isDataLoaded(loc);
34808           });
34809           if (missing.length) {
34810             missing.forEach(function(loc) {
34811               context.loadTileAtLoc(loc);
34812             });
34813             return true;
34814           }
34815         }
34816         return false;
34817       }
34818     };
34819     operation.tooltip = function() {
34820       var disable = operation.disabled();
34821       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
34822     };
34823     operation.annotation = function() {
34824       return _t("operations.circularize.annotation.feature", { n: _actions.length });
34825     };
34826     operation.id = "circularize";
34827     operation.keys = [_t("operations.circularize.key")];
34828     operation.title = _t.append("operations.circularize.title");
34829     operation.behavior = behaviorOperation(context).which(operation);
34830     return operation;
34831   }
34832
34833   // modules/ui/cmd.js
34834   var uiCmd = function(code) {
34835     var detected = utilDetect();
34836     if (detected.os === "mac") {
34837       return code;
34838     }
34839     if (detected.os === "win") {
34840       if (code === "\u2318\u21E7Z")
34841         return "Ctrl+Y";
34842     }
34843     var result = "", replacements = {
34844       "\u2318": "Ctrl",
34845       "\u21E7": "Shift",
34846       "\u2325": "Alt",
34847       "\u232B": "Backspace",
34848       "\u2326": "Delete"
34849     };
34850     for (var i3 = 0; i3 < code.length; i3++) {
34851       if (code[i3] in replacements) {
34852         result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
34853       } else {
34854         result += code[i3];
34855       }
34856     }
34857     return result;
34858   };
34859   uiCmd.display = function(code) {
34860     if (code.length !== 1)
34861       return code;
34862     var detected = utilDetect();
34863     var mac = detected.os === "mac";
34864     var replacements = {
34865       "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
34866       "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
34867       "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
34868       "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
34869       "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
34870       "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
34871       "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
34872       "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
34873       "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
34874       "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
34875       "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
34876       "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
34877       "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
34878     };
34879     return replacements[code] || code;
34880   };
34881
34882   // modules/operations/delete.js
34883   function operationDelete(context, selectedIDs) {
34884     var multi = selectedIDs.length === 1 ? "single" : "multiple";
34885     var action = actionDeleteMultiple(selectedIDs);
34886     var nodes = utilGetAllNodes(selectedIDs, context.graph());
34887     var coords = nodes.map(function(n3) {
34888       return n3.loc;
34889     });
34890     var extent = utilTotalExtent(selectedIDs, context.graph());
34891     var operation = function() {
34892       var nextSelectedID;
34893       var nextSelectedLoc;
34894       if (selectedIDs.length === 1) {
34895         var id2 = selectedIDs[0];
34896         var entity = context.entity(id2);
34897         var geometry = entity.geometry(context.graph());
34898         var parents = context.graph().parentWays(entity);
34899         var parent = parents[0];
34900         if (geometry === "vertex") {
34901           var nodes2 = parent.nodes;
34902           var i3 = nodes2.indexOf(id2);
34903           if (i3 === 0) {
34904             i3++;
34905           } else if (i3 === nodes2.length - 1) {
34906             i3--;
34907           } else {
34908             var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
34909             var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
34910             i3 = a2 < b2 ? i3 - 1 : i3 + 1;
34911           }
34912           nextSelectedID = nodes2[i3];
34913           nextSelectedLoc = context.entity(nextSelectedID).loc;
34914         }
34915       }
34916       context.perform(action, operation.annotation());
34917       context.validator().validate();
34918       if (nextSelectedID && nextSelectedLoc) {
34919         if (context.hasEntity(nextSelectedID)) {
34920           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
34921         } else {
34922           context.map().centerEase(nextSelectedLoc);
34923           context.enter(modeBrowse(context));
34924         }
34925       } else {
34926         context.enter(modeBrowse(context));
34927       }
34928     };
34929     operation.available = function() {
34930       return true;
34931     };
34932     operation.disabled = function() {
34933       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
34934         return "too_large";
34935       } else if (someMissing()) {
34936         return "not_downloaded";
34937       } else if (selectedIDs.some(context.hasHiddenConnections)) {
34938         return "connected_to_hidden";
34939       } else if (selectedIDs.some(protectedMember)) {
34940         return "part_of_relation";
34941       } else if (selectedIDs.some(incompleteRelation)) {
34942         return "incomplete_relation";
34943       } else if (selectedIDs.some(hasWikidataTag)) {
34944         return "has_wikidata_tag";
34945       }
34946       return false;
34947       function someMissing() {
34948         if (context.inIntro())
34949           return false;
34950         var osm = context.connection();
34951         if (osm) {
34952           var missing = coords.filter(function(loc) {
34953             return !osm.isDataLoaded(loc);
34954           });
34955           if (missing.length) {
34956             missing.forEach(function(loc) {
34957               context.loadTileAtLoc(loc);
34958             });
34959             return true;
34960           }
34961         }
34962         return false;
34963       }
34964       function hasWikidataTag(id2) {
34965         var entity = context.entity(id2);
34966         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
34967       }
34968       function incompleteRelation(id2) {
34969         var entity = context.entity(id2);
34970         return entity.type === "relation" && !entity.isComplete(context.graph());
34971       }
34972       function protectedMember(id2) {
34973         var entity = context.entity(id2);
34974         if (entity.type !== "way")
34975           return false;
34976         var parents = context.graph().parentRelations(entity);
34977         for (var i3 = 0; i3 < parents.length; i3++) {
34978           var parent = parents[i3];
34979           var type2 = parent.tags.type;
34980           var role = parent.memberById(id2).role || "outer";
34981           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
34982             return true;
34983           }
34984         }
34985         return false;
34986       }
34987     };
34988     operation.tooltip = function() {
34989       var disable = operation.disabled();
34990       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
34991     };
34992     operation.annotation = function() {
34993       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
34994     };
34995     operation.id = "delete";
34996     operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
34997     operation.title = _t.append("operations.delete.title");
34998     operation.behavior = behaviorOperation(context).which(operation);
34999     return operation;
35000   }
35001
35002   // modules/operations/orthogonalize.js
35003   function operationOrthogonalize(context, selectedIDs) {
35004     var _extent;
35005     var _type;
35006     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
35007     var _amount = _actions.length === 1 ? "single" : "multiple";
35008     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35009       return n3.loc;
35010     });
35011     function chooseAction(entityID) {
35012       var entity = context.entity(entityID);
35013       var geometry = entity.geometry(context.graph());
35014       if (!_extent) {
35015         _extent = entity.extent(context.graph());
35016       } else {
35017         _extent = _extent.extend(entity.extent(context.graph()));
35018       }
35019       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
35020         if (_type && _type !== "feature")
35021           return null;
35022         _type = "feature";
35023         return actionOrthogonalize(entityID, context.projection);
35024       } else if (geometry === "vertex") {
35025         if (_type && _type !== "corner")
35026           return null;
35027         _type = "corner";
35028         var graph = context.graph();
35029         var parents = graph.parentWays(entity);
35030         if (parents.length === 1) {
35031           var way = parents[0];
35032           if (way.nodes.indexOf(entityID) !== -1) {
35033             return actionOrthogonalize(way.id, context.projection, entityID);
35034           }
35035         }
35036       }
35037       return null;
35038     }
35039     var operation = function() {
35040       if (!_actions.length)
35041         return;
35042       var combinedAction = function(graph, t2) {
35043         _actions.forEach(function(action) {
35044           if (!action.disabled(graph)) {
35045             graph = action(graph, t2);
35046           }
35047         });
35048         return graph;
35049       };
35050       combinedAction.transitionable = true;
35051       context.perform(combinedAction, operation.annotation());
35052       window.setTimeout(function() {
35053         context.validator().validate();
35054       }, 300);
35055     };
35056     operation.available = function() {
35057       return _actions.length && selectedIDs.length === _actions.length;
35058     };
35059     operation.disabled = function() {
35060       if (!_actions.length)
35061         return "";
35062       var actionDisableds = _actions.map(function(action) {
35063         return action.disabled(context.graph());
35064       }).filter(Boolean);
35065       if (actionDisableds.length === _actions.length) {
35066         if (new Set(actionDisableds).size > 1) {
35067           return "multiple_blockers";
35068         }
35069         return actionDisableds[0];
35070       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35071         return "too_large";
35072       } else if (someMissing()) {
35073         return "not_downloaded";
35074       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35075         return "connected_to_hidden";
35076       }
35077       return false;
35078       function someMissing() {
35079         if (context.inIntro())
35080           return false;
35081         var osm = context.connection();
35082         if (osm) {
35083           var missing = _coords.filter(function(loc) {
35084             return !osm.isDataLoaded(loc);
35085           });
35086           if (missing.length) {
35087             missing.forEach(function(loc) {
35088               context.loadTileAtLoc(loc);
35089             });
35090             return true;
35091           }
35092         }
35093         return false;
35094       }
35095     };
35096     operation.tooltip = function() {
35097       var disable = operation.disabled();
35098       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35099     };
35100     operation.annotation = function() {
35101       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35102     };
35103     operation.id = "orthogonalize";
35104     operation.keys = [_t("operations.orthogonalize.key")];
35105     operation.title = _t.append("operations.orthogonalize.title");
35106     operation.behavior = behaviorOperation(context).which(operation);
35107     return operation;
35108   }
35109
35110   // modules/operations/reflect.js
35111   function operationReflectShort(context, selectedIDs) {
35112     return operationReflect(context, selectedIDs, "short");
35113   }
35114   function operationReflectLong(context, selectedIDs) {
35115     return operationReflect(context, selectedIDs, "long");
35116   }
35117   function operationReflect(context, selectedIDs, axis) {
35118     axis = axis || "long";
35119     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35120     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35121     var coords = nodes.map(function(n3) {
35122       return n3.loc;
35123     });
35124     var extent = utilTotalExtent(selectedIDs, context.graph());
35125     var operation = function() {
35126       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35127       context.perform(action, operation.annotation());
35128       window.setTimeout(function() {
35129         context.validator().validate();
35130       }, 300);
35131     };
35132     operation.available = function() {
35133       return nodes.length >= 3;
35134     };
35135     operation.disabled = function() {
35136       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35137         return "too_large";
35138       } else if (someMissing()) {
35139         return "not_downloaded";
35140       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35141         return "connected_to_hidden";
35142       } else if (selectedIDs.some(incompleteRelation)) {
35143         return "incomplete_relation";
35144       }
35145       return false;
35146       function someMissing() {
35147         if (context.inIntro())
35148           return false;
35149         var osm = context.connection();
35150         if (osm) {
35151           var missing = coords.filter(function(loc) {
35152             return !osm.isDataLoaded(loc);
35153           });
35154           if (missing.length) {
35155             missing.forEach(function(loc) {
35156               context.loadTileAtLoc(loc);
35157             });
35158             return true;
35159           }
35160         }
35161         return false;
35162       }
35163       function incompleteRelation(id2) {
35164         var entity = context.entity(id2);
35165         return entity.type === "relation" && !entity.isComplete(context.graph());
35166       }
35167     };
35168     operation.tooltip = function() {
35169       var disable = operation.disabled();
35170       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35171     };
35172     operation.annotation = function() {
35173       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35174     };
35175     operation.id = "reflect-" + axis;
35176     operation.keys = [_t("operations.reflect.key." + axis)];
35177     operation.title = _t.append("operations.reflect.title." + axis);
35178     operation.behavior = behaviorOperation(context).which(operation);
35179     return operation;
35180   }
35181
35182   // modules/operations/move.js
35183   function operationMove(context, selectedIDs) {
35184     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35185     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35186     var coords = nodes.map(function(n3) {
35187       return n3.loc;
35188     });
35189     var extent = utilTotalExtent(selectedIDs, context.graph());
35190     var operation = function() {
35191       context.enter(modeMove(context, selectedIDs));
35192     };
35193     operation.available = function() {
35194       return selectedIDs.length > 0;
35195     };
35196     operation.disabled = function() {
35197       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35198         return "too_large";
35199       } else if (someMissing()) {
35200         return "not_downloaded";
35201       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35202         return "connected_to_hidden";
35203       } else if (selectedIDs.some(incompleteRelation)) {
35204         return "incomplete_relation";
35205       }
35206       return false;
35207       function someMissing() {
35208         if (context.inIntro())
35209           return false;
35210         var osm = context.connection();
35211         if (osm) {
35212           var missing = coords.filter(function(loc) {
35213             return !osm.isDataLoaded(loc);
35214           });
35215           if (missing.length) {
35216             missing.forEach(function(loc) {
35217               context.loadTileAtLoc(loc);
35218             });
35219             return true;
35220           }
35221         }
35222         return false;
35223       }
35224       function incompleteRelation(id2) {
35225         var entity = context.entity(id2);
35226         return entity.type === "relation" && !entity.isComplete(context.graph());
35227       }
35228     };
35229     operation.tooltip = function() {
35230       var disable = operation.disabled();
35231       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35232     };
35233     operation.annotation = function() {
35234       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35235     };
35236     operation.id = "move";
35237     operation.keys = [_t("operations.move.key")];
35238     operation.title = _t.append("operations.move.title");
35239     operation.behavior = behaviorOperation(context).which(operation);
35240     operation.mouseOnly = true;
35241     return operation;
35242   }
35243
35244   // modules/modes/rotate.js
35245   function modeRotate(context, entityIDs) {
35246     var _tolerancePx = 4;
35247     var mode = {
35248       id: "rotate",
35249       button: "browse"
35250     };
35251     var keybinding = utilKeybinding("rotate");
35252     var behaviors = [
35253       behaviorEdit(context),
35254       operationCircularize(context, entityIDs).behavior,
35255       operationDelete(context, entityIDs).behavior,
35256       operationMove(context, entityIDs).behavior,
35257       operationOrthogonalize(context, entityIDs).behavior,
35258       operationReflectLong(context, entityIDs).behavior,
35259       operationReflectShort(context, entityIDs).behavior
35260     ];
35261     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35262     var _prevGraph;
35263     var _prevAngle;
35264     var _prevTransform;
35265     var _pivot;
35266     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35267     function doRotate(d3_event) {
35268       var fn;
35269       if (context.graph() !== _prevGraph) {
35270         fn = context.perform;
35271       } else {
35272         fn = context.replace;
35273       }
35274       var projection2 = context.projection;
35275       var currTransform = projection2.transform();
35276       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35277         var nodes = utilGetAllNodes(entityIDs, context.graph());
35278         var points = nodes.map(function(n3) {
35279           return projection2(n3.loc);
35280         });
35281         _pivot = getPivot(points);
35282         _prevAngle = void 0;
35283       }
35284       var currMouse = context.map().mouse(d3_event);
35285       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35286       if (typeof _prevAngle === "undefined")
35287         _prevAngle = currAngle;
35288       var delta = currAngle - _prevAngle;
35289       fn(actionRotate(entityIDs, _pivot, delta, projection2));
35290       _prevTransform = currTransform;
35291       _prevAngle = currAngle;
35292       _prevGraph = context.graph();
35293     }
35294     function getPivot(points) {
35295       var _pivot2;
35296       if (points.length === 1) {
35297         _pivot2 = points[0];
35298       } else if (points.length === 2) {
35299         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35300       } else {
35301         var polygonHull = hull_default(points);
35302         if (polygonHull.length === 2) {
35303           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35304         } else {
35305           _pivot2 = centroid_default2(hull_default(points));
35306         }
35307       }
35308       return _pivot2;
35309     }
35310     function finish(d3_event) {
35311       d3_event.stopPropagation();
35312       context.replace(actionNoop(), annotation);
35313       context.enter(modeSelect(context, entityIDs));
35314     }
35315     function cancel() {
35316       if (_prevGraph)
35317         context.pop();
35318       context.enter(modeSelect(context, entityIDs));
35319     }
35320     function undone() {
35321       context.enter(modeBrowse(context));
35322     }
35323     mode.enter = function() {
35324       _prevGraph = null;
35325       context.features().forceVisible(entityIDs);
35326       behaviors.forEach(context.install);
35327       var downEvent;
35328       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
35329         downEvent = d3_event;
35330       });
35331       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
35332         if (!downEvent)
35333           return;
35334         var mapNode = context.container().select(".main-map").node();
35335         var pointGetter = utilFastMouse(mapNode);
35336         var p1 = pointGetter(downEvent);
35337         var p2 = pointGetter(d3_event);
35338         var dist = geoVecLength(p1, p2);
35339         if (dist <= _tolerancePx)
35340           finish(d3_event);
35341         downEvent = null;
35342       }, true);
35343       context.history().on("undone.modeRotate", undone);
35344       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35345       select_default2(document).call(keybinding);
35346     };
35347     mode.exit = function() {
35348       behaviors.forEach(context.uninstall);
35349       context.surface().on(_pointerPrefix + "down.modeRotate", null);
35350       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
35351       context.history().on("undone.modeRotate", null);
35352       select_default2(document).call(keybinding.unbind);
35353       context.features().forceVisible([]);
35354     };
35355     mode.selectedIDs = function() {
35356       if (!arguments.length)
35357         return entityIDs;
35358       return mode;
35359     };
35360     return mode;
35361   }
35362
35363   // modules/operations/rotate.js
35364   function operationRotate(context, selectedIDs) {
35365     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35366     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35367     var coords = nodes.map(function(n3) {
35368       return n3.loc;
35369     });
35370     var extent = utilTotalExtent(selectedIDs, context.graph());
35371     var operation = function() {
35372       context.enter(modeRotate(context, selectedIDs));
35373     };
35374     operation.available = function() {
35375       return nodes.length >= 2;
35376     };
35377     operation.disabled = function() {
35378       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35379         return "too_large";
35380       } else if (someMissing()) {
35381         return "not_downloaded";
35382       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35383         return "connected_to_hidden";
35384       } else if (selectedIDs.some(incompleteRelation)) {
35385         return "incomplete_relation";
35386       }
35387       return false;
35388       function someMissing() {
35389         if (context.inIntro())
35390           return false;
35391         var osm = context.connection();
35392         if (osm) {
35393           var missing = coords.filter(function(loc) {
35394             return !osm.isDataLoaded(loc);
35395           });
35396           if (missing.length) {
35397             missing.forEach(function(loc) {
35398               context.loadTileAtLoc(loc);
35399             });
35400             return true;
35401           }
35402         }
35403         return false;
35404       }
35405       function incompleteRelation(id2) {
35406         var entity = context.entity(id2);
35407         return entity.type === "relation" && !entity.isComplete(context.graph());
35408       }
35409     };
35410     operation.tooltip = function() {
35411       var disable = operation.disabled();
35412       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
35413     };
35414     operation.annotation = function() {
35415       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
35416     };
35417     operation.id = "rotate";
35418     operation.keys = [_t("operations.rotate.key")];
35419     operation.title = _t.append("operations.rotate.title");
35420     operation.behavior = behaviorOperation(context).which(operation);
35421     operation.mouseOnly = true;
35422     return operation;
35423   }
35424
35425   // modules/modes/move.js
35426   function modeMove(context, entityIDs, baseGraph) {
35427     var _tolerancePx = 4;
35428     var mode = {
35429       id: "move",
35430       button: "browse"
35431     };
35432     var keybinding = utilKeybinding("move");
35433     var behaviors = [
35434       behaviorEdit(context),
35435       operationCircularize(context, entityIDs).behavior,
35436       operationDelete(context, entityIDs).behavior,
35437       operationOrthogonalize(context, entityIDs).behavior,
35438       operationReflectLong(context, entityIDs).behavior,
35439       operationReflectShort(context, entityIDs).behavior,
35440       operationRotate(context, entityIDs).behavior
35441     ];
35442     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
35443     var _prevGraph;
35444     var _cache4;
35445     var _origin;
35446     var _nudgeInterval;
35447     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35448     function doMove(nudge) {
35449       nudge = nudge || [0, 0];
35450       var fn;
35451       if (_prevGraph !== context.graph()) {
35452         _cache4 = {};
35453         _origin = context.map().mouseCoordinates();
35454         fn = context.perform;
35455       } else {
35456         fn = context.overwrite;
35457       }
35458       var currMouse = context.map().mouse();
35459       var origMouse = context.projection(_origin);
35460       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
35461       fn(actionMove(entityIDs, delta, context.projection, _cache4));
35462       _prevGraph = context.graph();
35463     }
35464     function startNudge(nudge) {
35465       if (_nudgeInterval)
35466         window.clearInterval(_nudgeInterval);
35467       _nudgeInterval = window.setInterval(function() {
35468         context.map().pan(nudge);
35469         doMove(nudge);
35470       }, 50);
35471     }
35472     function stopNudge() {
35473       if (_nudgeInterval) {
35474         window.clearInterval(_nudgeInterval);
35475         _nudgeInterval = null;
35476       }
35477     }
35478     function move() {
35479       doMove();
35480       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
35481       if (nudge) {
35482         startNudge(nudge);
35483       } else {
35484         stopNudge();
35485       }
35486     }
35487     function finish(d3_event) {
35488       d3_event.stopPropagation();
35489       context.replace(actionNoop(), annotation);
35490       context.enter(modeSelect(context, entityIDs));
35491       stopNudge();
35492     }
35493     function cancel() {
35494       if (baseGraph) {
35495         while (context.graph() !== baseGraph)
35496           context.pop();
35497         context.enter(modeBrowse(context));
35498       } else {
35499         if (_prevGraph)
35500           context.pop();
35501         context.enter(modeSelect(context, entityIDs));
35502       }
35503       stopNudge();
35504     }
35505     function undone() {
35506       context.enter(modeBrowse(context));
35507     }
35508     mode.enter = function() {
35509       _origin = context.map().mouseCoordinates();
35510       _prevGraph = null;
35511       _cache4 = {};
35512       context.features().forceVisible(entityIDs);
35513       behaviors.forEach(context.install);
35514       var downEvent;
35515       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
35516         downEvent = d3_event;
35517       });
35518       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
35519         if (!downEvent)
35520           return;
35521         var mapNode = context.container().select(".main-map").node();
35522         var pointGetter = utilFastMouse(mapNode);
35523         var p1 = pointGetter(downEvent);
35524         var p2 = pointGetter(d3_event);
35525         var dist = geoVecLength(p1, p2);
35526         if (dist <= _tolerancePx)
35527           finish(d3_event);
35528         downEvent = null;
35529       }, true);
35530       context.history().on("undone.modeMove", undone);
35531       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35532       select_default2(document).call(keybinding);
35533     };
35534     mode.exit = function() {
35535       stopNudge();
35536       behaviors.forEach(function(behavior) {
35537         context.uninstall(behavior);
35538       });
35539       context.surface().on(_pointerPrefix + "down.modeMove", null);
35540       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
35541       context.history().on("undone.modeMove", null);
35542       select_default2(document).call(keybinding.unbind);
35543       context.features().forceVisible([]);
35544     };
35545     mode.selectedIDs = function() {
35546       if (!arguments.length)
35547         return entityIDs;
35548       return mode;
35549     };
35550     return mode;
35551   }
35552
35553   // modules/behavior/paste.js
35554   function behaviorPaste(context) {
35555     function doPaste(d3_event) {
35556       if (!context.map().withinEditableZoom())
35557         return;
35558       d3_event.preventDefault();
35559       var baseGraph = context.graph();
35560       var mouse = context.map().mouse();
35561       var projection2 = context.projection;
35562       var viewport = geoExtent(projection2.clipExtent()).polygon();
35563       if (!geoPointInPolygon(mouse, viewport))
35564         return;
35565       var oldIDs = context.copyIDs();
35566       if (!oldIDs.length)
35567         return;
35568       var extent = geoExtent();
35569       var oldGraph = context.copyGraph();
35570       var newIDs = [];
35571       var action = actionCopyEntities(oldIDs, oldGraph);
35572       context.perform(action);
35573       var copies = action.copies();
35574       var originals = /* @__PURE__ */ new Set();
35575       Object.values(copies).forEach(function(entity) {
35576         originals.add(entity.id);
35577       });
35578       for (var id2 in copies) {
35579         var oldEntity = oldGraph.entity(id2);
35580         var newEntity = copies[id2];
35581         extent._extend(oldEntity.extent(oldGraph));
35582         var parents = context.graph().parentWays(newEntity);
35583         var parentCopied = parents.some(function(parent) {
35584           return originals.has(parent.id);
35585         });
35586         if (!parentCopied) {
35587           newIDs.push(newEntity.id);
35588         }
35589       }
35590       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
35591       var delta = geoVecSubtract(mouse, copyPoint);
35592       context.perform(actionMove(newIDs, delta, projection2));
35593       context.enter(modeMove(context, newIDs, baseGraph));
35594     }
35595     function behavior() {
35596       context.keybinding().on(uiCmd("\u2318V"), doPaste);
35597       return behavior;
35598     }
35599     behavior.off = function() {
35600       context.keybinding().off(uiCmd("\u2318V"));
35601     };
35602     return behavior;
35603   }
35604
35605   // modules/behavior/drag.js
35606   function behaviorDrag() {
35607     var dispatch14 = dispatch_default("start", "move", "end");
35608     var _tolerancePx = 1;
35609     var _penTolerancePx = 4;
35610     var _origin = null;
35611     var _selector = "";
35612     var _targetNode;
35613     var _targetEntity;
35614     var _surface;
35615     var _pointerId;
35616     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35617     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
35618     var d3_event_userSelectSuppress = function() {
35619       var selection2 = selection_default();
35620       var select = selection2.style(d3_event_userSelectProperty);
35621       selection2.style(d3_event_userSelectProperty, "none");
35622       return function() {
35623         selection2.style(d3_event_userSelectProperty, select);
35624       };
35625     };
35626     function pointerdown(d3_event) {
35627       if (_pointerId)
35628         return;
35629       _pointerId = d3_event.pointerId || "mouse";
35630       _targetNode = this;
35631       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
35632       var offset;
35633       var startOrigin = pointerLocGetter(d3_event);
35634       var started = false;
35635       var selectEnable = d3_event_userSelectSuppress();
35636       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
35637       if (_origin) {
35638         offset = _origin.call(_targetNode, _targetEntity);
35639         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
35640       } else {
35641         offset = [0, 0];
35642       }
35643       d3_event.stopPropagation();
35644       function pointermove(d3_event2) {
35645         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35646           return;
35647         var p2 = pointerLocGetter(d3_event2);
35648         if (!started) {
35649           var dist = geoVecLength(startOrigin, p2);
35650           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
35651           if (dist < tolerance)
35652             return;
35653           started = true;
35654           dispatch14.call("start", this, d3_event2, _targetEntity);
35655         } else {
35656           startOrigin = p2;
35657           d3_event2.stopPropagation();
35658           d3_event2.preventDefault();
35659           var dx = p2[0] - startOrigin[0];
35660           var dy = p2[1] - startOrigin[1];
35661           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
35662         }
35663       }
35664       function pointerup(d3_event2) {
35665         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35666           return;
35667         _pointerId = null;
35668         if (started) {
35669           dispatch14.call("end", this, d3_event2, _targetEntity);
35670           d3_event2.preventDefault();
35671         }
35672         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35673         selectEnable();
35674       }
35675     }
35676     function behavior(selection2) {
35677       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
35678       var delegate = pointerdown;
35679       if (_selector) {
35680         delegate = function(d3_event) {
35681           var root3 = this;
35682           var target = d3_event.target;
35683           for (; target && target !== root3; target = target.parentNode) {
35684             var datum2 = target.__data__;
35685             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
35686             if (_targetEntity && target[matchesSelector](_selector)) {
35687               return pointerdown.call(target, d3_event);
35688             }
35689           }
35690         };
35691       }
35692       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
35693     }
35694     behavior.off = function(selection2) {
35695       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
35696     };
35697     behavior.selector = function(_2) {
35698       if (!arguments.length)
35699         return _selector;
35700       _selector = _2;
35701       return behavior;
35702     };
35703     behavior.origin = function(_2) {
35704       if (!arguments.length)
35705         return _origin;
35706       _origin = _2;
35707       return behavior;
35708     };
35709     behavior.cancel = function() {
35710       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35711       return behavior;
35712     };
35713     behavior.targetNode = function(_2) {
35714       if (!arguments.length)
35715         return _targetNode;
35716       _targetNode = _2;
35717       return behavior;
35718     };
35719     behavior.targetEntity = function(_2) {
35720       if (!arguments.length)
35721         return _targetEntity;
35722       _targetEntity = _2;
35723       return behavior;
35724     };
35725     behavior.surface = function(_2) {
35726       if (!arguments.length)
35727         return _surface;
35728       _surface = _2;
35729       return behavior;
35730     };
35731     return utilRebind(behavior, dispatch14, "on");
35732   }
35733
35734   // modules/modes/drag_node.js
35735   function modeDragNode(context) {
35736     var mode = {
35737       id: "drag-node",
35738       button: "browse"
35739     };
35740     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
35741     var edit2 = behaviorEdit(context);
35742     var _nudgeInterval;
35743     var _restoreSelectedIDs = [];
35744     var _wasMidpoint = false;
35745     var _isCancelled = false;
35746     var _activeEntity;
35747     var _startLoc;
35748     var _lastLoc;
35749     function startNudge(d3_event, entity, nudge) {
35750       if (_nudgeInterval)
35751         window.clearInterval(_nudgeInterval);
35752       _nudgeInterval = window.setInterval(function() {
35753         context.map().pan(nudge);
35754         doMove(d3_event, entity, nudge);
35755       }, 50);
35756     }
35757     function stopNudge() {
35758       if (_nudgeInterval) {
35759         window.clearInterval(_nudgeInterval);
35760         _nudgeInterval = null;
35761       }
35762     }
35763     function moveAnnotation(entity) {
35764       return _t("operations.move.annotation." + entity.geometry(context.graph()));
35765     }
35766     function connectAnnotation(nodeEntity, targetEntity) {
35767       var nodeGeometry = nodeEntity.geometry(context.graph());
35768       var targetGeometry = targetEntity.geometry(context.graph());
35769       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
35770         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
35771         var targetParentWayIDs = context.graph().parentWays(targetEntity);
35772         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
35773         if (sharedParentWays.length !== 0) {
35774           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
35775             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
35776           }
35777           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
35778         }
35779       }
35780       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
35781     }
35782     function shouldSnapToNode(target) {
35783       if (!_activeEntity)
35784         return false;
35785       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
35786     }
35787     function origin(entity) {
35788       return context.projection(entity.loc);
35789     }
35790     function keydown(d3_event) {
35791       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35792         if (context.surface().classed("nope")) {
35793           context.surface().classed("nope-suppressed", true);
35794         }
35795         context.surface().classed("nope", false).classed("nope-disabled", true);
35796       }
35797     }
35798     function keyup(d3_event) {
35799       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35800         if (context.surface().classed("nope-suppressed")) {
35801           context.surface().classed("nope", true);
35802         }
35803         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
35804       }
35805     }
35806     function start2(d3_event, entity) {
35807       _wasMidpoint = entity.type === "midpoint";
35808       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
35809       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
35810       if (_isCancelled) {
35811         if (hasHidden) {
35812           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
35813         }
35814         return drag.cancel();
35815       }
35816       if (_wasMidpoint) {
35817         var midpoint = entity;
35818         entity = osmNode();
35819         context.perform(actionAddMidpoint(midpoint, entity));
35820         entity = context.entity(entity.id);
35821         var vertex = context.surface().selectAll("." + entity.id);
35822         drag.targetNode(vertex.node()).targetEntity(entity);
35823       } else {
35824         context.perform(actionNoop());
35825       }
35826       _activeEntity = entity;
35827       _startLoc = entity.loc;
35828       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
35829       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
35830       context.enter(mode);
35831     }
35832     function datum2(d3_event) {
35833       if (!d3_event || d3_event.altKey) {
35834         return {};
35835       } else {
35836         var d2 = d3_event.target.__data__;
35837         return d2 && d2.properties && d2.properties.target ? d2 : {};
35838       }
35839     }
35840     function doMove(d3_event, entity, nudge) {
35841       nudge = nudge || [0, 0];
35842       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
35843       var currMouse = geoVecSubtract(currPoint, nudge);
35844       var loc = context.projection.invert(currMouse);
35845       var target, edge;
35846       if (!_nudgeInterval) {
35847         var d2 = datum2(d3_event);
35848         target = d2 && d2.properties && d2.properties.entity;
35849         var targetLoc = target && target.loc;
35850         var targetNodes = d2 && d2.properties && d2.properties.nodes;
35851         if (targetLoc) {
35852           if (shouldSnapToNode(target)) {
35853             loc = targetLoc;
35854           }
35855         } else if (targetNodes) {
35856           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
35857           if (edge) {
35858             loc = edge.loc;
35859           }
35860         }
35861       }
35862       context.replace(
35863         actionMoveNode(entity.id, loc)
35864       );
35865       var isInvalid = false;
35866       if (target) {
35867         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
35868       }
35869       if (!isInvalid) {
35870         isInvalid = hasInvalidGeometry(entity, context.graph());
35871       }
35872       var nope = context.surface().classed("nope");
35873       if (isInvalid === "relation" || isInvalid === "restriction") {
35874         if (!nope) {
35875           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
35876             "operations.connect." + isInvalid,
35877             { relation: _mainPresetIndex.item("type/restriction").name() }
35878           ))();
35879         }
35880       } else if (isInvalid) {
35881         var errorID = isInvalid === "line" ? "lines" : "areas";
35882         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
35883       } else {
35884         if (nope) {
35885           context.ui().flash.duration(1).label("")();
35886         }
35887       }
35888       var nopeDisabled = context.surface().classed("nope-disabled");
35889       if (nopeDisabled) {
35890         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
35891       } else {
35892         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
35893       }
35894       _lastLoc = loc;
35895     }
35896     function hasRelationConflict(entity, target, edge, graph) {
35897       var testGraph = graph.update();
35898       if (edge) {
35899         var midpoint = osmNode();
35900         var action = actionAddMidpoint({
35901           loc: edge.loc,
35902           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
35903         }, midpoint);
35904         testGraph = action(testGraph);
35905         target = midpoint;
35906       }
35907       var ids = [entity.id, target.id];
35908       return actionConnect(ids).disabled(testGraph);
35909     }
35910     function hasInvalidGeometry(entity, graph) {
35911       var parents = graph.parentWays(entity);
35912       var i3, j3, k2;
35913       for (i3 = 0; i3 < parents.length; i3++) {
35914         var parent = parents[i3];
35915         var nodes = [];
35916         var activeIndex = null;
35917         var relations = graph.parentRelations(parent);
35918         for (j3 = 0; j3 < relations.length; j3++) {
35919           if (!relations[j3].isMultipolygon())
35920             continue;
35921           var rings = osmJoinWays(relations[j3].members, graph);
35922           for (k2 = 0; k2 < rings.length; k2++) {
35923             nodes = rings[k2].nodes;
35924             if (nodes.find(function(n3) {
35925               return n3.id === entity.id;
35926             })) {
35927               activeIndex = k2;
35928               if (geoHasSelfIntersections(nodes, entity.id)) {
35929                 return "multipolygonMember";
35930               }
35931             }
35932             rings[k2].coords = nodes.map(function(n3) {
35933               return n3.loc;
35934             });
35935           }
35936           for (k2 = 0; k2 < rings.length; k2++) {
35937             if (k2 === activeIndex)
35938               continue;
35939             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
35940               return "multipolygonRing";
35941             }
35942           }
35943         }
35944         if (activeIndex === null) {
35945           nodes = parent.nodes.map(function(nodeID) {
35946             return graph.entity(nodeID);
35947           });
35948           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
35949             return parent.geometry(graph);
35950           }
35951         }
35952       }
35953       return false;
35954     }
35955     function move(d3_event, entity, point2) {
35956       if (_isCancelled)
35957         return;
35958       d3_event.stopPropagation();
35959       context.surface().classed("nope-disabled", d3_event.altKey);
35960       _lastLoc = context.projection.invert(point2);
35961       doMove(d3_event, entity);
35962       var nudge = geoViewportEdge(point2, context.map().dimensions());
35963       if (nudge) {
35964         startNudge(d3_event, entity, nudge);
35965       } else {
35966         stopNudge();
35967       }
35968     }
35969     function end(d3_event, entity) {
35970       if (_isCancelled)
35971         return;
35972       var wasPoint = entity.geometry(context.graph()) === "point";
35973       var d2 = datum2(d3_event);
35974       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
35975       var target = d2 && d2.properties && d2.properties.entity;
35976       if (nope) {
35977         context.perform(
35978           _actionBounceBack(entity.id, _startLoc)
35979         );
35980       } else if (target && target.type === "way") {
35981         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
35982         context.replace(
35983           actionAddMidpoint({
35984             loc: choice.loc,
35985             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
35986           }, entity),
35987           connectAnnotation(entity, target)
35988         );
35989       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
35990         context.replace(
35991           actionConnect([target.id, entity.id]),
35992           connectAnnotation(entity, target)
35993         );
35994       } else if (_wasMidpoint) {
35995         context.replace(
35996           actionNoop(),
35997           _t("operations.add.annotation.vertex")
35998         );
35999       } else {
36000         context.replace(
36001           actionNoop(),
36002           moveAnnotation(entity)
36003         );
36004       }
36005       if (wasPoint) {
36006         context.enter(modeSelect(context, [entity.id]));
36007       } else {
36008         var reselection = _restoreSelectedIDs.filter(function(id2) {
36009           return context.graph().hasEntity(id2);
36010         });
36011         if (reselection.length) {
36012           context.enter(modeSelect(context, reselection));
36013         } else {
36014           context.enter(modeBrowse(context));
36015         }
36016       }
36017     }
36018     function _actionBounceBack(nodeID, toLoc) {
36019       var moveNode = actionMoveNode(nodeID, toLoc);
36020       var action = function(graph, t2) {
36021         if (t2 === 1)
36022           context.pop();
36023         return moveNode(graph, t2);
36024       };
36025       action.transitionable = true;
36026       return action;
36027     }
36028     function cancel() {
36029       drag.cancel();
36030       context.enter(modeBrowse(context));
36031     }
36032     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);
36033     mode.enter = function() {
36034       context.install(hover);
36035       context.install(edit2);
36036       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
36037       context.history().on("undone.drag-node", cancel);
36038     };
36039     mode.exit = function() {
36040       context.ui().sidebar.hover.cancel();
36041       context.uninstall(hover);
36042       context.uninstall(edit2);
36043       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
36044       context.history().on("undone.drag-node", null);
36045       _activeEntity = null;
36046       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
36047       stopNudge();
36048     };
36049     mode.selectedIDs = function() {
36050       if (!arguments.length)
36051         return _activeEntity ? [_activeEntity.id] : [];
36052       return mode;
36053     };
36054     mode.activeID = function() {
36055       if (!arguments.length)
36056         return _activeEntity && _activeEntity.id;
36057       return mode;
36058     };
36059     mode.restoreSelectedIDs = function(_2) {
36060       if (!arguments.length)
36061         return _restoreSelectedIDs;
36062       _restoreSelectedIDs = _2;
36063       return mode;
36064     };
36065     mode.behavior = drag;
36066     return mode;
36067   }
36068
36069   // modules/services/keepRight.js
36070   var import_rbush = __toESM(require_rbush_min());
36071
36072   // node_modules/d3-fetch/src/text.js
36073   function responseText(response) {
36074     if (!response.ok)
36075       throw new Error(response.status + " " + response.statusText);
36076     return response.text();
36077   }
36078   function text_default3(input, init2) {
36079     return fetch(input, init2).then(responseText);
36080   }
36081
36082   // node_modules/d3-fetch/src/json.js
36083   function responseJson(response) {
36084     if (!response.ok)
36085       throw new Error(response.status + " " + response.statusText);
36086     if (response.status === 204 || response.status === 205)
36087       return;
36088     return response.json();
36089   }
36090   function json_default(input, init2) {
36091     return fetch(input, init2).then(responseJson);
36092   }
36093
36094   // node_modules/d3-fetch/src/xml.js
36095   function parser(type2) {
36096     return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type2));
36097   }
36098   var xml_default = parser("application/xml");
36099   var html = parser("text/html");
36100   var svg = parser("image/svg+xml");
36101
36102   // modules/services/keepRight.js
36103   var tiler = utilTiler();
36104   var dispatch2 = dispatch_default("loaded");
36105   var _tileZoom = 14;
36106   var _krUrlRoot = "https://www.keepright.at";
36107   var _krData = { errorTypes: {}, localizeStrings: {} };
36108   var _cache;
36109   var _krRuleset = [
36110     // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
36111     30,
36112     40,
36113     50,
36114     60,
36115     70,
36116     90,
36117     100,
36118     110,
36119     120,
36120     130,
36121     150,
36122     160,
36123     170,
36124     180,
36125     190,
36126     191,
36127     192,
36128     193,
36129     194,
36130     195,
36131     196,
36132     197,
36133     198,
36134     200,
36135     201,
36136     202,
36137     203,
36138     204,
36139     205,
36140     206,
36141     207,
36142     208,
36143     210,
36144     220,
36145     230,
36146     231,
36147     232,
36148     270,
36149     280,
36150     281,
36151     282,
36152     283,
36153     284,
36154     285,
36155     290,
36156     291,
36157     292,
36158     293,
36159     294,
36160     295,
36161     296,
36162     297,
36163     298,
36164     300,
36165     310,
36166     311,
36167     312,
36168     313,
36169     320,
36170     350,
36171     360,
36172     370,
36173     380,
36174     390,
36175     400,
36176     401,
36177     402,
36178     410,
36179     411,
36180     412,
36181     413
36182   ];
36183   function abortRequest(controller) {
36184     if (controller) {
36185       controller.abort();
36186     }
36187   }
36188   function abortUnwantedRequests(cache, tiles) {
36189     Object.keys(cache.inflightTile).forEach((k2) => {
36190       const wanted = tiles.find((tile) => k2 === tile.id);
36191       if (!wanted) {
36192         abortRequest(cache.inflightTile[k2]);
36193         delete cache.inflightTile[k2];
36194       }
36195     });
36196   }
36197   function encodeIssueRtree(d2) {
36198     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36199   }
36200   function updateRtree(item, replace) {
36201     _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36202     if (replace) {
36203       _cache.rtree.insert(item);
36204     }
36205   }
36206   function tokenReplacements(d2) {
36207     if (!(d2 instanceof QAItem))
36208       return;
36209     const replacements = {};
36210     const issueTemplate = _krData.errorTypes[d2.whichType];
36211     if (!issueTemplate) {
36212       console.log("No Template: ", d2.whichType);
36213       console.log("  ", d2.description);
36214       return;
36215     }
36216     if (!issueTemplate.regex)
36217       return;
36218     const errorRegex = new RegExp(issueTemplate.regex, "i");
36219     const errorMatch = errorRegex.exec(d2.description);
36220     if (!errorMatch) {
36221       console.log("Unmatched: ", d2.whichType);
36222       console.log("  ", d2.description);
36223       console.log("  ", errorRegex);
36224       return;
36225     }
36226     for (let i3 = 1; i3 < errorMatch.length; i3++) {
36227       let capture = errorMatch[i3];
36228       let idType;
36229       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
36230       if (idType && capture) {
36231         capture = parseError(capture, idType);
36232       } else {
36233         const compare = capture.toLowerCase();
36234         if (_krData.localizeStrings[compare]) {
36235           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36236         } else {
36237           capture = unescape_default(capture);
36238         }
36239       }
36240       replacements["var" + i3] = capture;
36241     }
36242     return replacements;
36243   }
36244   function parseError(capture, idType) {
36245     const compare = capture.toLowerCase();
36246     if (_krData.localizeStrings[compare]) {
36247       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36248     }
36249     switch (idType) {
36250       case "this":
36251         capture = linkErrorObject2(capture);
36252         break;
36253       case "url":
36254         capture = linkURL(capture);
36255         break;
36256       case "n":
36257       case "w":
36258       case "r":
36259         capture = linkEntity2(idType + capture);
36260         break;
36261       case "20":
36262         capture = parse20(capture);
36263         break;
36264       case "211":
36265         capture = parse211(capture);
36266         break;
36267       case "231":
36268         capture = parse231(capture);
36269         break;
36270       case "294":
36271         capture = parse294(capture);
36272         break;
36273       case "370":
36274         capture = parse370(capture);
36275         break;
36276     }
36277     return capture;
36278     function linkErrorObject2(d2) {
36279       return { html: `<a class="error_object_link">${d2}</a>` };
36280     }
36281     function linkEntity2(d2) {
36282       return { html: `<a class="error_entity_link">${d2}</a>` };
36283     }
36284     function linkURL(d2) {
36285       return { html: `<a class="kr_external_link" target="_blank" href="${d2}">${d2}</a>` };
36286     }
36287     function parse211(capture2) {
36288       let newList = [];
36289       const items = capture2.split(", ");
36290       items.forEach((item) => {
36291         let id2 = linkEntity2("n" + item.slice(1));
36292         newList.push(id2);
36293       });
36294       return newList.join(", ");
36295     }
36296     function parse231(capture2) {
36297       let newList = [];
36298       const items = capture2.split("),");
36299       items.forEach((item) => {
36300         const match = item.match(/\#(\d+)\((.+)\)?/);
36301         if (match !== null && match.length > 2) {
36302           newList.push(
36303             linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
36304           );
36305         }
36306       });
36307       return newList.join(", ");
36308     }
36309     function parse294(capture2) {
36310       let newList = [];
36311       const items = capture2.split(",");
36312       items.forEach((item) => {
36313         item = item.split(" ");
36314         const role = `"${item[0]}"`;
36315         const idType2 = item[1].slice(0, 1);
36316         let id2 = item[2].slice(1);
36317         id2 = linkEntity2(idType2 + id2);
36318         newList.push(`${role} ${item[1]} ${id2}`);
36319       });
36320       return newList.join(", ");
36321     }
36322     function parse370(capture2) {
36323       if (!capture2)
36324         return "";
36325       const match = capture2.match(/\(including the name (\'.+\')\)/);
36326       if (match && match.length) {
36327         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
36328       }
36329       return "";
36330     }
36331     function parse20(capture2) {
36332       let newList = [];
36333       const items = capture2.split(",");
36334       items.forEach((item) => {
36335         const id2 = linkEntity2("n" + item.slice(1));
36336         newList.push(id2);
36337       });
36338       return newList.join(", ");
36339     }
36340   }
36341   var keepRight_default = {
36342     title: "keepRight",
36343     init() {
36344       _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
36345       if (!_cache) {
36346         this.reset();
36347       }
36348       this.event = utilRebind(this, dispatch2, "on");
36349     },
36350     reset() {
36351       if (_cache) {
36352         Object.values(_cache.inflightTile).forEach(abortRequest);
36353       }
36354       _cache = {
36355         data: {},
36356         loadedTile: {},
36357         inflightTile: {},
36358         inflightPost: {},
36359         closed: {},
36360         rtree: new import_rbush.default()
36361       };
36362     },
36363     // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
36364     loadIssues(projection2) {
36365       const options2 = {
36366         format: "geojson",
36367         ch: _krRuleset
36368       };
36369       const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
36370       abortUnwantedRequests(_cache, tiles);
36371       tiles.forEach((tile) => {
36372         if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
36373           return;
36374         const [left, top, right, bottom] = tile.extent.rectangle();
36375         const params = Object.assign({}, options2, { left, bottom, right, top });
36376         const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
36377         const controller = new AbortController();
36378         _cache.inflightTile[tile.id] = controller;
36379         json_default(url, { signal: controller.signal }).then((data) => {
36380           delete _cache.inflightTile[tile.id];
36381           _cache.loadedTile[tile.id] = true;
36382           if (!data || !data.features || !data.features.length) {
36383             throw new Error("No Data");
36384           }
36385           data.features.forEach((feature3) => {
36386             const {
36387               properties: {
36388                 error_type: itemType,
36389                 error_id: id2,
36390                 comment = null,
36391                 object_id: objectId,
36392                 object_type: objectType,
36393                 schema,
36394                 title
36395               }
36396             } = feature3;
36397             let {
36398               geometry: { coordinates: loc },
36399               properties: { description = "" }
36400             } = feature3;
36401             const issueTemplate = _krData.errorTypes[itemType];
36402             const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
36403             const whichType = issueTemplate ? itemType : parentIssueType;
36404             const whichTemplate = _krData.errorTypes[whichType];
36405             switch (whichType) {
36406               case "170":
36407                 description = `This feature has a FIXME tag: ${description}`;
36408                 break;
36409               case "292":
36410               case "293":
36411                 description = description.replace("A turn-", "This turn-");
36412                 break;
36413               case "294":
36414               case "295":
36415               case "296":
36416               case "297":
36417               case "298":
36418                 description = `This turn-restriction~${description}`;
36419                 break;
36420               case "300":
36421                 description = "This highway is missing a maxspeed tag";
36422                 break;
36423               case "411":
36424               case "412":
36425               case "413":
36426                 description = `This feature~${description}`;
36427                 break;
36428             }
36429             let coincident = false;
36430             do {
36431               let delta = coincident ? [1e-5, 0] : [0, 1e-5];
36432               loc = geoVecAdd(loc, delta);
36433               let bbox2 = geoExtent(loc).bbox();
36434               coincident = _cache.rtree.search(bbox2).length;
36435             } while (coincident);
36436             let d2 = new QAItem(loc, this, itemType, id2, {
36437               comment,
36438               description,
36439               whichType,
36440               parentIssueType,
36441               severity: whichTemplate.severity || "error",
36442               objectId,
36443               objectType,
36444               schema,
36445               title
36446             });
36447             d2.replacements = tokenReplacements(d2);
36448             _cache.data[id2] = d2;
36449             _cache.rtree.insert(encodeIssueRtree(d2));
36450           });
36451           dispatch2.call("loaded");
36452         }).catch(() => {
36453           delete _cache.inflightTile[tile.id];
36454           _cache.loadedTile[tile.id] = true;
36455         });
36456       });
36457     },
36458     postUpdate(d2, callback) {
36459       if (_cache.inflightPost[d2.id]) {
36460         return callback({ message: "Error update already inflight", status: -2 }, d2);
36461       }
36462       const params = { schema: d2.schema, id: d2.id };
36463       if (d2.newStatus) {
36464         params.st = d2.newStatus;
36465       }
36466       if (d2.newComment !== void 0) {
36467         params.co = d2.newComment;
36468       }
36469       const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
36470       const controller = new AbortController();
36471       _cache.inflightPost[d2.id] = controller;
36472       json_default(url, { signal: controller.signal }).finally(() => {
36473         delete _cache.inflightPost[d2.id];
36474         if (d2.newStatus === "ignore") {
36475           this.removeItem(d2);
36476         } else if (d2.newStatus === "ignore_t") {
36477           this.removeItem(d2);
36478           _cache.closed[`${d2.schema}:${d2.id}`] = true;
36479         } else {
36480           d2 = this.replaceItem(d2.update({
36481             comment: d2.newComment,
36482             newComment: void 0,
36483             newState: void 0
36484           }));
36485         }
36486         if (callback)
36487           callback(null, d2);
36488       });
36489     },
36490     // Get all cached QAItems covering the viewport
36491     getItems(projection2) {
36492       const viewport = projection2.clipExtent();
36493       const min3 = [viewport[0][0], viewport[1][1]];
36494       const max3 = [viewport[1][0], viewport[0][1]];
36495       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36496       return _cache.rtree.search(bbox2).map((d2) => d2.data);
36497     },
36498     // Get a QAItem from cache
36499     // NOTE: Don't change method name until UI v3 is merged
36500     getError(id2) {
36501       return _cache.data[id2];
36502     },
36503     // Replace a single QAItem in the cache
36504     replaceItem(item) {
36505       if (!(item instanceof QAItem) || !item.id)
36506         return;
36507       _cache.data[item.id] = item;
36508       updateRtree(encodeIssueRtree(item), true);
36509       return item;
36510     },
36511     // Remove a single QAItem from the cache
36512     removeItem(item) {
36513       if (!(item instanceof QAItem) || !item.id)
36514         return;
36515       delete _cache.data[item.id];
36516       updateRtree(encodeIssueRtree(item), false);
36517     },
36518     issueURL(item) {
36519       return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
36520     },
36521     // Get an array of issues closed during this session.
36522     // Used to populate `closed:keepright` changeset tag
36523     getClosedIDs() {
36524       return Object.keys(_cache.closed).sort();
36525     }
36526   };
36527
36528   // modules/services/improveOSM.js
36529   var import_rbush2 = __toESM(require_rbush_min());
36530   var tiler2 = utilTiler();
36531   var dispatch3 = dispatch_default("loaded");
36532   var _tileZoom2 = 14;
36533   var _impOsmUrls = {
36534     ow: "https://grab.community.improve-osm.org/directionOfFlowService",
36535     mr: "https://grab.community.improve-osm.org/missingGeoService",
36536     tr: "https://grab.community.improve-osm.org/turnRestrictionService"
36537   };
36538   var _impOsmData = { icons: {} };
36539   var _cache2;
36540   function abortRequest2(i3) {
36541     Object.values(i3).forEach((controller) => {
36542       if (controller) {
36543         controller.abort();
36544       }
36545     });
36546   }
36547   function abortUnwantedRequests2(cache, tiles) {
36548     Object.keys(cache.inflightTile).forEach((k2) => {
36549       const wanted = tiles.find((tile) => k2 === tile.id);
36550       if (!wanted) {
36551         abortRequest2(cache.inflightTile[k2]);
36552         delete cache.inflightTile[k2];
36553       }
36554     });
36555   }
36556   function encodeIssueRtree2(d2) {
36557     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36558   }
36559   function updateRtree2(item, replace) {
36560     _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36561     if (replace) {
36562       _cache2.rtree.insert(item);
36563     }
36564   }
36565   function linkErrorObject(d2) {
36566     return { html: `<a class="error_object_link">${d2}</a>` };
36567   }
36568   function linkEntity(d2) {
36569     return { html: `<a class="error_entity_link">${d2}</a>` };
36570   }
36571   function pointAverage(points) {
36572     if (points.length) {
36573       const sum = points.reduce(
36574         (acc, point2) => geoVecAdd(acc, [point2.lon, point2.lat]),
36575         [0, 0]
36576       );
36577       return geoVecScale(sum, 1 / points.length);
36578     } else {
36579       return [0, 0];
36580     }
36581   }
36582   function relativeBearing(p1, p2) {
36583     let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
36584     if (angle2 < 0) {
36585       angle2 += 2 * Math.PI;
36586     }
36587     return angle2 * 180 / Math.PI;
36588   }
36589   function cardinalDirection(bearing) {
36590     const dir = 45 * Math.round(bearing / 45);
36591     const compass = {
36592       0: "north",
36593       45: "northeast",
36594       90: "east",
36595       135: "southeast",
36596       180: "south",
36597       225: "southwest",
36598       270: "west",
36599       315: "northwest",
36600       360: "north"
36601     };
36602     return _t(`QA.improveOSM.directions.${compass[dir]}`);
36603   }
36604   function preventCoincident(loc, bumpUp) {
36605     let coincident = false;
36606     do {
36607       let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
36608       loc = geoVecAdd(loc, delta);
36609       let bbox2 = geoExtent(loc).bbox();
36610       coincident = _cache2.rtree.search(bbox2).length;
36611     } while (coincident);
36612     return loc;
36613   }
36614   var improveOSM_default = {
36615     title: "improveOSM",
36616     init() {
36617       _mainFileFetcher.get("qa_data").then((d2) => _impOsmData = d2.improveOSM);
36618       if (!_cache2) {
36619         this.reset();
36620       }
36621       this.event = utilRebind(this, dispatch3, "on");
36622     },
36623     reset() {
36624       if (_cache2) {
36625         Object.values(_cache2.inflightTile).forEach(abortRequest2);
36626       }
36627       _cache2 = {
36628         data: {},
36629         loadedTile: {},
36630         inflightTile: {},
36631         inflightPost: {},
36632         closed: {},
36633         rtree: new import_rbush2.default()
36634       };
36635     },
36636     loadIssues(projection2) {
36637       const options2 = {
36638         client: "iD",
36639         status: "OPEN",
36640         zoom: "19"
36641         // Use a high zoom so that clusters aren't returned
36642       };
36643       const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
36644       abortUnwantedRequests2(_cache2, tiles);
36645       tiles.forEach((tile) => {
36646         if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
36647           return;
36648         const [east, north, west, south] = tile.extent.rectangle();
36649         const params = Object.assign({}, options2, { east, south, west, north });
36650         const requests = {};
36651         Object.keys(_impOsmUrls).forEach((k2) => {
36652           const kParams = Object.assign(
36653             {},
36654             params,
36655             k2 === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" }
36656           );
36657           const url = `${_impOsmUrls[k2]}/search?` + utilQsString(kParams);
36658           const controller = new AbortController();
36659           requests[k2] = controller;
36660           json_default(url, { signal: controller.signal }).then((data) => {
36661             delete _cache2.inflightTile[tile.id][k2];
36662             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36663               delete _cache2.inflightTile[tile.id];
36664               _cache2.loadedTile[tile.id] = true;
36665             }
36666             if (data.roadSegments) {
36667               data.roadSegments.forEach((feature3) => {
36668                 const { points, wayId, fromNodeId, toNodeId } = feature3;
36669                 const itemId = `${wayId}${fromNodeId}${toNodeId}`;
36670                 let mid = points.length / 2;
36671                 let loc;
36672                 if (mid % 1 === 0) {
36673                   loc = pointAverage([points[mid - 1], points[mid]]);
36674                 } else {
36675                   mid = points[Math.floor(mid)];
36676                   loc = [mid.lon, mid.lat];
36677                 }
36678                 loc = preventCoincident(loc, false);
36679                 let d2 = new QAItem(loc, this, k2, itemId, {
36680                   issueKey: k2,
36681                   // used as a category
36682                   identifier: {
36683                     // used to post changes
36684                     wayId,
36685                     fromNodeId,
36686                     toNodeId
36687                   },
36688                   objectId: wayId,
36689                   objectType: "way"
36690                 });
36691                 d2.replacements = {
36692                   percentage: feature3.percentOfTrips,
36693                   num_trips: feature3.numberOfTrips,
36694                   highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
36695                   from_node: linkEntity("n" + feature3.fromNodeId),
36696                   to_node: linkEntity("n" + feature3.toNodeId)
36697                 };
36698                 _cache2.data[d2.id] = d2;
36699                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36700               });
36701             }
36702             if (data.tiles) {
36703               data.tiles.forEach((feature3) => {
36704                 const { type: type2, x: x2, y: y2, numberOfTrips } = feature3;
36705                 const geoType = type2.toLowerCase();
36706                 const itemId = `${geoType}${x2}${y2}${numberOfTrips}`;
36707                 let loc = pointAverage(feature3.points);
36708                 loc = preventCoincident(loc, false);
36709                 let d2 = new QAItem(loc, this, `${k2}-${geoType}`, itemId, {
36710                   issueKey: k2,
36711                   identifier: { x: x2, y: y2 }
36712                 });
36713                 d2.replacements = {
36714                   num_trips: numberOfTrips,
36715                   geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`)
36716                 };
36717                 if (numberOfTrips === -1) {
36718                   d2.desc = _t("QA.improveOSM.error_types.mr.description_alt", d2.replacements);
36719                 }
36720                 _cache2.data[d2.id] = d2;
36721                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36722               });
36723             }
36724             if (data.entities) {
36725               data.entities.forEach((feature3) => {
36726                 const { point: point2, id: id2, segments, numberOfPasses, turnType } = feature3;
36727                 const itemId = `${id2.replace(/[,:+#]/g, "_")}`;
36728                 const loc = preventCoincident([point2.lon, point2.lat], true);
36729                 const ids = id2.split(",");
36730                 const from_way = ids[0];
36731                 const via_node = ids[3];
36732                 const to_way = ids[2].split(":")[1];
36733                 let d2 = new QAItem(loc, this, k2, itemId, {
36734                   issueKey: k2,
36735                   identifier: id2,
36736                   objectId: via_node,
36737                   objectType: "node"
36738                 });
36739                 const [p1, p2] = segments[0].points;
36740                 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
36741                 d2.replacements = {
36742                   num_passed: numberOfPasses,
36743                   num_trips: segments[0].numberOfTrips,
36744                   turn_restriction: turnType.toLowerCase(),
36745                   from_way: linkEntity("w" + from_way),
36746                   to_way: linkEntity("w" + to_way),
36747                   travel_direction: dir_of_travel,
36748                   junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
36749                 };
36750                 _cache2.data[d2.id] = d2;
36751                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36752                 dispatch3.call("loaded");
36753               });
36754             }
36755           }).catch(() => {
36756             delete _cache2.inflightTile[tile.id][k2];
36757             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36758               delete _cache2.inflightTile[tile.id];
36759               _cache2.loadedTile[tile.id] = true;
36760             }
36761           });
36762         });
36763         _cache2.inflightTile[tile.id] = requests;
36764       });
36765     },
36766     getComments(item) {
36767       if (item.comments) {
36768         return Promise.resolve(item);
36769       }
36770       const key = item.issueKey;
36771       let qParams = {};
36772       if (key === "ow") {
36773         qParams = item.identifier;
36774       } else if (key === "mr") {
36775         qParams.tileX = item.identifier.x;
36776         qParams.tileY = item.identifier.y;
36777       } else if (key === "tr") {
36778         qParams.targetId = item.identifier;
36779       }
36780       const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams);
36781       const cacheComments = (data) => {
36782         item.comments = data.comments ? data.comments.reverse() : [];
36783         this.replaceItem(item);
36784       };
36785       return json_default(url).then(cacheComments).then(() => item);
36786     },
36787     postUpdate(d2, callback) {
36788       if (!osm_default.authenticated()) {
36789         return callback({ message: "Not Authenticated", status: -3 }, d2);
36790       }
36791       if (_cache2.inflightPost[d2.id]) {
36792         return callback({ message: "Error update already inflight", status: -2 }, d2);
36793       }
36794       osm_default.userDetails(sendPayload.bind(this));
36795       function sendPayload(err, user) {
36796         if (err) {
36797           return callback(err, d2);
36798         }
36799         const key = d2.issueKey;
36800         const url = `${_impOsmUrls[key]}/comment`;
36801         const payload = {
36802           username: user.display_name,
36803           targetIds: [d2.identifier]
36804         };
36805         if (d2.newStatus) {
36806           payload.status = d2.newStatus;
36807           payload.text = "status changed";
36808         }
36809         if (d2.newComment) {
36810           payload.text = d2.newComment;
36811         }
36812         const controller = new AbortController();
36813         _cache2.inflightPost[d2.id] = controller;
36814         const options2 = {
36815           method: "POST",
36816           signal: controller.signal,
36817           body: JSON.stringify(payload)
36818         };
36819         json_default(url, options2).then(() => {
36820           delete _cache2.inflightPost[d2.id];
36821           if (!d2.newStatus) {
36822             const now3 = /* @__PURE__ */ new Date();
36823             let comments = d2.comments ? d2.comments : [];
36824             comments.push({
36825               username: payload.username,
36826               text: payload.text,
36827               timestamp: now3.getTime() / 1e3
36828             });
36829             this.replaceItem(d2.update({
36830               comments,
36831               newComment: void 0
36832             }));
36833           } else {
36834             this.removeItem(d2);
36835             if (d2.newStatus === "SOLVED") {
36836               if (!(d2.issueKey in _cache2.closed)) {
36837                 _cache2.closed[d2.issueKey] = 0;
36838               }
36839               _cache2.closed[d2.issueKey] += 1;
36840             }
36841           }
36842           if (callback)
36843             callback(null, d2);
36844         }).catch((err2) => {
36845           delete _cache2.inflightPost[d2.id];
36846           if (callback)
36847             callback(err2.message);
36848         });
36849       }
36850     },
36851     // Get all cached QAItems covering the viewport
36852     getItems(projection2) {
36853       const viewport = projection2.clipExtent();
36854       const min3 = [viewport[0][0], viewport[1][1]];
36855       const max3 = [viewport[1][0], viewport[0][1]];
36856       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36857       return _cache2.rtree.search(bbox2).map((d2) => d2.data);
36858     },
36859     // Get a QAItem from cache
36860     // NOTE: Don't change method name until UI v3 is merged
36861     getError(id2) {
36862       return _cache2.data[id2];
36863     },
36864     // get the name of the icon to display for this item
36865     getIcon(itemType) {
36866       return _impOsmData.icons[itemType];
36867     },
36868     // Replace a single QAItem in the cache
36869     replaceItem(issue) {
36870       if (!(issue instanceof QAItem) || !issue.id)
36871         return;
36872       _cache2.data[issue.id] = issue;
36873       updateRtree2(encodeIssueRtree2(issue), true);
36874       return issue;
36875     },
36876     // Remove a single QAItem from the cache
36877     removeItem(issue) {
36878       if (!(issue instanceof QAItem) || !issue.id)
36879         return;
36880       delete _cache2.data[issue.id];
36881       updateRtree2(encodeIssueRtree2(issue), false);
36882     },
36883     // Used to populate `closed:improveosm:*` changeset tags
36884     getClosedCounts() {
36885       return _cache2.closed;
36886     }
36887   };
36888
36889   // modules/services/osmose.js
36890   var import_rbush3 = __toESM(require_rbush_min());
36891
36892   // node_modules/marked/lib/marked.esm.js
36893   function _getDefaults() {
36894     return {
36895       async: false,
36896       baseUrl: null,
36897       breaks: false,
36898       extensions: null,
36899       gfm: true,
36900       headerIds: false,
36901       headerPrefix: "",
36902       highlight: null,
36903       hooks: null,
36904       langPrefix: "language-",
36905       mangle: false,
36906       pedantic: false,
36907       renderer: null,
36908       sanitize: false,
36909       sanitizer: null,
36910       silent: false,
36911       smartypants: false,
36912       tokenizer: null,
36913       walkTokens: null,
36914       xhtml: false
36915     };
36916   }
36917   var _defaults = _getDefaults();
36918   function changeDefaults(newDefaults) {
36919     _defaults = newDefaults;
36920   }
36921   var escapeTest = /[&<>"']/;
36922   var escapeReplace = new RegExp(escapeTest.source, "g");
36923   var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
36924   var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
36925   var escapeReplacements = {
36926     "&": "&amp;",
36927     "<": "&lt;",
36928     ">": "&gt;",
36929     '"': "&quot;",
36930     "'": "&#39;"
36931   };
36932   var getEscapeReplacement = (ch) => escapeReplacements[ch];
36933   function escape4(html2, encode) {
36934     if (encode) {
36935       if (escapeTest.test(html2)) {
36936         return html2.replace(escapeReplace, getEscapeReplacement);
36937       }
36938     } else {
36939       if (escapeTestNoEncode.test(html2)) {
36940         return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
36941       }
36942     }
36943     return html2;
36944   }
36945   var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
36946   function unescape3(html2) {
36947     return html2.replace(unescapeTest, (_2, n3) => {
36948       n3 = n3.toLowerCase();
36949       if (n3 === "colon")
36950         return ":";
36951       if (n3.charAt(0) === "#") {
36952         return n3.charAt(1) === "x" ? String.fromCharCode(parseInt(n3.substring(2), 16)) : String.fromCharCode(+n3.substring(1));
36953       }
36954       return "";
36955     });
36956   }
36957   var caret = /(^|[^\[])\^/g;
36958   function edit(regex, opt) {
36959     regex = typeof regex === "string" ? regex : regex.source;
36960     opt = opt || "";
36961     const obj = {
36962       replace: (name, val) => {
36963         val = typeof val === "object" && "source" in val ? val.source : val;
36964         val = val.replace(caret, "$1");
36965         regex = regex.replace(name, val);
36966         return obj;
36967       },
36968       getRegex: () => {
36969         return new RegExp(regex, opt);
36970       }
36971     };
36972     return obj;
36973   }
36974   var nonWordAndColonTest = /[^\w:]/g;
36975   var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
36976   function cleanUrl(sanitize, base, href) {
36977     if (sanitize) {
36978       let prot;
36979       try {
36980         prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
36981       } catch (e3) {
36982         return null;
36983       }
36984       if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
36985         return null;
36986       }
36987     }
36988     if (base && !originIndependentUrl.test(href)) {
36989       href = resolveUrl(base, href);
36990     }
36991     try {
36992       href = encodeURI(href).replace(/%25/g, "%");
36993     } catch (e3) {
36994       return null;
36995     }
36996     return href;
36997   }
36998   var baseUrls = {};
36999   var justDomain = /^[^:]+:\/*[^/]*$/;
37000   var protocol = /^([^:]+:)[\s\S]*$/;
37001   var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
37002   function resolveUrl(base, href) {
37003     if (!baseUrls[" " + base]) {
37004       if (justDomain.test(base)) {
37005         baseUrls[" " + base] = base + "/";
37006       } else {
37007         baseUrls[" " + base] = rtrim(base, "/", true);
37008       }
37009     }
37010     base = baseUrls[" " + base];
37011     const relativeBase = base.indexOf(":") === -1;
37012     if (href.substring(0, 2) === "//") {
37013       if (relativeBase) {
37014         return href;
37015       }
37016       return base.replace(protocol, "$1") + href;
37017     } else if (href.charAt(0) === "/") {
37018       if (relativeBase) {
37019         return href;
37020       }
37021       return base.replace(domain, "$1") + href;
37022     } else {
37023       return base + href;
37024     }
37025   }
37026   var noopTest = { exec: () => null };
37027   function splitCells(tableRow, count) {
37028     const row = tableRow.replace(/\|/g, (match, offset, str2) => {
37029       let escaped = false, curr = offset;
37030       while (--curr >= 0 && str2[curr] === "\\")
37031         escaped = !escaped;
37032       if (escaped) {
37033         return "|";
37034       } else {
37035         return " |";
37036       }
37037     }), cells = row.split(/ \|/);
37038     let i3 = 0;
37039     if (!cells[0].trim()) {
37040       cells.shift();
37041     }
37042     if (cells.length > 0 && !cells[cells.length - 1].trim()) {
37043       cells.pop();
37044     }
37045     if (count) {
37046       if (cells.length > count) {
37047         cells.splice(count);
37048       } else {
37049         while (cells.length < count)
37050           cells.push("");
37051       }
37052     }
37053     for (; i3 < cells.length; i3++) {
37054       cells[i3] = cells[i3].trim().replace(/\\\|/g, "|");
37055     }
37056     return cells;
37057   }
37058   function rtrim(str2, c2, invert) {
37059     const l2 = str2.length;
37060     if (l2 === 0) {
37061       return "";
37062     }
37063     let suffLen = 0;
37064     while (suffLen < l2) {
37065       const currChar = str2.charAt(l2 - suffLen - 1);
37066       if (currChar === c2 && !invert) {
37067         suffLen++;
37068       } else if (currChar !== c2 && invert) {
37069         suffLen++;
37070       } else {
37071         break;
37072       }
37073     }
37074     return str2.slice(0, l2 - suffLen);
37075   }
37076   function findClosingBracket(str2, b2) {
37077     if (str2.indexOf(b2[1]) === -1) {
37078       return -1;
37079     }
37080     const l2 = str2.length;
37081     let level = 0, i3 = 0;
37082     for (; i3 < l2; i3++) {
37083       if (str2[i3] === "\\") {
37084         i3++;
37085       } else if (str2[i3] === b2[0]) {
37086         level++;
37087       } else if (str2[i3] === b2[1]) {
37088         level--;
37089         if (level < 0) {
37090           return i3;
37091         }
37092       }
37093     }
37094     return -1;
37095   }
37096   function checkDeprecations(opt, callback) {
37097     if (!opt || opt.silent) {
37098       return;
37099     }
37100     if (callback) {
37101       console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async");
37102     }
37103     if (opt.sanitize || opt.sanitizer) {
37104       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");
37105     }
37106     if (opt.highlight || opt.langPrefix !== "language-") {
37107       console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.");
37108     }
37109     if (opt.mangle) {
37110       console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.");
37111     }
37112     if (opt.baseUrl) {
37113       console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.");
37114     }
37115     if (opt.smartypants) {
37116       console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.");
37117     }
37118     if (opt.xhtml) {
37119       console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.");
37120     }
37121     if (opt.headerIds || opt.headerPrefix) {
37122       console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install  https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.");
37123     }
37124   }
37125   function outputLink(cap, link2, raw, lexer2) {
37126     const href = link2.href;
37127     const title = link2.title ? escape4(link2.title) : null;
37128     const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
37129     if (cap[0].charAt(0) !== "!") {
37130       lexer2.state.inLink = true;
37131       const token = {
37132         type: "link",
37133         raw,
37134         href,
37135         title,
37136         text: text2,
37137         tokens: lexer2.inlineTokens(text2)
37138       };
37139       lexer2.state.inLink = false;
37140       return token;
37141     }
37142     return {
37143       type: "image",
37144       raw,
37145       href,
37146       title,
37147       text: escape4(text2)
37148     };
37149   }
37150   function indentCodeCompensation(raw, text2) {
37151     const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
37152     if (matchIndentToCode === null) {
37153       return text2;
37154     }
37155     const indentToCode = matchIndentToCode[1];
37156     return text2.split("\n").map((node) => {
37157       const matchIndentInNode = node.match(/^\s+/);
37158       if (matchIndentInNode === null) {
37159         return node;
37160       }
37161       const [indentInNode] = matchIndentInNode;
37162       if (indentInNode.length >= indentToCode.length) {
37163         return node.slice(indentToCode.length);
37164       }
37165       return node;
37166     }).join("\n");
37167   }
37168   var _Tokenizer = class {
37169     options;
37170     rules;
37171     lexer;
37172     constructor(options2) {
37173       this.options = options2 || _defaults;
37174     }
37175     space(src) {
37176       const cap = this.rules.block.newline.exec(src);
37177       if (cap && cap[0].length > 0) {
37178         return {
37179           type: "space",
37180           raw: cap[0]
37181         };
37182       }
37183     }
37184     code(src) {
37185       const cap = this.rules.block.code.exec(src);
37186       if (cap) {
37187         const text2 = cap[0].replace(/^ {1,4}/gm, "");
37188         return {
37189           type: "code",
37190           raw: cap[0],
37191           codeBlockStyle: "indented",
37192           text: !this.options.pedantic ? rtrim(text2, "\n") : text2
37193         };
37194       }
37195     }
37196     fences(src) {
37197       const cap = this.rules.block.fences.exec(src);
37198       if (cap) {
37199         const raw = cap[0];
37200         const text2 = indentCodeCompensation(raw, cap[3] || "");
37201         return {
37202           type: "code",
37203           raw,
37204           lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2],
37205           text: text2
37206         };
37207       }
37208     }
37209     heading(src) {
37210       const cap = this.rules.block.heading.exec(src);
37211       if (cap) {
37212         let text2 = cap[2].trim();
37213         if (/#$/.test(text2)) {
37214           const trimmed = rtrim(text2, "#");
37215           if (this.options.pedantic) {
37216             text2 = trimmed.trim();
37217           } else if (!trimmed || / $/.test(trimmed)) {
37218             text2 = trimmed.trim();
37219           }
37220         }
37221         return {
37222           type: "heading",
37223           raw: cap[0],
37224           depth: cap[1].length,
37225           text: text2,
37226           tokens: this.lexer.inline(text2)
37227         };
37228       }
37229     }
37230     hr(src) {
37231       const cap = this.rules.block.hr.exec(src);
37232       if (cap) {
37233         return {
37234           type: "hr",
37235           raw: cap[0]
37236         };
37237       }
37238     }
37239     blockquote(src) {
37240       const cap = this.rules.block.blockquote.exec(src);
37241       if (cap) {
37242         const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
37243         const top = this.lexer.state.top;
37244         this.lexer.state.top = true;
37245         const tokens = this.lexer.blockTokens(text2);
37246         this.lexer.state.top = top;
37247         return {
37248           type: "blockquote",
37249           raw: cap[0],
37250           tokens,
37251           text: text2
37252         };
37253       }
37254     }
37255     list(src) {
37256       let cap = this.rules.block.list.exec(src);
37257       if (cap) {
37258         let raw, istask, ischecked, indent2, i3, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
37259         let bull = cap[1].trim();
37260         const isordered = bull.length > 1;
37261         const list = {
37262           type: "list",
37263           raw: "",
37264           ordered: isordered,
37265           start: isordered ? +bull.slice(0, -1) : "",
37266           loose: false,
37267           items: []
37268         };
37269         bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
37270         if (this.options.pedantic) {
37271           bull = isordered ? bull : "[*+-]";
37272         }
37273         const itemRegex = new RegExp(`^( {0,3}${bull})((?:[      ][^\\n]*)?(?:\\n|$))`);
37274         while (src) {
37275           endEarly = false;
37276           if (!(cap = itemRegex.exec(src))) {
37277             break;
37278           }
37279           if (this.rules.block.hr.test(src)) {
37280             break;
37281           }
37282           raw = cap[0];
37283           src = src.substring(raw.length);
37284           line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t2) => " ".repeat(3 * t2.length));
37285           nextLine = src.split("\n", 1)[0];
37286           if (this.options.pedantic) {
37287             indent2 = 2;
37288             itemContents = line.trimLeft();
37289           } else {
37290             indent2 = cap[2].search(/[^ ]/);
37291             indent2 = indent2 > 4 ? 1 : indent2;
37292             itemContents = line.slice(indent2);
37293             indent2 += cap[1].length;
37294           }
37295           blankLine = false;
37296           if (!line && /^ *$/.test(nextLine)) {
37297             raw += nextLine + "\n";
37298             src = src.substring(nextLine.length + 1);
37299             endEarly = true;
37300           }
37301           if (!endEarly) {
37302             const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[    ][^\\n]*)?(?:\\n|$))`);
37303             const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
37304             const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:\`\`\`|~~~)`);
37305             const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}#`);
37306             while (src) {
37307               rawLine = src.split("\n", 1)[0];
37308               nextLine = rawLine;
37309               if (this.options.pedantic) {
37310                 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
37311               }
37312               if (fencesBeginRegex.test(nextLine)) {
37313                 break;
37314               }
37315               if (headingBeginRegex.test(nextLine)) {
37316                 break;
37317               }
37318               if (nextBulletRegex.test(nextLine)) {
37319                 break;
37320               }
37321               if (hrRegex.test(src)) {
37322                 break;
37323               }
37324               if (nextLine.search(/[^ ]/) >= indent2 || !nextLine.trim()) {
37325                 itemContents += "\n" + nextLine.slice(indent2);
37326               } else {
37327                 if (blankLine) {
37328                   break;
37329                 }
37330                 if (line.search(/[^ ]/) >= 4) {
37331                   break;
37332                 }
37333                 if (fencesBeginRegex.test(line)) {
37334                   break;
37335                 }
37336                 if (headingBeginRegex.test(line)) {
37337                   break;
37338                 }
37339                 if (hrRegex.test(line)) {
37340                   break;
37341                 }
37342                 itemContents += "\n" + nextLine;
37343               }
37344               if (!blankLine && !nextLine.trim()) {
37345                 blankLine = true;
37346               }
37347               raw += rawLine + "\n";
37348               src = src.substring(rawLine.length + 1);
37349               line = nextLine.slice(indent2);
37350             }
37351           }
37352           if (!list.loose) {
37353             if (endsWithBlankLine) {
37354               list.loose = true;
37355             } else if (/\n *\n *$/.test(raw)) {
37356               endsWithBlankLine = true;
37357             }
37358           }
37359           if (this.options.gfm) {
37360             istask = /^\[[ xX]\] /.exec(itemContents);
37361             if (istask) {
37362               ischecked = istask[0] !== "[ ] ";
37363               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
37364             }
37365           }
37366           list.items.push({
37367             type: "list_item",
37368             raw,
37369             task: !!istask,
37370             checked: ischecked,
37371             loose: false,
37372             text: itemContents
37373           });
37374           list.raw += raw;
37375         }
37376         list.items[list.items.length - 1].raw = raw.trimRight();
37377         list.items[list.items.length - 1].text = itemContents.trimRight();
37378         list.raw = list.raw.trimRight();
37379         const l2 = list.items.length;
37380         for (i3 = 0; i3 < l2; i3++) {
37381           this.lexer.state.top = false;
37382           list.items[i3].tokens = this.lexer.blockTokens(list.items[i3].text, []);
37383           if (!list.loose) {
37384             const spacers = list.items[i3].tokens.filter((t2) => t2.type === "space");
37385             const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => /\n.*\n/.test(t2.raw));
37386             list.loose = hasMultipleLineBreaks;
37387           }
37388         }
37389         if (list.loose) {
37390           for (i3 = 0; i3 < l2; i3++) {
37391             list.items[i3].loose = true;
37392           }
37393         }
37394         return list;
37395       }
37396     }
37397     html(src) {
37398       const cap = this.rules.block.html.exec(src);
37399       if (cap) {
37400         const token = {
37401           type: "html",
37402           block: true,
37403           raw: cap[0],
37404           pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
37405           text: cap[0]
37406         };
37407         if (this.options.sanitize) {
37408           const text2 = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
37409           const paragraph = token;
37410           paragraph.type = "paragraph";
37411           paragraph.text = text2;
37412           paragraph.tokens = this.lexer.inline(text2);
37413         }
37414         return token;
37415       }
37416     }
37417     def(src) {
37418       const cap = this.rules.block.def.exec(src);
37419       if (cap) {
37420         const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
37421         const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "";
37422         const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3];
37423         return {
37424           type: "def",
37425           tag,
37426           raw: cap[0],
37427           href,
37428           title
37429         };
37430       }
37431     }
37432     table(src) {
37433       const cap = this.rules.block.table.exec(src);
37434       if (cap) {
37435         const item = {
37436           type: "table",
37437           raw: cap[0],
37438           header: splitCells(cap[1]).map((c2) => {
37439             return { text: c2 };
37440           }),
37441           align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
37442           rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
37443         };
37444         if (item.header.length === item.align.length) {
37445           let l2 = item.align.length;
37446           let i3, j3, k2, row;
37447           for (i3 = 0; i3 < l2; i3++) {
37448             if (/^ *-+: *$/.test(item.align[i3])) {
37449               item.align[i3] = "right";
37450             } else if (/^ *:-+: *$/.test(item.align[i3])) {
37451               item.align[i3] = "center";
37452             } else if (/^ *:-+ *$/.test(item.align[i3])) {
37453               item.align[i3] = "left";
37454             } else {
37455               item.align[i3] = null;
37456             }
37457           }
37458           l2 = item.rows.length;
37459           for (i3 = 0; i3 < l2; i3++) {
37460             item.rows[i3] = splitCells(item.rows[i3], item.header.length).map((c2) => {
37461               return { text: c2 };
37462             });
37463           }
37464           l2 = item.header.length;
37465           for (j3 = 0; j3 < l2; j3++) {
37466             item.header[j3].tokens = this.lexer.inline(item.header[j3].text);
37467           }
37468           l2 = item.rows.length;
37469           for (j3 = 0; j3 < l2; j3++) {
37470             row = item.rows[j3];
37471             for (k2 = 0; k2 < row.length; k2++) {
37472               row[k2].tokens = this.lexer.inline(row[k2].text);
37473             }
37474           }
37475           return item;
37476         }
37477       }
37478     }
37479     lheading(src) {
37480       const cap = this.rules.block.lheading.exec(src);
37481       if (cap) {
37482         return {
37483           type: "heading",
37484           raw: cap[0],
37485           depth: cap[2].charAt(0) === "=" ? 1 : 2,
37486           text: cap[1],
37487           tokens: this.lexer.inline(cap[1])
37488         };
37489       }
37490     }
37491     paragraph(src) {
37492       const cap = this.rules.block.paragraph.exec(src);
37493       if (cap) {
37494         const text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
37495         return {
37496           type: "paragraph",
37497           raw: cap[0],
37498           text: text2,
37499           tokens: this.lexer.inline(text2)
37500         };
37501       }
37502     }
37503     text(src) {
37504       const cap = this.rules.block.text.exec(src);
37505       if (cap) {
37506         return {
37507           type: "text",
37508           raw: cap[0],
37509           text: cap[0],
37510           tokens: this.lexer.inline(cap[0])
37511         };
37512       }
37513     }
37514     escape(src) {
37515       const cap = this.rules.inline.escape.exec(src);
37516       if (cap) {
37517         return {
37518           type: "escape",
37519           raw: cap[0],
37520           text: escape4(cap[1])
37521         };
37522       }
37523     }
37524     tag(src) {
37525       const cap = this.rules.inline.tag.exec(src);
37526       if (cap) {
37527         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
37528           this.lexer.state.inLink = true;
37529         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
37530           this.lexer.state.inLink = false;
37531         }
37532         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37533           this.lexer.state.inRawBlock = true;
37534         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37535           this.lexer.state.inRawBlock = false;
37536         }
37537         return {
37538           type: this.options.sanitize ? "text" : "html",
37539           raw: cap[0],
37540           inLink: this.lexer.state.inLink,
37541           inRawBlock: this.lexer.state.inRawBlock,
37542           block: false,
37543           text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
37544         };
37545       }
37546     }
37547     link(src) {
37548       const cap = this.rules.inline.link.exec(src);
37549       if (cap) {
37550         const trimmedUrl = cap[2].trim();
37551         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
37552           if (!/>$/.test(trimmedUrl)) {
37553             return;
37554           }
37555           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
37556           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
37557             return;
37558           }
37559         } else {
37560           const lastParenIndex = findClosingBracket(cap[2], "()");
37561           if (lastParenIndex > -1) {
37562             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
37563             const linkLen = start2 + cap[1].length + lastParenIndex;
37564             cap[2] = cap[2].substring(0, lastParenIndex);
37565             cap[0] = cap[0].substring(0, linkLen).trim();
37566             cap[3] = "";
37567           }
37568         }
37569         let href = cap[2];
37570         let title = "";
37571         if (this.options.pedantic) {
37572           const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
37573           if (link2) {
37574             href = link2[1];
37575             title = link2[3];
37576           }
37577         } else {
37578           title = cap[3] ? cap[3].slice(1, -1) : "";
37579         }
37580         href = href.trim();
37581         if (/^</.test(href)) {
37582           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
37583             href = href.slice(1);
37584           } else {
37585             href = href.slice(1, -1);
37586           }
37587         }
37588         return outputLink(cap, {
37589           href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
37590           title: title ? title.replace(this.rules.inline._escapes, "$1") : title
37591         }, cap[0], this.lexer);
37592       }
37593     }
37594     reflink(src, links) {
37595       let cap;
37596       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
37597         let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
37598         link2 = links[link2.toLowerCase()];
37599         if (!link2) {
37600           const text2 = cap[0].charAt(0);
37601           return {
37602             type: "text",
37603             raw: text2,
37604             text: text2
37605           };
37606         }
37607         return outputLink(cap, link2, cap[0], this.lexer);
37608       }
37609     }
37610     emStrong(src, maskedSrc, prevChar = "") {
37611       let match = this.rules.inline.emStrong.lDelim.exec(src);
37612       if (!match)
37613         return;
37614       if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
37615         return;
37616       const nextChar = match[1] || match[2] || "";
37617       if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
37618         const lLength = [...match[0]].length - 1;
37619         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
37620         const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
37621         endReg.lastIndex = 0;
37622         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
37623         while ((match = endReg.exec(maskedSrc)) != null) {
37624           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
37625           if (!rDelim)
37626             continue;
37627           rLength = [...rDelim].length;
37628           if (match[3] || match[4]) {
37629             delimTotal += rLength;
37630             continue;
37631           } else if (match[5] || match[6]) {
37632             if (lLength % 3 && !((lLength + rLength) % 3)) {
37633               midDelimTotal += rLength;
37634               continue;
37635             }
37636           }
37637           delimTotal -= rLength;
37638           if (delimTotal > 0)
37639             continue;
37640           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
37641           const raw = [...src].slice(0, lLength + match.index + rLength + 1).join("");
37642           if (Math.min(lLength, rLength) % 2) {
37643             const text3 = raw.slice(1, -1);
37644             return {
37645               type: "em",
37646               raw,
37647               text: text3,
37648               tokens: this.lexer.inlineTokens(text3)
37649             };
37650           }
37651           const text2 = raw.slice(2, -2);
37652           return {
37653             type: "strong",
37654             raw,
37655             text: text2,
37656             tokens: this.lexer.inlineTokens(text2)
37657           };
37658         }
37659       }
37660     }
37661     codespan(src) {
37662       const cap = this.rules.inline.code.exec(src);
37663       if (cap) {
37664         let text2 = cap[2].replace(/\n/g, " ");
37665         const hasNonSpaceChars = /[^ ]/.test(text2);
37666         const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
37667         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
37668           text2 = text2.substring(1, text2.length - 1);
37669         }
37670         text2 = escape4(text2, true);
37671         return {
37672           type: "codespan",
37673           raw: cap[0],
37674           text: text2
37675         };
37676       }
37677     }
37678     br(src) {
37679       const cap = this.rules.inline.br.exec(src);
37680       if (cap) {
37681         return {
37682           type: "br",
37683           raw: cap[0]
37684         };
37685       }
37686     }
37687     del(src) {
37688       const cap = this.rules.inline.del.exec(src);
37689       if (cap) {
37690         return {
37691           type: "del",
37692           raw: cap[0],
37693           text: cap[2],
37694           tokens: this.lexer.inlineTokens(cap[2])
37695         };
37696       }
37697     }
37698     autolink(src, mangle2) {
37699       const cap = this.rules.inline.autolink.exec(src);
37700       if (cap) {
37701         let text2, href;
37702         if (cap[2] === "@") {
37703           text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
37704           href = "mailto:" + text2;
37705         } else {
37706           text2 = escape4(cap[1]);
37707           href = text2;
37708         }
37709         return {
37710           type: "link",
37711           raw: cap[0],
37712           text: text2,
37713           href,
37714           tokens: [
37715             {
37716               type: "text",
37717               raw: text2,
37718               text: text2
37719             }
37720           ]
37721         };
37722       }
37723     }
37724     url(src, mangle2) {
37725       let cap;
37726       if (cap = this.rules.inline.url.exec(src)) {
37727         let text2, href;
37728         if (cap[2] === "@") {
37729           text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
37730           href = "mailto:" + text2;
37731         } else {
37732           let prevCapZero;
37733           do {
37734             prevCapZero = cap[0];
37735             cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
37736           } while (prevCapZero !== cap[0]);
37737           text2 = escape4(cap[0]);
37738           if (cap[1] === "www.") {
37739             href = "http://" + cap[0];
37740           } else {
37741             href = cap[0];
37742           }
37743         }
37744         return {
37745           type: "link",
37746           raw: cap[0],
37747           text: text2,
37748           href,
37749           tokens: [
37750             {
37751               type: "text",
37752               raw: text2,
37753               text: text2
37754             }
37755           ]
37756         };
37757       }
37758     }
37759     inlineText(src, smartypants2) {
37760       const cap = this.rules.inline.text.exec(src);
37761       if (cap) {
37762         let text2;
37763         if (this.lexer.state.inRawBlock) {
37764           text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
37765         } else {
37766           text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
37767         }
37768         return {
37769           type: "text",
37770           raw: cap[0],
37771           text: text2
37772         };
37773       }
37774     }
37775   };
37776   var block = {
37777     newline: /^(?: *(?:\n|$))+/,
37778     code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
37779     fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
37780     hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
37781     heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
37782     blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
37783     list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
37784     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|$))",
37785     def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
37786     table: noopTest,
37787     lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37788     // regex template, placeholders will be replaced according to different paragraph
37789     // interruption rules of commonmark and the original markdown spec:
37790     _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
37791     text: /^[^\n]+/
37792   };
37793   block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
37794   block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
37795   block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
37796   block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
37797   block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
37798   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();
37799   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";
37800   block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
37801   block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
37802   block.lheading = edit(block.lheading).replace(/bull/g, block.bullet).getRegex();
37803   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();
37804   block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
37805   block.normal = { ...block };
37806   block.gfm = {
37807     ...block.normal,
37808     table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
37809     // Cells
37810   };
37811   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();
37812   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();
37813   block.pedantic = {
37814     ...block.normal,
37815     html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).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(),
37816     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
37817     heading: /^(#{1,6})(.*)(?:\n+|$)/,
37818     fences: noopTest,
37819     lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37820     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()
37821   };
37822   var inline = {
37823     escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
37824     autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
37825     url: noopTest,
37826     tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
37827     link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
37828     reflink: /^!?\[(label)\]\[(ref)\]/,
37829     nolink: /^!?\[(ref)\](?:\[\])?/,
37830     reflinkSearch: "reflink|nolink(?!\\()",
37831     emStrong: {
37832       lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
37833       //         (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left.  (5) and (6) can be either Left or Right.
37834       //         | Skip orphan inside strong      | Consume to delim | (1) #***              | (2) a***#, a***                    | (3) #***a, ***a                  | (4) ***#                 | (5) #***#                         | (6) a***a
37835       rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
37836       rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/
37837       // ^- Not allowed for _
37838     },
37839     code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
37840     br: /^( {2,}|\\)\n(?!\s*$)/,
37841     del: noopTest,
37842     text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
37843     punctuation: /^((?![*_])[\spunctuation])/
37844   };
37845   inline._punctuation = "\\p{P}$+<=>`^|~";
37846   inline.punctuation = edit(inline.punctuation, "u").replace(/punctuation/g, inline._punctuation).getRegex();
37847   inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
37848   inline.anyPunctuation = /\\[punct]/g;
37849   inline._escapes = /\\([punct])/g;
37850   inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
37851   inline.emStrong.lDelim = edit(inline.emStrong.lDelim, "u").replace(/punct/g, inline._punctuation).getRegex();
37852   inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "gu").replace(/punct/g, inline._punctuation).getRegex();
37853   inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "gu").replace(/punct/g, inline._punctuation).getRegex();
37854   inline.anyPunctuation = edit(inline.anyPunctuation, "gu").replace(/punct/g, inline._punctuation).getRegex();
37855   inline._escapes = edit(inline._escapes, "gu").replace(/punct/g, inline._punctuation).getRegex();
37856   inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
37857   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])?)+(?![-_])/;
37858   inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
37859   inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
37860   inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
37861   inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
37862   inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
37863   inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
37864   inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
37865   inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
37866   inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
37867   inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
37868   inline.normal = { ...inline };
37869   inline.pedantic = {
37870     ...inline.normal,
37871     strong: {
37872       start: /^__|\*\*/,
37873       middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
37874       endAst: /\*\*(?!\*)/g,
37875       endUnd: /__(?!_)/g
37876     },
37877     em: {
37878       start: /^_|\*/,
37879       middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
37880       endAst: /\*(?!\*)/g,
37881       endUnd: /_(?!_)/g
37882     },
37883     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
37884     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
37885   };
37886   inline.gfm = {
37887     ...inline.normal,
37888     escape: edit(inline.escape).replace("])", "~|])").getRegex(),
37889     _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
37890     url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
37891     _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
37892     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
37893     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
37894   };
37895   inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
37896   inline.breaks = {
37897     ...inline.gfm,
37898     br: edit(inline.br).replace("{2,}", "*").getRegex(),
37899     text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
37900   };
37901   function smartypants(text2) {
37902     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");
37903   }
37904   function mangle(text2) {
37905     let out = "", i3, ch;
37906     const l2 = text2.length;
37907     for (i3 = 0; i3 < l2; i3++) {
37908       ch = text2.charCodeAt(i3);
37909       if (Math.random() > 0.5) {
37910         ch = "x" + ch.toString(16);
37911       }
37912       out += "&#" + ch + ";";
37913     }
37914     return out;
37915   }
37916   var _Lexer = class __Lexer {
37917     tokens;
37918     options;
37919     state;
37920     tokenizer;
37921     inlineQueue;
37922     constructor(options2) {
37923       this.tokens = [];
37924       this.tokens.links = /* @__PURE__ */ Object.create(null);
37925       this.options = options2 || _defaults;
37926       this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
37927       this.tokenizer = this.options.tokenizer;
37928       this.tokenizer.options = this.options;
37929       this.tokenizer.lexer = this;
37930       this.inlineQueue = [];
37931       this.state = {
37932         inLink: false,
37933         inRawBlock: false,
37934         top: true
37935       };
37936       const rules = {
37937         block: block.normal,
37938         inline: inline.normal
37939       };
37940       if (this.options.pedantic) {
37941         rules.block = block.pedantic;
37942         rules.inline = inline.pedantic;
37943       } else if (this.options.gfm) {
37944         rules.block = block.gfm;
37945         if (this.options.breaks) {
37946           rules.inline = inline.breaks;
37947         } else {
37948           rules.inline = inline.gfm;
37949         }
37950       }
37951       this.tokenizer.rules = rules;
37952     }
37953     /**
37954      * Expose Rules
37955      */
37956     static get rules() {
37957       return {
37958         block,
37959         inline
37960       };
37961     }
37962     /**
37963      * Static Lex Method
37964      */
37965     static lex(src, options2) {
37966       const lexer2 = new __Lexer(options2);
37967       return lexer2.lex(src);
37968     }
37969     /**
37970      * Static Lex Inline Method
37971      */
37972     static lexInline(src, options2) {
37973       const lexer2 = new __Lexer(options2);
37974       return lexer2.inlineTokens(src);
37975     }
37976     /**
37977      * Preprocessing
37978      */
37979     lex(src) {
37980       src = src.replace(/\r\n|\r/g, "\n");
37981       this.blockTokens(src, this.tokens);
37982       let next;
37983       while (next = this.inlineQueue.shift()) {
37984         this.inlineTokens(next.src, next.tokens);
37985       }
37986       return this.tokens;
37987     }
37988     blockTokens(src, tokens = []) {
37989       if (this.options.pedantic) {
37990         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
37991       } else {
37992         src = src.replace(/^( *)(\t+)/gm, (_2, leading, tabs) => {
37993           return leading + "    ".repeat(tabs.length);
37994         });
37995       }
37996       let token;
37997       let lastToken;
37998       let cutSrc;
37999       let lastParagraphClipped;
38000       while (src) {
38001         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
38002           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38003             src = src.substring(token.raw.length);
38004             tokens.push(token);
38005             return true;
38006           }
38007           return false;
38008         })) {
38009           continue;
38010         }
38011         if (token = this.tokenizer.space(src)) {
38012           src = src.substring(token.raw.length);
38013           if (token.raw.length === 1 && tokens.length > 0) {
38014             tokens[tokens.length - 1].raw += "\n";
38015           } else {
38016             tokens.push(token);
38017           }
38018           continue;
38019         }
38020         if (token = this.tokenizer.code(src)) {
38021           src = src.substring(token.raw.length);
38022           lastToken = tokens[tokens.length - 1];
38023           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38024             lastToken.raw += "\n" + token.raw;
38025             lastToken.text += "\n" + token.text;
38026             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38027           } else {
38028             tokens.push(token);
38029           }
38030           continue;
38031         }
38032         if (token = this.tokenizer.fences(src)) {
38033           src = src.substring(token.raw.length);
38034           tokens.push(token);
38035           continue;
38036         }
38037         if (token = this.tokenizer.heading(src)) {
38038           src = src.substring(token.raw.length);
38039           tokens.push(token);
38040           continue;
38041         }
38042         if (token = this.tokenizer.hr(src)) {
38043           src = src.substring(token.raw.length);
38044           tokens.push(token);
38045           continue;
38046         }
38047         if (token = this.tokenizer.blockquote(src)) {
38048           src = src.substring(token.raw.length);
38049           tokens.push(token);
38050           continue;
38051         }
38052         if (token = this.tokenizer.list(src)) {
38053           src = src.substring(token.raw.length);
38054           tokens.push(token);
38055           continue;
38056         }
38057         if (token = this.tokenizer.html(src)) {
38058           src = src.substring(token.raw.length);
38059           tokens.push(token);
38060           continue;
38061         }
38062         if (token = this.tokenizer.def(src)) {
38063           src = src.substring(token.raw.length);
38064           lastToken = tokens[tokens.length - 1];
38065           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38066             lastToken.raw += "\n" + token.raw;
38067             lastToken.text += "\n" + token.raw;
38068             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38069           } else if (!this.tokens.links[token.tag]) {
38070             this.tokens.links[token.tag] = {
38071               href: token.href,
38072               title: token.title
38073             };
38074           }
38075           continue;
38076         }
38077         if (token = this.tokenizer.table(src)) {
38078           src = src.substring(token.raw.length);
38079           tokens.push(token);
38080           continue;
38081         }
38082         if (token = this.tokenizer.lheading(src)) {
38083           src = src.substring(token.raw.length);
38084           tokens.push(token);
38085           continue;
38086         }
38087         cutSrc = src;
38088         if (this.options.extensions && this.options.extensions.startBlock) {
38089           let startIndex = Infinity;
38090           const tempSrc = src.slice(1);
38091           let tempStart;
38092           this.options.extensions.startBlock.forEach((getStartIndex) => {
38093             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38094             if (typeof tempStart === "number" && tempStart >= 0) {
38095               startIndex = Math.min(startIndex, tempStart);
38096             }
38097           });
38098           if (startIndex < Infinity && startIndex >= 0) {
38099             cutSrc = src.substring(0, startIndex + 1);
38100           }
38101         }
38102         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
38103           lastToken = tokens[tokens.length - 1];
38104           if (lastParagraphClipped && lastToken.type === "paragraph") {
38105             lastToken.raw += "\n" + token.raw;
38106             lastToken.text += "\n" + token.text;
38107             this.inlineQueue.pop();
38108             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38109           } else {
38110             tokens.push(token);
38111           }
38112           lastParagraphClipped = cutSrc.length !== src.length;
38113           src = src.substring(token.raw.length);
38114           continue;
38115         }
38116         if (token = this.tokenizer.text(src)) {
38117           src = src.substring(token.raw.length);
38118           lastToken = tokens[tokens.length - 1];
38119           if (lastToken && lastToken.type === "text") {
38120             lastToken.raw += "\n" + token.raw;
38121             lastToken.text += "\n" + token.text;
38122             this.inlineQueue.pop();
38123             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38124           } else {
38125             tokens.push(token);
38126           }
38127           continue;
38128         }
38129         if (src) {
38130           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38131           if (this.options.silent) {
38132             console.error(errMsg);
38133             break;
38134           } else {
38135             throw new Error(errMsg);
38136           }
38137         }
38138       }
38139       this.state.top = true;
38140       return tokens;
38141     }
38142     inline(src, tokens = []) {
38143       this.inlineQueue.push({ src, tokens });
38144       return tokens;
38145     }
38146     /**
38147      * Lexing/Compiling
38148      */
38149     inlineTokens(src, tokens = []) {
38150       let token, lastToken, cutSrc;
38151       let maskedSrc = src;
38152       let match;
38153       let keepPrevChar, prevChar;
38154       if (this.tokens.links) {
38155         const links = Object.keys(this.tokens.links);
38156         if (links.length > 0) {
38157           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
38158             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
38159               maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
38160             }
38161           }
38162         }
38163       }
38164       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
38165         maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
38166       }
38167       while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
38168         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
38169       }
38170       while (src) {
38171         if (!keepPrevChar) {
38172           prevChar = "";
38173         }
38174         keepPrevChar = false;
38175         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
38176           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38177             src = src.substring(token.raw.length);
38178             tokens.push(token);
38179             return true;
38180           }
38181           return false;
38182         })) {
38183           continue;
38184         }
38185         if (token = this.tokenizer.escape(src)) {
38186           src = src.substring(token.raw.length);
38187           tokens.push(token);
38188           continue;
38189         }
38190         if (token = this.tokenizer.tag(src)) {
38191           src = src.substring(token.raw.length);
38192           lastToken = tokens[tokens.length - 1];
38193           if (lastToken && token.type === "text" && lastToken.type === "text") {
38194             lastToken.raw += token.raw;
38195             lastToken.text += token.text;
38196           } else {
38197             tokens.push(token);
38198           }
38199           continue;
38200         }
38201         if (token = this.tokenizer.link(src)) {
38202           src = src.substring(token.raw.length);
38203           tokens.push(token);
38204           continue;
38205         }
38206         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
38207           src = src.substring(token.raw.length);
38208           lastToken = tokens[tokens.length - 1];
38209           if (lastToken && token.type === "text" && lastToken.type === "text") {
38210             lastToken.raw += token.raw;
38211             lastToken.text += token.text;
38212           } else {
38213             tokens.push(token);
38214           }
38215           continue;
38216         }
38217         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
38218           src = src.substring(token.raw.length);
38219           tokens.push(token);
38220           continue;
38221         }
38222         if (token = this.tokenizer.codespan(src)) {
38223           src = src.substring(token.raw.length);
38224           tokens.push(token);
38225           continue;
38226         }
38227         if (token = this.tokenizer.br(src)) {
38228           src = src.substring(token.raw.length);
38229           tokens.push(token);
38230           continue;
38231         }
38232         if (token = this.tokenizer.del(src)) {
38233           src = src.substring(token.raw.length);
38234           tokens.push(token);
38235           continue;
38236         }
38237         if (token = this.tokenizer.autolink(src, mangle)) {
38238           src = src.substring(token.raw.length);
38239           tokens.push(token);
38240           continue;
38241         }
38242         if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
38243           src = src.substring(token.raw.length);
38244           tokens.push(token);
38245           continue;
38246         }
38247         cutSrc = src;
38248         if (this.options.extensions && this.options.extensions.startInline) {
38249           let startIndex = Infinity;
38250           const tempSrc = src.slice(1);
38251           let tempStart;
38252           this.options.extensions.startInline.forEach((getStartIndex) => {
38253             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38254             if (typeof tempStart === "number" && tempStart >= 0) {
38255               startIndex = Math.min(startIndex, tempStart);
38256             }
38257           });
38258           if (startIndex < Infinity && startIndex >= 0) {
38259             cutSrc = src.substring(0, startIndex + 1);
38260           }
38261         }
38262         if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
38263           src = src.substring(token.raw.length);
38264           if (token.raw.slice(-1) !== "_") {
38265             prevChar = token.raw.slice(-1);
38266           }
38267           keepPrevChar = true;
38268           lastToken = tokens[tokens.length - 1];
38269           if (lastToken && lastToken.type === "text") {
38270             lastToken.raw += token.raw;
38271             lastToken.text += token.text;
38272           } else {
38273             tokens.push(token);
38274           }
38275           continue;
38276         }
38277         if (src) {
38278           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38279           if (this.options.silent) {
38280             console.error(errMsg);
38281             break;
38282           } else {
38283             throw new Error(errMsg);
38284           }
38285         }
38286       }
38287       return tokens;
38288     }
38289   };
38290   var _Renderer = class {
38291     options;
38292     constructor(options2) {
38293       this.options = options2 || _defaults;
38294     }
38295     code(code, infostring, escaped) {
38296       const lang = (infostring || "").match(/\S*/)[0];
38297       if (this.options.highlight) {
38298         const out = this.options.highlight(code, lang);
38299         if (out != null && out !== code) {
38300           escaped = true;
38301           code = out;
38302         }
38303       }
38304       code = code.replace(/\n$/, "") + "\n";
38305       if (!lang) {
38306         return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38307       }
38308       return '<pre><code class="' + this.options.langPrefix + escape4(lang) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38309     }
38310     blockquote(quote2) {
38311       return `<blockquote>
38312 ${quote2}</blockquote>
38313 `;
38314     }
38315     html(html2, block2) {
38316       return html2;
38317     }
38318     heading(text2, level, raw, slugger) {
38319       if (this.options.headerIds) {
38320         const id2 = this.options.headerPrefix + slugger.slug(raw);
38321         return `<h${level} id="${id2}">${text2}</h${level}>
38322 `;
38323       }
38324       return `<h${level}>${text2}</h${level}>
38325 `;
38326     }
38327     hr() {
38328       return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
38329     }
38330     list(body, ordered, start2) {
38331       const type2 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
38332       return "<" + type2 + startatt + ">\n" + body + "</" + type2 + ">\n";
38333     }
38334     listitem(text2, task, checked) {
38335       return `<li>${text2}</li>
38336 `;
38337     }
38338     checkbox(checked) {
38339       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
38340     }
38341     paragraph(text2) {
38342       return `<p>${text2}</p>
38343 `;
38344     }
38345     table(header, body) {
38346       if (body)
38347         body = `<tbody>${body}</tbody>`;
38348       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
38349     }
38350     tablerow(content) {
38351       return `<tr>
38352 ${content}</tr>
38353 `;
38354     }
38355     tablecell(content, flags) {
38356       const type2 = flags.header ? "th" : "td";
38357       const tag = flags.align ? `<${type2} align="${flags.align}">` : `<${type2}>`;
38358       return tag + content + `</${type2}>
38359 `;
38360     }
38361     /**
38362      * span level renderer
38363      */
38364     strong(text2) {
38365       return `<strong>${text2}</strong>`;
38366     }
38367     em(text2) {
38368       return `<em>${text2}</em>`;
38369     }
38370     codespan(text2) {
38371       return `<code>${text2}</code>`;
38372     }
38373     br() {
38374       return this.options.xhtml ? "<br/>" : "<br>";
38375     }
38376     del(text2) {
38377       return `<del>${text2}</del>`;
38378     }
38379     link(href, title, text2) {
38380       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38381       if (href === null) {
38382         return text2;
38383       }
38384       let out = '<a href="' + href + '"';
38385       if (title) {
38386         out += ' title="' + title + '"';
38387       }
38388       out += ">" + text2 + "</a>";
38389       return out;
38390     }
38391     image(href, title, text2) {
38392       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38393       if (href === null) {
38394         return text2;
38395       }
38396       let out = `<img src="${href}" alt="${text2}"`;
38397       if (title) {
38398         out += ` title="${title}"`;
38399       }
38400       out += this.options.xhtml ? "/>" : ">";
38401       return out;
38402     }
38403     text(text2) {
38404       return text2;
38405     }
38406   };
38407   var _TextRenderer = class {
38408     // no need for block level renderers
38409     strong(text2) {
38410       return text2;
38411     }
38412     em(text2) {
38413       return text2;
38414     }
38415     codespan(text2) {
38416       return text2;
38417     }
38418     del(text2) {
38419       return text2;
38420     }
38421     html(text2) {
38422       return text2;
38423     }
38424     text(text2) {
38425       return text2;
38426     }
38427     link(href, title, text2) {
38428       return "" + text2;
38429     }
38430     image(href, title, text2) {
38431       return "" + text2;
38432     }
38433     br() {
38434       return "";
38435     }
38436   };
38437   var _Slugger = class {
38438     seen;
38439     constructor() {
38440       this.seen = {};
38441     }
38442     serialize(value) {
38443       return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
38444     }
38445     /**
38446      * Finds the next safe (unique) slug to use
38447      */
38448     getNextSafeSlug(originalSlug, isDryRun) {
38449       let slug = originalSlug;
38450       let occurenceAccumulator = 0;
38451       if (this.seen.hasOwnProperty(slug)) {
38452         occurenceAccumulator = this.seen[originalSlug];
38453         do {
38454           occurenceAccumulator++;
38455           slug = originalSlug + "-" + occurenceAccumulator;
38456         } while (this.seen.hasOwnProperty(slug));
38457       }
38458       if (!isDryRun) {
38459         this.seen[originalSlug] = occurenceAccumulator;
38460         this.seen[slug] = 0;
38461       }
38462       return slug;
38463     }
38464     /**
38465      * Convert string to unique id
38466      */
38467     slug(value, options2 = {}) {
38468       const slug = this.serialize(value);
38469       return this.getNextSafeSlug(slug, options2.dryrun);
38470     }
38471   };
38472   var _Parser = class __Parser {
38473     options;
38474     renderer;
38475     textRenderer;
38476     slugger;
38477     constructor(options2) {
38478       this.options = options2 || _defaults;
38479       this.options.renderer = this.options.renderer || new _Renderer();
38480       this.renderer = this.options.renderer;
38481       this.renderer.options = this.options;
38482       this.textRenderer = new _TextRenderer();
38483       this.slugger = new _Slugger();
38484     }
38485     /**
38486      * Static Parse Method
38487      */
38488     static parse(tokens, options2) {
38489       const parser3 = new __Parser(options2);
38490       return parser3.parse(tokens);
38491     }
38492     /**
38493      * Static Parse Inline Method
38494      */
38495     static parseInline(tokens, options2) {
38496       const parser3 = new __Parser(options2);
38497       return parser3.parseInline(tokens);
38498     }
38499     /**
38500      * Parse Loop
38501      */
38502     parse(tokens, top = true) {
38503       let out = "", i3, j3, k2, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
38504       const l4 = tokens.length;
38505       for (i3 = 0; i3 < l4; i3++) {
38506         token = tokens[i3];
38507         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38508           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38509           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
38510             out += ret || "";
38511             continue;
38512           }
38513         }
38514         switch (token.type) {
38515           case "space": {
38516             continue;
38517           }
38518           case "hr": {
38519             out += this.renderer.hr();
38520             continue;
38521           }
38522           case "heading": {
38523             out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape3(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
38524             continue;
38525           }
38526           case "code": {
38527             out += this.renderer.code(token.text, token.lang, !!token.escaped);
38528             continue;
38529           }
38530           case "table": {
38531             header = "";
38532             cell = "";
38533             l2 = token.header.length;
38534             for (j3 = 0; j3 < l2; j3++) {
38535               cell += this.renderer.tablecell(this.parseInline(token.header[j3].tokens), { header: true, align: token.align[j3] });
38536             }
38537             header += this.renderer.tablerow(cell);
38538             body = "";
38539             l2 = token.rows.length;
38540             for (j3 = 0; j3 < l2; j3++) {
38541               row = token.rows[j3];
38542               cell = "";
38543               l3 = row.length;
38544               for (k2 = 0; k2 < l3; k2++) {
38545                 cell += this.renderer.tablecell(this.parseInline(row[k2].tokens), { header: false, align: token.align[k2] });
38546               }
38547               body += this.renderer.tablerow(cell);
38548             }
38549             out += this.renderer.table(header, body);
38550             continue;
38551           }
38552           case "blockquote": {
38553             body = this.parse(token.tokens);
38554             out += this.renderer.blockquote(body);
38555             continue;
38556           }
38557           case "list": {
38558             ordered = token.ordered;
38559             start2 = token.start;
38560             loose = token.loose;
38561             l2 = token.items.length;
38562             body = "";
38563             for (j3 = 0; j3 < l2; j3++) {
38564               item = token.items[j3];
38565               checked = item.checked;
38566               task = item.task;
38567               itemBody = "";
38568               if (item.task) {
38569                 checkbox = this.renderer.checkbox(!!checked);
38570                 if (loose) {
38571                   if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
38572                     item.tokens[0].text = checkbox + " " + item.tokens[0].text;
38573                     if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
38574                       item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
38575                     }
38576                   } else {
38577                     item.tokens.unshift({
38578                       type: "text",
38579                       text: checkbox
38580                     });
38581                   }
38582                 } else {
38583                   itemBody += checkbox;
38584                 }
38585               }
38586               itemBody += this.parse(item.tokens, loose);
38587               body += this.renderer.listitem(itemBody, task, !!checked);
38588             }
38589             out += this.renderer.list(body, ordered, start2);
38590             continue;
38591           }
38592           case "html": {
38593             out += this.renderer.html(token.text, token.block);
38594             continue;
38595           }
38596           case "paragraph": {
38597             out += this.renderer.paragraph(this.parseInline(token.tokens));
38598             continue;
38599           }
38600           case "text": {
38601             body = token.tokens ? this.parseInline(token.tokens) : token.text;
38602             while (i3 + 1 < l4 && tokens[i3 + 1].type === "text") {
38603               token = tokens[++i3];
38604               body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
38605             }
38606             out += top ? this.renderer.paragraph(body) : body;
38607             continue;
38608           }
38609           default: {
38610             const errMsg = 'Token with "' + token.type + '" type was not found.';
38611             if (this.options.silent) {
38612               console.error(errMsg);
38613               return "";
38614             } else {
38615               throw new Error(errMsg);
38616             }
38617           }
38618         }
38619       }
38620       return out;
38621     }
38622     /**
38623      * Parse Inline Tokens
38624      */
38625     parseInline(tokens, renderer) {
38626       renderer = renderer || this.renderer;
38627       let out = "", i3, token, ret;
38628       const l2 = tokens.length;
38629       for (i3 = 0; i3 < l2; i3++) {
38630         token = tokens[i3];
38631         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38632           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38633           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
38634             out += ret || "";
38635             continue;
38636           }
38637         }
38638         switch (token.type) {
38639           case "escape": {
38640             out += renderer.text(token.text);
38641             break;
38642           }
38643           case "html": {
38644             out += renderer.html(token.text);
38645             break;
38646           }
38647           case "link": {
38648             out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
38649             break;
38650           }
38651           case "image": {
38652             out += renderer.image(token.href, token.title, token.text);
38653             break;
38654           }
38655           case "strong": {
38656             out += renderer.strong(this.parseInline(token.tokens, renderer));
38657             break;
38658           }
38659           case "em": {
38660             out += renderer.em(this.parseInline(token.tokens, renderer));
38661             break;
38662           }
38663           case "codespan": {
38664             out += renderer.codespan(token.text);
38665             break;
38666           }
38667           case "br": {
38668             out += renderer.br();
38669             break;
38670           }
38671           case "del": {
38672             out += renderer.del(this.parseInline(token.tokens, renderer));
38673             break;
38674           }
38675           case "text": {
38676             out += renderer.text(token.text);
38677             break;
38678           }
38679           default: {
38680             const errMsg = 'Token with "' + token.type + '" type was not found.';
38681             if (this.options.silent) {
38682               console.error(errMsg);
38683               return "";
38684             } else {
38685               throw new Error(errMsg);
38686             }
38687           }
38688         }
38689       }
38690       return out;
38691     }
38692   };
38693   var _Hooks = class {
38694     options;
38695     constructor(options2) {
38696       this.options = options2 || _defaults;
38697     }
38698     static passThroughHooks = /* @__PURE__ */ new Set([
38699       "preprocess",
38700       "postprocess"
38701     ]);
38702     /**
38703      * Process markdown before marked
38704      */
38705     preprocess(markdown) {
38706       return markdown;
38707     }
38708     /**
38709      * Process HTML after marked is finished
38710      */
38711     postprocess(html2) {
38712       return html2;
38713     }
38714   };
38715   var Marked = class {
38716     defaults = _getDefaults();
38717     options = this.setOptions;
38718     parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);
38719     parseInline = this.#parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
38720     Parser = _Parser;
38721     parser = _Parser.parse;
38722     Renderer = _Renderer;
38723     TextRenderer = _TextRenderer;
38724     Lexer = _Lexer;
38725     lexer = _Lexer.lex;
38726     Tokenizer = _Tokenizer;
38727     Slugger = _Slugger;
38728     Hooks = _Hooks;
38729     constructor(...args) {
38730       this.use(...args);
38731     }
38732     /**
38733      * Run callback for every token
38734      */
38735     walkTokens(tokens, callback) {
38736       let values = [];
38737       for (const token of tokens) {
38738         values = values.concat(callback.call(this, token));
38739         switch (token.type) {
38740           case "table": {
38741             for (const cell of token.header) {
38742               values = values.concat(this.walkTokens(cell.tokens, callback));
38743             }
38744             for (const row of token.rows) {
38745               for (const cell of row) {
38746                 values = values.concat(this.walkTokens(cell.tokens, callback));
38747               }
38748             }
38749             break;
38750           }
38751           case "list": {
38752             values = values.concat(this.walkTokens(token.items, callback));
38753             break;
38754           }
38755           default: {
38756             if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) {
38757               this.defaults.extensions.childTokens[token.type].forEach((childTokens) => {
38758                 values = values.concat(this.walkTokens(token[childTokens], callback));
38759               });
38760             } else if (token.tokens) {
38761               values = values.concat(this.walkTokens(token.tokens, callback));
38762             }
38763           }
38764         }
38765       }
38766       return values;
38767     }
38768     use(...args) {
38769       const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
38770       args.forEach((pack) => {
38771         const opts = { ...pack };
38772         opts.async = this.defaults.async || opts.async || false;
38773         if (pack.extensions) {
38774           pack.extensions.forEach((ext) => {
38775             if (!ext.name) {
38776               throw new Error("extension name required");
38777             }
38778             if ("renderer" in ext) {
38779               const prevRenderer = extensions.renderers[ext.name];
38780               if (prevRenderer) {
38781                 extensions.renderers[ext.name] = function(...args2) {
38782                   let ret = ext.renderer.apply(this, args2);
38783                   if (ret === false) {
38784                     ret = prevRenderer.apply(this, args2);
38785                   }
38786                   return ret;
38787                 };
38788               } else {
38789                 extensions.renderers[ext.name] = ext.renderer;
38790               }
38791             }
38792             if ("tokenizer" in ext) {
38793               if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
38794                 throw new Error("extension level must be 'block' or 'inline'");
38795               }
38796               if (extensions[ext.level]) {
38797                 extensions[ext.level].unshift(ext.tokenizer);
38798               } else {
38799                 extensions[ext.level] = [ext.tokenizer];
38800               }
38801               if (ext.start) {
38802                 if (ext.level === "block") {
38803                   if (extensions.startBlock) {
38804                     extensions.startBlock.push(ext.start);
38805                   } else {
38806                     extensions.startBlock = [ext.start];
38807                   }
38808                 } else if (ext.level === "inline") {
38809                   if (extensions.startInline) {
38810                     extensions.startInline.push(ext.start);
38811                   } else {
38812                     extensions.startInline = [ext.start];
38813                   }
38814                 }
38815               }
38816             }
38817             if ("childTokens" in ext && ext.childTokens) {
38818               extensions.childTokens[ext.name] = ext.childTokens;
38819             }
38820           });
38821           opts.extensions = extensions;
38822         }
38823         if (pack.renderer) {
38824           const renderer = this.defaults.renderer || new _Renderer(this.defaults);
38825           for (const prop in pack.renderer) {
38826             const rendererFunc = pack.renderer[prop];
38827             const rendererKey = prop;
38828             const prevRenderer = renderer[rendererKey];
38829             renderer[rendererKey] = (...args2) => {
38830               let ret = rendererFunc.apply(renderer, args2);
38831               if (ret === false) {
38832                 ret = prevRenderer.apply(renderer, args2);
38833               }
38834               return ret || "";
38835             };
38836           }
38837           opts.renderer = renderer;
38838         }
38839         if (pack.tokenizer) {
38840           const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
38841           for (const prop in pack.tokenizer) {
38842             const tokenizerFunc = pack.tokenizer[prop];
38843             const tokenizerKey = prop;
38844             const prevTokenizer = tokenizer[tokenizerKey];
38845             tokenizer[tokenizerKey] = (...args2) => {
38846               let ret = tokenizerFunc.apply(tokenizer, args2);
38847               if (ret === false) {
38848                 ret = prevTokenizer.apply(tokenizer, args2);
38849               }
38850               return ret;
38851             };
38852           }
38853           opts.tokenizer = tokenizer;
38854         }
38855         if (pack.hooks) {
38856           const hooks = this.defaults.hooks || new _Hooks();
38857           for (const prop in pack.hooks) {
38858             const hooksFunc = pack.hooks[prop];
38859             const hooksKey = prop;
38860             const prevHook = hooks[hooksKey];
38861             if (_Hooks.passThroughHooks.has(prop)) {
38862               hooks[hooksKey] = (arg) => {
38863                 if (this.defaults.async) {
38864                   return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
38865                     return prevHook.call(hooks, ret2);
38866                   });
38867                 }
38868                 const ret = hooksFunc.call(hooks, arg);
38869                 return prevHook.call(hooks, ret);
38870               };
38871             } else {
38872               hooks[hooksKey] = (...args2) => {
38873                 let ret = hooksFunc.apply(hooks, args2);
38874                 if (ret === false) {
38875                   ret = prevHook.apply(hooks, args2);
38876                 }
38877                 return ret;
38878               };
38879             }
38880           }
38881           opts.hooks = hooks;
38882         }
38883         if (pack.walkTokens) {
38884           const walkTokens2 = this.defaults.walkTokens;
38885           opts.walkTokens = function(token) {
38886             let values = [];
38887             values.push(pack.walkTokens.call(this, token));
38888             if (walkTokens2) {
38889               values = values.concat(walkTokens2.call(this, token));
38890             }
38891             return values;
38892           };
38893         }
38894         this.defaults = { ...this.defaults, ...opts };
38895       });
38896       return this;
38897     }
38898     setOptions(opt) {
38899       this.defaults = { ...this.defaults, ...opt };
38900       return this;
38901     }
38902     #parseMarkdown(lexer2, parser3) {
38903       return (src, optOrCallback, callback) => {
38904         if (typeof optOrCallback === "function") {
38905           callback = optOrCallback;
38906           optOrCallback = null;
38907         }
38908         const origOpt = { ...optOrCallback };
38909         const opt = { ...this.defaults, ...origOpt };
38910         const throwError = this.#onError(!!opt.silent, !!opt.async, callback);
38911         if (typeof src === "undefined" || src === null) {
38912           return throwError(new Error("marked(): input parameter is undefined or null"));
38913         }
38914         if (typeof src !== "string") {
38915           return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
38916         }
38917         checkDeprecations(opt, callback);
38918         if (opt.hooks) {
38919           opt.hooks.options = opt;
38920         }
38921         if (callback) {
38922           const highlight = opt.highlight;
38923           let tokens;
38924           try {
38925             if (opt.hooks) {
38926               src = opt.hooks.preprocess(src);
38927             }
38928             tokens = lexer2(src, opt);
38929           } catch (e3) {
38930             return throwError(e3);
38931           }
38932           const done = (err) => {
38933             let out;
38934             if (!err) {
38935               try {
38936                 if (opt.walkTokens) {
38937                   this.walkTokens(tokens, opt.walkTokens);
38938                 }
38939                 out = parser3(tokens, opt);
38940                 if (opt.hooks) {
38941                   out = opt.hooks.postprocess(out);
38942                 }
38943               } catch (e3) {
38944                 err = e3;
38945               }
38946             }
38947             opt.highlight = highlight;
38948             return err ? throwError(err) : callback(null, out);
38949           };
38950           if (!highlight || highlight.length < 3) {
38951             return done();
38952           }
38953           delete opt.highlight;
38954           if (!tokens.length)
38955             return done();
38956           let pending = 0;
38957           this.walkTokens(tokens, (token) => {
38958             if (token.type === "code") {
38959               pending++;
38960               setTimeout(() => {
38961                 highlight(token.text, token.lang, (err, code) => {
38962                   if (err) {
38963                     return done(err);
38964                   }
38965                   if (code != null && code !== token.text) {
38966                     token.text = code;
38967                     token.escaped = true;
38968                   }
38969                   pending--;
38970                   if (pending === 0) {
38971                     done();
38972                   }
38973                 });
38974               }, 0);
38975             }
38976           });
38977           if (pending === 0) {
38978             done();
38979           }
38980           return;
38981         }
38982         if (opt.async) {
38983           return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
38984         }
38985         try {
38986           if (opt.hooks) {
38987             src = opt.hooks.preprocess(src);
38988           }
38989           const tokens = lexer2(src, opt);
38990           if (opt.walkTokens) {
38991             this.walkTokens(tokens, opt.walkTokens);
38992           }
38993           let html2 = parser3(tokens, opt);
38994           if (opt.hooks) {
38995             html2 = opt.hooks.postprocess(html2);
38996           }
38997           return html2;
38998         } catch (e3) {
38999           return throwError(e3);
39000         }
39001       };
39002     }
39003     #onError(silent, async, callback) {
39004       return (e3) => {
39005         e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
39006         if (silent) {
39007           const msg = "<p>An error occurred:</p><pre>" + escape4(e3.message + "", true) + "</pre>";
39008           if (async) {
39009             return Promise.resolve(msg);
39010           }
39011           if (callback) {
39012             callback(null, msg);
39013             return;
39014           }
39015           return msg;
39016         }
39017         if (async) {
39018           return Promise.reject(e3);
39019         }
39020         if (callback) {
39021           callback(e3);
39022           return;
39023         }
39024         throw e3;
39025       };
39026     }
39027   };
39028   var markedInstance = new Marked();
39029   function marked(src, opt, callback) {
39030     return markedInstance.parse(src, opt, callback);
39031   }
39032   marked.options = marked.setOptions = function(options2) {
39033     markedInstance.setOptions(options2);
39034     marked.defaults = markedInstance.defaults;
39035     changeDefaults(marked.defaults);
39036     return marked;
39037   };
39038   marked.getDefaults = _getDefaults;
39039   marked.defaults = _defaults;
39040   marked.use = function(...args) {
39041     markedInstance.use(...args);
39042     marked.defaults = markedInstance.defaults;
39043     changeDefaults(marked.defaults);
39044     return marked;
39045   };
39046   marked.walkTokens = function(tokens, callback) {
39047     return markedInstance.walkTokens(tokens, callback);
39048   };
39049   marked.parseInline = markedInstance.parseInline;
39050   marked.Parser = _Parser;
39051   marked.parser = _Parser.parse;
39052   marked.Renderer = _Renderer;
39053   marked.TextRenderer = _TextRenderer;
39054   marked.Lexer = _Lexer;
39055   marked.lexer = _Lexer.lex;
39056   marked.Tokenizer = _Tokenizer;
39057   marked.Slugger = _Slugger;
39058   marked.Hooks = _Hooks;
39059   marked.parse = marked;
39060   var options = marked.options;
39061   var setOptions = marked.setOptions;
39062   var use = marked.use;
39063   var walkTokens = marked.walkTokens;
39064   var parseInline = marked.parseInline;
39065   var parser2 = _Parser.parse;
39066   var lexer = _Lexer.lex;
39067
39068   // modules/services/osmose.js
39069   var tiler3 = utilTiler();
39070   var dispatch4 = dispatch_default("loaded");
39071   var _tileZoom3 = 14;
39072   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39073   var _osmoseData = { icons: {}, items: [] };
39074   var _cache3;
39075   function abortRequest3(controller) {
39076     if (controller) {
39077       controller.abort();
39078     }
39079   }
39080   function abortUnwantedRequests3(cache, tiles) {
39081     Object.keys(cache.inflightTile).forEach((k2) => {
39082       let wanted = tiles.find((tile) => k2 === tile.id);
39083       if (!wanted) {
39084         abortRequest3(cache.inflightTile[k2]);
39085         delete cache.inflightTile[k2];
39086       }
39087     });
39088   }
39089   function encodeIssueRtree3(d2) {
39090     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39091   }
39092   function updateRtree3(item, replace) {
39093     _cache3.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39094     if (replace) {
39095       _cache3.rtree.insert(item);
39096     }
39097   }
39098   function preventCoincident2(loc) {
39099     let coincident = false;
39100     do {
39101       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39102       loc = geoVecAdd(loc, delta);
39103       let bbox2 = geoExtent(loc).bbox();
39104       coincident = _cache3.rtree.search(bbox2).length;
39105     } while (coincident);
39106     return loc;
39107   }
39108   var osmose_default = {
39109     title: "osmose",
39110     init() {
39111       _mainFileFetcher.get("qa_data").then((d2) => {
39112         _osmoseData = d2.osmose;
39113         _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39114       });
39115       if (!_cache3) {
39116         this.reset();
39117       }
39118       this.event = utilRebind(this, dispatch4, "on");
39119     },
39120     reset() {
39121       let _strings = {};
39122       let _colors = {};
39123       if (_cache3) {
39124         Object.values(_cache3.inflightTile).forEach(abortRequest3);
39125         _strings = _cache3.strings;
39126         _colors = _cache3.colors;
39127       }
39128       _cache3 = {
39129         data: {},
39130         loadedTile: {},
39131         inflightTile: {},
39132         inflightPost: {},
39133         closed: {},
39134         rtree: new import_rbush3.default(),
39135         strings: _strings,
39136         colors: _colors
39137       };
39138     },
39139     loadIssues(projection2) {
39140       let params = {
39141         // Tiles return a maximum # of issues
39142         // So we want to filter our request for only types iD supports
39143         item: _osmoseData.items
39144       };
39145       let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
39146       abortUnwantedRequests3(_cache3, tiles);
39147       tiles.forEach((tile) => {
39148         if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
39149           return;
39150         let [x2, y2, z2] = tile.xyz;
39151         let url = `${_osmoseUrlRoot}/issues/${z2}/${x2}/${y2}.geojson?` + utilQsString(params);
39152         let controller = new AbortController();
39153         _cache3.inflightTile[tile.id] = controller;
39154         json_default(url, { signal: controller.signal }).then((data) => {
39155           delete _cache3.inflightTile[tile.id];
39156           _cache3.loadedTile[tile.id] = true;
39157           if (data.features) {
39158             data.features.forEach((issue) => {
39159               const { item, class: cl, uuid: id2 } = issue.properties;
39160               const itemType = `${item}-${cl}`;
39161               if (itemType in _osmoseData.icons) {
39162                 let loc = issue.geometry.coordinates;
39163                 loc = preventCoincident2(loc);
39164                 let d2 = new QAItem(loc, this, itemType, id2, { item });
39165                 if (item === 8300 || item === 8360) {
39166                   d2.elems = [];
39167                 }
39168                 _cache3.data[d2.id] = d2;
39169                 _cache3.rtree.insert(encodeIssueRtree3(d2));
39170               }
39171             });
39172           }
39173           dispatch4.call("loaded");
39174         }).catch(() => {
39175           delete _cache3.inflightTile[tile.id];
39176           _cache3.loadedTile[tile.id] = true;
39177         });
39178       });
39179     },
39180     loadIssueDetail(issue) {
39181       if (issue.elems !== void 0) {
39182         return Promise.resolve(issue);
39183       }
39184       const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
39185       const cacheDetails = (data) => {
39186         issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
39187         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
39188         this.replaceItem(issue);
39189       };
39190       return json_default(url).then(cacheDetails).then(() => issue);
39191     },
39192     loadStrings(locale2 = _mainLocalizer.localeCode()) {
39193       const items = Object.keys(_osmoseData.icons);
39194       if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
39195         return Promise.resolve(_cache3.strings[locale2]);
39196       }
39197       if (!(locale2 in _cache3.strings)) {
39198         _cache3.strings[locale2] = {};
39199       }
39200       const allRequests = items.map((itemType) => {
39201         if (itemType in _cache3.strings[locale2])
39202           return null;
39203         const cacheData = (data) => {
39204           const [cat = { items: [] }] = data.categories;
39205           const [item2 = { class: [] }] = cat.items;
39206           const [cl2 = null] = item2.class;
39207           if (!cl2) {
39208             console.log(`Osmose strings request (${itemType}) had unexpected data`);
39209             return;
39210           }
39211           const { item: itemInt, color: color2 } = item2;
39212           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
39213             _cache3.colors[itemInt] = color2;
39214           }
39215           const { title, detail, fix, trap } = cl2;
39216           let issueStrings = {};
39217           if (title)
39218             issueStrings.title = title.auto;
39219           if (detail)
39220             issueStrings.detail = marked(detail.auto);
39221           if (trap)
39222             issueStrings.trap = marked(trap.auto);
39223           if (fix)
39224             issueStrings.fix = marked(fix.auto);
39225           _cache3.strings[locale2][itemType] = issueStrings;
39226         };
39227         const [item, cl] = itemType.split("-");
39228         const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
39229         return json_default(url).then(cacheData);
39230       }).filter(Boolean);
39231       return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
39232     },
39233     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
39234       return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
39235     },
39236     getColor(itemType) {
39237       return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
39238     },
39239     postUpdate(issue, callback) {
39240       if (_cache3.inflightPost[issue.id]) {
39241         return callback({ message: "Issue update already inflight", status: -2 }, issue);
39242       }
39243       const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
39244       const controller = new AbortController();
39245       const after = () => {
39246         delete _cache3.inflightPost[issue.id];
39247         this.removeItem(issue);
39248         if (issue.newStatus === "done") {
39249           if (!(issue.item in _cache3.closed)) {
39250             _cache3.closed[issue.item] = 0;
39251           }
39252           _cache3.closed[issue.item] += 1;
39253         }
39254         if (callback)
39255           callback(null, issue);
39256       };
39257       _cache3.inflightPost[issue.id] = controller;
39258       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
39259         delete _cache3.inflightPost[issue.id];
39260         if (callback)
39261           callback(err.message);
39262       });
39263     },
39264     // Get all cached QAItems covering the viewport
39265     getItems(projection2) {
39266       const viewport = projection2.clipExtent();
39267       const min3 = [viewport[0][0], viewport[1][1]];
39268       const max3 = [viewport[1][0], viewport[0][1]];
39269       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39270       return _cache3.rtree.search(bbox2).map((d2) => d2.data);
39271     },
39272     // Get a QAItem from cache
39273     // NOTE: Don't change method name until UI v3 is merged
39274     getError(id2) {
39275       return _cache3.data[id2];
39276     },
39277     // get the name of the icon to display for this item
39278     getIcon(itemType) {
39279       return _osmoseData.icons[itemType];
39280     },
39281     // Replace a single QAItem in the cache
39282     replaceItem(item) {
39283       if (!(item instanceof QAItem) || !item.id)
39284         return;
39285       _cache3.data[item.id] = item;
39286       updateRtree3(encodeIssueRtree3(item), true);
39287       return item;
39288     },
39289     // Remove a single QAItem from the cache
39290     removeItem(item) {
39291       if (!(item instanceof QAItem) || !item.id)
39292         return;
39293       delete _cache3.data[item.id];
39294       updateRtree3(encodeIssueRtree3(item), false);
39295     },
39296     // Used to populate `closed:osmose:*` changeset tags
39297     getClosedCounts() {
39298       return _cache3.closed;
39299     },
39300     itemURL(item) {
39301       return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
39302     }
39303   };
39304
39305   // modules/services/mapillary.js
39306   var import_pbf = __toESM(require_pbf());
39307   var import_rbush4 = __toESM(require_rbush_min());
39308   var import_vector_tile = __toESM(require_vector_tile());
39309   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
39310   var apiUrl = "https://graph.mapillary.com/";
39311   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
39312   var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
39313   var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
39314   var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
39315   var viewercss = "mapillary-js/mapillary.css";
39316   var viewerjs = "mapillary-js/mapillary.js";
39317   var minZoom = 14;
39318   var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
39319   var _loadViewerPromise;
39320   var _mlyActiveImage;
39321   var _mlyCache;
39322   var _mlyFallback = false;
39323   var _mlyHighlightedDetection;
39324   var _mlyShowFeatureDetections = false;
39325   var _mlyShowSignDetections = false;
39326   var _mlyViewer;
39327   var _mlyViewerFilter = ["all"];
39328   function loadTiles(which, url, maxZoom2, projection2) {
39329     const tiler9 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
39330     const tiles = tiler9.getTiles(projection2);
39331     tiles.forEach(function(tile) {
39332       loadTile(which, url, tile);
39333     });
39334   }
39335   function loadTile(which, url, tile) {
39336     const cache = _mlyCache.requests;
39337     const tileId = `${tile.id}-${which}`;
39338     if (cache.loaded[tileId] || cache.inflight[tileId])
39339       return;
39340     const controller = new AbortController();
39341     cache.inflight[tileId] = controller;
39342     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
39343     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
39344       if (!response.ok) {
39345         throw new Error(response.status + " " + response.statusText);
39346       }
39347       cache.loaded[tileId] = true;
39348       delete cache.inflight[tileId];
39349       return response.arrayBuffer();
39350     }).then(function(data) {
39351       if (!data) {
39352         throw new Error("No Data");
39353       }
39354       loadTileDataToCache(data, tile, which);
39355       if (which === "images") {
39356         dispatch5.call("loadedImages");
39357       } else if (which === "signs") {
39358         dispatch5.call("loadedSigns");
39359       } else if (which === "points") {
39360         dispatch5.call("loadedMapFeatures");
39361       }
39362     }).catch(function() {
39363       cache.loaded[tileId] = true;
39364       delete cache.inflight[tileId];
39365     });
39366   }
39367   function loadTileDataToCache(data, tile, which) {
39368     const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
39369     let features, cache, layer, i3, feature3, loc, d2;
39370     if (vectorTile.layers.hasOwnProperty("image")) {
39371       features = [];
39372       cache = _mlyCache.images;
39373       layer = vectorTile.layers.image;
39374       for (i3 = 0; i3 < layer.length; i3++) {
39375         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39376         loc = feature3.geometry.coordinates;
39377         d2 = {
39378           loc,
39379           captured_at: feature3.properties.captured_at,
39380           ca: feature3.properties.compass_angle,
39381           id: feature3.properties.id,
39382           is_pano: feature3.properties.is_pano,
39383           sequence_id: feature3.properties.sequence_id
39384         };
39385         cache.forImageId[d2.id] = d2;
39386         features.push({
39387           minX: loc[0],
39388           minY: loc[1],
39389           maxX: loc[0],
39390           maxY: loc[1],
39391           data: d2
39392         });
39393       }
39394       if (cache.rtree) {
39395         cache.rtree.load(features);
39396       }
39397     }
39398     if (vectorTile.layers.hasOwnProperty("sequence")) {
39399       features = [];
39400       cache = _mlyCache.sequences;
39401       layer = vectorTile.layers.sequence;
39402       for (i3 = 0; i3 < layer.length; i3++) {
39403         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39404         if (cache.lineString[feature3.properties.id]) {
39405           cache.lineString[feature3.properties.id].push(feature3);
39406         } else {
39407           cache.lineString[feature3.properties.id] = [feature3];
39408         }
39409       }
39410     }
39411     if (vectorTile.layers.hasOwnProperty("point")) {
39412       features = [];
39413       cache = _mlyCache[which];
39414       layer = vectorTile.layers.point;
39415       for (i3 = 0; i3 < layer.length; i3++) {
39416         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39417         loc = feature3.geometry.coordinates;
39418         d2 = {
39419           loc,
39420           id: feature3.properties.id,
39421           first_seen_at: feature3.properties.first_seen_at,
39422           last_seen_at: feature3.properties.last_seen_at,
39423           value: feature3.properties.value
39424         };
39425         features.push({
39426           minX: loc[0],
39427           minY: loc[1],
39428           maxX: loc[0],
39429           maxY: loc[1],
39430           data: d2
39431         });
39432       }
39433       if (cache.rtree) {
39434         cache.rtree.load(features);
39435       }
39436     }
39437     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
39438       features = [];
39439       cache = _mlyCache[which];
39440       layer = vectorTile.layers.traffic_sign;
39441       for (i3 = 0; i3 < layer.length; i3++) {
39442         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39443         loc = feature3.geometry.coordinates;
39444         d2 = {
39445           loc,
39446           id: feature3.properties.id,
39447           first_seen_at: feature3.properties.first_seen_at,
39448           last_seen_at: feature3.properties.last_seen_at,
39449           value: feature3.properties.value
39450         };
39451         features.push({
39452           minX: loc[0],
39453           minY: loc[1],
39454           maxX: loc[0],
39455           maxY: loc[1],
39456           data: d2
39457         });
39458       }
39459       if (cache.rtree) {
39460         cache.rtree.load(features);
39461       }
39462     }
39463   }
39464   function loadData(url) {
39465     return fetch(url).then(function(response) {
39466       if (!response.ok) {
39467         throw new Error(response.status + " " + response.statusText);
39468       }
39469       return response.json();
39470     }).then(function(result) {
39471       if (!result) {
39472         return [];
39473       }
39474       return result.data || [];
39475     });
39476   }
39477   function partitionViewport(projection2) {
39478     const z2 = geoScaleToZoom(projection2.scale());
39479     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
39480     const tiler9 = utilTiler().zoomExtent([z22, z22]);
39481     return tiler9.getTiles(projection2).map(function(tile) {
39482       return tile.extent;
39483     });
39484   }
39485   function searchLimited(limit, projection2, rtree) {
39486     limit = limit || 5;
39487     return partitionViewport(projection2).reduce(function(result, extent) {
39488       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
39489         return d2.data;
39490       });
39491       return found.length ? result.concat(found) : result;
39492     }, []);
39493   }
39494   var mapillary_default = {
39495     // Initialize Mapillary
39496     init: function() {
39497       if (!_mlyCache) {
39498         this.reset();
39499       }
39500       this.event = utilRebind(this, dispatch5, "on");
39501     },
39502     // Reset cache and state
39503     reset: function() {
39504       if (_mlyCache) {
39505         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
39506           request3.abort();
39507         });
39508       }
39509       _mlyCache = {
39510         images: { rtree: new import_rbush4.default(), forImageId: {} },
39511         image_detections: { forImageId: {} },
39512         signs: { rtree: new import_rbush4.default() },
39513         points: { rtree: new import_rbush4.default() },
39514         sequences: { rtree: new import_rbush4.default(), lineString: {} },
39515         requests: { loaded: {}, inflight: {} }
39516       };
39517       _mlyActiveImage = null;
39518     },
39519     // Get visible images
39520     images: function(projection2) {
39521       const limit = 5;
39522       return searchLimited(limit, projection2, _mlyCache.images.rtree);
39523     },
39524     // Get visible traffic signs
39525     signs: function(projection2) {
39526       const limit = 5;
39527       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
39528     },
39529     // Get visible map (point) features
39530     mapFeatures: function(projection2) {
39531       const limit = 5;
39532       return searchLimited(limit, projection2, _mlyCache.points.rtree);
39533     },
39534     // Get cached image by id
39535     cachedImage: function(imageId) {
39536       return _mlyCache.images.forImageId[imageId];
39537     },
39538     // Get visible sequences
39539     sequences: function(projection2) {
39540       const viewport = projection2.clipExtent();
39541       const min3 = [viewport[0][0], viewport[1][1]];
39542       const max3 = [viewport[1][0], viewport[0][1]];
39543       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39544       const sequenceIds = {};
39545       let lineStrings = [];
39546       _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
39547         if (d2.data.sequence_id) {
39548           sequenceIds[d2.data.sequence_id] = true;
39549         }
39550       });
39551       Object.keys(sequenceIds).forEach(function(sequenceId) {
39552         if (_mlyCache.sequences.lineString[sequenceId]) {
39553           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
39554         }
39555       });
39556       return lineStrings;
39557     },
39558     // Load images in the visible area
39559     loadImages: function(projection2) {
39560       loadTiles("images", tileUrl, 14, projection2);
39561     },
39562     // Load traffic signs in the visible area
39563     loadSigns: function(projection2) {
39564       loadTiles("signs", trafficSignTileUrl, 14, projection2);
39565     },
39566     // Load map (point) features in the visible area
39567     loadMapFeatures: function(projection2) {
39568       loadTiles("points", mapFeatureTileUrl, 14, projection2);
39569     },
39570     // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
39571     ensureViewerLoaded: function(context) {
39572       if (_loadViewerPromise)
39573         return _loadViewerPromise;
39574       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
39575       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
39576       const that = this;
39577       _loadViewerPromise = new Promise((resolve, reject) => {
39578         let loadedCount = 0;
39579         function loaded() {
39580           loadedCount += 1;
39581           if (loadedCount === 2)
39582             resolve();
39583         }
39584         const head = select_default2("head");
39585         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() {
39586           reject();
39587         });
39588         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() {
39589           reject();
39590         });
39591       }).catch(function() {
39592         _loadViewerPromise = null;
39593       }).then(function() {
39594         that.initViewer(context);
39595       });
39596       return _loadViewerPromise;
39597     },
39598     // Load traffic sign image sprites
39599     loadSignResources: function(context) {
39600       context.ui().svgDefs.addSprites(
39601         ["mapillary-sprite"],
39602         false
39603         /* don't override colors */
39604       );
39605       return this;
39606     },
39607     // Load map (point) feature image sprites
39608     loadObjectResources: function(context) {
39609       context.ui().svgDefs.addSprites(
39610         ["mapillary-object-sprite"],
39611         false
39612         /* don't override colors */
39613       );
39614       return this;
39615     },
39616     // Remove previous detections in image viewer
39617     resetTags: function() {
39618       if (_mlyViewer && !_mlyFallback) {
39619         _mlyViewer.getComponent("tag").removeAll();
39620       }
39621     },
39622     // Show map feature detections in image viewer
39623     showFeatureDetections: function(value) {
39624       _mlyShowFeatureDetections = value;
39625       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39626         this.resetTags();
39627       }
39628     },
39629     // Show traffic sign detections in image viewer
39630     showSignDetections: function(value) {
39631       _mlyShowSignDetections = value;
39632       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39633         this.resetTags();
39634       }
39635     },
39636     // Apply filter to image viewer
39637     filterViewer: function(context) {
39638       const showsPano = context.photos().showsPanoramic();
39639       const showsFlat = context.photos().showsFlat();
39640       const fromDate = context.photos().fromDate();
39641       const toDate = context.photos().toDate();
39642       const filter2 = ["all"];
39643       if (!showsPano)
39644         filter2.push(["!=", "cameraType", "spherical"]);
39645       if (!showsFlat && showsPano)
39646         filter2.push(["==", "pano", true]);
39647       if (fromDate) {
39648         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
39649       }
39650       if (toDate) {
39651         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
39652       }
39653       if (_mlyViewer) {
39654         _mlyViewer.setFilter(filter2);
39655       }
39656       _mlyViewerFilter = filter2;
39657       return filter2;
39658     },
39659     // Make the image viewer visible
39660     showViewer: function(context) {
39661       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
39662       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
39663       if (isHidden && _mlyViewer) {
39664         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
39665         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
39666         _mlyViewer.resize();
39667       }
39668       return this;
39669     },
39670     // Hide the image viewer and resets map markers
39671     hideViewer: function(context) {
39672       _mlyActiveImage = null;
39673       if (!_mlyFallback && _mlyViewer) {
39674         _mlyViewer.getComponent("sequence").stop();
39675       }
39676       const viewer = context.container().select(".photoviewer");
39677       if (!viewer.empty())
39678         viewer.datum(null);
39679       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
39680       this.updateUrlImage(null);
39681       dispatch5.call("imageChanged");
39682       dispatch5.call("loadedMapFeatures");
39683       dispatch5.call("loadedSigns");
39684       return this.setStyles(context, null);
39685     },
39686     // Update the URL with current image id
39687     updateUrlImage: function(imageId) {
39688       if (!window.mocha) {
39689         const hash = utilStringQs(window.location.hash);
39690         if (imageId) {
39691           hash.photo = "mapillary/" + imageId;
39692         } else {
39693           delete hash.photo;
39694         }
39695         window.location.replace("#" + utilQsString(hash, true));
39696       }
39697     },
39698     // Highlight the detection in the viewer that is related to the clicked map feature
39699     highlightDetection: function(detection) {
39700       if (detection) {
39701         _mlyHighlightedDetection = detection.id;
39702       }
39703       return this;
39704     },
39705     // Initialize image viewer (Mapillar JS)
39706     initViewer: function(context) {
39707       const that = this;
39708       if (!window.mapillary)
39709         return;
39710       const opts = {
39711         accessToken,
39712         component: {
39713           cover: false,
39714           keyboard: false,
39715           tag: true
39716         },
39717         container: "ideditor-mly"
39718       };
39719       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
39720         _mlyFallback = true;
39721         opts.component = {
39722           cover: false,
39723           direction: false,
39724           imagePlane: false,
39725           keyboard: false,
39726           mouse: false,
39727           sequence: false,
39728           tag: false,
39729           image: true,
39730           // fallback
39731           navigation: true
39732           // fallback
39733         };
39734       }
39735       _mlyViewer = new mapillary.Viewer(opts);
39736       _mlyViewer.on("image", imageChanged);
39737       _mlyViewer.on("bearing", bearingChanged);
39738       if (_mlyViewerFilter) {
39739         _mlyViewer.setFilter(_mlyViewerFilter);
39740       }
39741       context.ui().photoviewer.on("resize.mapillary", function() {
39742         if (_mlyViewer)
39743           _mlyViewer.resize();
39744       });
39745       function imageChanged(node) {
39746         that.resetTags();
39747         const image = node.image;
39748         that.setActiveImage(image);
39749         that.setStyles(context, null);
39750         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
39751         context.map().centerEase(loc);
39752         that.updateUrlImage(image.id);
39753         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
39754           that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
39755         }
39756         dispatch5.call("imageChanged");
39757       }
39758       function bearingChanged(e3) {
39759         dispatch5.call("bearingChanged", void 0, e3);
39760       }
39761     },
39762     // Move to an image
39763     selectImage: function(context, imageId) {
39764       if (_mlyViewer && imageId) {
39765         _mlyViewer.moveTo(imageId).catch(function(e3) {
39766           console.error("mly3", e3);
39767         });
39768       }
39769       return this;
39770     },
39771     // Return the currently displayed image
39772     getActiveImage: function() {
39773       return _mlyActiveImage;
39774     },
39775     // Return a list of detection objects for the given id
39776     getDetections: function(id2) {
39777       return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
39778     },
39779     // Set the currently visible image
39780     setActiveImage: function(image) {
39781       if (image) {
39782         _mlyActiveImage = {
39783           ca: image.originalCompassAngle,
39784           id: image.id,
39785           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
39786           is_pano: image.cameraType === "spherical",
39787           sequence_id: image.sequenceId
39788         };
39789       } else {
39790         _mlyActiveImage = null;
39791       }
39792     },
39793     // Update the currently highlighted sequence and selected bubble.
39794     setStyles: function(context, hovered) {
39795       const hoveredImageId = hovered && hovered.id;
39796       const hoveredSequenceId = hovered && hovered.sequence_id;
39797       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
39798       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
39799         return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
39800       }).classed("hovered", function(d2) {
39801         return d2.id === hoveredImageId;
39802       });
39803       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
39804         return d2.properties.id === hoveredSequenceId;
39805       }).classed("currentView", function(d2) {
39806         return d2.properties.id === selectedSequenceId;
39807       });
39808       return this;
39809     },
39810     // Get detections for the current image and shows them in the image viewer
39811     updateDetections: function(imageId, url) {
39812       if (!_mlyViewer || _mlyFallback)
39813         return;
39814       if (!imageId)
39815         return;
39816       const cache = _mlyCache.image_detections;
39817       if (cache.forImageId[imageId]) {
39818         showDetections(_mlyCache.image_detections.forImageId[imageId]);
39819       } else {
39820         loadData(url).then((detections) => {
39821           detections.forEach(function(detection) {
39822             if (!cache.forImageId[imageId]) {
39823               cache.forImageId[imageId] = [];
39824             }
39825             cache.forImageId[imageId].push({
39826               geometry: detection.geometry,
39827               id: detection.id,
39828               image_id: imageId,
39829               value: detection.value
39830             });
39831           });
39832           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
39833         });
39834       }
39835       function showDetections(detections) {
39836         const tagComponent = _mlyViewer.getComponent("tag");
39837         detections.forEach(function(data) {
39838           const tag = makeTag(data);
39839           if (tag) {
39840             tagComponent.add([tag]);
39841           }
39842         });
39843       }
39844       function makeTag(data) {
39845         const valueParts = data.value.split("--");
39846         if (!valueParts.length)
39847           return;
39848         let tag;
39849         let text2;
39850         let color2 = 16777215;
39851         if (_mlyHighlightedDetection === data.id) {
39852           color2 = 16776960;
39853           text2 = valueParts[1];
39854           if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
39855             text2 = valueParts[2];
39856           }
39857           text2 = text2.replace(/-/g, " ");
39858           text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
39859           _mlyHighlightedDetection = null;
39860         }
39861         var decodedGeometry = window.atob(data.geometry);
39862         var uintArray = new Uint8Array(decodedGeometry.length);
39863         for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
39864           uintArray[i3] = decodedGeometry.charCodeAt(i3);
39865         }
39866         const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
39867         const layer = tile.layers["mpy-or"];
39868         const geometries = layer.feature(0).loadGeometry();
39869         const polygon2 = geometries.map((ring) => ring.map((point2) => [point2.x / layer.extent, point2.y / layer.extent]));
39870         tag = new mapillary.OutlineTag(
39871           data.id,
39872           new mapillary.PolygonGeometry(polygon2[0]),
39873           {
39874             text: text2,
39875             textColor: color2,
39876             lineColor: color2,
39877             lineWidth: 2,
39878             fillColor: color2,
39879             fillOpacity: 0.3
39880           }
39881         );
39882         return tag;
39883       }
39884     },
39885     // Return the current cache
39886     cache: function() {
39887       return _mlyCache;
39888     }
39889   };
39890
39891   // modules/core/validation/models.js
39892   function validationIssue(attrs) {
39893     this.type = attrs.type;
39894     this.subtype = attrs.subtype;
39895     this.severity = attrs.severity;
39896     this.message = attrs.message;
39897     this.reference = attrs.reference;
39898     this.entityIds = attrs.entityIds;
39899     this.loc = attrs.loc;
39900     this.data = attrs.data;
39901     this.dynamicFixes = attrs.dynamicFixes;
39902     this.hash = attrs.hash;
39903     this.id = generateID.apply(this);
39904     this.key = generateKey.apply(this);
39905     this.autoFix = null;
39906     function generateID() {
39907       var parts = [this.type];
39908       if (this.hash) {
39909         parts.push(this.hash);
39910       }
39911       if (this.subtype) {
39912         parts.push(this.subtype);
39913       }
39914       if (this.entityIds) {
39915         var entityKeys = this.entityIds.slice().sort();
39916         parts.push.apply(parts, entityKeys);
39917       }
39918       return parts.join(":");
39919     }
39920     function generateKey() {
39921       return this.id + ":" + Date.now().toString();
39922     }
39923     this.extent = function(resolver) {
39924       if (this.loc) {
39925         return geoExtent(this.loc);
39926       }
39927       if (this.entityIds && this.entityIds.length) {
39928         return this.entityIds.reduce(function(extent, entityId) {
39929           return extent.extend(resolver.entity(entityId).extent(resolver));
39930         }, geoExtent());
39931       }
39932       return null;
39933     };
39934     this.fixes = function(context) {
39935       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
39936       var issue = this;
39937       if (issue.severity === "warning") {
39938         fixes.push(new validationIssueFix({
39939           title: _t.append("issues.fix.ignore_issue.title"),
39940           icon: "iD-icon-close",
39941           onClick: function() {
39942             context.validator().ignoreIssue(this.issue.id);
39943           }
39944         }));
39945       }
39946       fixes.forEach(function(fix) {
39947         fix.id = fix.title.stringId;
39948         fix.issue = issue;
39949         if (fix.autoArgs) {
39950           issue.autoFix = fix;
39951         }
39952       });
39953       return fixes;
39954     };
39955   }
39956   function validationIssueFix(attrs) {
39957     this.title = attrs.title;
39958     this.onClick = attrs.onClick;
39959     this.disabledReason = attrs.disabledReason;
39960     this.icon = attrs.icon;
39961     this.entityIds = attrs.entityIds || [];
39962     this.autoArgs = attrs.autoArgs;
39963     this.issue = null;
39964   }
39965
39966   // modules/services/maprules.js
39967   var buildRuleChecks = function() {
39968     return {
39969       equals: function(equals) {
39970         return function(tags) {
39971           return Object.keys(equals).every(function(k2) {
39972             return equals[k2] === tags[k2];
39973           });
39974         };
39975       },
39976       notEquals: function(notEquals) {
39977         return function(tags) {
39978           return Object.keys(notEquals).some(function(k2) {
39979             return notEquals[k2] !== tags[k2];
39980           });
39981         };
39982       },
39983       absence: function(absence) {
39984         return function(tags) {
39985           return Object.keys(tags).indexOf(absence) === -1;
39986         };
39987       },
39988       presence: function(presence) {
39989         return function(tags) {
39990           return Object.keys(tags).indexOf(presence) > -1;
39991         };
39992       },
39993       greaterThan: function(greaterThan) {
39994         var key = Object.keys(greaterThan)[0];
39995         var value = greaterThan[key];
39996         return function(tags) {
39997           return tags[key] > value;
39998         };
39999       },
40000       greaterThanEqual: function(greaterThanEqual) {
40001         var key = Object.keys(greaterThanEqual)[0];
40002         var value = greaterThanEqual[key];
40003         return function(tags) {
40004           return tags[key] >= value;
40005         };
40006       },
40007       lessThan: function(lessThan) {
40008         var key = Object.keys(lessThan)[0];
40009         var value = lessThan[key];
40010         return function(tags) {
40011           return tags[key] < value;
40012         };
40013       },
40014       lessThanEqual: function(lessThanEqual) {
40015         var key = Object.keys(lessThanEqual)[0];
40016         var value = lessThanEqual[key];
40017         return function(tags) {
40018           return tags[key] <= value;
40019         };
40020       },
40021       positiveRegex: function(positiveRegex) {
40022         var tagKey = Object.keys(positiveRegex)[0];
40023         var expression = positiveRegex[tagKey].join("|");
40024         var regex = new RegExp(expression);
40025         return function(tags) {
40026           return regex.test(tags[tagKey]);
40027         };
40028       },
40029       negativeRegex: function(negativeRegex) {
40030         var tagKey = Object.keys(negativeRegex)[0];
40031         var expression = negativeRegex[tagKey].join("|");
40032         var regex = new RegExp(expression);
40033         return function(tags) {
40034           return !regex.test(tags[tagKey]);
40035         };
40036       }
40037     };
40038   };
40039   var buildLineKeys = function() {
40040     return {
40041       highway: {
40042         rest_area: true,
40043         services: true
40044       },
40045       railway: {
40046         roundhouse: true,
40047         station: true,
40048         traverser: true,
40049         turntable: true,
40050         wash: true
40051       }
40052     };
40053   };
40054   var maprules_default = {
40055     init: function() {
40056       this._ruleChecks = buildRuleChecks();
40057       this._validationRules = [];
40058       this._areaKeys = osmAreaKeys;
40059       this._lineKeys = buildLineKeys();
40060     },
40061     // list of rules only relevant to tag checks...
40062     filterRuleChecks: function(selector) {
40063       var _ruleChecks = this._ruleChecks;
40064       return Object.keys(selector).reduce(function(rules, key) {
40065         if (["geometry", "error", "warning"].indexOf(key) === -1) {
40066           rules.push(_ruleChecks[key](selector[key]));
40067         }
40068         return rules;
40069       }, []);
40070     },
40071     // builds tagMap from mapcss-parse selector object...
40072     buildTagMap: function(selector) {
40073       var getRegexValues = function(regexes) {
40074         return regexes.map(function(regex) {
40075           return regex.replace(/\$|\^/g, "");
40076         });
40077       };
40078       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
40079         var values;
40080         var isRegex = /regex/gi.test(key);
40081         var isEqual4 = /equals/gi.test(key);
40082         if (isRegex || isEqual4) {
40083           Object.keys(selector[key]).forEach(function(selectorKey) {
40084             values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
40085             if (expectedTags.hasOwnProperty(selectorKey)) {
40086               values = values.concat(expectedTags[selectorKey]);
40087             }
40088             expectedTags[selectorKey] = values;
40089           });
40090         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
40091           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
40092           values = [selector[key][tagKey]];
40093           if (expectedTags.hasOwnProperty(tagKey)) {
40094             values = values.concat(expectedTags[tagKey]);
40095           }
40096           expectedTags[tagKey] = values;
40097         }
40098         return expectedTags;
40099       }, {});
40100       return tagMap;
40101     },
40102     // inspired by osmWay#isArea()
40103     inferGeometry: function(tagMap) {
40104       var _lineKeys = this._lineKeys;
40105       var _areaKeys = this._areaKeys;
40106       var keyValueDoesNotImplyArea = function(key2) {
40107         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
40108       };
40109       var keyValueImpliesLine = function(key2) {
40110         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
40111       };
40112       if (tagMap.hasOwnProperty("area")) {
40113         if (tagMap.area.indexOf("yes") > -1) {
40114           return "area";
40115         }
40116         if (tagMap.area.indexOf("no") > -1) {
40117           return "line";
40118         }
40119       }
40120       for (var key in tagMap) {
40121         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
40122           return "area";
40123         }
40124         if (key in _lineKeys && keyValueImpliesLine(key)) {
40125           return "area";
40126         }
40127       }
40128       return "line";
40129     },
40130     // adds from mapcss-parse selector check...
40131     addRule: function(selector) {
40132       var rule = {
40133         // checks relevant to mapcss-selector
40134         checks: this.filterRuleChecks(selector),
40135         // true if all conditions for a tag error are true..
40136         matches: function(entity) {
40137           return this.checks.every(function(check) {
40138             return check(entity.tags);
40139           });
40140         },
40141         // borrowed from Way#isArea()
40142         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
40143         geometryMatches: function(entity, graph) {
40144           if (entity.type === "node" || entity.type === "relation") {
40145             return selector.geometry === entity.type;
40146           } else if (entity.type === "way") {
40147             return this.inferredGeometry === entity.geometry(graph);
40148           }
40149         },
40150         // when geometries match and tag matches are present, return a warning...
40151         findIssues: function(entity, graph, issues) {
40152           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
40153             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
40154             var message = selector[severity];
40155             issues.push(new validationIssue({
40156               type: "maprules",
40157               severity,
40158               message: function() {
40159                 return message;
40160               },
40161               entityIds: [entity.id]
40162             }));
40163           }
40164         }
40165       };
40166       this._validationRules.push(rule);
40167     },
40168     clearRules: function() {
40169       this._validationRules = [];
40170     },
40171     // returns validationRules...
40172     validationRules: function() {
40173       return this._validationRules;
40174     },
40175     // returns ruleChecks
40176     ruleChecks: function() {
40177       return this._ruleChecks;
40178     }
40179   };
40180
40181   // modules/services/nominatim.js
40182   var import_rbush7 = __toESM(require_rbush_min());
40183
40184   // modules/core/difference.js
40185   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
40186   function coreDifference(base, head) {
40187     var _changes = {};
40188     var _didChange = {};
40189     var _diff = {};
40190     function checkEntityID(id2) {
40191       var h2 = head.entities[id2];
40192       var b2 = base.entities[id2];
40193       if (h2 === b2)
40194         return;
40195       if (_changes[id2])
40196         return;
40197       if (!h2 && b2) {
40198         _changes[id2] = { base: b2, head: h2 };
40199         _didChange.deletion = true;
40200         return;
40201       }
40202       if (h2 && !b2) {
40203         _changes[id2] = { base: b2, head: h2 };
40204         _didChange.addition = true;
40205         return;
40206       }
40207       if (h2 && b2) {
40208         if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
40209           _changes[id2] = { base: b2, head: h2 };
40210           _didChange.geometry = true;
40211           _didChange.properties = true;
40212           return;
40213         }
40214         if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
40215           _changes[id2] = { base: b2, head: h2 };
40216           _didChange.geometry = true;
40217         }
40218         if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
40219           _changes[id2] = { base: b2, head: h2 };
40220           _didChange.geometry = true;
40221         }
40222         if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
40223           _changes[id2] = { base: b2, head: h2 };
40224           _didChange.properties = true;
40225         }
40226       }
40227     }
40228     function load() {
40229       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
40230       for (var i3 = 0; i3 < ids.length; i3++) {
40231         checkEntityID(ids[i3]);
40232       }
40233     }
40234     load();
40235     _diff.length = function length() {
40236       return Object.keys(_changes).length;
40237     };
40238     _diff.changes = function changes() {
40239       return _changes;
40240     };
40241     _diff.didChange = _didChange;
40242     _diff.extantIDs = function extantIDs(includeRelMembers) {
40243       var result = /* @__PURE__ */ new Set();
40244       Object.keys(_changes).forEach(function(id2) {
40245         if (_changes[id2].head) {
40246           result.add(id2);
40247         }
40248         var h2 = _changes[id2].head;
40249         var b2 = _changes[id2].base;
40250         var entity = h2 || b2;
40251         if (includeRelMembers && entity.type === "relation") {
40252           var mh = h2 ? h2.members.map(function(m2) {
40253             return m2.id;
40254           }) : [];
40255           var mb = b2 ? b2.members.map(function(m2) {
40256             return m2.id;
40257           }) : [];
40258           utilArrayUnion(mh, mb).forEach(function(memberID) {
40259             if (head.hasEntity(memberID)) {
40260               result.add(memberID);
40261             }
40262           });
40263         }
40264       });
40265       return Array.from(result);
40266     };
40267     _diff.modified = function modified() {
40268       var result = [];
40269       Object.values(_changes).forEach(function(change) {
40270         if (change.base && change.head) {
40271           result.push(change.head);
40272         }
40273       });
40274       return result;
40275     };
40276     _diff.created = function created() {
40277       var result = [];
40278       Object.values(_changes).forEach(function(change) {
40279         if (!change.base && change.head) {
40280           result.push(change.head);
40281         }
40282       });
40283       return result;
40284     };
40285     _diff.deleted = function deleted() {
40286       var result = [];
40287       Object.values(_changes).forEach(function(change) {
40288         if (change.base && !change.head) {
40289           result.push(change.base);
40290         }
40291       });
40292       return result;
40293     };
40294     _diff.summary = function summary() {
40295       var relevant = {};
40296       var keys2 = Object.keys(_changes);
40297       for (var i3 = 0; i3 < keys2.length; i3++) {
40298         var change = _changes[keys2[i3]];
40299         if (change.head && change.head.geometry(head) !== "vertex") {
40300           addEntity(change.head, head, change.base ? "modified" : "created");
40301         } else if (change.base && change.base.geometry(base) !== "vertex") {
40302           addEntity(change.base, base, "deleted");
40303         } else if (change.base && change.head) {
40304           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
40305           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
40306           if (moved) {
40307             addParents(change.head);
40308           }
40309           if (retagged || moved && change.head.hasInterestingTags()) {
40310             addEntity(change.head, head, "modified");
40311           }
40312         } else if (change.head && change.head.hasInterestingTags()) {
40313           addEntity(change.head, head, "created");
40314         } else if (change.base && change.base.hasInterestingTags()) {
40315           addEntity(change.base, base, "deleted");
40316         }
40317       }
40318       return Object.values(relevant);
40319       function addEntity(entity, graph, changeType) {
40320         relevant[entity.id] = {
40321           entity,
40322           graph,
40323           changeType
40324         };
40325       }
40326       function addParents(entity) {
40327         var parents = head.parentWays(entity);
40328         for (var j3 = parents.length - 1; j3 >= 0; j3--) {
40329           var parent = parents[j3];
40330           if (!(parent.id in relevant)) {
40331             addEntity(parent, head, "modified");
40332           }
40333         }
40334       }
40335     };
40336     _diff.complete = function complete(extent) {
40337       var result = {};
40338       var id2, change;
40339       for (id2 in _changes) {
40340         change = _changes[id2];
40341         var h2 = change.head;
40342         var b2 = change.base;
40343         var entity = h2 || b2;
40344         var i3;
40345         if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
40346           continue;
40347         }
40348         result[id2] = h2;
40349         if (entity.type === "way") {
40350           var nh = h2 ? h2.nodes : [];
40351           var nb = b2 ? b2.nodes : [];
40352           var diff;
40353           diff = utilArrayDifference(nh, nb);
40354           for (i3 = 0; i3 < diff.length; i3++) {
40355             result[diff[i3]] = head.hasEntity(diff[i3]);
40356           }
40357           diff = utilArrayDifference(nb, nh);
40358           for (i3 = 0; i3 < diff.length; i3++) {
40359             result[diff[i3]] = head.hasEntity(diff[i3]);
40360           }
40361         }
40362         if (entity.type === "relation" && entity.isMultipolygon()) {
40363           var mh = h2 ? h2.members.map(function(m2) {
40364             return m2.id;
40365           }) : [];
40366           var mb = b2 ? b2.members.map(function(m2) {
40367             return m2.id;
40368           }) : [];
40369           var ids = utilArrayUnion(mh, mb);
40370           for (i3 = 0; i3 < ids.length; i3++) {
40371             var member = head.hasEntity(ids[i3]);
40372             if (!member)
40373               continue;
40374             if (extent && !member.intersects(extent, head))
40375               continue;
40376             result[ids[i3]] = member;
40377           }
40378         }
40379         addParents(head.parentWays(entity), result);
40380         addParents(head.parentRelations(entity), result);
40381       }
40382       return result;
40383       function addParents(parents, result2) {
40384         for (var i4 = 0; i4 < parents.length; i4++) {
40385           var parent = parents[i4];
40386           if (parent.id in result2)
40387             continue;
40388           result2[parent.id] = parent;
40389           addParents(head.parentRelations(parent), result2);
40390         }
40391       }
40392     };
40393     return _diff;
40394   }
40395
40396   // modules/core/tree.js
40397   var import_rbush5 = __toESM(require_rbush_min());
40398   function coreTree(head) {
40399     var _rtree = new import_rbush5.default();
40400     var _bboxes = {};
40401     var _segmentsRTree = new import_rbush5.default();
40402     var _segmentsBBoxes = {};
40403     var _segmentsByWayId = {};
40404     var tree = {};
40405     function entityBBox(entity) {
40406       var bbox2 = entity.extent(head).bbox();
40407       bbox2.id = entity.id;
40408       _bboxes[entity.id] = bbox2;
40409       return bbox2;
40410     }
40411     function segmentBBox(segment) {
40412       var extent = segment.extent(head);
40413       if (!extent)
40414         return null;
40415       var bbox2 = extent.bbox();
40416       bbox2.segment = segment;
40417       _segmentsBBoxes[segment.id] = bbox2;
40418       return bbox2;
40419     }
40420     function removeEntity(entity) {
40421       _rtree.remove(_bboxes[entity.id]);
40422       delete _bboxes[entity.id];
40423       if (_segmentsByWayId[entity.id]) {
40424         _segmentsByWayId[entity.id].forEach(function(segment) {
40425           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
40426           delete _segmentsBBoxes[segment.id];
40427         });
40428         delete _segmentsByWayId[entity.id];
40429       }
40430     }
40431     function loadEntities(entities) {
40432       _rtree.load(entities.map(entityBBox));
40433       var segments = [];
40434       entities.forEach(function(entity) {
40435         if (entity.segments) {
40436           var entitySegments = entity.segments(head);
40437           _segmentsByWayId[entity.id] = entitySegments;
40438           segments = segments.concat(entitySegments);
40439         }
40440       });
40441       if (segments.length)
40442         _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
40443     }
40444     function updateParents(entity, insertions, memo) {
40445       head.parentWays(entity).forEach(function(way) {
40446         if (_bboxes[way.id]) {
40447           removeEntity(way);
40448           insertions[way.id] = way;
40449         }
40450         updateParents(way, insertions, memo);
40451       });
40452       head.parentRelations(entity).forEach(function(relation) {
40453         if (memo[entity.id])
40454           return;
40455         memo[entity.id] = true;
40456         if (_bboxes[relation.id]) {
40457           removeEntity(relation);
40458           insertions[relation.id] = relation;
40459         }
40460         updateParents(relation, insertions, memo);
40461       });
40462     }
40463     tree.rebase = function(entities, force) {
40464       var insertions = {};
40465       for (var i3 = 0; i3 < entities.length; i3++) {
40466         var entity = entities[i3];
40467         if (!entity.visible)
40468           continue;
40469         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
40470           if (!force) {
40471             continue;
40472           } else if (_bboxes[entity.id]) {
40473             removeEntity(entity);
40474           }
40475         }
40476         insertions[entity.id] = entity;
40477         updateParents(entity, insertions, {});
40478       }
40479       loadEntities(Object.values(insertions));
40480       return tree;
40481     };
40482     function updateToGraph(graph) {
40483       if (graph === head)
40484         return;
40485       var diff = coreDifference(head, graph);
40486       head = graph;
40487       var changed = diff.didChange;
40488       if (!changed.addition && !changed.deletion && !changed.geometry)
40489         return;
40490       var insertions = {};
40491       if (changed.deletion) {
40492         diff.deleted().forEach(function(entity) {
40493           removeEntity(entity);
40494         });
40495       }
40496       if (changed.geometry) {
40497         diff.modified().forEach(function(entity) {
40498           removeEntity(entity);
40499           insertions[entity.id] = entity;
40500           updateParents(entity, insertions, {});
40501         });
40502       }
40503       if (changed.addition) {
40504         diff.created().forEach(function(entity) {
40505           insertions[entity.id] = entity;
40506         });
40507       }
40508       loadEntities(Object.values(insertions));
40509     }
40510     tree.intersects = function(extent, graph) {
40511       updateToGraph(graph);
40512       return _rtree.search(extent.bbox()).map(function(bbox2) {
40513         return graph.entity(bbox2.id);
40514       });
40515     };
40516     tree.waySegments = function(extent, graph) {
40517       updateToGraph(graph);
40518       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
40519         return bbox2.segment;
40520       });
40521     };
40522     return tree;
40523   }
40524
40525   // modules/svg/icon.js
40526   function svgIcon(name, svgklass, useklass) {
40527     return function drawIcon(selection2) {
40528       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);
40529     };
40530   }
40531
40532   // modules/ui/modal.js
40533   function uiModal(selection2, blocking) {
40534     let keybinding = utilKeybinding("modal");
40535     let previous = selection2.select("div.modal");
40536     let animate = previous.empty();
40537     previous.transition().duration(200).style("opacity", 0).remove();
40538     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
40539     shaded.close = () => {
40540       shaded.transition().duration(200).style("opacity", 0).remove();
40541       modal.transition().duration(200).style("top", "0px");
40542       select_default2(document).call(keybinding.unbind);
40543     };
40544     let modal = shaded.append("div").attr("class", "modal fillL");
40545     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
40546     if (!blocking) {
40547       shaded.on("click.remove-modal", (d3_event) => {
40548         if (d3_event.target === this) {
40549           shaded.close();
40550         }
40551       });
40552       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
40553       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
40554       select_default2(document).call(keybinding);
40555     }
40556     modal.append("div").attr("class", "content");
40557     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
40558     if (animate) {
40559       shaded.transition().style("opacity", 1);
40560     } else {
40561       shaded.style("opacity", 1);
40562     }
40563     return shaded;
40564     function moveFocusToFirst() {
40565       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
40566       if (node) {
40567         node.focus();
40568       } else {
40569         select_default2(this).node().blur();
40570       }
40571     }
40572     function moveFocusToLast() {
40573       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
40574       if (nodes.length) {
40575         nodes[nodes.length - 1].focus();
40576       } else {
40577         select_default2(this).node().blur();
40578       }
40579     }
40580   }
40581
40582   // modules/ui/loading.js
40583   function uiLoading(context) {
40584     let _modalSelection = select_default2(null);
40585     let _message = "";
40586     let _blocking = false;
40587     let loading = (selection2) => {
40588       _modalSelection = uiModal(selection2, _blocking);
40589       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
40590       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
40591       loadertext.append("h3").html(_message);
40592       _modalSelection.select("button.close").attr("class", "hide");
40593       return loading;
40594     };
40595     loading.message = function(val) {
40596       if (!arguments.length)
40597         return _message;
40598       _message = val;
40599       return loading;
40600     };
40601     loading.blocking = function(val) {
40602       if (!arguments.length)
40603         return _blocking;
40604       _blocking = val;
40605       return loading;
40606     };
40607     loading.close = () => {
40608       _modalSelection.remove();
40609     };
40610     loading.isShown = () => {
40611       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
40612     };
40613     return loading;
40614   }
40615
40616   // modules/core/history.js
40617   function coreHistory(context) {
40618     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
40619     var lock = utilSessionMutex("lock");
40620     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
40621     var duration = 150;
40622     var _imageryUsed = [];
40623     var _photoOverlaysUsed = [];
40624     var _checkpoints = {};
40625     var _pausedGraph;
40626     var _stack;
40627     var _index;
40628     var _tree;
40629     function _act(actions, t2) {
40630       actions = Array.prototype.slice.call(actions);
40631       var annotation;
40632       if (typeof actions[actions.length - 1] !== "function") {
40633         annotation = actions.pop();
40634       }
40635       var graph = _stack[_index].graph;
40636       for (var i3 = 0; i3 < actions.length; i3++) {
40637         graph = actions[i3](graph, t2);
40638       }
40639       return {
40640         graph,
40641         annotation,
40642         imageryUsed: _imageryUsed,
40643         photoOverlaysUsed: _photoOverlaysUsed,
40644         transform: context.projection.transform(),
40645         selectedIDs: context.selectedIDs()
40646       };
40647     }
40648     function _perform(args, t2) {
40649       var previous = _stack[_index].graph;
40650       _stack = _stack.slice(0, _index + 1);
40651       var actionResult = _act(args, t2);
40652       _stack.push(actionResult);
40653       _index++;
40654       return change(previous);
40655     }
40656     function _replace(args, t2) {
40657       var previous = _stack[_index].graph;
40658       var actionResult = _act(args, t2);
40659       _stack[_index] = actionResult;
40660       return change(previous);
40661     }
40662     function _overwrite(args, t2) {
40663       var previous = _stack[_index].graph;
40664       if (_index > 0) {
40665         _index--;
40666         _stack.pop();
40667       }
40668       _stack = _stack.slice(0, _index + 1);
40669       var actionResult = _act(args, t2);
40670       _stack.push(actionResult);
40671       _index++;
40672       return change(previous);
40673     }
40674     function change(previous) {
40675       var difference = coreDifference(previous, history.graph());
40676       if (!_pausedGraph) {
40677         dispatch14.call("change", this, difference);
40678       }
40679       return difference;
40680     }
40681     function getKey(n3) {
40682       return "iD_" + window.location.origin + "_" + n3;
40683     }
40684     var history = {
40685       graph: function() {
40686         return _stack[_index].graph;
40687       },
40688       tree: function() {
40689         return _tree;
40690       },
40691       base: function() {
40692         return _stack[0].graph;
40693       },
40694       merge: function(entities) {
40695         var stack = _stack.map(function(state) {
40696           return state.graph;
40697         });
40698         _stack[0].graph.rebase(entities, stack, false);
40699         _tree.rebase(entities, false);
40700         dispatch14.call("merge", this, entities);
40701       },
40702       perform: function() {
40703         select_default2(document).interrupt("history.perform");
40704         var transitionable = false;
40705         var action0 = arguments[0];
40706         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
40707           transitionable = !!action0.transitionable;
40708         }
40709         if (transitionable) {
40710           var origArguments = arguments;
40711           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
40712             return function(t2) {
40713               if (t2 < 1)
40714                 _overwrite([action0], t2);
40715             };
40716           }).on("start", function() {
40717             _perform([action0], 0);
40718           }).on("end interrupt", function() {
40719             _overwrite(origArguments, 1);
40720           });
40721         } else {
40722           return _perform(arguments);
40723         }
40724       },
40725       replace: function() {
40726         select_default2(document).interrupt("history.perform");
40727         return _replace(arguments, 1);
40728       },
40729       // Same as calling pop and then perform
40730       overwrite: function() {
40731         select_default2(document).interrupt("history.perform");
40732         return _overwrite(arguments, 1);
40733       },
40734       pop: function(n3) {
40735         select_default2(document).interrupt("history.perform");
40736         var previous = _stack[_index].graph;
40737         if (isNaN(+n3) || +n3 < 0) {
40738           n3 = 1;
40739         }
40740         while (n3-- > 0 && _index > 0) {
40741           _index--;
40742           _stack.pop();
40743         }
40744         return change(previous);
40745       },
40746       // Back to the previous annotated state or _index = 0.
40747       undo: function() {
40748         select_default2(document).interrupt("history.perform");
40749         var previousStack = _stack[_index];
40750         var previous = previousStack.graph;
40751         while (_index > 0) {
40752           _index--;
40753           if (_stack[_index].annotation)
40754             break;
40755         }
40756         dispatch14.call("undone", this, _stack[_index], previousStack);
40757         return change(previous);
40758       },
40759       // Forward to the next annotated state.
40760       redo: function() {
40761         select_default2(document).interrupt("history.perform");
40762         var previousStack = _stack[_index];
40763         var previous = previousStack.graph;
40764         var tryIndex = _index;
40765         while (tryIndex < _stack.length - 1) {
40766           tryIndex++;
40767           if (_stack[tryIndex].annotation) {
40768             _index = tryIndex;
40769             dispatch14.call("redone", this, _stack[_index], previousStack);
40770             break;
40771           }
40772         }
40773         return change(previous);
40774       },
40775       pauseChangeDispatch: function() {
40776         if (!_pausedGraph) {
40777           _pausedGraph = _stack[_index].graph;
40778         }
40779       },
40780       resumeChangeDispatch: function() {
40781         if (_pausedGraph) {
40782           var previous = _pausedGraph;
40783           _pausedGraph = null;
40784           return change(previous);
40785         }
40786       },
40787       undoAnnotation: function() {
40788         var i3 = _index;
40789         while (i3 >= 0) {
40790           if (_stack[i3].annotation)
40791             return _stack[i3].annotation;
40792           i3--;
40793         }
40794       },
40795       redoAnnotation: function() {
40796         var i3 = _index + 1;
40797         while (i3 <= _stack.length - 1) {
40798           if (_stack[i3].annotation)
40799             return _stack[i3].annotation;
40800           i3++;
40801         }
40802       },
40803       // Returns the entities from the active graph with bounding boxes
40804       // overlapping the given `extent`.
40805       intersects: function(extent) {
40806         return _tree.intersects(extent, _stack[_index].graph);
40807       },
40808       difference: function() {
40809         var base = _stack[0].graph;
40810         var head = _stack[_index].graph;
40811         return coreDifference(base, head);
40812       },
40813       changes: function(action) {
40814         var base = _stack[0].graph;
40815         var head = _stack[_index].graph;
40816         if (action) {
40817           head = action(head);
40818         }
40819         var difference = coreDifference(base, head);
40820         return {
40821           modified: difference.modified(),
40822           created: difference.created(),
40823           deleted: difference.deleted()
40824         };
40825       },
40826       hasChanges: function() {
40827         return this.difference().length() > 0;
40828       },
40829       imageryUsed: function(sources) {
40830         if (sources) {
40831           _imageryUsed = sources;
40832           return history;
40833         } else {
40834           var s2 = /* @__PURE__ */ new Set();
40835           _stack.slice(1, _index + 1).forEach(function(state) {
40836             state.imageryUsed.forEach(function(source) {
40837               if (source !== "Custom") {
40838                 s2.add(source);
40839               }
40840             });
40841           });
40842           return Array.from(s2);
40843         }
40844       },
40845       photoOverlaysUsed: function(sources) {
40846         if (sources) {
40847           _photoOverlaysUsed = sources;
40848           return history;
40849         } else {
40850           var s2 = /* @__PURE__ */ new Set();
40851           _stack.slice(1, _index + 1).forEach(function(state) {
40852             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
40853               state.photoOverlaysUsed.forEach(function(photoOverlay) {
40854                 s2.add(photoOverlay);
40855               });
40856             }
40857           });
40858           return Array.from(s2);
40859         }
40860       },
40861       // save the current history state
40862       checkpoint: function(key) {
40863         _checkpoints[key] = {
40864           stack: _stack,
40865           index: _index
40866         };
40867         return history;
40868       },
40869       // restore history state to a given checkpoint or reset completely
40870       reset: function(key) {
40871         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
40872           _stack = _checkpoints[key].stack;
40873           _index = _checkpoints[key].index;
40874         } else {
40875           _stack = [{ graph: coreGraph() }];
40876           _index = 0;
40877           _tree = coreTree(_stack[0].graph);
40878           _checkpoints = {};
40879         }
40880         dispatch14.call("reset");
40881         dispatch14.call("change");
40882         return history;
40883       },
40884       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
40885       //
40886       // To use it:
40887       //  1. Start the walkthrough.
40888       //  2. Get to a "free editing" tutorial step
40889       //  3. Make your edits to the walkthrough map
40890       //  4. In your browser dev console run:
40891       //        `id.history().toIntroGraph()`
40892       //  5. This outputs stringified JSON to the browser console
40893       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
40894       toIntroGraph: function() {
40895         var nextID = { n: 0, r: 0, w: 0 };
40896         var permIDs = {};
40897         var graph = this.graph();
40898         var baseEntities = {};
40899         Object.values(graph.base().entities).forEach(function(entity) {
40900           var copy2 = copyIntroEntity(entity);
40901           baseEntities[copy2.id] = copy2;
40902         });
40903         Object.keys(graph.entities).forEach(function(id2) {
40904           var entity = graph.entities[id2];
40905           if (entity) {
40906             var copy2 = copyIntroEntity(entity);
40907             baseEntities[copy2.id] = copy2;
40908           } else {
40909             delete baseEntities[id2];
40910           }
40911         });
40912         Object.values(baseEntities).forEach(function(entity) {
40913           if (Array.isArray(entity.nodes)) {
40914             entity.nodes = entity.nodes.map(function(node) {
40915               return permIDs[node] || node;
40916             });
40917           }
40918           if (Array.isArray(entity.members)) {
40919             entity.members = entity.members.map(function(member) {
40920               member.id = permIDs[member.id] || member.id;
40921               return member;
40922             });
40923           }
40924         });
40925         return JSON.stringify({ dataIntroGraph: baseEntities });
40926         function copyIntroEntity(source) {
40927           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
40928           if (copy2.tags && !Object.keys(copy2.tags)) {
40929             delete copy2.tags;
40930           }
40931           if (Array.isArray(copy2.loc)) {
40932             copy2.loc[0] = +copy2.loc[0].toFixed(6);
40933             copy2.loc[1] = +copy2.loc[1].toFixed(6);
40934           }
40935           var match = source.id.match(/([nrw])-\d*/);
40936           if (match !== null) {
40937             var nrw = match[1];
40938             var permID;
40939             do {
40940               permID = nrw + ++nextID[nrw];
40941             } while (baseEntities.hasOwnProperty(permID));
40942             copy2.id = permIDs[source.id] = permID;
40943           }
40944           return copy2;
40945         }
40946       },
40947       toJSON: function() {
40948         if (!this.hasChanges())
40949           return;
40950         var allEntities = {};
40951         var baseEntities = {};
40952         var base = _stack[0];
40953         var s2 = _stack.map(function(i3) {
40954           var modified = [];
40955           var deleted = [];
40956           Object.keys(i3.graph.entities).forEach(function(id2) {
40957             var entity = i3.graph.entities[id2];
40958             if (entity) {
40959               var key = osmEntity.key(entity);
40960               allEntities[key] = entity;
40961               modified.push(key);
40962             } else {
40963               deleted.push(id2);
40964             }
40965             if (id2 in base.graph.entities) {
40966               baseEntities[id2] = base.graph.entities[id2];
40967             }
40968             if (entity && entity.nodes) {
40969               entity.nodes.forEach(function(nodeID) {
40970                 if (nodeID in base.graph.entities) {
40971                   baseEntities[nodeID] = base.graph.entities[nodeID];
40972                 }
40973               });
40974             }
40975             var baseParents = base.graph._parentWays[id2];
40976             if (baseParents) {
40977               baseParents.forEach(function(parentID) {
40978                 if (parentID in base.graph.entities) {
40979                   baseEntities[parentID] = base.graph.entities[parentID];
40980                 }
40981               });
40982             }
40983           });
40984           var x2 = {};
40985           if (modified.length)
40986             x2.modified = modified;
40987           if (deleted.length)
40988             x2.deleted = deleted;
40989           if (i3.imageryUsed)
40990             x2.imageryUsed = i3.imageryUsed;
40991           if (i3.photoOverlaysUsed)
40992             x2.photoOverlaysUsed = i3.photoOverlaysUsed;
40993           if (i3.annotation)
40994             x2.annotation = i3.annotation;
40995           if (i3.transform)
40996             x2.transform = i3.transform;
40997           if (i3.selectedIDs)
40998             x2.selectedIDs = i3.selectedIDs;
40999           return x2;
41000         });
41001         return JSON.stringify({
41002           version: 3,
41003           entities: Object.values(allEntities),
41004           baseEntities: Object.values(baseEntities),
41005           stack: s2,
41006           nextIDs: osmEntity.id.next,
41007           index: _index,
41008           // note the time the changes were saved
41009           timestamp: (/* @__PURE__ */ new Date()).getTime()
41010         });
41011       },
41012       fromJSON: function(json, loadChildNodes) {
41013         var h2 = JSON.parse(json);
41014         var loadComplete = true;
41015         osmEntity.id.next = h2.nextIDs;
41016         _index = h2.index;
41017         if (h2.version === 2 || h2.version === 3) {
41018           var allEntities = {};
41019           h2.entities.forEach(function(entity) {
41020             allEntities[osmEntity.key(entity)] = osmEntity(entity);
41021           });
41022           if (h2.version === 3) {
41023             var baseEntities = h2.baseEntities.map(function(d2) {
41024               return osmEntity(d2);
41025             });
41026             var stack = _stack.map(function(state) {
41027               return state.graph;
41028             });
41029             _stack[0].graph.rebase(baseEntities, stack, true);
41030             _tree.rebase(baseEntities, true);
41031             if (loadChildNodes) {
41032               var osm = context.connection();
41033               var baseWays = baseEntities.filter(function(e3) {
41034                 return e3.type === "way";
41035               });
41036               var nodeIDs = baseWays.reduce(function(acc, way) {
41037                 return utilArrayUnion(acc, way.nodes);
41038               }, []);
41039               var missing = nodeIDs.filter(function(n3) {
41040                 return !_stack[0].graph.hasEntity(n3);
41041               });
41042               if (missing.length && osm) {
41043                 loadComplete = false;
41044                 context.map().redrawEnable(false);
41045                 var loading = uiLoading(context).blocking(true);
41046                 context.container().call(loading);
41047                 var childNodesLoaded = function(err, result) {
41048                   if (!err) {
41049                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
41050                     var visibles = visibleGroups.true || [];
41051                     var invisibles = visibleGroups.false || [];
41052                     if (visibles.length) {
41053                       var visibleIDs = visibles.map(function(entity) {
41054                         return entity.id;
41055                       });
41056                       var stack2 = _stack.map(function(state) {
41057                         return state.graph;
41058                       });
41059                       missing = utilArrayDifference(missing, visibleIDs);
41060                       _stack[0].graph.rebase(visibles, stack2, true);
41061                       _tree.rebase(visibles, true);
41062                     }
41063                     invisibles.forEach(function(entity) {
41064                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
41065                     });
41066                   }
41067                   if (err || !missing.length) {
41068                     loading.close();
41069                     context.map().redrawEnable(true);
41070                     dispatch14.call("change");
41071                     dispatch14.call("restore", this);
41072                   }
41073                 };
41074                 osm.loadMultiple(missing, childNodesLoaded);
41075               }
41076             }
41077           }
41078           _stack = h2.stack.map(function(d2) {
41079             var entities = {}, entity;
41080             if (d2.modified) {
41081               d2.modified.forEach(function(key) {
41082                 entity = allEntities[key];
41083                 entities[entity.id] = entity;
41084               });
41085             }
41086             if (d2.deleted) {
41087               d2.deleted.forEach(function(id2) {
41088                 entities[id2] = void 0;
41089               });
41090             }
41091             return {
41092               graph: coreGraph(_stack[0].graph).load(entities),
41093               annotation: d2.annotation,
41094               imageryUsed: d2.imageryUsed,
41095               photoOverlaysUsed: d2.photoOverlaysUsed,
41096               transform: d2.transform,
41097               selectedIDs: d2.selectedIDs
41098             };
41099           });
41100         } else {
41101           _stack = h2.stack.map(function(d2) {
41102             var entities = {};
41103             for (var i3 in d2.entities) {
41104               var entity = d2.entities[i3];
41105               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
41106             }
41107             d2.graph = coreGraph(_stack[0].graph).load(entities);
41108             return d2;
41109           });
41110         }
41111         var transform2 = _stack[_index].transform;
41112         if (transform2) {
41113           context.map().transformEase(transform2, 0);
41114         }
41115         if (loadComplete) {
41116           dispatch14.call("change");
41117           dispatch14.call("restore", this);
41118         }
41119         return history;
41120       },
41121       lock: function() {
41122         return lock.lock();
41123       },
41124       unlock: function() {
41125         lock.unlock();
41126       },
41127       save: function() {
41128         if (lock.locked() && // don't overwrite existing, unresolved changes
41129         !_hasUnresolvedRestorableChanges) {
41130           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
41131           if (!success)
41132             dispatch14.call("storage_error");
41133         }
41134         return history;
41135       },
41136       // delete the history version saved in localStorage
41137       clearSaved: function() {
41138         context.debouncedSave.cancel();
41139         if (lock.locked()) {
41140           _hasUnresolvedRestorableChanges = false;
41141           corePreferences(getKey("saved_history"), null);
41142           corePreferences("comment", null);
41143           corePreferences("hashtags", null);
41144           corePreferences("source", null);
41145         }
41146         return history;
41147       },
41148       savedHistoryJSON: function() {
41149         return corePreferences(getKey("saved_history"));
41150       },
41151       hasRestorableChanges: function() {
41152         return _hasUnresolvedRestorableChanges;
41153       },
41154       // load history from a version stored in localStorage
41155       restore: function() {
41156         if (lock.locked()) {
41157           _hasUnresolvedRestorableChanges = false;
41158           var json = this.savedHistoryJSON();
41159           if (json)
41160             history.fromJSON(json, true);
41161         }
41162       },
41163       _getKey: getKey
41164     };
41165     history.reset();
41166     return utilRebind(history, dispatch14, "on");
41167   }
41168
41169   // modules/validations/index.js
41170   var validations_exports = {};
41171   __export(validations_exports, {
41172     validationAlmostJunction: () => validationAlmostJunction,
41173     validationCloseNodes: () => validationCloseNodes,
41174     validationCrossingWays: () => validationCrossingWays,
41175     validationDisconnectedWay: () => validationDisconnectedWay,
41176     validationFormatting: () => validationFormatting,
41177     validationHelpRequest: () => validationHelpRequest,
41178     validationImpossibleOneway: () => validationImpossibleOneway,
41179     validationIncompatibleSource: () => validationIncompatibleSource,
41180     validationMaprules: () => validationMaprules,
41181     validationMismatchedGeometry: () => validationMismatchedGeometry,
41182     validationMissingRole: () => validationMissingRole,
41183     validationMissingTag: () => validationMissingTag,
41184     validationOutdatedTags: () => validationOutdatedTags,
41185     validationPrivateData: () => validationPrivateData,
41186     validationSuspiciousName: () => validationSuspiciousName,
41187     validationUnsquareWay: () => validationUnsquareWay
41188   });
41189
41190   // modules/validations/almost_junction.js
41191   function validationAlmostJunction(context) {
41192     const type2 = "almost_junction";
41193     const EXTEND_TH_METERS = 5;
41194     const WELD_TH_METERS = 0.75;
41195     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
41196     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
41197     function isHighway(entity) {
41198       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
41199     }
41200     function isTaggedAsNotContinuing(node) {
41201       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
41202     }
41203     const validation = function checkAlmostJunction(entity, graph) {
41204       if (!isHighway(entity))
41205         return [];
41206       if (entity.isDegenerate())
41207         return [];
41208       const tree = context.history().tree();
41209       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
41210       let issues = [];
41211       extendableNodeInfos.forEach((extendableNodeInfo) => {
41212         issues.push(new validationIssue({
41213           type: type2,
41214           subtype: "highway-highway",
41215           severity: "warning",
41216           message: function(context2) {
41217             const entity1 = context2.hasEntity(this.entityIds[0]);
41218             if (this.entityIds[0] === this.entityIds[2]) {
41219               return entity1 ? _t.append("issues.almost_junction.self.message", {
41220                 feature: utilDisplayLabel(entity1, context2.graph())
41221               }) : "";
41222             } else {
41223               const entity2 = context2.hasEntity(this.entityIds[2]);
41224               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
41225                 feature: utilDisplayLabel(entity1, context2.graph()),
41226                 feature2: utilDisplayLabel(entity2, context2.graph())
41227               }) : "";
41228             }
41229           },
41230           reference: showReference,
41231           entityIds: [
41232             entity.id,
41233             extendableNodeInfo.node.id,
41234             extendableNodeInfo.wid
41235           ],
41236           loc: extendableNodeInfo.node.loc,
41237           hash: JSON.stringify(extendableNodeInfo.node.loc),
41238           data: {
41239             midId: extendableNodeInfo.mid.id,
41240             edge: extendableNodeInfo.edge,
41241             cross_loc: extendableNodeInfo.cross_loc
41242           },
41243           dynamicFixes: makeFixes
41244         }));
41245       });
41246       return issues;
41247       function makeFixes(context2) {
41248         let fixes = [new validationIssueFix({
41249           icon: "iD-icon-abutment",
41250           title: _t.append("issues.fix.connect_features.title"),
41251           onClick: function(context3) {
41252             const annotation = _t("issues.fix.connect_almost_junction.annotation");
41253             const [, endNodeId, crossWayId] = this.issue.entityIds;
41254             const midNode = context3.entity(this.issue.data.midId);
41255             const endNode = context3.entity(endNodeId);
41256             const crossWay = context3.entity(crossWayId);
41257             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
41258             if (nearEndNodes.length > 0) {
41259               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
41260               if (collinear) {
41261                 context3.perform(
41262                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
41263                   annotation
41264                 );
41265                 return;
41266               }
41267             }
41268             const targetEdge = this.issue.data.edge;
41269             const crossLoc = this.issue.data.cross_loc;
41270             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
41271             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
41272             if (closestNodeInfo.distance < WELD_TH_METERS) {
41273               context3.perform(
41274                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
41275                 annotation
41276               );
41277             } else {
41278               context3.perform(
41279                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
41280                 annotation
41281               );
41282             }
41283           }
41284         })];
41285         const node = context2.hasEntity(this.entityIds[1]);
41286         if (node && !node.hasInterestingTags()) {
41287           fixes.push(new validationIssueFix({
41288             icon: "maki-barrier",
41289             title: _t.append("issues.fix.tag_as_disconnected.title"),
41290             onClick: function(context3) {
41291               const nodeID = this.issue.entityIds[1];
41292               const tags = Object.assign({}, context3.entity(nodeID).tags);
41293               tags.noexit = "yes";
41294               context3.perform(
41295                 actionChangeTags(nodeID, tags),
41296                 _t("issues.fix.tag_as_disconnected.annotation")
41297               );
41298             }
41299           }));
41300         }
41301         return fixes;
41302       }
41303       function showReference(selection2) {
41304         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
41305       }
41306       function isExtendableCandidate(node, way) {
41307         const osm = services.osm;
41308         if (osm && !osm.isDataLoaded(node.loc)) {
41309           return false;
41310         }
41311         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
41312           return false;
41313         }
41314         let occurrences = 0;
41315         for (const index in way.nodes) {
41316           if (way.nodes[index] === node.id) {
41317             occurrences += 1;
41318             if (occurrences > 1) {
41319               return false;
41320             }
41321           }
41322         }
41323         return true;
41324       }
41325       function findConnectableEndNodesByExtension(way) {
41326         let results = [];
41327         if (way.isClosed())
41328           return results;
41329         let testNodes;
41330         const indices = [0, way.nodes.length - 1];
41331         indices.forEach((nodeIndex) => {
41332           const nodeID = way.nodes[nodeIndex];
41333           const node = graph.entity(nodeID);
41334           if (!isExtendableCandidate(node, way))
41335             return;
41336           const connectionInfo = canConnectByExtend(way, nodeIndex);
41337           if (!connectionInfo)
41338             return;
41339           testNodes = graph.childNodes(way).slice();
41340           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
41341           if (geoHasSelfIntersections(testNodes, nodeID))
41342             return;
41343           results.push(connectionInfo);
41344         });
41345         return results;
41346       }
41347       function findNearbyEndNodes(node, way) {
41348         return [
41349           way.nodes[0],
41350           way.nodes[way.nodes.length - 1]
41351         ].map((d2) => graph.entity(d2)).filter((d2) => {
41352           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
41353         });
41354       }
41355       function findSmallJoinAngle(midNode, tipNode, endNodes) {
41356         let joinTo;
41357         let minAngle = Infinity;
41358         endNodes.forEach((endNode) => {
41359           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
41360           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
41361           const diff = Math.max(a1, a2) - Math.min(a1, a2);
41362           if (diff < minAngle) {
41363             joinTo = endNode;
41364             minAngle = diff;
41365           }
41366         });
41367         if (minAngle <= SIG_ANGLE_TH)
41368           return joinTo;
41369         return null;
41370       }
41371       function hasTag(tags, key) {
41372         return tags[key] !== void 0 && tags[key] !== "no";
41373       }
41374       function canConnectWays(way, way2) {
41375         if (way.id === way2.id)
41376           return true;
41377         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
41378           return false;
41379         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
41380           return false;
41381         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
41382         if (layer1 !== layer2)
41383           return false;
41384         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
41385         if (level1 !== level2)
41386           return false;
41387         return true;
41388       }
41389       function canConnectByExtend(way, endNodeIdx) {
41390         const tipNid = way.nodes[endNodeIdx];
41391         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
41392         const tipNode = graph.entity(tipNid);
41393         const midNode = graph.entity(midNid);
41394         const lon = tipNode.loc[0];
41395         const lat = tipNode.loc[1];
41396         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
41397         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
41398         const queryExtent = geoExtent([
41399           [lon - lon_range, lat - lat_range],
41400           [lon + lon_range, lat + lat_range]
41401         ]);
41402         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
41403         const t2 = EXTEND_TH_METERS / edgeLen + 1;
41404         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
41405         const segmentInfos = tree.waySegments(queryExtent, graph);
41406         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
41407           let segmentInfo = segmentInfos[i3];
41408           let way2 = graph.entity(segmentInfo.wayId);
41409           if (!isHighway(way2))
41410             continue;
41411           if (!canConnectWays(way, way2))
41412             continue;
41413           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
41414           if (nAid === tipNid || nBid === tipNid)
41415             continue;
41416           let nA = graph.entity(nAid), nB = graph.entity(nBid);
41417           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
41418           if (crossLoc) {
41419             return {
41420               mid: midNode,
41421               node: tipNode,
41422               wid: way2.id,
41423               edge: [nA.id, nB.id],
41424               cross_loc: crossLoc
41425             };
41426           }
41427         }
41428         return null;
41429       }
41430     };
41431     validation.type = type2;
41432     return validation;
41433   }
41434
41435   // modules/validations/close_nodes.js
41436   function validationCloseNodes(context) {
41437     var type2 = "close_nodes";
41438     var pointThresholdMeters = 0.2;
41439     var validation = function(entity, graph) {
41440       if (entity.type === "node") {
41441         return getIssuesForNode(entity);
41442       } else if (entity.type === "way") {
41443         return getIssuesForWay(entity);
41444       }
41445       return [];
41446       function getIssuesForNode(node) {
41447         var parentWays = graph.parentWays(node);
41448         if (parentWays.length) {
41449           return getIssuesForVertex(node, parentWays);
41450         } else {
41451           return getIssuesForDetachedPoint(node);
41452         }
41453       }
41454       function wayTypeFor(way) {
41455         if (way.tags.boundary && way.tags.boundary !== "no")
41456           return "boundary";
41457         if (way.tags.indoor && way.tags.indoor !== "no")
41458           return "indoor";
41459         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
41460           return "building";
41461         if (osmPathHighwayTagValues[way.tags.highway])
41462           return "path";
41463         var parentRelations = graph.parentRelations(way);
41464         for (var i3 in parentRelations) {
41465           var relation = parentRelations[i3];
41466           if (relation.tags.type === "boundary")
41467             return "boundary";
41468           if (relation.isMultipolygon()) {
41469             if (relation.tags.indoor && relation.tags.indoor !== "no")
41470               return "indoor";
41471             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
41472               return "building";
41473           }
41474         }
41475         return "other";
41476       }
41477       function shouldCheckWay(way) {
41478         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
41479           return false;
41480         var bbox2 = way.extent(graph).bbox();
41481         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
41482         if (hypotenuseMeters < 1.5)
41483           return false;
41484         return true;
41485       }
41486       function getIssuesForWay(way) {
41487         if (!shouldCheckWay(way))
41488           return [];
41489         var issues = [], nodes = graph.childNodes(way);
41490         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
41491           var node1 = nodes[i3];
41492           var node2 = nodes[i3 + 1];
41493           var issue = getWayIssueIfAny(node1, node2, way);
41494           if (issue)
41495             issues.push(issue);
41496         }
41497         return issues;
41498       }
41499       function getIssuesForVertex(node, parentWays) {
41500         var issues = [];
41501         function checkForCloseness(node1, node2, way) {
41502           var issue = getWayIssueIfAny(node1, node2, way);
41503           if (issue)
41504             issues.push(issue);
41505         }
41506         for (var i3 = 0; i3 < parentWays.length; i3++) {
41507           var parentWay = parentWays[i3];
41508           if (!shouldCheckWay(parentWay))
41509             continue;
41510           var lastIndex = parentWay.nodes.length - 1;
41511           for (var j3 = 0; j3 < parentWay.nodes.length; j3++) {
41512             if (j3 !== 0) {
41513               if (parentWay.nodes[j3 - 1] === node.id) {
41514                 checkForCloseness(node, graph.entity(parentWay.nodes[j3]), parentWay);
41515               }
41516             }
41517             if (j3 !== lastIndex) {
41518               if (parentWay.nodes[j3 + 1] === node.id) {
41519                 checkForCloseness(graph.entity(parentWay.nodes[j3]), node, parentWay);
41520               }
41521             }
41522           }
41523         }
41524         return issues;
41525       }
41526       function thresholdMetersForWay(way) {
41527         if (!shouldCheckWay(way))
41528           return 0;
41529         var wayType = wayTypeFor(way);
41530         if (wayType === "boundary")
41531           return 0;
41532         if (wayType === "indoor")
41533           return 0.01;
41534         if (wayType === "building")
41535           return 0.05;
41536         if (wayType === "path")
41537           return 0.1;
41538         return 0.2;
41539       }
41540       function getIssuesForDetachedPoint(node) {
41541         var issues = [];
41542         var lon = node.loc[0];
41543         var lat = node.loc[1];
41544         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
41545         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
41546         var queryExtent = geoExtent([
41547           [lon - lon_range, lat - lat_range],
41548           [lon + lon_range, lat + lat_range]
41549         ]);
41550         var intersected = context.history().tree().intersects(queryExtent, graph);
41551         for (var j3 = 0; j3 < intersected.length; j3++) {
41552           var nearby = intersected[j3];
41553           if (nearby.id === node.id)
41554             continue;
41555           if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
41556             continue;
41557           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
41558             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein")
41559               continue;
41560             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein")
41561               continue;
41562             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
41563             var zAxisDifferentiates = false;
41564             for (var key in zAxisKeys) {
41565               var nodeValue = node.tags[key] || "0";
41566               var nearbyValue = nearby.tags[key] || "0";
41567               if (nodeValue !== nearbyValue) {
41568                 zAxisDifferentiates = true;
41569                 break;
41570               }
41571             }
41572             if (zAxisDifferentiates)
41573               continue;
41574             issues.push(new validationIssue({
41575               type: type2,
41576               subtype: "detached",
41577               severity: "warning",
41578               message: function(context2) {
41579                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
41580                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
41581                   feature: utilDisplayLabel(entity2, context2.graph()),
41582                   feature2: utilDisplayLabel(entity22, context2.graph())
41583                 }) : "";
41584               },
41585               reference: showReference,
41586               entityIds: [node.id, nearby.id],
41587               dynamicFixes: function() {
41588                 return [
41589                   new validationIssueFix({
41590                     icon: "iD-operation-disconnect",
41591                     title: _t.append("issues.fix.move_points_apart.title")
41592                   }),
41593                   new validationIssueFix({
41594                     icon: "iD-icon-layers",
41595                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
41596                   })
41597                 ];
41598               }
41599             }));
41600           }
41601         }
41602         return issues;
41603         function showReference(selection2) {
41604           var referenceText = _t("issues.close_nodes.detached.reference");
41605           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41606         }
41607       }
41608       function getWayIssueIfAny(node1, node2, way) {
41609         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
41610           return null;
41611         }
41612         if (node1.loc !== node2.loc) {
41613           var parentWays1 = graph.parentWays(node1);
41614           var parentWays2 = new Set(graph.parentWays(node2));
41615           var sharedWays = parentWays1.filter(function(parentWay) {
41616             return parentWays2.has(parentWay);
41617           });
41618           var thresholds = sharedWays.map(function(parentWay) {
41619             return thresholdMetersForWay(parentWay);
41620           });
41621           var threshold = Math.min(...thresholds);
41622           var distance = geoSphericalDistance(node1.loc, node2.loc);
41623           if (distance > threshold)
41624             return null;
41625         }
41626         return new validationIssue({
41627           type: type2,
41628           subtype: "vertices",
41629           severity: "warning",
41630           message: function(context2) {
41631             var entity2 = context2.hasEntity(this.entityIds[0]);
41632             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
41633           },
41634           reference: showReference,
41635           entityIds: [way.id, node1.id, node2.id],
41636           loc: node1.loc,
41637           dynamicFixes: function() {
41638             return [
41639               new validationIssueFix({
41640                 icon: "iD-icon-plus",
41641                 title: _t.append("issues.fix.merge_points.title"),
41642                 onClick: function(context2) {
41643                   var entityIds = this.issue.entityIds;
41644                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
41645                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
41646                 }
41647               }),
41648               new validationIssueFix({
41649                 icon: "iD-operation-disconnect",
41650                 title: _t.append("issues.fix.move_points_apart.title")
41651               })
41652             ];
41653           }
41654         });
41655         function showReference(selection2) {
41656           var referenceText = _t("issues.close_nodes.reference");
41657           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41658         }
41659       }
41660     };
41661     validation.type = type2;
41662     return validation;
41663   }
41664
41665   // modules/validations/crossing_ways.js
41666   var import_lodash3 = __toESM(require_lodash());
41667   function validationCrossingWays(context) {
41668     var type2 = "crossing_ways";
41669     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
41670       if (getFeatureType(way, graph) === null) {
41671         var parentRels = graph.parentRelations(way);
41672         for (var i3 = 0; i3 < parentRels.length; i3++) {
41673           var rel = parentRels[i3];
41674           if (getFeatureType(rel, graph) !== null) {
41675             return rel;
41676           }
41677         }
41678       }
41679       return way;
41680     }
41681     function hasTag(tags, key) {
41682       return tags[key] !== void 0 && tags[key] !== "no";
41683     }
41684     function taggedAsIndoor(tags) {
41685       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
41686     }
41687     function allowsBridge(featureType) {
41688       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41689     }
41690     function allowsTunnel(featureType) {
41691       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41692     }
41693     var ignoredBuildings = {
41694       demolished: true,
41695       dismantled: true,
41696       proposed: true,
41697       razed: true
41698     };
41699     function getFeatureType(entity, graph) {
41700       var geometry = entity.geometry(graph);
41701       if (geometry !== "line" && geometry !== "area")
41702         return null;
41703       var tags = entity.tags;
41704       if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
41705         return "building";
41706       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
41707         return "highway";
41708       if (geometry !== "line")
41709         return null;
41710       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
41711         return "railway";
41712       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
41713         return "waterway";
41714       return null;
41715     }
41716     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
41717       var level1 = tags1.level || "0";
41718       var level2 = tags2.level || "0";
41719       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
41720         return true;
41721       }
41722       var layer1 = tags1.layer || "0";
41723       var layer2 = tags2.layer || "0";
41724       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
41725         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
41726           return true;
41727         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
41728           return true;
41729         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
41730           return true;
41731       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
41732         return true;
41733       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
41734         return true;
41735       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
41736         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
41737           return true;
41738         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
41739           return true;
41740         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
41741           return true;
41742       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
41743         return true;
41744       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
41745         return true;
41746       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
41747         return true;
41748       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
41749         return true;
41750       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
41751         if (layer1 !== layer2)
41752           return true;
41753       }
41754       return false;
41755     }
41756     var highwaysDisallowingFords = {
41757       motorway: true,
41758       motorway_link: true,
41759       trunk: true,
41760       trunk_link: true,
41761       primary: true,
41762       primary_link: true,
41763       secondary: true,
41764       secondary_link: true
41765     };
41766     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
41767       var featureType1 = getFeatureType(entity1, graph);
41768       var featureType2 = getFeatureType(entity2, graph);
41769       var geometry1 = entity1.geometry(graph);
41770       var geometry2 = entity2.geometry(graph);
41771       var bothLines = geometry1 === "line" && geometry2 === "line";
41772       if (featureType1 === featureType2) {
41773         if (featureType1 === "highway") {
41774           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
41775           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
41776           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
41777             var roadFeature = entity1IsPath ? entity2 : entity1;
41778             var pathFeature = entity1IsPath ? entity1 : entity2;
41779             if (roadFeature.tags.highway === "track") {
41780               return {};
41781             }
41782             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
41783               return {};
41784             }
41785             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
41786               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
41787             }
41788             return bothLines ? { highway: "crossing" } : {};
41789           }
41790           return {};
41791         }
41792         if (featureType1 === "waterway")
41793           return {};
41794         if (featureType1 === "railway")
41795           return {};
41796       } else {
41797         var featureTypes = [featureType1, featureType2];
41798         if (featureTypes.indexOf("highway") !== -1) {
41799           if (featureTypes.indexOf("railway") !== -1) {
41800             if (!bothLines)
41801               return {};
41802             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
41803             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
41804               if (isTram)
41805                 return { railway: "tram_crossing" };
41806               return { railway: "crossing" };
41807             } else {
41808               if (isTram)
41809                 return { railway: "tram_level_crossing" };
41810               return { railway: "level_crossing" };
41811             }
41812           }
41813           if (featureTypes.indexOf("waterway") !== -1) {
41814             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
41815               return null;
41816             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
41817               return null;
41818             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
41819               return null;
41820             }
41821             return bothLines ? { ford: "yes" } : {};
41822           }
41823         }
41824       }
41825       return null;
41826     }
41827     function findCrossingsByWay(way1, graph, tree) {
41828       var edgeCrossInfos = [];
41829       if (way1.type !== "way")
41830         return edgeCrossInfos;
41831       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
41832       var way1FeatureType = getFeatureType(taggedFeature1, graph);
41833       if (way1FeatureType === null)
41834         return edgeCrossInfos;
41835       var checkedSingleCrossingWays = {};
41836       var i3, j3;
41837       var extent;
41838       var n1, n22, nA, nB, nAId, nBId;
41839       var segment1, segment2;
41840       var oneOnly;
41841       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
41842       var way1Nodes = graph.childNodes(way1);
41843       var comparedWays = {};
41844       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
41845         n1 = way1Nodes[i3];
41846         n22 = way1Nodes[i3 + 1];
41847         extent = geoExtent([
41848           [
41849             Math.min(n1.loc[0], n22.loc[0]),
41850             Math.min(n1.loc[1], n22.loc[1])
41851           ],
41852           [
41853             Math.max(n1.loc[0], n22.loc[0]),
41854             Math.max(n1.loc[1], n22.loc[1])
41855           ]
41856         ]);
41857         segmentInfos = tree.waySegments(extent, graph);
41858         for (j3 = 0; j3 < segmentInfos.length; j3++) {
41859           segment2Info = segmentInfos[j3];
41860           if (segment2Info.wayId === way1.id)
41861             continue;
41862           if (checkedSingleCrossingWays[segment2Info.wayId])
41863             continue;
41864           comparedWays[segment2Info.wayId] = true;
41865           way2 = graph.hasEntity(segment2Info.wayId);
41866           if (!way2)
41867             continue;
41868           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
41869           way2FeatureType = getFeatureType(taggedFeature2, graph);
41870           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
41871             continue;
41872           }
41873           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
41874           nAId = segment2Info.nodes[0];
41875           nBId = segment2Info.nodes[1];
41876           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
41877             continue;
41878           }
41879           nA = graph.hasEntity(nAId);
41880           if (!nA)
41881             continue;
41882           nB = graph.hasEntity(nBId);
41883           if (!nB)
41884             continue;
41885           segment1 = [n1.loc, n22.loc];
41886           segment2 = [nA.loc, nB.loc];
41887           var point2 = geoLineIntersection(segment1, segment2);
41888           if (point2) {
41889             edgeCrossInfos.push({
41890               wayInfos: [
41891                 {
41892                   way: way1,
41893                   featureType: way1FeatureType,
41894                   edge: [n1.id, n22.id]
41895                 },
41896                 {
41897                   way: way2,
41898                   featureType: way2FeatureType,
41899                   edge: [nA.id, nB.id]
41900                 }
41901               ],
41902               crossPoint: point2
41903             });
41904             if (oneOnly) {
41905               checkedSingleCrossingWays[way2.id] = true;
41906               break;
41907             }
41908           }
41909         }
41910       }
41911       return edgeCrossInfos;
41912     }
41913     function waysToCheck(entity, graph) {
41914       var featureType = getFeatureType(entity, graph);
41915       if (!featureType)
41916         return [];
41917       if (entity.type === "way") {
41918         return [entity];
41919       } else if (entity.type === "relation") {
41920         return entity.members.reduce(function(array2, member) {
41921           if (member.type === "way" && // only look at geometry ways
41922           (!member.role || member.role === "outer" || member.role === "inner")) {
41923             var entity2 = graph.hasEntity(member.id);
41924             if (entity2 && array2.indexOf(entity2) === -1) {
41925               array2.push(entity2);
41926             }
41927           }
41928           return array2;
41929         }, []);
41930       }
41931       return [];
41932     }
41933     var validation = function checkCrossingWays(entity, graph) {
41934       var tree = context.history().tree();
41935       var ways = waysToCheck(entity, graph);
41936       var issues = [];
41937       var wayIndex, crossingIndex, crossings;
41938       for (wayIndex in ways) {
41939         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
41940         for (crossingIndex in crossings) {
41941           issues.push(createIssue(crossings[crossingIndex], graph));
41942         }
41943       }
41944       return issues;
41945     };
41946     function createIssue(crossing, graph) {
41947       crossing.wayInfos.sort(function(way1Info, way2Info) {
41948         var type1 = way1Info.featureType;
41949         var type22 = way2Info.featureType;
41950         if (type1 === type22) {
41951           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
41952         } else if (type1 === "waterway") {
41953           return true;
41954         } else if (type22 === "waterway") {
41955           return false;
41956         }
41957         return type1 < type22;
41958       });
41959       var entities = crossing.wayInfos.map(function(wayInfo) {
41960         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
41961       });
41962       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
41963       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
41964       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
41965       var featureType1 = crossing.wayInfos[0].featureType;
41966       var featureType2 = crossing.wayInfos[1].featureType;
41967       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
41968       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
41969       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
41970       var subtype = [featureType1, featureType2].sort().join("-");
41971       var crossingTypeID = subtype;
41972       if (isCrossingIndoors) {
41973         crossingTypeID = "indoor-indoor";
41974       } else if (isCrossingTunnels) {
41975         crossingTypeID = "tunnel-tunnel";
41976       } else if (isCrossingBridges) {
41977         crossingTypeID = "bridge-bridge";
41978       }
41979       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
41980         crossingTypeID += "_connectable";
41981       }
41982       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
41983       return new validationIssue({
41984         type: type2,
41985         subtype,
41986         severity: "warning",
41987         message: function(context2) {
41988           var graph2 = context2.graph();
41989           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
41990           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
41991             feature: utilDisplayLabel(entity1, graph2),
41992             feature2: utilDisplayLabel(entity2, graph2)
41993           }) : "";
41994         },
41995         reference: showReference,
41996         entityIds: entities.map(function(entity) {
41997           return entity.id;
41998         }),
41999         data: {
42000           edges,
42001           featureTypes,
42002           connectionTags
42003         },
42004         hash: uniqueID,
42005         loc: crossing.crossPoint,
42006         dynamicFixes: function(context2) {
42007           var mode = context2.mode();
42008           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
42009             return [];
42010           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
42011           var selectedFeatureType = this.data.featureTypes[selectedIndex];
42012           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
42013           var fixes = [];
42014           if (connectionTags) {
42015             fixes.push(makeConnectWaysFix(this.data.connectionTags));
42016             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
42017             if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
42018               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
42019             }
42020           }
42021           if (isCrossingIndoors) {
42022             fixes.push(new validationIssueFix({
42023               icon: "iD-icon-layers",
42024               title: _t.append("issues.fix.use_different_levels.title")
42025             }));
42026           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
42027             fixes.push(makeChangeLayerFix("higher"));
42028             fixes.push(makeChangeLayerFix("lower"));
42029           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
42030             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
42031               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
42032             }
42033             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
42034             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
42035               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
42036             }
42037           }
42038           fixes.push(new validationIssueFix({
42039             icon: "iD-operation-move",
42040             title: _t.append("issues.fix.reposition_features.title")
42041           }));
42042           return fixes;
42043         }
42044       });
42045       function showReference(selection2) {
42046         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
42047       }
42048     }
42049     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
42050       return new validationIssueFix({
42051         icon: iconName,
42052         title: _t.append("issues.fix." + fixTitleID + ".title"),
42053         onClick: function(context2) {
42054           var mode = context2.mode();
42055           if (!mode || mode.id !== "select")
42056             return;
42057           var selectedIDs = mode.selectedIDs();
42058           if (selectedIDs.length !== 1)
42059             return;
42060           var selectedWayID = selectedIDs[0];
42061           if (!context2.hasEntity(selectedWayID))
42062             return;
42063           var resultWayIDs = [selectedWayID];
42064           var edge, crossedEdge, crossedWayID;
42065           if (this.issue.entityIds[0] === selectedWayID) {
42066             edge = this.issue.data.edges[0];
42067             crossedEdge = this.issue.data.edges[1];
42068             crossedWayID = this.issue.entityIds[1];
42069           } else {
42070             edge = this.issue.data.edges[1];
42071             crossedEdge = this.issue.data.edges[0];
42072             crossedWayID = this.issue.entityIds[0];
42073           }
42074           var crossingLoc = this.issue.loc;
42075           var projection2 = context2.projection;
42076           var action = function actionAddStructure(graph) {
42077             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42078             var crossedWay = graph.hasEntity(crossedWayID);
42079             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
42080             if (!structLengthMeters) {
42081               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
42082             }
42083             if (structLengthMeters) {
42084               if (getFeatureType(crossedWay, graph) === "railway") {
42085                 structLengthMeters *= 2;
42086               }
42087             } else {
42088               structLengthMeters = 8;
42089             }
42090             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
42091             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
42092             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
42093             if (crossingAngle > Math.PI)
42094               crossingAngle -= Math.PI;
42095             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
42096             structLengthMeters += 4;
42097             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
42098             function geomToProj(geoPoint) {
42099               return [
42100                 geoLonToMeters(geoPoint[0], geoPoint[1]),
42101                 geoLatToMeters(geoPoint[1])
42102               ];
42103             }
42104             function projToGeom(projPoint) {
42105               var lat = geoMetersToLat(projPoint[1]);
42106               return [
42107                 geoMetersToLon(projPoint[0], lat),
42108                 lat
42109               ];
42110             }
42111             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
42112             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
42113             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
42114             var projectedCrossingLoc = geomToProj(crossingLoc);
42115             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
42116             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
42117               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
42118               return projToGeom([
42119                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
42120                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
42121               ]);
42122             }
42123             var endpointLocGetter1 = function(lengthMeters) {
42124               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
42125             };
42126             var endpointLocGetter2 = function(lengthMeters) {
42127               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
42128             };
42129             var minEdgeLengthMeters = 0.55;
42130             function determineEndpoint(edge2, endNode, locGetter) {
42131               var newNode;
42132               var idealLengthMeters = structLengthMeters / 2;
42133               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
42134               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
42135                 var idealNodeLoc = locGetter(idealLengthMeters);
42136                 newNode = osmNode();
42137                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
42138               } else {
42139                 var edgeCount = 0;
42140                 endNode.parentIntersectionWays(graph).forEach(function(way) {
42141                   way.nodes.forEach(function(nodeID) {
42142                     if (nodeID === endNode.id) {
42143                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
42144                         edgeCount += 1;
42145                       } else {
42146                         edgeCount += 2;
42147                       }
42148                     }
42149                   });
42150                 });
42151                 if (edgeCount >= 3) {
42152                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
42153                   if (insetLength > minEdgeLengthMeters) {
42154                     var insetNodeLoc = locGetter(insetLength);
42155                     newNode = osmNode();
42156                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
42157                   }
42158                 }
42159               }
42160               if (!newNode)
42161                 newNode = endNode;
42162               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
42163               graph = splitAction(graph);
42164               if (splitAction.getCreatedWayIDs().length) {
42165                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
42166               }
42167               return newNode;
42168             }
42169             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
42170             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
42171             var structureWay = resultWayIDs.map(function(id2) {
42172               return graph.entity(id2);
42173             }).find(function(way) {
42174               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
42175             });
42176             var tags = Object.assign({}, structureWay.tags);
42177             if (bridgeOrTunnel === "bridge") {
42178               tags.bridge = "yes";
42179               tags.layer = "1";
42180             } else {
42181               var tunnelValue = "yes";
42182               if (getFeatureType(structureWay, graph) === "waterway") {
42183                 tunnelValue = "culvert";
42184               }
42185               tags.tunnel = tunnelValue;
42186               tags.layer = "-1";
42187             }
42188             graph = actionChangeTags(structureWay.id, tags)(graph);
42189             return graph;
42190           };
42191           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
42192           context2.enter(modeSelect(context2, resultWayIDs));
42193         }
42194       });
42195     }
42196     function makeConnectWaysFix(connectionTags) {
42197       var fixTitleID = "connect_features";
42198       var fixIcon = "iD-icon-crossing";
42199       if (connectionTags.highway === "crossing") {
42200         fixTitleID = "connect_using_crossing";
42201         fixIcon = "temaki-pedestrian";
42202       }
42203       if (connectionTags.ford) {
42204         fixTitleID = "connect_using_ford";
42205         fixIcon = "roentgen-ford";
42206       }
42207       const fix = new validationIssueFix({
42208         icon: fixIcon,
42209         title: _t.append("issues.fix." + fixTitleID + ".title"),
42210         onClick: function(context2) {
42211           var loc = this.issue.loc;
42212           var edges = this.issue.data.edges;
42213           context2.perform(
42214             function actionConnectCrossingWays(graph) {
42215               var node = osmNode({ loc, tags: connectionTags });
42216               graph = graph.replace(node);
42217               var nodesToMerge = [node.id];
42218               var mergeThresholdInMeters = 0.75;
42219               edges.forEach(function(edge) {
42220                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42221                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
42222                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
42223                   nodesToMerge.push(nearby.node.id);
42224                 } else {
42225                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
42226                 }
42227               });
42228               if (nodesToMerge.length > 1) {
42229                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
42230               }
42231               return graph;
42232             },
42233             _t("issues.fix.connect_crossing_features.annotation")
42234           );
42235         }
42236       });
42237       fix._connectionTags = connectionTags;
42238       return fix;
42239     }
42240     function makeChangeLayerFix(higherOrLower) {
42241       return new validationIssueFix({
42242         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
42243         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
42244         onClick: function(context2) {
42245           var mode = context2.mode();
42246           if (!mode || mode.id !== "select")
42247             return;
42248           var selectedIDs = mode.selectedIDs();
42249           if (selectedIDs.length !== 1)
42250             return;
42251           var selectedID = selectedIDs[0];
42252           if (!this.issue.entityIds.some(function(entityId) {
42253             return entityId === selectedID;
42254           }))
42255             return;
42256           var entity = context2.hasEntity(selectedID);
42257           if (!entity)
42258             return;
42259           var tags = Object.assign({}, entity.tags);
42260           var layer = tags.layer && Number(tags.layer);
42261           if (layer && !isNaN(layer)) {
42262             if (higherOrLower === "higher") {
42263               layer += 1;
42264             } else {
42265               layer -= 1;
42266             }
42267           } else {
42268             if (higherOrLower === "higher") {
42269               layer = 1;
42270             } else {
42271               layer = -1;
42272             }
42273           }
42274           tags.layer = layer.toString();
42275           context2.perform(
42276             actionChangeTags(entity.id, tags),
42277             _t("operations.change_tags.annotation")
42278           );
42279         }
42280       });
42281     }
42282     validation.type = type2;
42283     return validation;
42284   }
42285
42286   // modules/behavior/draw_way.js
42287   function behaviorDrawWay(context, wayID, mode, startGraph) {
42288     const keybinding = utilKeybinding("drawWay");
42289     var dispatch14 = dispatch_default("rejectedSelfIntersection");
42290     var behavior = behaviorDraw(context);
42291     var _nodeIndex;
42292     var _origWay;
42293     var _wayGeometry;
42294     var _headNodeID;
42295     var _annotation;
42296     var _pointerHasMoved = false;
42297     var _drawNode;
42298     var _didResolveTempEdit = false;
42299     function createDrawNode(loc) {
42300       _drawNode = osmNode({ loc });
42301       context.pauseChangeDispatch();
42302       context.replace(function actionAddDrawNode(graph) {
42303         var way = graph.entity(wayID);
42304         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
42305       }, _annotation);
42306       context.resumeChangeDispatch();
42307       setActiveElements();
42308     }
42309     function removeDrawNode() {
42310       context.pauseChangeDispatch();
42311       context.replace(
42312         function actionDeleteDrawNode(graph) {
42313           var way = graph.entity(wayID);
42314           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
42315         },
42316         _annotation
42317       );
42318       _drawNode = void 0;
42319       context.resumeChangeDispatch();
42320     }
42321     function keydown(d3_event) {
42322       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42323         if (context.surface().classed("nope")) {
42324           context.surface().classed("nope-suppressed", true);
42325         }
42326         context.surface().classed("nope", false).classed("nope-disabled", true);
42327       }
42328     }
42329     function keyup(d3_event) {
42330       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42331         if (context.surface().classed("nope-suppressed")) {
42332           context.surface().classed("nope", true);
42333         }
42334         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
42335       }
42336     }
42337     function allowsVertex(d2) {
42338       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
42339     }
42340     function move(d3_event, datum2) {
42341       var loc = context.map().mouseCoordinates();
42342       if (!_drawNode)
42343         createDrawNode(loc);
42344       context.surface().classed("nope-disabled", d3_event.altKey);
42345       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
42346       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
42347       if (targetLoc) {
42348         loc = targetLoc;
42349       } else if (targetNodes) {
42350         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
42351         if (choice) {
42352           loc = choice.loc;
42353         }
42354       }
42355       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42356       _drawNode = context.entity(_drawNode.id);
42357       checkGeometry(
42358         true
42359         /* includeDrawNode */
42360       );
42361     }
42362     function checkGeometry(includeDrawNode) {
42363       var nopeDisabled = context.surface().classed("nope-disabled");
42364       var isInvalid = isInvalidGeometry(includeDrawNode);
42365       if (nopeDisabled) {
42366         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
42367       } else {
42368         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
42369       }
42370     }
42371     function isInvalidGeometry(includeDrawNode) {
42372       var testNode = _drawNode;
42373       var parentWay = context.graph().entity(wayID);
42374       var nodes = context.graph().childNodes(parentWay).slice();
42375       if (includeDrawNode) {
42376         if (parentWay.isClosed()) {
42377           nodes.pop();
42378         }
42379       } else {
42380         if (parentWay.isClosed()) {
42381           if (nodes.length < 3)
42382             return false;
42383           if (_drawNode)
42384             nodes.splice(-2, 1);
42385           testNode = nodes[nodes.length - 2];
42386         } else {
42387           return false;
42388         }
42389       }
42390       return testNode && geoHasSelfIntersections(nodes, testNode.id);
42391     }
42392     function undone() {
42393       _didResolveTempEdit = true;
42394       context.pauseChangeDispatch();
42395       var nextMode;
42396       if (context.graph() === startGraph) {
42397         nextMode = modeSelect(context, [wayID]);
42398       } else {
42399         context.pop(1);
42400         nextMode = mode;
42401       }
42402       context.perform(actionNoop());
42403       context.pop(1);
42404       context.resumeChangeDispatch();
42405       context.enter(nextMode);
42406     }
42407     function setActiveElements() {
42408       if (!_drawNode)
42409         return;
42410       context.surface().selectAll("." + _drawNode.id).classed("active", true);
42411     }
42412     function resetToStartGraph() {
42413       while (context.graph() !== startGraph) {
42414         context.pop();
42415       }
42416     }
42417     var drawWay = function(surface) {
42418       _drawNode = void 0;
42419       _didResolveTempEdit = false;
42420       _origWay = context.entity(wayID);
42421       if (typeof _nodeIndex === "number") {
42422         _headNodeID = _origWay.nodes[_nodeIndex];
42423       } else if (_origWay.isClosed()) {
42424         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
42425       } else {
42426         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
42427       }
42428       _wayGeometry = _origWay.geometry(context.graph());
42429       _annotation = _t(
42430         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
42431       );
42432       _pointerHasMoved = false;
42433       context.pauseChangeDispatch();
42434       context.perform(actionNoop(), _annotation);
42435       context.resumeChangeDispatch();
42436       behavior.hover().initialNodeID(_headNodeID);
42437       behavior.on("move", function() {
42438         _pointerHasMoved = true;
42439         move.apply(this, arguments);
42440       }).on("down", function() {
42441         move.apply(this, arguments);
42442       }).on("downcancel", function() {
42443         if (_drawNode)
42444           removeDrawNode();
42445       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
42446       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
42447       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
42448       setActiveElements();
42449       surface.call(behavior);
42450       context.history().on("undone.draw", undone);
42451     };
42452     drawWay.off = function(surface) {
42453       if (!_didResolveTempEdit) {
42454         context.pauseChangeDispatch();
42455         resetToStartGraph();
42456         context.resumeChangeDispatch();
42457       }
42458       _drawNode = void 0;
42459       _nodeIndex = void 0;
42460       context.map().on("drawn.draw", null);
42461       surface.call(behavior.off).selectAll(".active").classed("active", false);
42462       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
42463       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
42464       context.history().on("undone.draw", null);
42465     };
42466     function attemptAdd(d2, loc, doAdd) {
42467       if (_drawNode) {
42468         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42469         _drawNode = context.entity(_drawNode.id);
42470       } else {
42471         createDrawNode(loc);
42472       }
42473       checkGeometry(
42474         true
42475         /* includeDrawNode */
42476       );
42477       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
42478         if (!_pointerHasMoved) {
42479           removeDrawNode();
42480         }
42481         dispatch14.call("rejectedSelfIntersection", this);
42482         return;
42483       }
42484       context.pauseChangeDispatch();
42485       doAdd();
42486       _didResolveTempEdit = true;
42487       context.resumeChangeDispatch();
42488       context.enter(mode);
42489     }
42490     drawWay.add = function(loc, d2) {
42491       attemptAdd(d2, loc, function() {
42492       });
42493     };
42494     drawWay.addWay = function(loc, edge, d2) {
42495       attemptAdd(d2, loc, function() {
42496         context.replace(
42497           actionAddMidpoint({ loc, edge }, _drawNode),
42498           _annotation
42499         );
42500       });
42501     };
42502     drawWay.addNode = function(node, d2) {
42503       if (node.id === _headNodeID || // or the first node when drawing an area
42504       _origWay.isClosed() && node.id === _origWay.first()) {
42505         drawWay.finish();
42506         return;
42507       }
42508       attemptAdd(d2, node.loc, function() {
42509         context.replace(
42510           function actionReplaceDrawNode(graph) {
42511             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
42512             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
42513           },
42514           _annotation
42515         );
42516       });
42517     };
42518     function getFeatureType(ways) {
42519       if (ways.every((way) => way.isClosed()))
42520         return "area";
42521       if (ways.every((way) => !way.isClosed()))
42522         return "line";
42523       return "generic";
42524     }
42525     function followMode() {
42526       if (_didResolveTempEdit)
42527         return;
42528       try {
42529         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
42530         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
42531         const historyGraph = context.history().graph();
42532         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
42533           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
42534           return;
42535         }
42536         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
42537         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
42538         const featureType = getFeatureType(lastNodesParents);
42539         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
42540           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
42541           return;
42542         }
42543         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
42544           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
42545           return;
42546         }
42547         const way = lastNodesParents[0];
42548         const indexOfLast = way.nodes.indexOf(lastNodeId);
42549         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
42550         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
42551         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
42552         if (nextNodeIndex === -1)
42553           nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
42554         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
42555         drawWay.addNode(nextNode, {
42556           geometry: { type: "Point", coordinates: nextNode.loc },
42557           id: nextNode.id,
42558           properties: { target: true, entity: nextNode }
42559         });
42560       } catch (ex) {
42561         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
42562       }
42563     }
42564     keybinding.on(_t("operations.follow.key"), followMode);
42565     select_default2(document).call(keybinding);
42566     drawWay.finish = function() {
42567       checkGeometry(
42568         false
42569         /* includeDrawNode */
42570       );
42571       if (context.surface().classed("nope")) {
42572         dispatch14.call("rejectedSelfIntersection", this);
42573         return;
42574       }
42575       context.pauseChangeDispatch();
42576       context.pop(1);
42577       _didResolveTempEdit = true;
42578       context.resumeChangeDispatch();
42579       var way = context.hasEntity(wayID);
42580       if (!way || way.isDegenerate()) {
42581         drawWay.cancel();
42582         return;
42583       }
42584       window.setTimeout(function() {
42585         context.map().dblclickZoomEnable(true);
42586       }, 1e3);
42587       var isNewFeature = !mode.isContinuing;
42588       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
42589     };
42590     drawWay.cancel = function() {
42591       context.pauseChangeDispatch();
42592       resetToStartGraph();
42593       context.resumeChangeDispatch();
42594       window.setTimeout(function() {
42595         context.map().dblclickZoomEnable(true);
42596       }, 1e3);
42597       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
42598       context.enter(modeBrowse(context));
42599     };
42600     drawWay.nodeIndex = function(val) {
42601       if (!arguments.length)
42602         return _nodeIndex;
42603       _nodeIndex = val;
42604       return drawWay;
42605     };
42606     drawWay.activeID = function() {
42607       if (!arguments.length)
42608         return _drawNode && _drawNode.id;
42609       return drawWay;
42610     };
42611     return utilRebind(drawWay, dispatch14, "on");
42612   }
42613
42614   // modules/modes/draw_line.js
42615   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
42616     var mode = {
42617       button,
42618       id: "draw-line"
42619     };
42620     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
42621       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
42622     });
42623     mode.wayID = wayID;
42624     mode.isContinuing = continuing;
42625     mode.enter = function() {
42626       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
42627       context.install(behavior);
42628     };
42629     mode.exit = function() {
42630       context.uninstall(behavior);
42631     };
42632     mode.selectedIDs = function() {
42633       return [wayID];
42634     };
42635     mode.activeID = function() {
42636       return behavior && behavior.activeID() || [];
42637     };
42638     return mode;
42639   }
42640
42641   // modules/validations/disconnected_way.js
42642   function validationDisconnectedWay() {
42643     var type2 = "disconnected_way";
42644     function isTaggedAsHighway(entity) {
42645       return osmRoutableHighwayTagValues[entity.tags.highway];
42646     }
42647     var validation = function checkDisconnectedWay(entity, graph) {
42648       var routingIslandWays = routingIslandForEntity(entity);
42649       if (!routingIslandWays)
42650         return [];
42651       return [new validationIssue({
42652         type: type2,
42653         subtype: "highway",
42654         severity: "warning",
42655         message: function(context) {
42656           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
42657           var label = entity2 && utilDisplayLabel(entity2, context.graph());
42658           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
42659         },
42660         reference: showReference,
42661         entityIds: Array.from(routingIslandWays).map(function(way) {
42662           return way.id;
42663         }),
42664         dynamicFixes: makeFixes
42665       })];
42666       function makeFixes(context) {
42667         var fixes = [];
42668         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
42669         if (singleEntity) {
42670           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
42671             var textDirection = _mainLocalizer.textDirection();
42672             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
42673             if (startFix)
42674               fixes.push(startFix);
42675             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
42676             if (endFix)
42677               fixes.push(endFix);
42678           }
42679           if (!fixes.length) {
42680             fixes.push(new validationIssueFix({
42681               title: _t.append("issues.fix.connect_feature.title")
42682             }));
42683           }
42684           fixes.push(new validationIssueFix({
42685             icon: "iD-operation-delete",
42686             title: _t.append("issues.fix.delete_feature.title"),
42687             entityIds: [singleEntity.id],
42688             onClick: function(context2) {
42689               var id2 = this.issue.entityIds[0];
42690               var operation = operationDelete(context2, [id2]);
42691               if (!operation.disabled()) {
42692                 operation();
42693               }
42694             }
42695           }));
42696         } else {
42697           fixes.push(new validationIssueFix({
42698             title: _t.append("issues.fix.connect_features.title")
42699           }));
42700         }
42701         return fixes;
42702       }
42703       function showReference(selection2) {
42704         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
42705       }
42706       function routingIslandForEntity(entity2) {
42707         var routingIsland = /* @__PURE__ */ new Set();
42708         var waysToCheck = [];
42709         function queueParentWays(node) {
42710           graph.parentWays(node).forEach(function(parentWay) {
42711             if (!routingIsland.has(parentWay) && // only check each feature once
42712             isRoutableWay(parentWay, false)) {
42713               routingIsland.add(parentWay);
42714               waysToCheck.push(parentWay);
42715             }
42716           });
42717         }
42718         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
42719           routingIsland.add(entity2);
42720           waysToCheck.push(entity2);
42721         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
42722           routingIsland.add(entity2);
42723           queueParentWays(entity2);
42724         } else {
42725           return null;
42726         }
42727         while (waysToCheck.length) {
42728           var wayToCheck = waysToCheck.pop();
42729           var childNodes = graph.childNodes(wayToCheck);
42730           for (var i3 in childNodes) {
42731             var vertex = childNodes[i3];
42732             if (isConnectedVertex(vertex)) {
42733               return null;
42734             }
42735             if (isRoutableNode(vertex)) {
42736               routingIsland.add(vertex);
42737             }
42738             queueParentWays(vertex);
42739           }
42740         }
42741         return routingIsland;
42742       }
42743       function isConnectedVertex(vertex) {
42744         var osm = services.osm;
42745         if (osm && !osm.isDataLoaded(vertex.loc))
42746           return true;
42747         if (vertex.tags.entrance && vertex.tags.entrance !== "no")
42748           return true;
42749         if (vertex.tags.amenity === "parking_entrance")
42750           return true;
42751         return false;
42752       }
42753       function isRoutableNode(node) {
42754         if (node.tags.highway === "elevator")
42755           return true;
42756         return false;
42757       }
42758       function isRoutableWay(way, ignoreInnerWays) {
42759         if (isTaggedAsHighway(way) || way.tags.route === "ferry")
42760           return true;
42761         return graph.parentRelations(way).some(function(parentRelation) {
42762           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
42763             return true;
42764           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
42765             return true;
42766           return false;
42767         });
42768       }
42769       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
42770         var vertex = graph.hasEntity(vertexID);
42771         if (!vertex || vertex.tags.noexit === "yes")
42772           return null;
42773         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
42774         return new validationIssueFix({
42775           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
42776           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
42777           entityIds: [vertexID],
42778           onClick: function(context) {
42779             var wayId = this.issue.entityIds[0];
42780             var way = context.hasEntity(wayId);
42781             var vertexId = this.entityIds[0];
42782             var vertex2 = context.hasEntity(vertexId);
42783             if (!way || !vertex2)
42784               return;
42785             var map2 = context.map();
42786             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
42787               map2.zoomToEase(vertex2);
42788             }
42789             context.enter(
42790               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
42791             );
42792           }
42793         });
42794       }
42795     };
42796     validation.type = type2;
42797     return validation;
42798   }
42799
42800   // modules/validations/invalid_format.js
42801   function validationFormatting() {
42802     var type2 = "invalid_format";
42803     var validation = function(entity) {
42804       var issues = [];
42805       function isValidEmail(email) {
42806         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
42807         return !email || valid_email.test(email);
42808       }
42809       function showReferenceEmail(selection2) {
42810         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
42811       }
42812       if (entity.tags.email) {
42813         var emails = entity.tags.email.split(";").map(function(s2) {
42814           return s2.trim();
42815         }).filter(function(x2) {
42816           return !isValidEmail(x2);
42817         });
42818         if (emails.length) {
42819           issues.push(new validationIssue({
42820             type: type2,
42821             subtype: "email",
42822             severity: "warning",
42823             message: function(context) {
42824               var entity2 = context.hasEntity(this.entityIds[0]);
42825               return entity2 ? _t.append(
42826                 "issues.invalid_format.email.message" + this.data,
42827                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
42828               ) : "";
42829             },
42830             reference: showReferenceEmail,
42831             entityIds: [entity.id],
42832             hash: emails.join(),
42833             data: emails.length > 1 ? "_multi" : ""
42834           }));
42835         }
42836       }
42837       return issues;
42838     };
42839     validation.type = type2;
42840     return validation;
42841   }
42842
42843   // modules/validations/help_request.js
42844   function validationHelpRequest(context) {
42845     var type2 = "help_request";
42846     var validation = function checkFixmeTag(entity) {
42847       if (!entity.tags.fixme)
42848         return [];
42849       if (entity.version === void 0)
42850         return [];
42851       if (entity.v !== void 0) {
42852         var baseEntity = context.history().base().hasEntity(entity.id);
42853         if (!baseEntity || !baseEntity.tags.fixme)
42854           return [];
42855       }
42856       return [new validationIssue({
42857         type: type2,
42858         subtype: "fixme_tag",
42859         severity: "warning",
42860         message: function(context2) {
42861           var entity2 = context2.hasEntity(this.entityIds[0]);
42862           return entity2 ? _t.append("issues.fixme_tag.message", {
42863             feature: utilDisplayLabel(
42864               entity2,
42865               context2.graph(),
42866               true
42867               /* verbose */
42868             )
42869           }) : "";
42870         },
42871         dynamicFixes: function() {
42872           return [
42873             new validationIssueFix({
42874               title: _t.append("issues.fix.address_the_concern.title")
42875             })
42876           ];
42877         },
42878         reference: showReference,
42879         entityIds: [entity.id]
42880       })];
42881       function showReference(selection2) {
42882         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
42883       }
42884     };
42885     validation.type = type2;
42886     return validation;
42887   }
42888
42889   // modules/validations/impossible_oneway.js
42890   function validationImpossibleOneway() {
42891     var type2 = "impossible_oneway";
42892     var validation = function checkImpossibleOneway(entity, graph) {
42893       if (entity.type !== "way" || entity.geometry(graph) !== "line")
42894         return [];
42895       if (entity.isClosed())
42896         return [];
42897       if (!typeForWay(entity))
42898         return [];
42899       if (!isOneway(entity))
42900         return [];
42901       var firstIssues = issuesForNode(entity, entity.first());
42902       var lastIssues = issuesForNode(entity, entity.last());
42903       return firstIssues.concat(lastIssues);
42904       function typeForWay(way) {
42905         if (way.geometry(graph) !== "line")
42906           return null;
42907         if (osmRoutableHighwayTagValues[way.tags.highway])
42908           return "highway";
42909         if (osmFlowingWaterwayTagValues[way.tags.waterway])
42910           return "waterway";
42911         return null;
42912       }
42913       function isOneway(way) {
42914         if (way.tags.oneway === "yes")
42915           return true;
42916         if (way.tags.oneway)
42917           return false;
42918         for (var key in way.tags) {
42919           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
42920             return true;
42921           }
42922         }
42923         return false;
42924       }
42925       function nodeOccursMoreThanOnce(way, nodeID) {
42926         var occurrences = 0;
42927         for (var index in way.nodes) {
42928           if (way.nodes[index] === nodeID) {
42929             occurrences += 1;
42930             if (occurrences > 1)
42931               return true;
42932           }
42933         }
42934         return false;
42935       }
42936       function isConnectedViaOtherTypes(way, node) {
42937         var wayType = typeForWay(way);
42938         if (wayType === "highway") {
42939           if (node.tags.entrance && node.tags.entrance !== "no")
42940             return true;
42941           if (node.tags.amenity === "parking_entrance")
42942             return true;
42943         } else if (wayType === "waterway") {
42944           if (node.id === way.first()) {
42945             if (node.tags.natural === "spring")
42946               return true;
42947           } else {
42948             if (node.tags.manhole === "drain")
42949               return true;
42950           }
42951         }
42952         return graph.parentWays(node).some(function(parentWay) {
42953           if (parentWay.id === way.id)
42954             return false;
42955           if (wayType === "highway") {
42956             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
42957               return true;
42958             if (parentWay.tags.route === "ferry")
42959               return true;
42960             return graph.parentRelations(parentWay).some(function(parentRelation) {
42961               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
42962                 return true;
42963               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
42964             });
42965           } else if (wayType === "waterway") {
42966             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
42967               return true;
42968           }
42969           return false;
42970         });
42971       }
42972       function issuesForNode(way, nodeID) {
42973         var isFirst = nodeID === way.first();
42974         var wayType = typeForWay(way);
42975         if (nodeOccursMoreThanOnce(way, nodeID))
42976           return [];
42977         var osm = services.osm;
42978         if (!osm)
42979           return [];
42980         var node = graph.hasEntity(nodeID);
42981         if (!node || !osm.isDataLoaded(node.loc))
42982           return [];
42983         if (isConnectedViaOtherTypes(way, node))
42984           return [];
42985         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
42986           if (parentWay.id === way.id)
42987             return false;
42988           return typeForWay(parentWay) === wayType;
42989         });
42990         if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
42991           return [];
42992         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
42993           return isOneway(attachedWay);
42994         });
42995         if (attachedOneways.length < attachedWaysOfSameType.length)
42996           return [];
42997         if (attachedOneways.length) {
42998           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
42999             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
43000               return true;
43001             if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
43002               return true;
43003             return false;
43004           });
43005           if (connectedEndpointsOkay)
43006             return [];
43007         }
43008         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
43009         if (wayType === "waterway") {
43010           messageID += "connected." + placement;
43011           referenceID += "connected";
43012         } else {
43013           messageID += placement;
43014           referenceID += placement;
43015         }
43016         return [new validationIssue({
43017           type: type2,
43018           subtype: wayType,
43019           severity: "warning",
43020           message: function(context) {
43021             var entity2 = context.hasEntity(this.entityIds[0]);
43022             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
43023               feature: utilDisplayLabel(entity2, context.graph())
43024             }) : "";
43025           },
43026           reference: getReference(referenceID),
43027           entityIds: [way.id, node.id],
43028           dynamicFixes: function() {
43029             var fixes = [];
43030             if (attachedOneways.length) {
43031               fixes.push(new validationIssueFix({
43032                 icon: "iD-operation-reverse",
43033                 title: _t.append("issues.fix.reverse_feature.title"),
43034                 entityIds: [way.id],
43035                 onClick: function(context) {
43036                   var id2 = this.issue.entityIds[0];
43037                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
43038                 }
43039               }));
43040             }
43041             if (node.tags.noexit !== "yes") {
43042               var textDirection = _mainLocalizer.textDirection();
43043               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
43044               fixes.push(new validationIssueFix({
43045                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
43046                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
43047                 onClick: function(context) {
43048                   var entityID = this.issue.entityIds[0];
43049                   var vertexID = this.issue.entityIds[1];
43050                   var way2 = context.entity(entityID);
43051                   var vertex = context.entity(vertexID);
43052                   continueDrawing(way2, vertex, context);
43053                 }
43054               }));
43055             }
43056             return fixes;
43057           },
43058           loc: node.loc
43059         })];
43060         function getReference(referenceID2) {
43061           return function showReference(selection2) {
43062             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
43063           };
43064         }
43065       }
43066     };
43067     function continueDrawing(way, vertex, context) {
43068       var map2 = context.map();
43069       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
43070         map2.zoomToEase(vertex);
43071       }
43072       context.enter(
43073         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
43074       );
43075     }
43076     validation.type = type2;
43077     return validation;
43078   }
43079
43080   // modules/validations/incompatible_source.js
43081   function validationIncompatibleSource() {
43082     const type2 = "incompatible_source";
43083     const incompatibleRules = [
43084       {
43085         id: "amap",
43086         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
43087       },
43088       {
43089         id: "baidu",
43090         regex: /(baidu|mapbar|百度)/i
43091       },
43092       {
43093         id: "google",
43094         regex: /google/i,
43095         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
43096       }
43097     ];
43098     const validation = function checkIncompatibleSource(entity) {
43099       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
43100       if (!entitySources)
43101         return [];
43102       const entityID = entity.id;
43103       return entitySources.map((source) => {
43104         const matchRule = incompatibleRules.find((rule) => {
43105           if (!rule.regex.test(source))
43106             return false;
43107           if (rule.exceptRegex && rule.exceptRegex.test(source))
43108             return false;
43109           return true;
43110         });
43111         if (!matchRule)
43112           return null;
43113         return new validationIssue({
43114           type: type2,
43115           severity: "warning",
43116           message: (context) => {
43117             const entity2 = context.hasEntity(entityID);
43118             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
43119               feature: utilDisplayLabel(
43120                 entity2,
43121                 context.graph(),
43122                 true
43123                 /* verbose */
43124               ),
43125               value: source
43126             }) : "";
43127           },
43128           reference: getReference(matchRule.id),
43129           entityIds: [entityID],
43130           hash: source,
43131           dynamicFixes: () => {
43132             return [
43133               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
43134             ];
43135           }
43136         });
43137       }).filter(Boolean);
43138       function getReference(id2) {
43139         return function showReference(selection2) {
43140           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
43141         };
43142       }
43143     };
43144     validation.type = type2;
43145     return validation;
43146   }
43147
43148   // modules/validations/maprules.js
43149   function validationMaprules() {
43150     var type2 = "maprules";
43151     var validation = function checkMaprules(entity, graph) {
43152       if (!services.maprules)
43153         return [];
43154       var rules = services.maprules.validationRules();
43155       var issues = [];
43156       for (var i3 = 0; i3 < rules.length; i3++) {
43157         var rule = rules[i3];
43158         rule.findIssues(entity, graph, issues);
43159       }
43160       return issues;
43161     };
43162     validation.type = type2;
43163     return validation;
43164   }
43165
43166   // modules/validations/mismatched_geometry.js
43167   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
43168   function validationMismatchedGeometry() {
43169     var type2 = "mismatched_geometry";
43170     function tagSuggestingLineIsArea(entity) {
43171       if (entity.type !== "way" || entity.isClosed())
43172         return null;
43173       var tagSuggestingArea = entity.tagSuggestingArea();
43174       if (!tagSuggestingArea) {
43175         return null;
43176       }
43177       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
43178       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
43179       if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
43180         return null;
43181       }
43182       return tagSuggestingArea;
43183     }
43184     function makeConnectEndpointsFixOnClick(way, graph) {
43185       if (way.nodes.length < 3)
43186         return null;
43187       var nodes = graph.childNodes(way), testNodes;
43188       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
43189       if (firstToLastDistanceMeters < 0.75) {
43190         testNodes = nodes.slice();
43191         testNodes.pop();
43192         testNodes.push(testNodes[0]);
43193         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43194           return function(context) {
43195             var way2 = context.entity(this.issue.entityIds[0]);
43196             context.perform(
43197               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
43198               _t("issues.fix.connect_endpoints.annotation")
43199             );
43200           };
43201         }
43202       }
43203       testNodes = nodes.slice();
43204       testNodes.push(testNodes[0]);
43205       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43206         return function(context) {
43207           var wayId = this.issue.entityIds[0];
43208           var way2 = context.entity(wayId);
43209           var nodeId = way2.nodes[0];
43210           var index = way2.nodes.length;
43211           context.perform(
43212             actionAddVertex(wayId, nodeId, index),
43213             _t("issues.fix.connect_endpoints.annotation")
43214           );
43215         };
43216       }
43217     }
43218     function lineTaggedAsAreaIssue(entity) {
43219       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
43220       if (!tagSuggestingArea)
43221         return null;
43222       var validAsLine = false;
43223       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
43224       if (presetAsLine) {
43225         validAsLine = true;
43226         var key = Object.keys(tagSuggestingArea)[0];
43227         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
43228           validAsLine = false;
43229         }
43230         if (Object.keys(presetAsLine.tags).length === 0) {
43231           validAsLine = false;
43232         }
43233       }
43234       return new validationIssue({
43235         type: type2,
43236         subtype: "area_as_line",
43237         severity: "warning",
43238         message: function(context) {
43239           var entity2 = context.hasEntity(this.entityIds[0]);
43240           return entity2 ? _t.append("issues.tag_suggests_area.message", {
43241             feature: utilDisplayLabel(
43242               entity2,
43243               "area",
43244               true
43245               /* verbose */
43246             ),
43247             tag: utilTagText({ tags: tagSuggestingArea })
43248           }) : "";
43249         },
43250         reference: showReference,
43251         entityIds: [entity.id],
43252         hash: JSON.stringify(tagSuggestingArea),
43253         dynamicFixes: function(context) {
43254           var fixes = [];
43255           var entity2 = context.entity(this.entityIds[0]);
43256           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
43257           if (!validAsLine) {
43258             fixes.push(new validationIssueFix({
43259               title: _t.append("issues.fix.connect_endpoints.title"),
43260               onClick: connectEndsOnClick
43261             }));
43262           }
43263           fixes.push(new validationIssueFix({
43264             icon: "iD-operation-delete",
43265             title: _t.append("issues.fix.remove_tag.title"),
43266             onClick: function(context2) {
43267               var entityId = this.issue.entityIds[0];
43268               var entity3 = context2.entity(entityId);
43269               var tags = Object.assign({}, entity3.tags);
43270               for (var key2 in tagSuggestingArea) {
43271                 delete tags[key2];
43272               }
43273               context2.perform(
43274                 actionChangeTags(entityId, tags),
43275                 _t("issues.fix.remove_tag.annotation")
43276               );
43277             }
43278           }));
43279           return fixes;
43280         }
43281       });
43282       function showReference(selection2) {
43283         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
43284       }
43285     }
43286     function vertexPointIssue(entity, graph) {
43287       if (entity.type !== "node")
43288         return null;
43289       if (Object.keys(entity.tags).length === 0)
43290         return null;
43291       if (entity.isOnAddressLine(graph))
43292         return null;
43293       var geometry = entity.geometry(graph);
43294       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
43295       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
43296         return new validationIssue({
43297           type: type2,
43298           subtype: "vertex_as_point",
43299           severity: "warning",
43300           message: function(context) {
43301             var entity2 = context.hasEntity(this.entityIds[0]);
43302             return entity2 ? _t.append("issues.vertex_as_point.message", {
43303               feature: utilDisplayLabel(
43304                 entity2,
43305                 "vertex",
43306                 true
43307                 /* verbose */
43308               )
43309             }) : "";
43310           },
43311           reference: function showReference(selection2) {
43312             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
43313           },
43314           entityIds: [entity.id]
43315         });
43316       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
43317         return new validationIssue({
43318           type: type2,
43319           subtype: "point_as_vertex",
43320           severity: "warning",
43321           message: function(context) {
43322             var entity2 = context.hasEntity(this.entityIds[0]);
43323             return entity2 ? _t.append("issues.point_as_vertex.message", {
43324               feature: utilDisplayLabel(
43325                 entity2,
43326                 "point",
43327                 true
43328                 /* verbose */
43329               )
43330             }) : "";
43331           },
43332           reference: function showReference(selection2) {
43333             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
43334           },
43335           entityIds: [entity.id],
43336           dynamicFixes: extractPointDynamicFixes
43337         });
43338       }
43339       return null;
43340     }
43341     function otherMismatchIssue(entity, graph) {
43342       if (!entity.hasInterestingTags())
43343         return null;
43344       if (entity.type !== "node" && entity.type !== "way")
43345         return null;
43346       if (entity.type === "node" && entity.isOnAddressLine(graph))
43347         return null;
43348       var sourceGeom = entity.geometry(graph);
43349       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
43350       if (sourceGeom === "area")
43351         targetGeoms.unshift("line");
43352       var asSource = _mainPresetIndex.match(entity, graph);
43353       var targetGeom = targetGeoms.find((nodeGeom) => {
43354         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
43355         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
43356         (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
43357           return false;
43358         if (asTarget.isFallback())
43359           return false;
43360         var primaryKey = Object.keys(asTarget.tags)[0];
43361         if (primaryKey === "building")
43362           return false;
43363         if (asTarget.tags[primaryKey] === "*")
43364           return false;
43365         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
43366       });
43367       if (!targetGeom)
43368         return null;
43369       var subtype = targetGeom + "_as_" + sourceGeom;
43370       if (targetGeom === "vertex")
43371         targetGeom = "point";
43372       if (sourceGeom === "vertex")
43373         sourceGeom = "point";
43374       var referenceId = targetGeom + "_as_" + sourceGeom;
43375       var dynamicFixes;
43376       if (targetGeom === "point") {
43377         dynamicFixes = extractPointDynamicFixes;
43378       } else if (sourceGeom === "area" && targetGeom === "line") {
43379         dynamicFixes = lineToAreaDynamicFixes;
43380       }
43381       return new validationIssue({
43382         type: type2,
43383         subtype,
43384         severity: "warning",
43385         message: function(context) {
43386           var entity2 = context.hasEntity(this.entityIds[0]);
43387           return entity2 ? _t.append("issues." + referenceId + ".message", {
43388             feature: utilDisplayLabel(
43389               entity2,
43390               targetGeom,
43391               true
43392               /* verbose */
43393             )
43394           }) : "";
43395         },
43396         reference: function showReference(selection2) {
43397           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
43398         },
43399         entityIds: [entity.id],
43400         dynamicFixes
43401       });
43402     }
43403     function lineToAreaDynamicFixes(context) {
43404       var convertOnClick;
43405       var entityId = this.entityIds[0];
43406       var entity = context.entity(entityId);
43407       var tags = Object.assign({}, entity.tags);
43408       delete tags.area;
43409       if (!osmTagSuggestingArea(tags)) {
43410         convertOnClick = function(context2) {
43411           var entityId2 = this.issue.entityIds[0];
43412           var entity2 = context2.entity(entityId2);
43413           var tags2 = Object.assign({}, entity2.tags);
43414           if (tags2.area) {
43415             delete tags2.area;
43416           }
43417           context2.perform(
43418             actionChangeTags(entityId2, tags2),
43419             _t("issues.fix.convert_to_line.annotation")
43420           );
43421         };
43422       }
43423       return [
43424         new validationIssueFix({
43425           icon: "iD-icon-line",
43426           title: _t.append("issues.fix.convert_to_line.title"),
43427           onClick: convertOnClick
43428         })
43429       ];
43430     }
43431     function extractPointDynamicFixes(context) {
43432       var entityId = this.entityIds[0];
43433       var extractOnClick = null;
43434       if (!context.hasHiddenConnections(entityId)) {
43435         extractOnClick = function(context2) {
43436           var entityId2 = this.issue.entityIds[0];
43437           var action = actionExtract(entityId2, context2.projection);
43438           context2.perform(
43439             action,
43440             _t("operations.extract.annotation", { n: 1 })
43441           );
43442           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
43443         };
43444       }
43445       return [
43446         new validationIssueFix({
43447           icon: "iD-operation-extract",
43448           title: _t.append("issues.fix.extract_point.title"),
43449           onClick: extractOnClick
43450         })
43451       ];
43452     }
43453     function unclosedMultipolygonPartIssues(entity, graph) {
43454       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
43455       !entity.isComplete(graph))
43456         return [];
43457       var sequences = osmJoinWays(entity.members, graph);
43458       var issues = [];
43459       for (var i3 in sequences) {
43460         var sequence = sequences[i3];
43461         if (!sequence.nodes)
43462           continue;
43463         var firstNode = sequence.nodes[0];
43464         var lastNode = sequence.nodes[sequence.nodes.length - 1];
43465         if (firstNode === lastNode)
43466           continue;
43467         var issue = new validationIssue({
43468           type: type2,
43469           subtype: "unclosed_multipolygon_part",
43470           severity: "warning",
43471           message: function(context) {
43472             var entity2 = context.hasEntity(this.entityIds[0]);
43473             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
43474               feature: utilDisplayLabel(
43475                 entity2,
43476                 context.graph(),
43477                 true
43478                 /* verbose */
43479               )
43480             }) : "";
43481           },
43482           reference: showReference,
43483           loc: sequence.nodes[0].loc,
43484           entityIds: [entity.id],
43485           hash: sequence.map(function(way) {
43486             return way.id;
43487           }).join()
43488         });
43489         issues.push(issue);
43490       }
43491       return issues;
43492       function showReference(selection2) {
43493         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
43494       }
43495     }
43496     var validation = function checkMismatchedGeometry(entity, graph) {
43497       var vertexPoint = vertexPointIssue(entity, graph);
43498       if (vertexPoint)
43499         return [vertexPoint];
43500       var lineAsArea = lineTaggedAsAreaIssue(entity);
43501       if (lineAsArea)
43502         return [lineAsArea];
43503       var mismatch = otherMismatchIssue(entity, graph);
43504       if (mismatch)
43505         return [mismatch];
43506       return unclosedMultipolygonPartIssues(entity, graph);
43507     };
43508     validation.type = type2;
43509     return validation;
43510   }
43511
43512   // modules/validations/missing_role.js
43513   function validationMissingRole() {
43514     var type2 = "missing_role";
43515     var validation = function checkMissingRole(entity, graph) {
43516       var issues = [];
43517       if (entity.type === "way") {
43518         graph.parentRelations(entity).forEach(function(relation) {
43519           if (!relation.isMultipolygon())
43520             return;
43521           var member = relation.memberById(entity.id);
43522           if (member && isMissingRole(member)) {
43523             issues.push(makeIssue(entity, relation, member));
43524           }
43525         });
43526       } else if (entity.type === "relation" && entity.isMultipolygon()) {
43527         entity.indexedMembers().forEach(function(member) {
43528           var way = graph.hasEntity(member.id);
43529           if (way && isMissingRole(member)) {
43530             issues.push(makeIssue(way, entity, member));
43531           }
43532         });
43533       }
43534       return issues;
43535     };
43536     function isMissingRole(member) {
43537       return !member.role || !member.role.trim().length;
43538     }
43539     function makeIssue(way, relation, member) {
43540       return new validationIssue({
43541         type: type2,
43542         severity: "warning",
43543         message: function(context) {
43544           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
43545           return member2 && relation2 ? _t.append("issues.missing_role.message", {
43546             member: utilDisplayLabel(member2, context.graph()),
43547             relation: utilDisplayLabel(relation2, context.graph())
43548           }) : "";
43549         },
43550         reference: showReference,
43551         entityIds: [relation.id, way.id],
43552         data: {
43553           member
43554         },
43555         hash: member.index.toString(),
43556         dynamicFixes: function() {
43557           return [
43558             makeAddRoleFix("inner"),
43559             makeAddRoleFix("outer"),
43560             new validationIssueFix({
43561               icon: "iD-operation-delete",
43562               title: _t.append("issues.fix.remove_from_relation.title"),
43563               onClick: function(context) {
43564                 context.perform(
43565                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
43566                   _t("operations.delete_member.annotation", {
43567                     n: 1
43568                   })
43569                 );
43570               }
43571             })
43572           ];
43573         }
43574       });
43575       function showReference(selection2) {
43576         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
43577       }
43578     }
43579     function makeAddRoleFix(role) {
43580       return new validationIssueFix({
43581         title: _t.append("issues.fix.set_as_" + role + ".title"),
43582         onClick: function(context) {
43583           var oldMember = this.issue.data.member;
43584           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
43585           context.perform(
43586             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
43587             _t("operations.change_role.annotation", {
43588               n: 1
43589             })
43590           );
43591         }
43592       });
43593     }
43594     validation.type = type2;
43595     return validation;
43596   }
43597
43598   // modules/validations/missing_tag.js
43599   function validationMissingTag(context) {
43600     var type2 = "missing_tag";
43601     function hasDescriptiveTags(entity, graph) {
43602       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
43603       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
43604         if (k2 === "area" || !osmIsInterestingTag(k2))
43605           return false;
43606         return !onlyAttributeKeys.some(function(attributeKey) {
43607           return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
43608         });
43609       });
43610       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
43611         return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43612       }
43613       return entityDescriptiveKeys.length > 0;
43614     }
43615     function isUnknownRoad(entity) {
43616       return entity.type === "way" && entity.tags.highway === "road";
43617     }
43618     function isUntypedRelation(entity) {
43619       return entity.type === "relation" && !entity.tags.type;
43620     }
43621     var validation = function checkMissingTag(entity, graph) {
43622       var subtype;
43623       var osm = context.connection();
43624       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
43625       if (!isUnloadedNode && // allow untagged nodes that are part of ways
43626       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
43627       !entity.hasParentRelations(graph)) {
43628         if (Object.keys(entity.tags).length === 0) {
43629           subtype = "any";
43630         } else if (!hasDescriptiveTags(entity, graph)) {
43631           subtype = "descriptive";
43632         } else if (isUntypedRelation(entity)) {
43633           subtype = "relation_type";
43634         }
43635       }
43636       if (!subtype && isUnknownRoad(entity)) {
43637         subtype = "highway_classification";
43638       }
43639       if (!subtype)
43640         return [];
43641       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
43642       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
43643       var canDelete = entity.version === void 0 || entity.v !== void 0;
43644       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
43645       return [new validationIssue({
43646         type: type2,
43647         subtype,
43648         severity,
43649         message: function(context2) {
43650           var entity2 = context2.hasEntity(this.entityIds[0]);
43651           return entity2 ? _t.append("issues." + messageID + ".message", {
43652             feature: utilDisplayLabel(entity2, context2.graph())
43653           }) : "";
43654         },
43655         reference: showReference,
43656         entityIds: [entity.id],
43657         dynamicFixes: function(context2) {
43658           var fixes = [];
43659           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
43660           fixes.push(new validationIssueFix({
43661             icon: "iD-icon-search",
43662             title: _t.append("issues.fix." + selectFixType + ".title"),
43663             onClick: function(context3) {
43664               context3.ui().sidebar.showPresetList();
43665             }
43666           }));
43667           var deleteOnClick;
43668           var id2 = this.entityIds[0];
43669           var operation = operationDelete(context2, [id2]);
43670           var disabledReasonID = operation.disabled();
43671           if (!disabledReasonID) {
43672             deleteOnClick = function(context3) {
43673               var id3 = this.issue.entityIds[0];
43674               var operation2 = operationDelete(context3, [id3]);
43675               if (!operation2.disabled()) {
43676                 operation2();
43677               }
43678             };
43679           }
43680           fixes.push(
43681             new validationIssueFix({
43682               icon: "iD-operation-delete",
43683               title: _t.append("issues.fix.delete_feature.title"),
43684               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
43685               onClick: deleteOnClick
43686             })
43687           );
43688           return fixes;
43689         }
43690       })];
43691       function showReference(selection2) {
43692         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
43693       }
43694     };
43695     validation.type = type2;
43696     return validation;
43697   }
43698
43699   // modules/validations/outdated_tags.js
43700   function validationOutdatedTags() {
43701     const type2 = "outdated_tags";
43702     let _waitingForDeprecated = true;
43703     let _dataDeprecated;
43704     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
43705     }).finally(() => _waitingForDeprecated = false);
43706     function oldTagIssues(entity, graph) {
43707       if (!entity.hasInterestingTags())
43708         return [];
43709       let preset = _mainPresetIndex.match(entity, graph);
43710       if (!preset)
43711         return [];
43712       const oldTags = Object.assign({}, entity.tags);
43713       let subtype = "deprecated_tags";
43714       if (preset.replacement) {
43715         const newPreset = _mainPresetIndex.item(preset.replacement);
43716         graph = actionChangePreset(
43717           entity.id,
43718           preset,
43719           newPreset,
43720           true
43721           /* skip field defaults */
43722         )(graph);
43723         entity = graph.entity(entity.id);
43724         preset = newPreset;
43725       }
43726       if (_dataDeprecated) {
43727         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
43728         if (deprecatedTags.length) {
43729           deprecatedTags.forEach((tag) => {
43730             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
43731           });
43732           entity = graph.entity(entity.id);
43733         }
43734       }
43735       let newTags = Object.assign({}, entity.tags);
43736       if (preset.tags !== preset.addTags) {
43737         Object.keys(preset.addTags).forEach((k2) => {
43738           if (!newTags[k2]) {
43739             if (preset.addTags[k2] === "*") {
43740               newTags[k2] = "yes";
43741             } else {
43742               newTags[k2] = preset.addTags[k2];
43743             }
43744           }
43745         });
43746       }
43747       const nsi = services.nsi;
43748       let waitingForNsi = false;
43749       let nsiResult;
43750       if (nsi) {
43751         waitingForNsi = nsi.status() === "loading";
43752         if (!waitingForNsi) {
43753           const loc = entity.extent(graph).center();
43754           nsiResult = nsi.upgradeTags(newTags, loc);
43755           if (nsiResult) {
43756             newTags = nsiResult.newTags;
43757             subtype = "noncanonical_brand";
43758           }
43759         }
43760       }
43761       let issues = [];
43762       issues.provisional = _waitingForDeprecated || waitingForNsi;
43763       const tagDiff = utilTagDiff(oldTags, newTags);
43764       if (!tagDiff.length)
43765         return issues;
43766       const isOnlyAddingTags = tagDiff.every((d2) => d2.type === "+");
43767       let prefix = "";
43768       if (nsiResult) {
43769         prefix = "noncanonical_brand.";
43770       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
43771         subtype = "incomplete_tags";
43772         prefix = "incomplete.";
43773       }
43774       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
43775       issues.push(new validationIssue({
43776         type: type2,
43777         subtype,
43778         severity: "warning",
43779         message: showMessage,
43780         reference: showReference,
43781         entityIds: [entity.id],
43782         hash: utilHashcode(JSON.stringify(tagDiff)),
43783         dynamicFixes: () => {
43784           let fixes = [
43785             new validationIssueFix({
43786               autoArgs,
43787               title: _t.append("issues.fix.upgrade_tags.title"),
43788               onClick: (context) => {
43789                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
43790               }
43791             })
43792           ];
43793           const item = nsiResult && nsiResult.matched;
43794           if (item) {
43795             fixes.push(
43796               new validationIssueFix({
43797                 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
43798                 onClick: (context) => {
43799                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
43800                 }
43801               })
43802             );
43803           }
43804           return fixes;
43805         }
43806       }));
43807       return issues;
43808       function doUpgrade(graph2) {
43809         const currEntity = graph2.hasEntity(entity.id);
43810         if (!currEntity)
43811           return graph2;
43812         let newTags2 = Object.assign({}, currEntity.tags);
43813         tagDiff.forEach((diff) => {
43814           if (diff.type === "-") {
43815             delete newTags2[diff.key];
43816           } else if (diff.type === "+") {
43817             newTags2[diff.key] = diff.newVal;
43818           }
43819         });
43820         return actionChangeTags(currEntity.id, newTags2)(graph2);
43821       }
43822       function addNotTag(graph2) {
43823         const currEntity = graph2.hasEntity(entity.id);
43824         if (!currEntity)
43825           return graph2;
43826         const item = nsiResult && nsiResult.matched;
43827         if (!item)
43828           return graph2;
43829         let newTags2 = Object.assign({}, currEntity.tags);
43830         const wd = item.mainTag;
43831         const notwd = `not:${wd}`;
43832         const qid = item.tags[wd];
43833         newTags2[notwd] = qid;
43834         if (newTags2[wd] === qid) {
43835           const wp = item.mainTag.replace("wikidata", "wikipedia");
43836           delete newTags2[wd];
43837           delete newTags2[wp];
43838         }
43839         return actionChangeTags(currEntity.id, newTags2)(graph2);
43840       }
43841       function showMessage(context) {
43842         const currEntity = context.hasEntity(entity.id);
43843         if (!currEntity)
43844           return "";
43845         let messageID = `issues.outdated_tags.${prefix}message`;
43846         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
43847           messageID += "_incomplete";
43848         }
43849         return _t.append(messageID, {
43850           feature: utilDisplayLabel(
43851             currEntity,
43852             context.graph(),
43853             true
43854             /* verbose */
43855           )
43856         });
43857       }
43858       function showReference(selection2) {
43859         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
43860         enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
43861         enter.append("strong").call(_t.append("issues.suggested"));
43862         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
43863           let klass = d2.type === "+" ? "add" : "remove";
43864           return `tagDiff-cell tagDiff-cell-${klass}`;
43865         }).html((d2) => d2.display);
43866       }
43867     }
43868     function oldMultipolygonIssues(entity, graph) {
43869       let multipolygon, outerWay;
43870       if (entity.type === "relation") {
43871         outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43872         multipolygon = entity;
43873       } else if (entity.type === "way") {
43874         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
43875         outerWay = entity;
43876       } else {
43877         return [];
43878       }
43879       if (!multipolygon || !outerWay)
43880         return [];
43881       return [new validationIssue({
43882         type: type2,
43883         subtype: "old_multipolygon",
43884         severity: "warning",
43885         message: showMessage,
43886         reference: showReference,
43887         entityIds: [outerWay.id, multipolygon.id],
43888         dynamicFixes: () => {
43889           return [
43890             new validationIssueFix({
43891               autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
43892               title: _t.append("issues.fix.move_tags.title"),
43893               onClick: (context) => {
43894                 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
43895               }
43896             })
43897           ];
43898         }
43899       })];
43900       function doUpgrade(graph2) {
43901         let currMultipolygon = graph2.hasEntity(multipolygon.id);
43902         let currOuterWay = graph2.hasEntity(outerWay.id);
43903         if (!currMultipolygon || !currOuterWay)
43904           return graph2;
43905         currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
43906         graph2 = graph2.replace(currMultipolygon);
43907         return actionChangeTags(currOuterWay.id, {})(graph2);
43908       }
43909       function showMessage(context) {
43910         let currMultipolygon = context.hasEntity(multipolygon.id);
43911         if (!currMultipolygon)
43912           return "";
43913         return _t.append(
43914           "issues.old_multipolygon.message",
43915           { multipolygon: utilDisplayLabel(
43916             currMultipolygon,
43917             context.graph(),
43918             true
43919             /* verbose */
43920           ) }
43921         );
43922       }
43923       function showReference(selection2) {
43924         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
43925       }
43926     }
43927     let validation = function checkOutdatedTags(entity, graph) {
43928       let issues = oldMultipolygonIssues(entity, graph);
43929       if (!issues.length)
43930         issues = oldTagIssues(entity, graph);
43931       return issues;
43932     };
43933     validation.type = type2;
43934     return validation;
43935   }
43936
43937   // modules/validations/private_data.js
43938   function validationPrivateData() {
43939     var type2 = "private_data";
43940     var privateBuildingValues = {
43941       detached: true,
43942       farm: true,
43943       house: true,
43944       houseboat: true,
43945       residential: true,
43946       semidetached_house: true,
43947       static_caravan: true
43948     };
43949     var publicKeys = {
43950       amenity: true,
43951       craft: true,
43952       historic: true,
43953       leisure: true,
43954       office: true,
43955       shop: true,
43956       tourism: true
43957     };
43958     var personalTags = {
43959       "contact:email": true,
43960       "contact:fax": true,
43961       "contact:phone": true,
43962       email: true,
43963       fax: true,
43964       phone: true
43965     };
43966     var validation = function checkPrivateData(entity) {
43967       var tags = entity.tags;
43968       if (!tags.building || !privateBuildingValues[tags.building])
43969         return [];
43970       var keepTags = {};
43971       for (var k2 in tags) {
43972         if (publicKeys[k2])
43973           return [];
43974         if (!personalTags[k2]) {
43975           keepTags[k2] = tags[k2];
43976         }
43977       }
43978       var tagDiff = utilTagDiff(tags, keepTags);
43979       if (!tagDiff.length)
43980         return [];
43981       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
43982       return [new validationIssue({
43983         type: type2,
43984         severity: "warning",
43985         message: showMessage,
43986         reference: showReference,
43987         entityIds: [entity.id],
43988         dynamicFixes: function() {
43989           return [
43990             new validationIssueFix({
43991               icon: "iD-operation-delete",
43992               title: _t.append("issues.fix." + fixID + ".title"),
43993               onClick: function(context) {
43994                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
43995               }
43996             })
43997           ];
43998         }
43999       })];
44000       function doUpgrade(graph) {
44001         var currEntity = graph.hasEntity(entity.id);
44002         if (!currEntity)
44003           return graph;
44004         var newTags = Object.assign({}, currEntity.tags);
44005         tagDiff.forEach(function(diff) {
44006           if (diff.type === "-") {
44007             delete newTags[diff.key];
44008           } else if (diff.type === "+") {
44009             newTags[diff.key] = diff.newVal;
44010           }
44011         });
44012         return actionChangeTags(currEntity.id, newTags)(graph);
44013       }
44014       function showMessage(context) {
44015         var currEntity = context.hasEntity(this.entityIds[0]);
44016         if (!currEntity)
44017           return "";
44018         return _t.append(
44019           "issues.private_data.contact.message",
44020           { feature: utilDisplayLabel(currEntity, context.graph()) }
44021         );
44022       }
44023       function showReference(selection2) {
44024         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
44025         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
44026         enter.append("strong").call(_t.append("issues.suggested"));
44027         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", function(d2) {
44028           var klass = d2.type === "+" ? "add" : "remove";
44029           return "tagDiff-cell tagDiff-cell-" + klass;
44030         }).html(function(d2) {
44031           return d2.display;
44032         });
44033       }
44034     };
44035     validation.type = type2;
44036     return validation;
44037   }
44038
44039   // modules/validations/suspicious_name.js
44040   function validationSuspiciousName() {
44041     const type2 = "suspicious_name";
44042     const keysToTestForGenericValues = [
44043       "aerialway",
44044       "aeroway",
44045       "amenity",
44046       "building",
44047       "craft",
44048       "highway",
44049       "leisure",
44050       "railway",
44051       "man_made",
44052       "office",
44053       "shop",
44054       "tourism",
44055       "waterway"
44056     ];
44057     let _waitingForNsi = false;
44058     function isGenericMatchInNsi(tags) {
44059       const nsi = services.nsi;
44060       if (nsi) {
44061         _waitingForNsi = nsi.status() === "loading";
44062         if (!_waitingForNsi) {
44063           return nsi.isGenericName(tags);
44064         }
44065       }
44066       return false;
44067     }
44068     function nameMatchesRawTag(lowercaseName, tags) {
44069       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
44070         let key = keysToTestForGenericValues[i3];
44071         let val = tags[key];
44072         if (val) {
44073           val = val.toLowerCase();
44074           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
44075             return true;
44076           }
44077         }
44078       }
44079       return false;
44080     }
44081     function isGenericName(name, tags) {
44082       name = name.toLowerCase();
44083       return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
44084     }
44085     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
44086       return new validationIssue({
44087         type: type2,
44088         subtype: "generic_name",
44089         severity: "warning",
44090         message: function(context) {
44091           let entity = context.hasEntity(this.entityIds[0]);
44092           if (!entity)
44093             return "";
44094           let preset = _mainPresetIndex.match(entity, context.graph());
44095           let langName = langCode && _mainLocalizer.languageName(langCode);
44096           return _t.append(
44097             "issues.generic_name.message" + (langName ? "_language" : ""),
44098             { feature: preset.name(), name: genericName, language: langName }
44099           );
44100         },
44101         reference: showReference,
44102         entityIds: [entityId],
44103         hash: `${nameKey}=${genericName}`,
44104         dynamicFixes: function() {
44105           return [
44106             new validationIssueFix({
44107               icon: "iD-operation-delete",
44108               title: _t.append("issues.fix.remove_the_name.title"),
44109               onClick: function(context) {
44110                 let entityId2 = this.issue.entityIds[0];
44111                 let entity = context.entity(entityId2);
44112                 let tags = Object.assign({}, entity.tags);
44113                 delete tags[nameKey];
44114                 context.perform(
44115                   actionChangeTags(entityId2, tags),
44116                   _t("issues.fix.remove_generic_name.annotation")
44117                 );
44118               }
44119             })
44120           ];
44121         }
44122       });
44123       function showReference(selection2) {
44124         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44125       }
44126     }
44127     function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
44128       return new validationIssue({
44129         type: type2,
44130         subtype: "not_name",
44131         severity: "warning",
44132         message: function(context) {
44133           const entity = context.hasEntity(this.entityIds[0]);
44134           if (!entity)
44135             return "";
44136           const preset = _mainPresetIndex.match(entity, context.graph());
44137           const langName = langCode && _mainLocalizer.languageName(langCode);
44138           return _t.append(
44139             "issues.incorrect_name.message" + (langName ? "_language" : ""),
44140             { feature: preset.name(), name: incorrectName, language: langName }
44141           );
44142         },
44143         reference: showReference,
44144         entityIds: [entityId],
44145         hash: `${nameKey}=${incorrectName}`,
44146         dynamicFixes: function() {
44147           return [
44148             new validationIssueFix({
44149               icon: "iD-operation-delete",
44150               title: _t.append("issues.fix.remove_the_name.title"),
44151               onClick: function(context) {
44152                 const entityId2 = this.issue.entityIds[0];
44153                 const entity = context.entity(entityId2);
44154                 let tags = Object.assign({}, entity.tags);
44155                 delete tags[nameKey];
44156                 context.perform(
44157                   actionChangeTags(entityId2, tags),
44158                   _t("issues.fix.remove_mistaken_name.annotation")
44159                 );
44160               }
44161             })
44162           ];
44163         }
44164       });
44165       function showReference(selection2) {
44166         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44167       }
44168     }
44169     let validation = function checkGenericName(entity) {
44170       const tags = entity.tags;
44171       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
44172       if (hasWikidata)
44173         return [];
44174       let issues = [];
44175       const notNames2 = (tags["not:name"] || "").split(";");
44176       for (let key in tags) {
44177         const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
44178         if (!m2)
44179           continue;
44180         const langCode = m2.length >= 2 ? m2[1] : null;
44181         const value = tags[key];
44182         if (notNames2.length) {
44183           for (let i3 in notNames2) {
44184             const notName = notNames2[i3];
44185             if (notName && value === notName) {
44186               issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
44187               continue;
44188             }
44189           }
44190         }
44191         if (isGenericName(value, tags)) {
44192           issues.provisional = _waitingForNsi;
44193           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
44194         }
44195       }
44196       return issues;
44197     };
44198     validation.type = type2;
44199     return validation;
44200   }
44201
44202   // modules/validations/unsquare_way.js
44203   function validationUnsquareWay(context) {
44204     var type2 = "unsquare_way";
44205     var DEFAULT_DEG_THRESHOLD = 5;
44206     var epsilon3 = 0.05;
44207     var nodeThreshold = 10;
44208     function isBuilding(entity, graph) {
44209       if (entity.type !== "way" || entity.geometry(graph) !== "area")
44210         return false;
44211       return entity.tags.building && entity.tags.building !== "no";
44212     }
44213     var validation = function checkUnsquareWay(entity, graph) {
44214       if (!isBuilding(entity, graph))
44215         return [];
44216       if (entity.tags.nonsquare === "yes")
44217         return [];
44218       var isClosed = entity.isClosed();
44219       if (!isClosed)
44220         return [];
44221       var nodes = graph.childNodes(entity).slice();
44222       if (nodes.length > nodeThreshold + 1)
44223         return [];
44224       var osm = services.osm;
44225       if (!osm || nodes.some(function(node) {
44226         return !osm.isDataLoaded(node.loc);
44227       }))
44228         return [];
44229       var hasConnectedSquarableWays = nodes.some(function(node) {
44230         return graph.parentWays(node).some(function(way) {
44231           if (way.id === entity.id)
44232             return false;
44233           if (isBuilding(way, graph))
44234             return true;
44235           return graph.parentRelations(way).some(function(parentRelation) {
44236             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
44237           });
44238         });
44239       });
44240       if (hasConnectedSquarableWays)
44241         return [];
44242       var storedDegreeThreshold = corePreferences("validate-square-degrees");
44243       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
44244       var points = nodes.map(function(node) {
44245         return context.projection(node.loc);
44246       });
44247       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
44248         return [];
44249       var autoArgs;
44250       if (!entity.tags.wikidata) {
44251         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
44252         autoAction.transitionable = false;
44253         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
44254       }
44255       return [new validationIssue({
44256         type: type2,
44257         subtype: "building",
44258         severity: "warning",
44259         message: function(context2) {
44260           var entity2 = context2.hasEntity(this.entityIds[0]);
44261           return entity2 ? _t.append("issues.unsquare_way.message", {
44262             feature: utilDisplayLabel(entity2, context2.graph())
44263           }) : "";
44264         },
44265         reference: showReference,
44266         entityIds: [entity.id],
44267         hash: degreeThreshold,
44268         dynamicFixes: function() {
44269           return [
44270             new validationIssueFix({
44271               icon: "iD-operation-orthogonalize",
44272               title: _t.append("issues.fix.square_feature.title"),
44273               autoArgs,
44274               onClick: function(context2, completionHandler) {
44275                 var entityId = this.issue.entityIds[0];
44276                 context2.perform(
44277                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
44278                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
44279                 );
44280                 window.setTimeout(function() {
44281                   completionHandler();
44282                 }, 175);
44283               }
44284             })
44285             /*
44286             new validationIssueFix({
44287                 title: t.append('issues.fix.tag_as_unsquare.title'),
44288                 onClick: function(context) {
44289                     var entityId = this.issue.entityIds[0];
44290                     var entity = context.entity(entityId);
44291                     var tags = Object.assign({}, entity.tags);  // shallow copy
44292                     tags.nonsquare = 'yes';
44293                     context.perform(
44294                         actionChangeTags(entityId, tags),
44295                         t('issues.fix.tag_as_unsquare.annotation')
44296                     );
44297                 }
44298             })
44299             */
44300           ];
44301         }
44302       })];
44303       function showReference(selection2) {
44304         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
44305       }
44306     };
44307     validation.type = type2;
44308     return validation;
44309   }
44310
44311   // modules/core/validator.js
44312   function coreValidator(context) {
44313     let dispatch14 = dispatch_default("validated", "focusedIssue");
44314     let validator = utilRebind({}, dispatch14, "on");
44315     let _rules = {};
44316     let _disabledRules = {};
44317     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
44318     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
44319     let _baseCache = validationCache("base");
44320     let _headCache = validationCache("head");
44321     let _completeDiff = {};
44322     let _headIsCurrent = false;
44323     let _deferredRIC = {};
44324     let _deferredST = /* @__PURE__ */ new Set();
44325     let _headPromise;
44326     const RETRY = 5e3;
44327     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
44328     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
44329     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
44330     function parseHashParam(param) {
44331       let result = [];
44332       let rules = (param || "").split(",");
44333       rules.forEach((rule) => {
44334         rule = rule.trim();
44335         const parts = rule.split("/", 2);
44336         const type2 = parts[0];
44337         const subtype = parts[1] || "*";
44338         if (!type2 || !subtype)
44339           return;
44340         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
44341       });
44342       return result;
44343       function makeRegExp(str2) {
44344         const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
44345         return new RegExp("^" + escaped + "$");
44346       }
44347     }
44348     validator.init = () => {
44349       Object.values(validations_exports).forEach((validation) => {
44350         if (typeof validation !== "function")
44351           return;
44352         const fn = validation(context);
44353         const key = fn.type;
44354         _rules[key] = fn;
44355       });
44356       let disabledRules = corePreferences("validate-disabledRules");
44357       if (disabledRules) {
44358         disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
44359       }
44360     };
44361     function reset(resetIgnored) {
44362       _baseCache.queue = [];
44363       _headCache.queue = [];
44364       Object.keys(_deferredRIC).forEach((key) => {
44365         window.cancelIdleCallback(key);
44366         _deferredRIC[key]();
44367       });
44368       _deferredRIC = {};
44369       _deferredST.forEach(window.clearTimeout);
44370       _deferredST.clear();
44371       if (resetIgnored)
44372         _ignoredIssueIDs.clear();
44373       _resolvedIssueIDs.clear();
44374       _baseCache = validationCache("base");
44375       _headCache = validationCache("head");
44376       _completeDiff = {};
44377       _headIsCurrent = false;
44378     }
44379     validator.reset = () => {
44380       reset(true);
44381     };
44382     validator.resetIgnoredIssues = () => {
44383       _ignoredIssueIDs.clear();
44384       dispatch14.call("validated");
44385     };
44386     validator.revalidateUnsquare = () => {
44387       revalidateUnsquare(_headCache);
44388       revalidateUnsquare(_baseCache);
44389       dispatch14.call("validated");
44390     };
44391     function revalidateUnsquare(cache) {
44392       const checkUnsquareWay = _rules.unsquare_way;
44393       if (!cache.graph || typeof checkUnsquareWay !== "function")
44394         return;
44395       cache.uncacheIssuesOfType("unsquare_way");
44396       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");
44397       buildings.forEach((entity) => {
44398         const detected = checkUnsquareWay(entity, cache.graph);
44399         if (!detected.length)
44400           return;
44401         cache.cacheIssues(detected);
44402       });
44403     }
44404     validator.getIssues = (options2) => {
44405       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
44406       const view = context.map().extent();
44407       let seen = /* @__PURE__ */ new Set();
44408       let results = [];
44409       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
44410         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
44411           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44412           if (opts.what === "edited" && !userModified)
44413             return;
44414           if (!filter2(issue))
44415             return;
44416           seen.add(issue.id);
44417           results.push(issue);
44418         });
44419       }
44420       if (opts.what === "all") {
44421         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
44422           if (!filter2(issue))
44423             return;
44424           seen.add(issue.id);
44425           results.push(issue);
44426         });
44427       }
44428       return results;
44429       function filter2(issue) {
44430         if (!issue)
44431           return false;
44432         if (seen.has(issue.id))
44433           return false;
44434         if (_resolvedIssueIDs.has(issue.id))
44435           return false;
44436         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
44437           return false;
44438         if (!opts.includeDisabledRules && _disabledRules[issue.type])
44439           return false;
44440         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
44441           return false;
44442         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
44443           return false;
44444         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
44445           return false;
44446         if (opts.where === "visible") {
44447           const extent = issue.extent(context.graph());
44448           if (!view.intersects(extent))
44449             return false;
44450         }
44451         return true;
44452       }
44453     };
44454     validator.getResolvedIssues = () => {
44455       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
44456     };
44457     validator.focusIssue = (issue) => {
44458       const graph = context.graph();
44459       let selectID;
44460       let focusCenter;
44461       const issueExtent = issue.extent(graph);
44462       if (issueExtent) {
44463         focusCenter = issueExtent.center();
44464       }
44465       if (issue.entityIds && issue.entityIds.length) {
44466         selectID = issue.entityIds[0];
44467         if (selectID && selectID.charAt(0) === "r") {
44468           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
44469           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
44470           if (!nodeID) {
44471             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
44472             if (wayID) {
44473               nodeID = graph.entity(wayID).first();
44474             }
44475           }
44476           if (nodeID) {
44477             focusCenter = graph.entity(nodeID).loc;
44478           }
44479         }
44480       }
44481       if (focusCenter) {
44482         const setZoom = Math.max(context.map().zoom(), 19);
44483         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
44484       }
44485       if (selectID) {
44486         window.setTimeout(() => {
44487           context.enter(modeSelect(context, [selectID]));
44488           dispatch14.call("focusedIssue", this, issue);
44489         }, 250);
44490       }
44491     };
44492     validator.getIssuesBySeverity = (options2) => {
44493       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
44494       groups.error = groups.error || [];
44495       groups.warning = groups.warning || [];
44496       return groups;
44497     };
44498     validator.getSharedEntityIssues = (entityIDs, options2) => {
44499       const orderedIssueTypes = [
44500         // Show some issue types in a particular order:
44501         "missing_tag",
44502         "missing_role",
44503         // - missing data first
44504         "outdated_tags",
44505         "mismatched_geometry",
44506         // - identity issues
44507         "crossing_ways",
44508         "almost_junction",
44509         // - geometry issues where fixing them might solve connectivity issues
44510         "disconnected_way",
44511         "impossible_oneway"
44512         // - finally connectivity issues
44513       ];
44514       const allIssues = validator.getIssues(options2);
44515       const forEntityIDs = new Set(entityIDs);
44516       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
44517         if (issue1.type === issue2.type) {
44518           return issue1.id < issue2.id ? -1 : 1;
44519         }
44520         const index1 = orderedIssueTypes.indexOf(issue1.type);
44521         const index2 = orderedIssueTypes.indexOf(issue2.type);
44522         if (index1 !== -1 && index2 !== -1) {
44523           return index1 - index2;
44524         } else if (index1 === -1 && index2 === -1) {
44525           return issue1.type < issue2.type ? -1 : 1;
44526         } else {
44527           return index1 !== -1 ? -1 : 1;
44528         }
44529       });
44530     };
44531     validator.getEntityIssues = (entityID, options2) => {
44532       return validator.getSharedEntityIssues([entityID], options2);
44533     };
44534     validator.getRuleKeys = () => {
44535       return Object.keys(_rules);
44536     };
44537     validator.isRuleEnabled = (key) => {
44538       return !_disabledRules[key];
44539     };
44540     validator.toggleRule = (key) => {
44541       if (_disabledRules[key]) {
44542         delete _disabledRules[key];
44543       } else {
44544         _disabledRules[key] = true;
44545       }
44546       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44547       validator.validate();
44548     };
44549     validator.disableRules = (keys2) => {
44550       _disabledRules = {};
44551       keys2.forEach((k2) => _disabledRules[k2] = true);
44552       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44553       validator.validate();
44554     };
44555     validator.ignoreIssue = (issueID) => {
44556       _ignoredIssueIDs.add(issueID);
44557     };
44558     validator.validate = () => {
44559       const baseGraph = context.history().base();
44560       if (!_headCache.graph)
44561         _headCache.graph = baseGraph;
44562       if (!_baseCache.graph)
44563         _baseCache.graph = baseGraph;
44564       const prevGraph = _headCache.graph;
44565       const currGraph = context.graph();
44566       if (currGraph === prevGraph) {
44567         _headIsCurrent = true;
44568         dispatch14.call("validated");
44569         return Promise.resolve();
44570       }
44571       if (_headPromise) {
44572         _headIsCurrent = false;
44573         return _headPromise;
44574       }
44575       _headCache.graph = currGraph;
44576       _completeDiff = context.history().difference().complete();
44577       const incrementalDiff = coreDifference(prevGraph, currGraph);
44578       let entityIDs = Object.keys(incrementalDiff.complete());
44579       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
44580       if (!entityIDs.size) {
44581         dispatch14.call("validated");
44582         return Promise.resolve();
44583       }
44584       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
44585       }).then(() => {
44586         _headPromise = null;
44587         if (!_headIsCurrent) {
44588           validator.validate();
44589         }
44590       });
44591       return _headPromise;
44592     };
44593     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
44594       reset(false);
44595       validator.validate();
44596     });
44597     context.on("exit.validator", validator.validate);
44598     context.history().on("merge.validator", (entities) => {
44599       if (!entities)
44600         return;
44601       const baseGraph = context.history().base();
44602       if (!_headCache.graph)
44603         _headCache.graph = baseGraph;
44604       if (!_baseCache.graph)
44605         _baseCache.graph = baseGraph;
44606       let entityIDs = entities.map((entity) => entity.id);
44607       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
44608       validateEntitiesAsync(entityIDs, _baseCache);
44609     });
44610     function validateEntity(entity, graph) {
44611       let result = { issues: [], provisional: false };
44612       Object.keys(_rules).forEach(runValidation);
44613       return result;
44614       function runValidation(key) {
44615         const fn = _rules[key];
44616         if (typeof fn !== "function") {
44617           console.error("no such validation rule = " + key);
44618           return;
44619         }
44620         let detected = fn(entity, graph);
44621         if (detected.provisional) {
44622           result.provisional = true;
44623         }
44624         detected = detected.filter(applySeverityOverrides);
44625         result.issues = result.issues.concat(detected);
44626         function applySeverityOverrides(issue) {
44627           const type2 = issue.type;
44628           const subtype = issue.subtype || "";
44629           let i3;
44630           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
44631             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
44632               issue.severity = "error";
44633               return true;
44634             }
44635           }
44636           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
44637             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
44638               issue.severity = "warning";
44639               return true;
44640             }
44641           }
44642           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
44643             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
44644               return false;
44645             }
44646           }
44647           return true;
44648         }
44649       }
44650     }
44651     function updateResolvedIssues(entityIDs) {
44652       entityIDs.forEach((entityID) => {
44653         const baseIssues = _baseCache.issuesByEntityID[entityID];
44654         if (!baseIssues)
44655           return;
44656         baseIssues.forEach((issueID) => {
44657           const issue = _baseCache.issuesByIssueID[issueID];
44658           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44659           if (userModified && !_headCache.issuesByIssueID[issueID]) {
44660             _resolvedIssueIDs.add(issueID);
44661           } else {
44662             _resolvedIssueIDs.delete(issueID);
44663           }
44664         });
44665       });
44666     }
44667     function validateEntitiesAsync(entityIDs, cache) {
44668       const jobs = Array.from(entityIDs).map((entityID) => {
44669         if (cache.queuedEntityIDs.has(entityID))
44670           return null;
44671         cache.queuedEntityIDs.add(entityID);
44672         cache.uncacheEntityID(entityID);
44673         return () => {
44674           cache.queuedEntityIDs.delete(entityID);
44675           const graph = cache.graph;
44676           if (!graph)
44677             return;
44678           const entity = graph.hasEntity(entityID);
44679           if (!entity)
44680             return;
44681           const result = validateEntity(entity, graph);
44682           if (result.provisional) {
44683             cache.provisionalEntityIDs.add(entityID);
44684           }
44685           cache.cacheIssues(result.issues);
44686         };
44687       }).filter(Boolean);
44688       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
44689       if (cache.queuePromise)
44690         return cache.queuePromise;
44691       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
44692       }).finally(() => cache.queuePromise = null);
44693       return cache.queuePromise;
44694     }
44695     function revalidateProvisionalEntities(cache) {
44696       if (!cache.provisionalEntityIDs.size)
44697         return;
44698       const handle = window.setTimeout(() => {
44699         _deferredST.delete(handle);
44700         if (!cache.provisionalEntityIDs.size)
44701           return;
44702         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
44703       }, RETRY);
44704       _deferredST.add(handle);
44705     }
44706     function processQueue(cache) {
44707       if (!cache.queue.length)
44708         return Promise.resolve();
44709       const chunk = cache.queue.pop();
44710       return new Promise((resolvePromise, rejectPromise) => {
44711         const handle = window.requestIdleCallback(() => {
44712           delete _deferredRIC[handle];
44713           chunk.forEach((job) => job());
44714           resolvePromise();
44715         });
44716         _deferredRIC[handle] = rejectPromise;
44717       }).then(() => {
44718         if (cache.queue.length % 25 === 0)
44719           dispatch14.call("validated");
44720       }).then(() => processQueue(cache));
44721     }
44722     return validator;
44723   }
44724   function validationCache(which) {
44725     let cache = {
44726       which,
44727       graph: null,
44728       queue: [],
44729       queuePromise: null,
44730       queuedEntityIDs: /* @__PURE__ */ new Set(),
44731       provisionalEntityIDs: /* @__PURE__ */ new Set(),
44732       issuesByIssueID: {},
44733       // issue.id -> issue
44734       issuesByEntityID: {}
44735       // entity.id -> Set(issue.id)
44736     };
44737     cache.cacheIssue = (issue) => {
44738       (issue.entityIds || []).forEach((entityID) => {
44739         if (!cache.issuesByEntityID[entityID]) {
44740           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
44741         }
44742         cache.issuesByEntityID[entityID].add(issue.id);
44743       });
44744       cache.issuesByIssueID[issue.id] = issue;
44745     };
44746     cache.uncacheIssue = (issue) => {
44747       (issue.entityIds || []).forEach((entityID) => {
44748         if (cache.issuesByEntityID[entityID]) {
44749           cache.issuesByEntityID[entityID].delete(issue.id);
44750         }
44751       });
44752       delete cache.issuesByIssueID[issue.id];
44753     };
44754     cache.cacheIssues = (issues) => {
44755       issues.forEach(cache.cacheIssue);
44756     };
44757     cache.uncacheIssues = (issues) => {
44758       issues.forEach(cache.uncacheIssue);
44759     };
44760     cache.uncacheIssuesOfType = (type2) => {
44761       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
44762       cache.uncacheIssues(issuesOfType);
44763     };
44764     cache.uncacheEntityID = (entityID) => {
44765       const entityIssueIDs = cache.issuesByEntityID[entityID];
44766       if (entityIssueIDs) {
44767         entityIssueIDs.forEach((issueID) => {
44768           const issue = cache.issuesByIssueID[issueID];
44769           if (issue) {
44770             cache.uncacheIssue(issue);
44771           } else {
44772             delete cache.issuesByIssueID[issueID];
44773           }
44774         });
44775       }
44776       delete cache.issuesByEntityID[entityID];
44777       cache.provisionalEntityIDs.delete(entityID);
44778     };
44779     cache.withAllRelatedEntities = (entityIDs) => {
44780       let result = /* @__PURE__ */ new Set();
44781       (entityIDs || []).forEach((entityID) => {
44782         result.add(entityID);
44783         const entityIssueIDs = cache.issuesByEntityID[entityID];
44784         if (entityIssueIDs) {
44785           entityIssueIDs.forEach((issueID) => {
44786             const issue = cache.issuesByIssueID[issueID];
44787             if (issue) {
44788               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
44789             } else {
44790               delete cache.issuesByIssueID[issueID];
44791             }
44792           });
44793         }
44794       });
44795       return result;
44796     };
44797     return cache;
44798   }
44799
44800   // modules/core/uploader.js
44801   function coreUploader(context) {
44802     var dispatch14 = dispatch_default(
44803       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
44804       "saveStarted",
44805       // dispatched as soon as a call to `save` has been deemed legitimate
44806       "saveEnded",
44807       // dispatched after the result event has been dispatched
44808       "willAttemptUpload",
44809       // dispatched before the actual upload call occurs, if it will
44810       "progressChanged",
44811       // Each save results in one of these outcomes:
44812       "resultNoChanges",
44813       // upload wasn't attempted since there were no edits
44814       "resultErrors",
44815       // upload failed due to errors
44816       "resultConflicts",
44817       // upload failed due to data conflicts
44818       "resultSuccess"
44819       // upload completed without errors
44820     );
44821     var _isSaving = false;
44822     var _conflicts = [];
44823     var _errors = [];
44824     var _origChanges;
44825     var _discardTags = {};
44826     _mainFileFetcher.get("discarded").then(function(d2) {
44827       _discardTags = d2;
44828     }).catch(function() {
44829     });
44830     var uploader = utilRebind({}, dispatch14, "on");
44831     uploader.isSaving = function() {
44832       return _isSaving;
44833     };
44834     uploader.save = function(changeset, tryAgain, checkConflicts) {
44835       if (_isSaving && !tryAgain) {
44836         return;
44837       }
44838       var osm = context.connection();
44839       if (!osm)
44840         return;
44841       if (!osm.authenticated()) {
44842         osm.authenticate(function(err) {
44843           if (!err) {
44844             uploader.save(changeset, tryAgain, checkConflicts);
44845           }
44846         });
44847         return;
44848       }
44849       if (!_isSaving) {
44850         _isSaving = true;
44851         dispatch14.call("saveStarted", this);
44852       }
44853       var history = context.history();
44854       _conflicts = [];
44855       _errors = [];
44856       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
44857       if (!tryAgain) {
44858         history.perform(actionNoop());
44859       }
44860       if (!checkConflicts) {
44861         upload(changeset);
44862       } else {
44863         performFullConflictCheck(changeset);
44864       }
44865     };
44866     function performFullConflictCheck(changeset) {
44867       var osm = context.connection();
44868       if (!osm)
44869         return;
44870       var history = context.history();
44871       var localGraph = context.graph();
44872       var remoteGraph = coreGraph(history.base(), true);
44873       var summary = history.difference().summary();
44874       var _toCheck = [];
44875       for (var i3 = 0; i3 < summary.length; i3++) {
44876         var item = summary[i3];
44877         if (item.changeType === "modified") {
44878           _toCheck.push(item.entity.id);
44879         }
44880       }
44881       var _toLoad = withChildNodes(_toCheck, localGraph);
44882       var _loaded = {};
44883       var _toLoadCount = 0;
44884       var _toLoadTotal = _toLoad.length;
44885       if (_toCheck.length) {
44886         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
44887         _toLoad.forEach(function(id2) {
44888           _loaded[id2] = false;
44889         });
44890         osm.loadMultiple(_toLoad, loaded);
44891       } else {
44892         upload(changeset);
44893       }
44894       return;
44895       function withChildNodes(ids, graph) {
44896         var s2 = new Set(ids);
44897         ids.forEach(function(id2) {
44898           var entity = graph.entity(id2);
44899           if (entity.type !== "way")
44900             return;
44901           graph.childNodes(entity).forEach(function(child) {
44902             if (child.version !== void 0) {
44903               s2.add(child.id);
44904             }
44905           });
44906         });
44907         return Array.from(s2);
44908       }
44909       function loaded(err, result) {
44910         if (_errors.length)
44911           return;
44912         if (err) {
44913           _errors.push({
44914             msg: err.message || err.responseText,
44915             details: [_t("save.status_code", { code: err.status })]
44916           });
44917           didResultInErrors();
44918         } else {
44919           var loadMore = [];
44920           result.data.forEach(function(entity) {
44921             remoteGraph.replace(entity);
44922             _loaded[entity.id] = true;
44923             _toLoad = _toLoad.filter(function(val) {
44924               return val !== entity.id;
44925             });
44926             if (!entity.visible)
44927               return;
44928             var i4, id2;
44929             if (entity.type === "way") {
44930               for (i4 = 0; i4 < entity.nodes.length; i4++) {
44931                 id2 = entity.nodes[i4];
44932                 if (_loaded[id2] === void 0) {
44933                   _loaded[id2] = false;
44934                   loadMore.push(id2);
44935                 }
44936               }
44937             } else if (entity.type === "relation" && entity.isMultipolygon()) {
44938               for (i4 = 0; i4 < entity.members.length; i4++) {
44939                 id2 = entity.members[i4].id;
44940                 if (_loaded[id2] === void 0) {
44941                   _loaded[id2] = false;
44942                   loadMore.push(id2);
44943                 }
44944               }
44945             }
44946           });
44947           _toLoadCount += result.data.length;
44948           _toLoadTotal += loadMore.length;
44949           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
44950           if (loadMore.length) {
44951             _toLoad.push.apply(_toLoad, loadMore);
44952             osm.loadMultiple(loadMore, loaded);
44953           }
44954           if (!_toLoad.length) {
44955             detectConflicts();
44956             upload(changeset);
44957           }
44958         }
44959       }
44960       function detectConflicts() {
44961         function choice(id2, text2, action) {
44962           return {
44963             id: id2,
44964             text: text2,
44965             action: function() {
44966               history.replace(action);
44967             }
44968           };
44969         }
44970         function formatUser(d2) {
44971           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
44972         }
44973         function entityName(entity) {
44974           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
44975         }
44976         function sameVersions(local, remote) {
44977           if (local.version !== remote.version)
44978             return false;
44979           if (local.type === "way") {
44980             var children2 = utilArrayUnion(local.nodes, remote.nodes);
44981             for (var i4 = 0; i4 < children2.length; i4++) {
44982               var a2 = localGraph.hasEntity(children2[i4]);
44983               var b2 = remoteGraph.hasEntity(children2[i4]);
44984               if (a2 && b2 && a2.version !== b2.version)
44985                 return false;
44986             }
44987           }
44988           return true;
44989         }
44990         _toCheck.forEach(function(id2) {
44991           var local = localGraph.entity(id2);
44992           var remote = remoteGraph.entity(id2);
44993           if (sameVersions(local, remote))
44994             return;
44995           var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
44996           history.replace(merge2);
44997           var mergeConflicts = merge2.conflicts();
44998           if (!mergeConflicts.length)
44999             return;
45000           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
45001           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
45002           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
45003           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
45004           _conflicts.push({
45005             id: id2,
45006             name: entityName(local),
45007             details: mergeConflicts,
45008             chosen: 1,
45009             choices: [
45010               choice(id2, keepMine, forceLocal),
45011               choice(id2, keepTheirs, forceRemote)
45012             ]
45013           });
45014         });
45015       }
45016     }
45017     function upload(changeset) {
45018       var osm = context.connection();
45019       if (!osm) {
45020         _errors.push({ msg: "No OSM Service" });
45021       }
45022       if (_conflicts.length) {
45023         didResultInConflicts(changeset);
45024       } else if (_errors.length) {
45025         didResultInErrors();
45026       } else {
45027         var history = context.history();
45028         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
45029         if (changes.modified.length || changes.created.length || changes.deleted.length) {
45030           dispatch14.call("willAttemptUpload", this);
45031           osm.putChangeset(changeset, changes, uploadCallback);
45032         } else {
45033           didResultInNoChanges();
45034         }
45035       }
45036     }
45037     function uploadCallback(err, changeset) {
45038       if (err) {
45039         if (err.status === 409) {
45040           uploader.save(changeset, true, true);
45041         } else {
45042           _errors.push({
45043             msg: err.message || err.responseText,
45044             details: [_t("save.status_code", { code: err.status })]
45045           });
45046           didResultInErrors();
45047         }
45048       } else {
45049         didResultInSuccess(changeset);
45050       }
45051     }
45052     function didResultInNoChanges() {
45053       dispatch14.call("resultNoChanges", this);
45054       endSave();
45055       context.flush();
45056     }
45057     function didResultInErrors() {
45058       context.history().pop();
45059       dispatch14.call("resultErrors", this, _errors);
45060       endSave();
45061     }
45062     function didResultInConflicts(changeset) {
45063       _conflicts.sort(function(a2, b2) {
45064         return b2.id.localeCompare(a2.id);
45065       });
45066       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
45067       endSave();
45068     }
45069     function didResultInSuccess(changeset) {
45070       context.history().clearSaved();
45071       dispatch14.call("resultSuccess", this, changeset);
45072       window.setTimeout(function() {
45073         endSave();
45074         context.flush();
45075       }, 2500);
45076     }
45077     function endSave() {
45078       _isSaving = false;
45079       dispatch14.call("saveEnded", this);
45080     }
45081     uploader.cancelConflictResolution = function() {
45082       context.history().pop();
45083     };
45084     uploader.processResolvedConflicts = function(changeset) {
45085       var history = context.history();
45086       for (var i3 = 0; i3 < _conflicts.length; i3++) {
45087         if (_conflicts[i3].chosen === 1) {
45088           var entity = context.hasEntity(_conflicts[i3].id);
45089           if (entity && entity.type === "way") {
45090             var children2 = utilArrayUniq(entity.nodes);
45091             for (var j3 = 0; j3 < children2.length; j3++) {
45092               history.replace(actionRevert(children2[j3]));
45093             }
45094           }
45095           history.replace(actionRevert(_conflicts[i3].id));
45096         }
45097       }
45098       uploader.save(changeset, true, false);
45099     };
45100     uploader.reset = function() {
45101     };
45102     return uploader;
45103   }
45104
45105   // modules/renderer/background_source.js
45106   var import_lodash4 = __toESM(require_lodash());
45107
45108   // modules/util/IntervalTasksQueue.js
45109   var IntervalTasksQueue = class {
45110     /**
45111      * Interval in milliseconds inside which only 1 task can execute.
45112      * e.g. if interval is 200ms, and 5 async tasks are unqueued,
45113      * they will complete in ~1s if not cleared
45114      * @param {number} intervalInMs
45115      */
45116     constructor(intervalInMs) {
45117       this.intervalInMs = intervalInMs;
45118       this.pendingHandles = [];
45119       this.time = 0;
45120     }
45121     enqueue(task) {
45122       let taskTimeout = this.time;
45123       this.time += this.intervalInMs;
45124       this.pendingHandles.push(setTimeout(() => {
45125         this.time -= this.intervalInMs;
45126         task();
45127       }, taskTimeout));
45128     }
45129     clear() {
45130       this.pendingHandles.forEach((timeoutHandle) => {
45131         clearTimeout(timeoutHandle);
45132       });
45133       this.pendingHandles = [];
45134       this.time = 0;
45135     }
45136   };
45137
45138   // modules/renderer/background_source.js
45139   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45140   window.matchMedia(`
45141         (-webkit-min-device-pixel-ratio: 2), /* Safari */
45142         (min-resolution: 2dppx),             /* standard */
45143         (min-resolution: 192dpi)             /* fallback */
45144     `).addListener(function() {
45145     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45146   });
45147   function localeDateString(s2) {
45148     if (!s2)
45149       return null;
45150     var options2 = { day: "numeric", month: "short", year: "numeric" };
45151     var d2 = new Date(s2);
45152     if (isNaN(d2.getTime()))
45153       return null;
45154     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
45155   }
45156   function vintageRange(vintage) {
45157     var s2;
45158     if (vintage.start || vintage.end) {
45159       s2 = vintage.start || "?";
45160       if (vintage.start !== vintage.end) {
45161         s2 += " - " + (vintage.end || "?");
45162       }
45163     }
45164     return s2;
45165   }
45166   function rendererBackgroundSource(data) {
45167     var source = Object.assign({}, data);
45168     var _offset = [0, 0];
45169     var _name = source.name;
45170     var _description = source.description;
45171     var _best = !!source.best;
45172     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
45173     source.tileSize = data.tileSize || 256;
45174     source.zoomExtent = data.zoomExtent || [0, 22];
45175     source.overzoom = data.overzoom !== false;
45176     source.offset = function(val) {
45177       if (!arguments.length)
45178         return _offset;
45179       _offset = val;
45180       return source;
45181     };
45182     source.nudge = function(val, zoomlevel) {
45183       _offset[0] += val[0] / Math.pow(2, zoomlevel);
45184       _offset[1] += val[1] / Math.pow(2, zoomlevel);
45185       return source;
45186     };
45187     source.name = function() {
45188       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45189       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45190     };
45191     source.label = function() {
45192       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45193       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45194     };
45195     source.hasDescription = function() {
45196       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45197       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
45198       return descriptionText !== "";
45199     };
45200     source.description = function() {
45201       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45202       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
45203     };
45204     source.best = function() {
45205       return _best;
45206     };
45207     source.area = function() {
45208       if (!data.polygon)
45209         return Number.MAX_VALUE;
45210       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
45211       return isNaN(area) ? 0 : area;
45212     };
45213     source.imageryUsed = function() {
45214       return _name || source.id;
45215     };
45216     source.template = function(val) {
45217       if (!arguments.length)
45218         return _template;
45219       if (source.id === "custom" || source.id === "Bing") {
45220         _template = val;
45221       }
45222       return source;
45223     };
45224     source.url = function(coord2) {
45225       var result = _template.replace(/#[\s\S]*/u, "");
45226       if (result === "")
45227         return result;
45228       if (!source.type || source.id === "custom") {
45229         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
45230           source.type = "wms";
45231           source.projection = "EPSG:3857";
45232         } else if (/\{(x|y)\}/.test(result)) {
45233           source.type = "tms";
45234         } else if (/\{u\}/.test(result)) {
45235           source.type = "bing";
45236         }
45237       }
45238       if (source.type === "wms") {
45239         var tileToProjectedCoords = function(x2, y2, z2) {
45240           var zoomSize = Math.pow(2, z2);
45241           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
45242           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
45243           switch (source.projection) {
45244             case "EPSG:4326":
45245               return {
45246                 x: lon * 180 / Math.PI,
45247                 y: lat * 180 / Math.PI
45248               };
45249             default:
45250               var mercCoords = mercatorRaw(lon, lat);
45251               return {
45252                 x: 2003750834e-2 / Math.PI * mercCoords[0],
45253                 y: 2003750834e-2 / Math.PI * mercCoords[1]
45254               };
45255           }
45256         };
45257         var tileSize = source.tileSize;
45258         var projection2 = source.projection;
45259         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
45260         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
45261         result = result.replace(/\{(\w+)\}/g, function(token, key) {
45262           switch (key) {
45263             case "width":
45264             case "height":
45265               return tileSize;
45266             case "proj":
45267               return projection2;
45268             case "wkid":
45269               return projection2.replace(/^EPSG:/, "");
45270             case "bbox":
45271               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
45272               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
45273                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
45274               } else {
45275                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
45276               }
45277             case "w":
45278               return minXmaxY.x;
45279             case "s":
45280               return maxXminY.y;
45281             case "n":
45282               return maxXminY.x;
45283             case "e":
45284               return minXmaxY.y;
45285             default:
45286               return token;
45287           }
45288         });
45289       } else if (source.type === "tms") {
45290         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" : "");
45291       } else if (source.type === "bing") {
45292         result = result.replace("{u}", function() {
45293           var u2 = "";
45294           for (var zoom = coord2[2]; zoom > 0; zoom--) {
45295             var b2 = 0;
45296             var mask = 1 << zoom - 1;
45297             if ((coord2[0] & mask) !== 0)
45298               b2++;
45299             if ((coord2[1] & mask) !== 0)
45300               b2 += 2;
45301             u2 += b2.toString();
45302           }
45303           return u2;
45304         });
45305       }
45306       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
45307         var subdomains = r2.split(",");
45308         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
45309       });
45310       return result;
45311     };
45312     source.validZoom = function(z2) {
45313       return source.zoomExtent[0] <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
45314     };
45315     source.isLocatorOverlay = function() {
45316       return source.id === "mapbox_locator_overlay";
45317     };
45318     source.isHidden = function() {
45319       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
45320     };
45321     source.copyrightNotices = function() {
45322     };
45323     source.getMetadata = function(center, tileCoord, callback) {
45324       var vintage = {
45325         start: localeDateString(source.startDate),
45326         end: localeDateString(source.endDate)
45327       };
45328       vintage.range = vintageRange(vintage);
45329       var metadata = { vintage };
45330       callback(null, metadata);
45331     };
45332     return source;
45333   }
45334   rendererBackgroundSource.Bing = function(data, dispatch14) {
45335     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
45336     var bing = rendererBackgroundSource(data);
45337     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
45338     const strictParam = "n";
45339     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
45340     var cache = {};
45341     var inflight = {};
45342     var providers = [];
45343     var taskQueue = new IntervalTasksQueue(250);
45344     var metadataLastZoom = -1;
45345     json_default(url).then(function(json) {
45346       let imageryResource = json.resourceSets[0].resources[0];
45347       let template = imageryResource.imageUrl;
45348       let subDomains = imageryResource.imageUrlSubdomains;
45349       let subDomainNumbers = subDomains.map((subDomain) => {
45350         return subDomain.substring(1);
45351       }).join(",");
45352       template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
45353       if (!new URLSearchParams(template).has(strictParam)) {
45354         template += `&${strictParam}=z`;
45355       }
45356       bing.template(template);
45357       providers = imageryResource.imageryProviders.map(function(provider) {
45358         return {
45359           attribution: provider.attribution,
45360           areas: provider.coverageAreas.map(function(area) {
45361             return {
45362               zoom: [area.zoomMin, area.zoomMax],
45363               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
45364             };
45365           })
45366         };
45367       });
45368       dispatch14.call("change");
45369     }).catch(function() {
45370     });
45371     bing.copyrightNotices = function(zoom, extent) {
45372       zoom = Math.min(zoom, 21);
45373       return providers.filter(function(provider) {
45374         return provider.areas.some(function(area) {
45375           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
45376         });
45377       }).map(function(provider) {
45378         return provider.attribution;
45379       }).join(", ");
45380     };
45381     bing.getMetadata = function(center, tileCoord, callback) {
45382       var tileID = tileCoord.slice(0, 3).join("/");
45383       var zoom = Math.min(tileCoord[2], 21);
45384       var centerPoint = center[1] + "," + center[0];
45385       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
45386       if (inflight[tileID])
45387         return;
45388       if (!cache[tileID]) {
45389         cache[tileID] = {};
45390       }
45391       if (cache[tileID] && cache[tileID].metadata) {
45392         return callback(null, cache[tileID].metadata);
45393       }
45394       inflight[tileID] = true;
45395       if (metadataLastZoom !== tileCoord[2]) {
45396         metadataLastZoom = tileCoord[2];
45397         taskQueue.clear();
45398       }
45399       taskQueue.enqueue(() => {
45400         json_default(url2).then(function(result) {
45401           delete inflight[tileID];
45402           if (!result) {
45403             throw new Error("Unknown Error");
45404           }
45405           var vintage = {
45406             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
45407             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
45408           };
45409           vintage.range = vintageRange(vintage);
45410           var metadata = { vintage };
45411           cache[tileID].metadata = metadata;
45412           if (callback)
45413             callback(null, metadata);
45414         }).catch(function(err) {
45415           delete inflight[tileID];
45416           if (callback)
45417             callback(err.message);
45418         });
45419       });
45420     };
45421     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
45422     return bing;
45423   };
45424   rendererBackgroundSource.Esri = function(data) {
45425     if (data.template.match(/blankTile/) === null) {
45426       data.template = data.template + "?blankTile=false";
45427     }
45428     var esri = rendererBackgroundSource(data);
45429     var cache = {};
45430     var inflight = {};
45431     var _prevCenter;
45432     esri.fetchTilemap = function(center) {
45433       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
45434         return;
45435       _prevCenter = center;
45436       var z2 = 20;
45437       var dummyUrl = esri.url([1, 2, 3]);
45438       var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
45439       var y2 = Math.floor((1 - Math.log(Math.tan(center[1] * Math.PI / 180) + 1 / Math.cos(center[1] * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, z2));
45440       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
45441       json_default(tilemapUrl).then(function(tilemap) {
45442         if (!tilemap) {
45443           throw new Error("Unknown Error");
45444         }
45445         var hasTiles = true;
45446         for (var i3 = 0; i3 < tilemap.data.length; i3++) {
45447           if (!tilemap.data[i3]) {
45448             hasTiles = false;
45449             break;
45450           }
45451         }
45452         esri.zoomExtent[1] = hasTiles ? 22 : 19;
45453       }).catch(function() {
45454       });
45455     };
45456     esri.getMetadata = function(center, tileCoord, callback) {
45457       if (esri.id !== "EsriWorldImagery") {
45458         return callback(null, {});
45459       }
45460       var tileID = tileCoord.slice(0, 3).join("/");
45461       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
45462       var centerPoint = center[0] + "," + center[1];
45463       var unknown = _t("info_panels.background.unknown");
45464       var vintage = {};
45465       var metadata = {};
45466       if (inflight[tileID])
45467         return;
45468       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
45469       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
45470       if (!cache[tileID]) {
45471         cache[tileID] = {};
45472       }
45473       if (cache[tileID] && cache[tileID].metadata) {
45474         return callback(null, cache[tileID].metadata);
45475       }
45476       inflight[tileID] = true;
45477       json_default(url).then(function(result) {
45478         delete inflight[tileID];
45479         result = result.features.map((f3) => f3.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
45480         if (!result) {
45481           throw new Error("Unknown Error");
45482         } else if (result.features && result.features.length < 1) {
45483           throw new Error("No Results");
45484         } else if (result.error && result.error.message) {
45485           throw new Error(result.error.message);
45486         }
45487         var captureDate = localeDateString(result.SRC_DATE2);
45488         vintage = {
45489           start: captureDate,
45490           end: captureDate,
45491           range: captureDate
45492         };
45493         metadata = {
45494           vintage,
45495           source: clean2(result.NICE_NAME),
45496           description: clean2(result.NICE_DESC),
45497           resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
45498           accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
45499         };
45500         if (isFinite(metadata.resolution)) {
45501           metadata.resolution += " m";
45502         }
45503         if (isFinite(metadata.accuracy)) {
45504           metadata.accuracy += " m";
45505         }
45506         cache[tileID].metadata = metadata;
45507         if (callback)
45508           callback(null, metadata);
45509       }).catch(function(err) {
45510         delete inflight[tileID];
45511         if (callback)
45512           callback(err.message);
45513       });
45514       function clean2(val) {
45515         return String(val).trim() || unknown;
45516       }
45517     };
45518     return esri;
45519   };
45520   rendererBackgroundSource.None = function() {
45521     var source = rendererBackgroundSource({ id: "none", template: "" });
45522     source.name = function() {
45523       return _t("background.none");
45524     };
45525     source.label = function() {
45526       return _t.append("background.none");
45527     };
45528     source.imageryUsed = function() {
45529       return null;
45530     };
45531     source.area = function() {
45532       return -1;
45533     };
45534     return source;
45535   };
45536   rendererBackgroundSource.Custom = function(template) {
45537     var source = rendererBackgroundSource({ id: "custom", template });
45538     source.name = function() {
45539       return _t("background.custom");
45540     };
45541     source.label = function() {
45542       return _t.append("background.custom");
45543     };
45544     source.imageryUsed = function() {
45545       var cleaned = source.template();
45546       if (cleaned.indexOf("?") !== -1) {
45547         var parts = cleaned.split("?", 2);
45548         var qs = utilStringQs(parts[1]);
45549         ["access_token", "connectId", "token"].forEach(function(param) {
45550           if (qs[param]) {
45551             qs[param] = "{apikey}";
45552           }
45553         });
45554         cleaned = parts[0] + "?" + utilQsString(qs, true);
45555       }
45556       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
45557       return "Custom (" + cleaned + " )";
45558     };
45559     source.area = function() {
45560       return -2;
45561     };
45562     return source;
45563   };
45564
45565   // node_modules/@turf/helpers/dist/es/index.js
45566   var earthRadius = 63710088e-1;
45567   var factors = {
45568     centimeters: earthRadius * 100,
45569     centimetres: earthRadius * 100,
45570     degrees: earthRadius / 111325,
45571     feet: earthRadius * 3.28084,
45572     inches: earthRadius * 39.37,
45573     kilometers: earthRadius / 1e3,
45574     kilometres: earthRadius / 1e3,
45575     meters: earthRadius,
45576     metres: earthRadius,
45577     miles: earthRadius / 1609.344,
45578     millimeters: earthRadius * 1e3,
45579     millimetres: earthRadius * 1e3,
45580     nauticalmiles: earthRadius / 1852,
45581     radians: 1,
45582     yards: earthRadius * 1.0936
45583   };
45584   var unitsFactors = {
45585     centimeters: 100,
45586     centimetres: 100,
45587     degrees: 1 / 111325,
45588     feet: 3.28084,
45589     inches: 39.37,
45590     kilometers: 1 / 1e3,
45591     kilometres: 1 / 1e3,
45592     meters: 1,
45593     metres: 1,
45594     miles: 1 / 1609.344,
45595     millimeters: 1e3,
45596     millimetres: 1e3,
45597     nauticalmiles: 1 / 1852,
45598     radians: 1 / earthRadius,
45599     yards: 1.0936133
45600   };
45601   function feature2(geom, properties, options2) {
45602     if (options2 === void 0) {
45603       options2 = {};
45604     }
45605     var feat = { type: "Feature" };
45606     if (options2.id === 0 || options2.id) {
45607       feat.id = options2.id;
45608     }
45609     if (options2.bbox) {
45610       feat.bbox = options2.bbox;
45611     }
45612     feat.properties = properties || {};
45613     feat.geometry = geom;
45614     return feat;
45615   }
45616   function polygon(coordinates, properties, options2) {
45617     if (options2 === void 0) {
45618       options2 = {};
45619     }
45620     for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
45621       var ring = coordinates_1[_i];
45622       if (ring.length < 4) {
45623         throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
45624       }
45625       for (var j3 = 0; j3 < ring[ring.length - 1].length; j3++) {
45626         if (ring[ring.length - 1][j3] !== ring[0][j3]) {
45627           throw new Error("First and last Position are not equivalent.");
45628         }
45629       }
45630     }
45631     var geom = {
45632       type: "Polygon",
45633       coordinates
45634     };
45635     return feature2(geom, properties, options2);
45636   }
45637   function lineString(coordinates, properties, options2) {
45638     if (options2 === void 0) {
45639       options2 = {};
45640     }
45641     if (coordinates.length < 2) {
45642       throw new Error("coordinates must be an array of two or more positions");
45643     }
45644     var geom = {
45645       type: "LineString",
45646       coordinates
45647     };
45648     return feature2(geom, properties, options2);
45649   }
45650   function multiLineString(coordinates, properties, options2) {
45651     if (options2 === void 0) {
45652       options2 = {};
45653     }
45654     var geom = {
45655       type: "MultiLineString",
45656       coordinates
45657     };
45658     return feature2(geom, properties, options2);
45659   }
45660   function multiPolygon(coordinates, properties, options2) {
45661     if (options2 === void 0) {
45662       options2 = {};
45663     }
45664     var geom = {
45665       type: "MultiPolygon",
45666       coordinates
45667     };
45668     return feature2(geom, properties, options2);
45669   }
45670
45671   // node_modules/@turf/invariant/dist/es/index.js
45672   function getGeom(geojson) {
45673     if (geojson.type === "Feature") {
45674       return geojson.geometry;
45675     }
45676     return geojson;
45677   }
45678
45679   // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
45680   function lineclip(points, bbox2, result) {
45681     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
45682     var a2;
45683     var b2;
45684     if (!result)
45685       result = [];
45686     for (i3 = 1; i3 < len; i3++) {
45687       a2 = points[i3 - 1];
45688       b2 = points[i3];
45689       codeB = lastCode = bitCode(b2, bbox2);
45690       while (true) {
45691         if (!(codeA | codeB)) {
45692           part.push(a2);
45693           if (codeB !== lastCode) {
45694             part.push(b2);
45695             if (i3 < len - 1) {
45696               result.push(part);
45697               part = [];
45698             }
45699           } else if (i3 === len - 1) {
45700             part.push(b2);
45701           }
45702           break;
45703         } else if (codeA & codeB) {
45704           break;
45705         } else if (codeA) {
45706           a2 = intersect(a2, b2, codeA, bbox2);
45707           codeA = bitCode(a2, bbox2);
45708         } else {
45709           b2 = intersect(a2, b2, codeB, bbox2);
45710           codeB = bitCode(b2, bbox2);
45711         }
45712       }
45713       codeA = lastCode;
45714     }
45715     if (part.length)
45716       result.push(part);
45717     return result;
45718   }
45719   function polygonclip(points, bbox2) {
45720     var result, edge, prev, prevInside, i3, p2, inside;
45721     for (edge = 1; edge <= 8; edge *= 2) {
45722       result = [];
45723       prev = points[points.length - 1];
45724       prevInside = !(bitCode(prev, bbox2) & edge);
45725       for (i3 = 0; i3 < points.length; i3++) {
45726         p2 = points[i3];
45727         inside = !(bitCode(p2, bbox2) & edge);
45728         if (inside !== prevInside)
45729           result.push(intersect(prev, p2, edge, bbox2));
45730         if (inside)
45731           result.push(p2);
45732         prev = p2;
45733         prevInside = inside;
45734       }
45735       points = result;
45736       if (!points.length)
45737         break;
45738     }
45739     return result;
45740   }
45741   function intersect(a2, b2, edge, bbox2) {
45742     return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : null;
45743   }
45744   function bitCode(p2, bbox2) {
45745     var code = 0;
45746     if (p2[0] < bbox2[0])
45747       code |= 1;
45748     else if (p2[0] > bbox2[2])
45749       code |= 2;
45750     if (p2[1] < bbox2[1])
45751       code |= 4;
45752     else if (p2[1] > bbox2[3])
45753       code |= 8;
45754     return code;
45755   }
45756
45757   // node_modules/@turf/bbox-clip/dist/es/index.js
45758   function bboxClip(feature3, bbox2) {
45759     var geom = getGeom(feature3);
45760     var type2 = geom.type;
45761     var properties = feature3.type === "Feature" ? feature3.properties : {};
45762     var coords = geom.coordinates;
45763     switch (type2) {
45764       case "LineString":
45765       case "MultiLineString": {
45766         var lines_1 = [];
45767         if (type2 === "LineString") {
45768           coords = [coords];
45769         }
45770         coords.forEach(function(line) {
45771           lineclip(line, bbox2, lines_1);
45772         });
45773         if (lines_1.length === 1) {
45774           return lineString(lines_1[0], properties);
45775         }
45776         return multiLineString(lines_1, properties);
45777       }
45778       case "Polygon":
45779         return polygon(clipPolygon(coords, bbox2), properties);
45780       case "MultiPolygon":
45781         return multiPolygon(coords.map(function(poly) {
45782           return clipPolygon(poly, bbox2);
45783         }), properties);
45784       default:
45785         throw new Error("geometry " + type2 + " not supported");
45786     }
45787   }
45788   function clipPolygon(rings, bbox2) {
45789     var outRings = [];
45790     for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
45791       var ring = rings_1[_i];
45792       var clipped = polygonclip(ring, bbox2);
45793       if (clipped.length > 0) {
45794         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
45795           clipped.push(clipped[0]);
45796         }
45797         if (clipped.length >= 4) {
45798           outRings.push(clipped);
45799         }
45800       }
45801     }
45802     return outRings;
45803   }
45804
45805   // node_modules/@turf/meta/dist/es/index.js
45806   function coordEach(geojson, callback, excludeWrapCoord) {
45807     if (geojson === null)
45808       return;
45809     var j3, k2, l2, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
45810     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
45811       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
45812       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
45813       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
45814       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
45815         var multiFeatureIndex = 0;
45816         var geometryIndex = 0;
45817         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
45818         if (geometry === null)
45819           continue;
45820         coords = geometry.coordinates;
45821         var geomType = geometry.type;
45822         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
45823         switch (geomType) {
45824           case null:
45825             break;
45826           case "Point":
45827             if (callback(
45828               coords,
45829               coordIndex,
45830               featureIndex,
45831               multiFeatureIndex,
45832               geometryIndex
45833             ) === false)
45834               return false;
45835             coordIndex++;
45836             multiFeatureIndex++;
45837             break;
45838           case "LineString":
45839           case "MultiPoint":
45840             for (j3 = 0; j3 < coords.length; j3++) {
45841               if (callback(
45842                 coords[j3],
45843                 coordIndex,
45844                 featureIndex,
45845                 multiFeatureIndex,
45846                 geometryIndex
45847               ) === false)
45848                 return false;
45849               coordIndex++;
45850               if (geomType === "MultiPoint")
45851                 multiFeatureIndex++;
45852             }
45853             if (geomType === "LineString")
45854               multiFeatureIndex++;
45855             break;
45856           case "Polygon":
45857           case "MultiLineString":
45858             for (j3 = 0; j3 < coords.length; j3++) {
45859               for (k2 = 0; k2 < coords[j3].length - wrapShrink; k2++) {
45860                 if (callback(
45861                   coords[j3][k2],
45862                   coordIndex,
45863                   featureIndex,
45864                   multiFeatureIndex,
45865                   geometryIndex
45866                 ) === false)
45867                   return false;
45868                 coordIndex++;
45869               }
45870               if (geomType === "MultiLineString")
45871                 multiFeatureIndex++;
45872               if (geomType === "Polygon")
45873                 geometryIndex++;
45874             }
45875             if (geomType === "Polygon")
45876               multiFeatureIndex++;
45877             break;
45878           case "MultiPolygon":
45879             for (j3 = 0; j3 < coords.length; j3++) {
45880               geometryIndex = 0;
45881               for (k2 = 0; k2 < coords[j3].length; k2++) {
45882                 for (l2 = 0; l2 < coords[j3][k2].length - wrapShrink; l2++) {
45883                   if (callback(
45884                     coords[j3][k2][l2],
45885                     coordIndex,
45886                     featureIndex,
45887                     multiFeatureIndex,
45888                     geometryIndex
45889                   ) === false)
45890                     return false;
45891                   coordIndex++;
45892                 }
45893                 geometryIndex++;
45894               }
45895               multiFeatureIndex++;
45896             }
45897             break;
45898           case "GeometryCollection":
45899             for (j3 = 0; j3 < geometry.geometries.length; j3++)
45900               if (coordEach(geometry.geometries[j3], callback, excludeWrapCoord) === false)
45901                 return false;
45902             break;
45903           default:
45904             throw new Error("Unknown Geometry Type");
45905         }
45906       }
45907     }
45908   }
45909
45910   // node_modules/@turf/bbox/dist/es/index.js
45911   function bbox(geojson) {
45912     var result = [Infinity, Infinity, -Infinity, -Infinity];
45913     coordEach(geojson, function(coord2) {
45914       if (result[0] > coord2[0]) {
45915         result[0] = coord2[0];
45916       }
45917       if (result[1] > coord2[1]) {
45918         result[1] = coord2[1];
45919       }
45920       if (result[2] < coord2[0]) {
45921         result[2] = coord2[0];
45922       }
45923       if (result[3] < coord2[1]) {
45924         result[3] = coord2[1];
45925       }
45926     });
45927     return result;
45928   }
45929   bbox["default"] = bbox;
45930   var es_default = bbox;
45931
45932   // modules/renderer/background.js
45933   var import_which_polygon3 = __toESM(require_which_polygon());
45934
45935   // modules/renderer/tile_layer.js
45936   function rendererTileLayer(context) {
45937     var transformProp = utilPrefixCSSProperty("Transform");
45938     var tiler9 = utilTiler();
45939     var _tileSize = 256;
45940     var _projection;
45941     var _cache4 = {};
45942     var _tileOrigin;
45943     var _zoom;
45944     var _source;
45945     function tileSizeAtZoom(d2, z2) {
45946       var EPSILON = 2e-3;
45947       return _tileSize * Math.pow(2, z2 - d2[2]) / _tileSize + EPSILON;
45948     }
45949     function atZoom(t2, distance) {
45950       var power = Math.pow(2, distance);
45951       return [
45952         Math.floor(t2[0] * power),
45953         Math.floor(t2[1] * power),
45954         t2[2] + distance
45955       ];
45956     }
45957     function lookUp(d2) {
45958       for (var up = -1; up > -d2[2]; up--) {
45959         var tile = atZoom(d2, up);
45960         if (_cache4[_source.url(tile)] !== false) {
45961           return tile;
45962         }
45963       }
45964     }
45965     function uniqueBy(a2, n3) {
45966       var o2 = [];
45967       var seen = {};
45968       for (var i3 = 0; i3 < a2.length; i3++) {
45969         if (seen[a2[i3][n3]] === void 0) {
45970           o2.push(a2[i3]);
45971           seen[a2[i3][n3]] = true;
45972         }
45973       }
45974       return o2;
45975     }
45976     function addSource(d2) {
45977       d2.push(_source.url(d2));
45978       return d2;
45979     }
45980     function background(selection2) {
45981       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
45982       var pixelOffset;
45983       if (_source) {
45984         pixelOffset = [
45985           _source.offset()[0] * Math.pow(2, _zoom),
45986           _source.offset()[1] * Math.pow(2, _zoom)
45987         ];
45988       } else {
45989         pixelOffset = [0, 0];
45990       }
45991       var translate = [
45992         _projection.translate()[0] + pixelOffset[0],
45993         _projection.translate()[1] + pixelOffset[1]
45994       ];
45995       tiler9.scale(_projection.scale() * 2 * Math.PI).translate(translate);
45996       _tileOrigin = [
45997         _projection.scale() * Math.PI - translate[0],
45998         _projection.scale() * Math.PI - translate[1]
45999       ];
46000       render(selection2);
46001     }
46002     function render(selection2) {
46003       if (!_source)
46004         return;
46005       var requests = [];
46006       var showDebug = context.getDebug("tile") && !_source.overlay;
46007       if (_source.validZoom(_zoom)) {
46008         tiler9.skipNullIsland(!!_source.overlay);
46009         tiler9().forEach(function(d2) {
46010           addSource(d2);
46011           if (d2[3] === "")
46012             return;
46013           if (typeof d2[3] !== "string")
46014             return;
46015           requests.push(d2);
46016           if (_cache4[d2[3]] === false && lookUp(d2)) {
46017             requests.push(addSource(lookUp(d2)));
46018           }
46019         });
46020         requests = uniqueBy(requests, 3).filter(function(r2) {
46021           return _cache4[r2[3]] !== false;
46022         });
46023       }
46024       function load(d3_event, d2) {
46025         _cache4[d2[3]] = true;
46026         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
46027         render(selection2);
46028       }
46029       function error(d3_event, d2) {
46030         _cache4[d2[3]] = false;
46031         select_default2(this).on("error", null).on("load", null).remove();
46032         render(selection2);
46033       }
46034       function imageTransform(d2) {
46035         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
46036         var scale = tileSizeAtZoom(d2, _zoom);
46037         return "translate(" + (d2[0] * ts - _tileOrigin[0]) + "px," + (d2[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
46038       }
46039       function tileCenter(d2) {
46040         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
46041         return [
46042           d2[0] * ts - _tileOrigin[0] + ts / 2,
46043           d2[1] * ts - _tileOrigin[1] + ts / 2
46044         ];
46045       }
46046       function debugTransform(d2) {
46047         var coord2 = tileCenter(d2);
46048         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
46049       }
46050       var dims = tiler9.size();
46051       var mapCenter = [dims[0] / 2, dims[1] / 2];
46052       var minDist = Math.max(dims[0], dims[1]);
46053       var nearCenter;
46054       requests.forEach(function(d2) {
46055         var c2 = tileCenter(d2);
46056         var dist = geoVecLength(c2, mapCenter);
46057         if (dist < minDist) {
46058           minDist = dist;
46059           nearCenter = d2;
46060         }
46061       });
46062       var image = selection2.selectAll("img").data(requests, function(d2) {
46063         return d2[3];
46064       });
46065       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
46066         var tile = select_default2(this);
46067         window.setTimeout(function() {
46068           if (tile.classed("tile-removing")) {
46069             tile.remove();
46070           }
46071         }, 300);
46072       });
46073       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
46074         return d2[3];
46075       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
46076         return d2 === nearCenter;
46077       });
46078       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
46079         return d2[3];
46080       });
46081       debug2.exit().remove();
46082       if (showDebug) {
46083         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
46084         debugEnter.append("div").attr("class", "tile-label-debug-coord");
46085         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
46086         debug2 = debug2.merge(debugEnter);
46087         debug2.style(transformProp, debugTransform);
46088         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
46089           return d2[2] + " / " + d2[0] + " / " + d2[1];
46090         });
46091         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
46092           var span = select_default2(this);
46093           var center = context.projection.invert(tileCenter(d2));
46094           _source.getMetadata(center, d2, function(err, result) {
46095             if (result && result.vintage && result.vintage.range) {
46096               span.text(result.vintage.range);
46097             } else {
46098               span.text("");
46099               span.call(_t.append("info_panels.background.vintage"));
46100               span.append("span").text(": ");
46101               span.call(_t.append("info_panels.background.unknown"));
46102             }
46103           });
46104         });
46105       }
46106     }
46107     background.projection = function(val) {
46108       if (!arguments.length)
46109         return _projection;
46110       _projection = val;
46111       return background;
46112     };
46113     background.dimensions = function(val) {
46114       if (!arguments.length)
46115         return tiler9.size();
46116       tiler9.size(val);
46117       return background;
46118     };
46119     background.source = function(val) {
46120       if (!arguments.length)
46121         return _source;
46122       _source = val;
46123       _tileSize = _source.tileSize;
46124       _cache4 = {};
46125       tiler9.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
46126       return background;
46127     };
46128     return background;
46129   }
46130
46131   // modules/renderer/background.js
46132   var _imageryIndex = null;
46133   function rendererBackground(context) {
46134     const dispatch14 = dispatch_default("change");
46135     const baseLayer = rendererTileLayer(context).projection(context.projection);
46136     let _checkedBlocklists = [];
46137     let _isValid = true;
46138     let _overlayLayers = [];
46139     let _brightness = 1;
46140     let _contrast = 1;
46141     let _saturation = 1;
46142     let _sharpness = 1;
46143     function ensureImageryIndex() {
46144       return _mainFileFetcher.get("imagery").then((sources) => {
46145         if (_imageryIndex)
46146           return _imageryIndex;
46147         _imageryIndex = {
46148           imagery: sources,
46149           features: {}
46150         };
46151         const features = sources.map((source) => {
46152           if (!source.polygon)
46153             return null;
46154           const rings = source.polygon.map((ring) => [ring]);
46155           const feature3 = {
46156             type: "Feature",
46157             properties: { id: source.id },
46158             geometry: { type: "MultiPolygon", coordinates: rings }
46159           };
46160           _imageryIndex.features[source.id] = feature3;
46161           return feature3;
46162         }).filter(Boolean);
46163         _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
46164         _imageryIndex.backgrounds = sources.map((source) => {
46165           if (source.type === "bing") {
46166             return rendererBackgroundSource.Bing(source, dispatch14);
46167           } else if (/^EsriWorldImagery/.test(source.id)) {
46168             return rendererBackgroundSource.Esri(source);
46169           } else {
46170             return rendererBackgroundSource(source);
46171           }
46172         });
46173         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
46174         let template = corePreferences("background-custom-template") || "";
46175         const custom = rendererBackgroundSource.Custom(template);
46176         _imageryIndex.backgrounds.unshift(custom);
46177         return _imageryIndex;
46178       });
46179     }
46180     function background(selection2) {
46181       const currSource = baseLayer.source();
46182       if (context.map().zoom() > 18) {
46183         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
46184           const center = context.map().center();
46185           currSource.fetchTilemap(center);
46186         }
46187       }
46188       const sources = background.sources(context.map().extent());
46189       const wasValid = _isValid;
46190       _isValid = !!sources.filter((d2) => d2 === currSource).length;
46191       if (wasValid !== _isValid) {
46192         background.updateImagery();
46193       }
46194       let baseFilter = "";
46195       if (_brightness !== 1) {
46196         baseFilter += ` brightness(${_brightness})`;
46197       }
46198       if (_contrast !== 1) {
46199         baseFilter += ` contrast(${_contrast})`;
46200       }
46201       if (_saturation !== 1) {
46202         baseFilter += ` saturate(${_saturation})`;
46203       }
46204       if (_sharpness < 1) {
46205         const blur = number_default(0.5, 5)(1 - _sharpness);
46206         baseFilter += ` blur(${blur}px)`;
46207       }
46208       let base = selection2.selectAll(".layer-background").data([0]);
46209       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
46210       base.style("filter", baseFilter || null);
46211       let imagery = base.selectAll(".layer-imagery").data([0]);
46212       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
46213       let maskFilter = "";
46214       let mixBlendMode = "";
46215       if (_sharpness > 1) {
46216         mixBlendMode = "overlay";
46217         maskFilter = "saturate(0) blur(3px) invert(1)";
46218         let contrast = _sharpness - 1;
46219         maskFilter += ` contrast(${contrast})`;
46220         let brightness = number_default(1, 0.85)(_sharpness - 1);
46221         maskFilter += ` brightness(${brightness})`;
46222       }
46223       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
46224       mask.exit().remove();
46225       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);
46226       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
46227       overlays.exit().remove();
46228       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
46229     }
46230     background.updateImagery = function() {
46231       let currSource = baseLayer.source();
46232       if (context.inIntro() || !currSource)
46233         return;
46234       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
46235       const meters = geoOffsetToMeters(currSource.offset());
46236       const EPSILON = 0.01;
46237       const x2 = +meters[0].toFixed(2);
46238       const y2 = +meters[1].toFixed(2);
46239       let hash = utilStringQs(window.location.hash);
46240       let id2 = currSource.id;
46241       if (id2 === "custom") {
46242         id2 = `custom:${currSource.template()}`;
46243       }
46244       if (id2) {
46245         hash.background = id2;
46246       } else {
46247         delete hash.background;
46248       }
46249       if (o2) {
46250         hash.overlays = o2;
46251       } else {
46252         delete hash.overlays;
46253       }
46254       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
46255         hash.offset = `${x2},${y2}`;
46256       } else {
46257         delete hash.offset;
46258       }
46259       if (!window.mocha) {
46260         window.location.replace("#" + utilQsString(hash, true));
46261       }
46262       let imageryUsed = [];
46263       let photoOverlaysUsed = [];
46264       const currUsed = currSource.imageryUsed();
46265       if (currUsed && _isValid) {
46266         imageryUsed.push(currUsed);
46267       }
46268       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
46269       const dataLayer = context.layers().layer("data");
46270       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
46271         imageryUsed.push(dataLayer.getSrc());
46272       }
46273       const photoOverlayLayers = {
46274         streetside: "Bing Streetside",
46275         mapillary: "Mapillary Images",
46276         "mapillary-map-features": "Mapillary Map Features",
46277         "mapillary-signs": "Mapillary Signs",
46278         kartaview: "KartaView Images",
46279         vegbilder: "Norwegian Road Administration Images",
46280         mapilio: "Mapilio Images"
46281       };
46282       for (let layerID in photoOverlayLayers) {
46283         const layer = context.layers().layer(layerID);
46284         if (layer && layer.enabled()) {
46285           photoOverlaysUsed.push(layerID);
46286           imageryUsed.push(photoOverlayLayers[layerID]);
46287         }
46288       }
46289       context.history().imageryUsed(imageryUsed);
46290       context.history().photoOverlaysUsed(photoOverlaysUsed);
46291     };
46292     background.sources = (extent, zoom, includeCurrent) => {
46293       if (!_imageryIndex)
46294         return [];
46295       let visible = {};
46296       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
46297       const currSource = baseLayer.source();
46298       const osm = context.connection();
46299       const blocklists = osm && osm.imageryBlocklists() || [];
46300       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
46301       if (blocklistChanged) {
46302         _imageryIndex.backgrounds.forEach((source) => {
46303           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
46304         });
46305         _checkedBlocklists = blocklists.map((regex) => String(regex));
46306       }
46307       return _imageryIndex.backgrounds.filter((source) => {
46308         if (includeCurrent && currSource === source)
46309           return true;
46310         if (source.isBlocked)
46311           return false;
46312         if (!source.polygon)
46313           return true;
46314         if (zoom && zoom < 6)
46315           return false;
46316         return visible[source.id];
46317       });
46318     };
46319     background.dimensions = (val) => {
46320       if (!val)
46321         return;
46322       baseLayer.dimensions(val);
46323       _overlayLayers.forEach((layer) => layer.dimensions(val));
46324     };
46325     background.baseLayerSource = function(d2) {
46326       if (!arguments.length)
46327         return baseLayer.source();
46328       const osm = context.connection();
46329       if (!osm)
46330         return background;
46331       const blocklists = osm.imageryBlocklists();
46332       const template = d2.template();
46333       let fail = false;
46334       let tested = 0;
46335       let regex;
46336       for (let i3 = 0; i3 < blocklists.length; i3++) {
46337         regex = blocklists[i3];
46338         fail = regex.test(template);
46339         tested++;
46340         if (fail)
46341           break;
46342       }
46343       if (!tested) {
46344         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
46345         fail = regex.test(template);
46346       }
46347       baseLayer.source(!fail ? d2 : background.findSource("none"));
46348       dispatch14.call("change");
46349       background.updateImagery();
46350       return background;
46351     };
46352     background.findSource = (id2) => {
46353       if (!id2 || !_imageryIndex)
46354         return null;
46355       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
46356     };
46357     background.bing = () => {
46358       background.baseLayerSource(background.findSource("Bing"));
46359     };
46360     background.showsLayer = (d2) => {
46361       const currSource = baseLayer.source();
46362       if (!d2 || !currSource)
46363         return false;
46364       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
46365     };
46366     background.overlayLayerSources = () => {
46367       return _overlayLayers.map((layer) => layer.source());
46368     };
46369     background.toggleOverlayLayer = (d2) => {
46370       let layer;
46371       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
46372         layer = _overlayLayers[i3];
46373         if (layer.source() === d2) {
46374           _overlayLayers.splice(i3, 1);
46375           dispatch14.call("change");
46376           background.updateImagery();
46377           return;
46378         }
46379       }
46380       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
46381         baseLayer.dimensions()
46382       );
46383       _overlayLayers.push(layer);
46384       dispatch14.call("change");
46385       background.updateImagery();
46386     };
46387     background.nudge = (d2, zoom) => {
46388       const currSource = baseLayer.source();
46389       if (currSource) {
46390         currSource.nudge(d2, zoom);
46391         dispatch14.call("change");
46392         background.updateImagery();
46393       }
46394       return background;
46395     };
46396     background.offset = function(d2) {
46397       const currSource = baseLayer.source();
46398       if (!arguments.length) {
46399         return currSource && currSource.offset() || [0, 0];
46400       }
46401       if (currSource) {
46402         currSource.offset(d2);
46403         dispatch14.call("change");
46404         background.updateImagery();
46405       }
46406       return background;
46407     };
46408     background.brightness = function(d2) {
46409       if (!arguments.length)
46410         return _brightness;
46411       _brightness = d2;
46412       if (context.mode())
46413         dispatch14.call("change");
46414       return background;
46415     };
46416     background.contrast = function(d2) {
46417       if (!arguments.length)
46418         return _contrast;
46419       _contrast = d2;
46420       if (context.mode())
46421         dispatch14.call("change");
46422       return background;
46423     };
46424     background.saturation = function(d2) {
46425       if (!arguments.length)
46426         return _saturation;
46427       _saturation = d2;
46428       if (context.mode())
46429         dispatch14.call("change");
46430       return background;
46431     };
46432     background.sharpness = function(d2) {
46433       if (!arguments.length)
46434         return _sharpness;
46435       _sharpness = d2;
46436       if (context.mode())
46437         dispatch14.call("change");
46438       return background;
46439     };
46440     let _loadPromise;
46441     background.ensureLoaded = () => {
46442       if (_loadPromise)
46443         return _loadPromise;
46444       return _loadPromise = ensureImageryIndex();
46445     };
46446     background.init = () => {
46447       const loadPromise = background.ensureLoaded();
46448       const hash = utilStringQs(window.location.hash);
46449       const requestedBackground = hash.background || hash.layer;
46450       const lastUsedBackground = corePreferences("background-last-used");
46451       return loadPromise.then((imageryIndex) => {
46452         const extent = context.map().extent();
46453         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
46454         const first = validBackgrounds.length && validBackgrounds[0];
46455         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
46456         let best;
46457         if (!requestedBackground && extent) {
46458           const viewArea = extent.area();
46459           best = validBackgrounds.find((s2) => {
46460             if (!s2.best() || s2.overlay)
46461               return false;
46462             let bbox2 = es_default(bboxClip(
46463               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
46464               extent.rectangle()
46465             ));
46466             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
46467             return area / viewArea > 0.5;
46468           });
46469         }
46470         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
46471           const template = requestedBackground.replace(/^custom:/, "");
46472           const custom = background.findSource("custom");
46473           background.baseLayerSource(custom.template(template));
46474           corePreferences("background-custom-template", template);
46475         } else {
46476           background.baseLayerSource(
46477             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
46478           );
46479         }
46480         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
46481         if (locator) {
46482           background.toggleOverlayLayer(locator);
46483         }
46484         const overlays = (hash.overlays || "").split(",");
46485         overlays.forEach((overlay) => {
46486           overlay = background.findSource(overlay);
46487           if (overlay) {
46488             background.toggleOverlayLayer(overlay);
46489           }
46490         });
46491         if (hash.gpx) {
46492           const gpx2 = context.layers().layer("data");
46493           if (gpx2) {
46494             gpx2.url(hash.gpx, ".gpx");
46495           }
46496         }
46497         if (hash.offset) {
46498           const offset = hash.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
46499           if (offset.length === 2) {
46500             background.offset(geoMetersToOffset(offset));
46501           }
46502         }
46503       }).catch((err) => {
46504         console.error(err);
46505       });
46506     };
46507     return utilRebind(background, dispatch14, "on");
46508   }
46509
46510   // modules/renderer/features.js
46511   function rendererFeatures(context) {
46512     var dispatch14 = dispatch_default("change", "redraw");
46513     var features = utilRebind({}, dispatch14, "on");
46514     var _deferred2 = /* @__PURE__ */ new Set();
46515     var traffic_roads = {
46516       "motorway": true,
46517       "motorway_link": true,
46518       "trunk": true,
46519       "trunk_link": true,
46520       "primary": true,
46521       "primary_link": true,
46522       "secondary": true,
46523       "secondary_link": true,
46524       "tertiary": true,
46525       "tertiary_link": true,
46526       "residential": true,
46527       "unclassified": true,
46528       "living_street": true,
46529       "busway": true
46530     };
46531     var service_roads = {
46532       "service": true,
46533       "road": true,
46534       "track": true
46535     };
46536     var paths = {
46537       "path": true,
46538       "footway": true,
46539       "cycleway": true,
46540       "bridleway": true,
46541       "steps": true,
46542       "pedestrian": true
46543     };
46544     var _cullFactor = 1;
46545     var _cache4 = {};
46546     var _rules = {};
46547     var _stats = {};
46548     var _keys = [];
46549     var _hidden = [];
46550     var _forceVisible = {};
46551     function update() {
46552       if (!window.mocha) {
46553         var hash = utilStringQs(window.location.hash);
46554         var disabled = features.disabled();
46555         if (disabled.length) {
46556           hash.disable_features = disabled.join(",");
46557         } else {
46558           delete hash.disable_features;
46559         }
46560         window.location.replace("#" + utilQsString(hash, true));
46561         corePreferences("disabled-features", disabled.join(","));
46562       }
46563       _hidden = features.hidden();
46564       dispatch14.call("change");
46565       dispatch14.call("redraw");
46566     }
46567     function defineRule(k2, filter2, max3) {
46568       var isEnabled = true;
46569       _keys.push(k2);
46570       _rules[k2] = {
46571         filter: filter2,
46572         enabled: isEnabled,
46573         // whether the user wants it enabled..
46574         count: 0,
46575         currentMax: max3 || Infinity,
46576         defaultMax: max3 || Infinity,
46577         enable: function() {
46578           this.enabled = true;
46579           this.currentMax = this.defaultMax;
46580         },
46581         disable: function() {
46582           this.enabled = false;
46583           this.currentMax = 0;
46584         },
46585         hidden: function() {
46586           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
46587         },
46588         autoHidden: function() {
46589           return this.hidden() && this.currentMax > 0;
46590         }
46591       };
46592     }
46593     defineRule("points", function isPoint(tags, geometry) {
46594       return geometry === "point";
46595     }, 200);
46596     defineRule("traffic_roads", function isTrafficRoad(tags) {
46597       return traffic_roads[tags.highway];
46598     });
46599     defineRule("service_roads", function isServiceRoad(tags) {
46600       return service_roads[tags.highway];
46601     });
46602     defineRule("paths", function isPath(tags) {
46603       return paths[tags.highway];
46604     });
46605     defineRule("buildings", function isBuilding(tags) {
46606       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
46607     }, 250);
46608     defineRule("building_parts", function isBuildingPart(tags) {
46609       return tags["building:part"];
46610     });
46611     defineRule("indoor", function isIndoor(tags) {
46612       return tags.indoor;
46613     });
46614     defineRule("landuse", function isLanduse(tags, geometry) {
46615       return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
46616     });
46617     defineRule("boundaries", function isBoundary(tags, geometry) {
46618       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);
46619     });
46620     defineRule("water", function isWater(tags) {
46621       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";
46622     });
46623     defineRule("rail", function isRail(tags) {
46624       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
46625     });
46626     defineRule("pistes", function isPiste(tags) {
46627       return tags["piste:type"];
46628     });
46629     defineRule("aerialways", function isPiste(tags) {
46630       return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
46631     });
46632     defineRule("power", function isPower(tags) {
46633       return !!tags.power;
46634     });
46635     defineRule("past_future", function isPastFuture(tags) {
46636       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
46637         return false;
46638       }
46639       var strings = Object.keys(tags);
46640       for (var i3 = 0; i3 < strings.length; i3++) {
46641         var s2 = strings[i3];
46642         if (osmLifecyclePrefixes[s2] || osmLifecyclePrefixes[tags[s2]])
46643           return true;
46644       }
46645       return false;
46646     });
46647     defineRule("others", function isOther(tags, geometry) {
46648       return geometry === "line" || geometry === "area";
46649     });
46650     features.features = function() {
46651       return _rules;
46652     };
46653     features.keys = function() {
46654       return _keys;
46655     };
46656     features.enabled = function(k2) {
46657       if (!arguments.length) {
46658         return _keys.filter(function(k3) {
46659           return _rules[k3].enabled;
46660         });
46661       }
46662       return _rules[k2] && _rules[k2].enabled;
46663     };
46664     features.disabled = function(k2) {
46665       if (!arguments.length) {
46666         return _keys.filter(function(k3) {
46667           return !_rules[k3].enabled;
46668         });
46669       }
46670       return _rules[k2] && !_rules[k2].enabled;
46671     };
46672     features.hidden = function(k2) {
46673       if (!arguments.length) {
46674         return _keys.filter(function(k3) {
46675           return _rules[k3].hidden();
46676         });
46677       }
46678       return _rules[k2] && _rules[k2].hidden();
46679     };
46680     features.autoHidden = function(k2) {
46681       if (!arguments.length) {
46682         return _keys.filter(function(k3) {
46683           return _rules[k3].autoHidden();
46684         });
46685       }
46686       return _rules[k2] && _rules[k2].autoHidden();
46687     };
46688     features.enable = function(k2) {
46689       if (_rules[k2] && !_rules[k2].enabled) {
46690         _rules[k2].enable();
46691         update();
46692       }
46693     };
46694     features.enableAll = function() {
46695       var didEnable = false;
46696       for (var k2 in _rules) {
46697         if (!_rules[k2].enabled) {
46698           didEnable = true;
46699           _rules[k2].enable();
46700         }
46701       }
46702       if (didEnable)
46703         update();
46704     };
46705     features.disable = function(k2) {
46706       if (_rules[k2] && _rules[k2].enabled) {
46707         _rules[k2].disable();
46708         update();
46709       }
46710     };
46711     features.disableAll = function() {
46712       var didDisable = false;
46713       for (var k2 in _rules) {
46714         if (_rules[k2].enabled) {
46715           didDisable = true;
46716           _rules[k2].disable();
46717         }
46718       }
46719       if (didDisable)
46720         update();
46721     };
46722     features.toggle = function(k2) {
46723       if (_rules[k2]) {
46724         (function(f3) {
46725           return f3.enabled ? f3.disable() : f3.enable();
46726         })(_rules[k2]);
46727         update();
46728       }
46729     };
46730     features.resetStats = function() {
46731       for (var i3 = 0; i3 < _keys.length; i3++) {
46732         _rules[_keys[i3]].count = 0;
46733       }
46734       dispatch14.call("change");
46735     };
46736     features.gatherStats = function(d2, resolver, dimensions) {
46737       var needsRedraw = false;
46738       var types = utilArrayGroupBy(d2, "type");
46739       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
46740       var currHidden, geometry, matches, i3, j3;
46741       for (i3 = 0; i3 < _keys.length; i3++) {
46742         _rules[_keys[i3]].count = 0;
46743       }
46744       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
46745       for (i3 = 0; i3 < entities.length; i3++) {
46746         geometry = entities[i3].geometry(resolver);
46747         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
46748         for (j3 = 0; j3 < matches.length; j3++) {
46749           _rules[matches[j3]].count++;
46750         }
46751       }
46752       currHidden = features.hidden();
46753       if (currHidden !== _hidden) {
46754         _hidden = currHidden;
46755         needsRedraw = true;
46756         dispatch14.call("change");
46757       }
46758       return needsRedraw;
46759     };
46760     features.stats = function() {
46761       for (var i3 = 0; i3 < _keys.length; i3++) {
46762         _stats[_keys[i3]] = _rules[_keys[i3]].count;
46763       }
46764       return _stats;
46765     };
46766     features.clear = function(d2) {
46767       for (var i3 = 0; i3 < d2.length; i3++) {
46768         features.clearEntity(d2[i3]);
46769       }
46770     };
46771     features.clearEntity = function(entity) {
46772       delete _cache4[osmEntity.key(entity)];
46773     };
46774     features.reset = function() {
46775       Array.from(_deferred2).forEach(function(handle) {
46776         window.cancelIdleCallback(handle);
46777         _deferred2.delete(handle);
46778       });
46779       _cache4 = {};
46780     };
46781     function relationShouldBeChecked(relation) {
46782       return relation.tags.type === "boundary";
46783     }
46784     features.getMatches = function(entity, resolver, geometry) {
46785       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
46786         return {};
46787       var ent = osmEntity.key(entity);
46788       if (!_cache4[ent]) {
46789         _cache4[ent] = {};
46790       }
46791       if (!_cache4[ent].matches) {
46792         var matches = {};
46793         var hasMatch = false;
46794         for (var i3 = 0; i3 < _keys.length; i3++) {
46795           if (_keys[i3] === "others") {
46796             if (hasMatch)
46797               continue;
46798             if (entity.type === "way") {
46799               var parents = features.getParents(entity, resolver, geometry);
46800               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
46801               parents.length > 0 && parents.every(function(parent) {
46802                 return parent.tags.type === "boundary";
46803               })) {
46804                 var pkey = osmEntity.key(parents[0]);
46805                 if (_cache4[pkey] && _cache4[pkey].matches) {
46806                   matches = Object.assign({}, _cache4[pkey].matches);
46807                   continue;
46808                 }
46809               }
46810             }
46811           }
46812           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
46813             matches[_keys[i3]] = hasMatch = true;
46814           }
46815         }
46816         _cache4[ent].matches = matches;
46817       }
46818       return _cache4[ent].matches;
46819     };
46820     features.getParents = function(entity, resolver, geometry) {
46821       if (geometry === "point")
46822         return [];
46823       var ent = osmEntity.key(entity);
46824       if (!_cache4[ent]) {
46825         _cache4[ent] = {};
46826       }
46827       if (!_cache4[ent].parents) {
46828         var parents = [];
46829         if (geometry === "vertex") {
46830           parents = resolver.parentWays(entity);
46831         } else {
46832           parents = resolver.parentRelations(entity);
46833         }
46834         _cache4[ent].parents = parents;
46835       }
46836       return _cache4[ent].parents;
46837     };
46838     features.isHiddenPreset = function(preset, geometry) {
46839       if (!_hidden.length)
46840         return false;
46841       if (!preset.tags)
46842         return false;
46843       var test = preset.setTags({}, geometry);
46844       for (var key in _rules) {
46845         if (_rules[key].filter(test, geometry)) {
46846           if (_hidden.indexOf(key) !== -1) {
46847             return key;
46848           }
46849           return false;
46850         }
46851       }
46852       return false;
46853     };
46854     features.isHiddenFeature = function(entity, resolver, geometry) {
46855       if (!_hidden.length)
46856         return false;
46857       if (!entity.version)
46858         return false;
46859       if (_forceVisible[entity.id])
46860         return false;
46861       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
46862       return matches.length && matches.every(function(k2) {
46863         return features.hidden(k2);
46864       });
46865     };
46866     features.isHiddenChild = function(entity, resolver, geometry) {
46867       if (!_hidden.length)
46868         return false;
46869       if (!entity.version || geometry === "point")
46870         return false;
46871       if (_forceVisible[entity.id])
46872         return false;
46873       var parents = features.getParents(entity, resolver, geometry);
46874       if (!parents.length)
46875         return false;
46876       for (var i3 = 0; i3 < parents.length; i3++) {
46877         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
46878           return false;
46879         }
46880       }
46881       return true;
46882     };
46883     features.hasHiddenConnections = function(entity, resolver) {
46884       if (!_hidden.length)
46885         return false;
46886       var childNodes, connections;
46887       if (entity.type === "midpoint") {
46888         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
46889         connections = [];
46890       } else {
46891         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
46892         connections = features.getParents(entity, resolver, entity.geometry(resolver));
46893       }
46894       connections = childNodes.reduce(function(result, e3) {
46895         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
46896       }, connections);
46897       return connections.some(function(e3) {
46898         return features.isHidden(e3, resolver, e3.geometry(resolver));
46899       });
46900     };
46901     features.isHidden = function(entity, resolver, geometry) {
46902       if (!_hidden.length)
46903         return false;
46904       if (!entity.version)
46905         return false;
46906       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
46907       return fn(entity, resolver, geometry);
46908     };
46909     features.filter = function(d2, resolver) {
46910       if (!_hidden.length)
46911         return d2;
46912       var result = [];
46913       for (var i3 = 0; i3 < d2.length; i3++) {
46914         var entity = d2[i3];
46915         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
46916           result.push(entity);
46917         }
46918       }
46919       return result;
46920     };
46921     features.forceVisible = function(entityIDs) {
46922       if (!arguments.length)
46923         return Object.keys(_forceVisible);
46924       _forceVisible = {};
46925       for (var i3 = 0; i3 < entityIDs.length; i3++) {
46926         _forceVisible[entityIDs[i3]] = true;
46927         var entity = context.hasEntity(entityIDs[i3]);
46928         if (entity && entity.type === "relation") {
46929           for (var j3 in entity.members) {
46930             _forceVisible[entity.members[j3].id] = true;
46931           }
46932         }
46933       }
46934       return features;
46935     };
46936     features.init = function() {
46937       var storage = corePreferences("disabled-features");
46938       if (storage) {
46939         var storageDisabled = storage.replace(/;/g, ",").split(",");
46940         storageDisabled.forEach(features.disable);
46941       }
46942       var hash = utilStringQs(window.location.hash);
46943       if (hash.disable_features) {
46944         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
46945         hashDisabled.forEach(features.disable);
46946       }
46947     };
46948     context.history().on("merge.features", function(newEntities) {
46949       if (!newEntities)
46950         return;
46951       var handle = window.requestIdleCallback(function() {
46952         var graph = context.graph();
46953         var types = utilArrayGroupBy(newEntities, "type");
46954         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
46955         for (var i3 = 0; i3 < entities.length; i3++) {
46956           var geometry = entities[i3].geometry(graph);
46957           features.getMatches(entities[i3], graph, geometry);
46958         }
46959       });
46960       _deferred2.add(handle);
46961     });
46962     return features;
46963   }
46964
46965   // modules/svg/areas.js
46966   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
46967
46968   // modules/svg/helpers.js
46969   function svgPassiveVertex(node, graph, activeID) {
46970     if (!activeID)
46971       return 1;
46972     if (activeID === node.id)
46973       return 0;
46974     var parents = graph.parentWays(node);
46975     var i3, j3, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
46976     for (i3 = 0; i3 < parents.length; i3++) {
46977       nodes = parents[i3].nodes;
46978       isClosed = parents[i3].isClosed();
46979       for (j3 = 0; j3 < nodes.length; j3++) {
46980         if (nodes[j3] === node.id) {
46981           ix1 = j3 - 2;
46982           ix2 = j3 - 1;
46983           ix3 = j3 + 1;
46984           ix4 = j3 + 2;
46985           if (isClosed) {
46986             max3 = nodes.length - 1;
46987             if (ix1 < 0)
46988               ix1 = max3 + ix1;
46989             if (ix2 < 0)
46990               ix2 = max3 + ix2;
46991             if (ix3 > max3)
46992               ix3 = ix3 - max3;
46993             if (ix4 > max3)
46994               ix4 = ix4 - max3;
46995           }
46996           if (nodes[ix1] === activeID)
46997             return 0;
46998           else if (nodes[ix2] === activeID)
46999             return 2;
47000           else if (nodes[ix3] === activeID)
47001             return 2;
47002           else if (nodes[ix4] === activeID)
47003             return 0;
47004           else if (isClosed && nodes.indexOf(activeID) !== -1)
47005             return 0;
47006         }
47007       }
47008     }
47009     return 1;
47010   }
47011   function svgMarkerSegments(projection2, graph, dt2, shouldReverse, bothDirections) {
47012     return function(entity) {
47013       var i3 = 0;
47014       var offset = dt2;
47015       var segments = [];
47016       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
47017       var coordinates = graph.childNodes(entity).map(function(n3) {
47018         return n3.loc;
47019       });
47020       var a2, b2;
47021       if (shouldReverse(entity)) {
47022         coordinates.reverse();
47023       }
47024       stream_default({
47025         type: "LineString",
47026         coordinates
47027       }, projection2.stream(clip({
47028         lineStart: function() {
47029         },
47030         lineEnd: function() {
47031           a2 = null;
47032         },
47033         point: function(x2, y2) {
47034           b2 = [x2, y2];
47035           if (a2) {
47036             var span = geoVecLength(a2, b2) - offset;
47037             if (span >= 0) {
47038               var heading = geoVecAngle(a2, b2);
47039               var dx = dt2 * Math.cos(heading);
47040               var dy = dt2 * Math.sin(heading);
47041               var p2 = [
47042                 a2[0] + offset * Math.cos(heading),
47043                 a2[1] + offset * Math.sin(heading)
47044               ];
47045               var coord2 = [a2, p2];
47046               for (span -= dt2; span >= 0; span -= dt2) {
47047                 p2 = geoVecAdd(p2, [dx, dy]);
47048                 coord2.push(p2);
47049               }
47050               coord2.push(b2);
47051               var segment = "";
47052               var j3;
47053               for (j3 = 0; j3 < coord2.length; j3++) {
47054                 segment += (j3 === 0 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
47055               }
47056               segments.push({ id: entity.id, index: i3++, d: segment });
47057               if (bothDirections(entity)) {
47058                 segment = "";
47059                 for (j3 = coord2.length - 1; j3 >= 0; j3--) {
47060                   segment += (j3 === coord2.length - 1 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
47061                 }
47062                 segments.push({ id: entity.id, index: i3++, d: segment });
47063               }
47064             }
47065             offset = -span;
47066           }
47067           a2 = b2;
47068         }
47069       })));
47070       return segments;
47071     };
47072   }
47073   function svgPath(projection2, graph, isArea) {
47074     var cache = {};
47075     var padding = isArea ? 65 : 5;
47076     var viewport = projection2.clipExtent();
47077     var paddedExtent = [
47078       [viewport[0][0] - padding, viewport[0][1] - padding],
47079       [viewport[1][0] + padding, viewport[1][1] + padding]
47080     ];
47081     var clip = identity_default2().clipExtent(paddedExtent).stream;
47082     var project = projection2.stream;
47083     var path = path_default().projection({ stream: function(output) {
47084       return project(clip(output));
47085     } });
47086     var svgpath = function(entity) {
47087       if (entity.id in cache) {
47088         return cache[entity.id];
47089       } else {
47090         return cache[entity.id] = path(entity.asGeoJSON(graph));
47091       }
47092     };
47093     svgpath.geojson = function(d2) {
47094       if (d2.__featurehash__ !== void 0) {
47095         if (d2.__featurehash__ in cache) {
47096           return cache[d2.__featurehash__];
47097         } else {
47098           return cache[d2.__featurehash__] = path(d2);
47099         }
47100       } else {
47101         return path(d2);
47102       }
47103     };
47104     return svgpath;
47105   }
47106   function svgPointTransform(projection2) {
47107     var svgpoint = function(entity) {
47108       var pt2 = projection2(entity.loc);
47109       return "translate(" + pt2[0] + "," + pt2[1] + ")";
47110     };
47111     svgpoint.geojson = function(d2) {
47112       return svgpoint(d2.properties.entity);
47113     };
47114     return svgpoint;
47115   }
47116   function svgRelationMemberTags(graph) {
47117     return function(entity) {
47118       var tags = entity.tags;
47119       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
47120       graph.parentRelations(entity).forEach(function(relation) {
47121         var type2 = relation.tags.type;
47122         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
47123           tags = Object.assign({}, relation.tags, tags);
47124         }
47125       });
47126       return tags;
47127     };
47128   }
47129   function svgSegmentWay(way, graph, activeID) {
47130     if (activeID === void 0) {
47131       return graph.transient(way, "waySegments", getWaySegments);
47132     } else {
47133       return getWaySegments();
47134     }
47135     function getWaySegments() {
47136       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
47137       var features = { passive: [], active: [] };
47138       var start2 = {};
47139       var end = {};
47140       var node, type2;
47141       for (var i3 = 0; i3 < way.nodes.length; i3++) {
47142         node = graph.entity(way.nodes[i3]);
47143         type2 = svgPassiveVertex(node, graph, activeID);
47144         end = { node, type: type2 };
47145         if (start2.type !== void 0) {
47146           if (start2.node.id === activeID || end.node.id === activeID) {
47147           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
47148             pushActive(start2, end, i3);
47149           } else if (start2.type === 0 && end.type === 0) {
47150             pushActive(start2, end, i3);
47151           } else {
47152             pushPassive(start2, end, i3);
47153           }
47154         }
47155         start2 = end;
47156       }
47157       return features;
47158       function pushActive(start3, end2, index) {
47159         features.active.push({
47160           type: "Feature",
47161           id: way.id + "-" + index + "-nope",
47162           properties: {
47163             nope: true,
47164             target: true,
47165             entity: way,
47166             nodes: [start3.node, end2.node],
47167             index
47168           },
47169           geometry: {
47170             type: "LineString",
47171             coordinates: [start3.node.loc, end2.node.loc]
47172           }
47173         });
47174       }
47175       function pushPassive(start3, end2, index) {
47176         features.passive.push({
47177           type: "Feature",
47178           id: way.id + "-" + index,
47179           properties: {
47180             target: true,
47181             entity: way,
47182             nodes: [start3.node, end2.node],
47183             index
47184           },
47185           geometry: {
47186             type: "LineString",
47187             coordinates: [start3.node.loc, end2.node.loc]
47188           }
47189         });
47190       }
47191     }
47192   }
47193
47194   // modules/svg/tag_classes.js
47195   function svgTagClasses() {
47196     var primaries = [
47197       "building",
47198       "highway",
47199       "railway",
47200       "waterway",
47201       "aeroway",
47202       "aerialway",
47203       "piste:type",
47204       "boundary",
47205       "power",
47206       "amenity",
47207       "natural",
47208       "landuse",
47209       "leisure",
47210       "military",
47211       "place",
47212       "man_made",
47213       "route",
47214       "attraction",
47215       "building:part",
47216       "indoor"
47217     ];
47218     var statuses = Object.keys(osmLifecyclePrefixes);
47219     var secondaries = [
47220       "oneway",
47221       "bridge",
47222       "tunnel",
47223       "embankment",
47224       "cutting",
47225       "barrier",
47226       "surface",
47227       "tracktype",
47228       "footway",
47229       "crossing",
47230       "service",
47231       "sport",
47232       "public_transport",
47233       "location",
47234       "parking",
47235       "golf",
47236       "type",
47237       "leisure",
47238       "man_made",
47239       "indoor",
47240       "construction",
47241       "proposed"
47242     ];
47243     var _tags = function(entity) {
47244       return entity.tags;
47245     };
47246     var tagClasses = function(selection2) {
47247       selection2.each(function tagClassesEach(entity) {
47248         var value = this.className;
47249         if (value.baseVal !== void 0) {
47250           value = value.baseVal;
47251         }
47252         var t2 = _tags(entity);
47253         var computed = tagClasses.getClassesString(t2, value);
47254         if (computed !== value) {
47255           select_default2(this).attr("class", computed);
47256         }
47257       });
47258     };
47259     tagClasses.getClassesString = function(t2, value) {
47260       var primary, status;
47261       var i3, j3, k2, v2;
47262       var overrideGeometry;
47263       if (/\bstroke\b/.test(value)) {
47264         if (!!t2.barrier && t2.barrier !== "no") {
47265           overrideGeometry = "line";
47266         }
47267       }
47268       var classes = value.trim().split(/\s+/).filter(function(klass) {
47269         return klass.length && !/^tag-/.test(klass);
47270       }).map(function(klass) {
47271         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
47272       });
47273       for (i3 = 0; i3 < primaries.length; i3++) {
47274         k2 = primaries[i3];
47275         v2 = t2[k2];
47276         if (!v2 || v2 === "no")
47277           continue;
47278         if (k2 === "piste:type") {
47279           k2 = "piste";
47280         } else if (k2 === "building:part") {
47281           k2 = "building_part";
47282         }
47283         primary = k2;
47284         if (statuses.indexOf(v2) !== -1) {
47285           status = v2;
47286           classes.push("tag-" + k2);
47287         } else {
47288           classes.push("tag-" + k2);
47289           classes.push("tag-" + k2 + "-" + v2);
47290         }
47291         break;
47292       }
47293       if (!primary) {
47294         for (i3 = 0; i3 < statuses.length; i3++) {
47295           for (j3 = 0; j3 < primaries.length; j3++) {
47296             k2 = statuses[i3] + ":" + primaries[j3];
47297             v2 = t2[k2];
47298             if (!v2 || v2 === "no")
47299               continue;
47300             status = statuses[i3];
47301             break;
47302           }
47303         }
47304       }
47305       if (!status) {
47306         for (i3 = 0; i3 < statuses.length; i3++) {
47307           k2 = statuses[i3];
47308           v2 = t2[k2];
47309           if (!v2 || v2 === "no")
47310             continue;
47311           if (v2 === "yes") {
47312             status = k2;
47313           } else if (primary && primary === v2) {
47314             status = k2;
47315           } else if (!primary && primaries.indexOf(v2) !== -1) {
47316             status = k2;
47317             primary = v2;
47318             classes.push("tag-" + v2);
47319           }
47320           if (status)
47321             break;
47322         }
47323       }
47324       if (status) {
47325         classes.push("tag-status");
47326         classes.push("tag-status-" + status);
47327       }
47328       for (i3 = 0; i3 < secondaries.length; i3++) {
47329         k2 = secondaries[i3];
47330         v2 = t2[k2];
47331         if (!v2 || v2 === "no" || k2 === primary)
47332           continue;
47333         classes.push("tag-" + k2);
47334         classes.push("tag-" + k2 + "-" + v2);
47335       }
47336       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
47337         var surface = t2.highway === "track" ? "unpaved" : "paved";
47338         for (k2 in t2) {
47339           v2 = t2[k2];
47340           if (k2 in osmPavedTags) {
47341             surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
47342           }
47343           if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
47344             surface = "semipaved";
47345           }
47346         }
47347         classes.push("tag-" + surface);
47348       }
47349       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
47350       if (qid) {
47351         classes.push("tag-wikidata");
47352       }
47353       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
47354     };
47355     tagClasses.tags = function(val) {
47356       if (!arguments.length)
47357         return _tags;
47358       _tags = val;
47359       return tagClasses;
47360     };
47361     return tagClasses;
47362   }
47363
47364   // modules/svg/tag_pattern.js
47365   var patterns = {
47366     // tag - pattern name
47367     // -or-
47368     // tag - value - pattern name
47369     // -or-
47370     // tag - value - rules (optional tag-values, pattern name)
47371     // (matches earlier rules first, so fallback should be last entry)
47372     amenity: {
47373       grave_yard: "cemetery",
47374       fountain: "water_standing"
47375     },
47376     landuse: {
47377       cemetery: [
47378         { religion: "christian", pattern: "cemetery_christian" },
47379         { religion: "buddhist", pattern: "cemetery_buddhist" },
47380         { religion: "muslim", pattern: "cemetery_muslim" },
47381         { religion: "jewish", pattern: "cemetery_jewish" },
47382         { pattern: "cemetery" }
47383       ],
47384       construction: "construction",
47385       farmland: "farmland",
47386       farmyard: "farmyard",
47387       forest: [
47388         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47389         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47390         { leaf_type: "leafless", pattern: "forest_leafless" },
47391         { pattern: "forest" }
47392         // same as 'leaf_type:mixed'
47393       ],
47394       grave_yard: "cemetery",
47395       grass: "grass",
47396       landfill: "landfill",
47397       meadow: "meadow",
47398       military: "construction",
47399       orchard: "orchard",
47400       quarry: "quarry",
47401       vineyard: "vineyard"
47402     },
47403     leisure: {
47404       horse_riding: "farmyard"
47405     },
47406     natural: {
47407       beach: "beach",
47408       grassland: "grass",
47409       sand: "beach",
47410       scrub: "scrub",
47411       water: [
47412         { water: "pond", pattern: "pond" },
47413         { water: "reservoir", pattern: "water_standing" },
47414         { pattern: "waves" }
47415       ],
47416       wetland: [
47417         { wetland: "marsh", pattern: "wetland_marsh" },
47418         { wetland: "swamp", pattern: "wetland_swamp" },
47419         { wetland: "bog", pattern: "wetland_bog" },
47420         { wetland: "reedbed", pattern: "wetland_reedbed" },
47421         { pattern: "wetland" }
47422       ],
47423       wood: [
47424         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47425         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47426         { leaf_type: "leafless", pattern: "forest_leafless" },
47427         { pattern: "forest" }
47428         // same as 'leaf_type:mixed'
47429       ]
47430     },
47431     golf: {
47432       green: "golf_green",
47433       tee: "grass",
47434       fairway: "grass",
47435       rough: "scrub"
47436     },
47437     surface: {
47438       grass: "grass",
47439       sand: "beach"
47440     }
47441   };
47442   function svgTagPattern(tags) {
47443     if (tags.building && tags.building !== "no") {
47444       return null;
47445     }
47446     for (var tag in patterns) {
47447       var entityValue = tags[tag];
47448       if (!entityValue)
47449         continue;
47450       if (typeof patterns[tag] === "string") {
47451         return "pattern-" + patterns[tag];
47452       } else {
47453         var values = patterns[tag];
47454         for (var value in values) {
47455           if (entityValue !== value)
47456             continue;
47457           var rules = values[value];
47458           if (typeof rules === "string") {
47459             return "pattern-" + rules;
47460           }
47461           for (var ruleKey in rules) {
47462             var rule = rules[ruleKey];
47463             var pass = true;
47464             for (var criterion in rule) {
47465               if (criterion !== "pattern") {
47466                 var v2 = tags[criterion];
47467                 if (!v2 || v2 !== rule[criterion]) {
47468                   pass = false;
47469                   break;
47470                 }
47471               }
47472             }
47473             if (pass) {
47474               return "pattern-" + rule.pattern;
47475             }
47476           }
47477         }
47478       }
47479     }
47480     return null;
47481   }
47482
47483   // modules/svg/areas.js
47484   function svgAreas(projection2, context) {
47485     function getPatternStyle(tags) {
47486       var imageID = svgTagPattern(tags);
47487       if (imageID) {
47488         return 'url("#ideditor-' + imageID + '")';
47489       }
47490       return "";
47491     }
47492     function drawTargets(selection2, graph, entities, filter2) {
47493       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
47494       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
47495       var getPath = svgPath(projection2).geojson;
47496       var activeID = context.activeID();
47497       var base = context.history().base();
47498       var data = { targets: [], nopes: [] };
47499       entities.forEach(function(way) {
47500         var features = svgSegmentWay(way, graph, activeID);
47501         data.targets.push.apply(data.targets, features.passive);
47502         data.nopes.push.apply(data.nopes, features.active);
47503       });
47504       var targetData = data.targets.filter(getPath);
47505       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
47506         return filter2(d2.properties.entity);
47507       }).data(targetData, function key(d2) {
47508         return d2.id;
47509       });
47510       targets.exit().remove();
47511       var segmentWasEdited = function(d2) {
47512         var wayID = d2.properties.entity.id;
47513         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
47514           return false;
47515         }
47516         return d2.properties.nodes.some(function(n3) {
47517           return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
47518         });
47519       };
47520       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
47521         return "way area target target-allowed " + targetClass + d2.id;
47522       }).classed("segment-edited", segmentWasEdited);
47523       var nopeData = data.nopes.filter(getPath);
47524       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
47525         return filter2(d2.properties.entity);
47526       }).data(nopeData, function key(d2) {
47527         return d2.id;
47528       });
47529       nopes.exit().remove();
47530       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
47531         return "way area target target-nope " + nopeClass + d2.id;
47532       }).classed("segment-edited", segmentWasEdited);
47533     }
47534     function drawAreas(selection2, graph, entities, filter2) {
47535       var path = svgPath(projection2, graph, true);
47536       var areas = {};
47537       var multipolygon;
47538       var base = context.history().base();
47539       for (var i3 = 0; i3 < entities.length; i3++) {
47540         var entity = entities[i3];
47541         if (entity.geometry(graph) !== "area")
47542           continue;
47543         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
47544         if (multipolygon) {
47545           areas[multipolygon.id] = {
47546             entity: multipolygon.mergeTags(entity.tags),
47547             area: Math.abs(entity.area(graph))
47548           };
47549         } else if (!areas[entity.id]) {
47550           areas[entity.id] = {
47551             entity,
47552             area: Math.abs(entity.area(graph))
47553           };
47554         }
47555       }
47556       var fills = Object.values(areas).filter(function hasPath(a2) {
47557         return path(a2.entity);
47558       });
47559       fills.sort(function areaSort(a2, b2) {
47560         return b2.area - a2.area;
47561       });
47562       fills = fills.map(function(a2) {
47563         return a2.entity;
47564       });
47565       var strokes = fills.filter(function(area) {
47566         return area.type === "way";
47567       });
47568       var data = {
47569         clip: fills,
47570         shadow: strokes,
47571         stroke: strokes,
47572         fill: fills
47573       };
47574       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
47575       clipPaths.exit().remove();
47576       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
47577         return "ideditor-" + entity2.id + "-clippath";
47578       });
47579       clipPathsEnter.append("path");
47580       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
47581       var drawLayer = selection2.selectAll(".layer-osm.areas");
47582       var touchLayer = selection2.selectAll(".layer-touch.areas");
47583       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
47584       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
47585         return "areagroup area-" + d2;
47586       }).merge(areagroup);
47587       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
47588         return data[layer];
47589       }, osmEntity.key);
47590       paths.exit().remove();
47591       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
47592       var bisect = bisector(function(node) {
47593         return -node.__data__.area(graph);
47594       }).left;
47595       function sortedByArea(entity2) {
47596         if (this._parent.__data__ === "fill") {
47597           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
47598         }
47599       }
47600       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
47601         var layer = this.parentNode.__data__;
47602         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
47603         if (layer === "fill") {
47604           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
47605           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
47606         }
47607       }).classed("added", function(d2) {
47608         return !base.entities[d2.id];
47609       }).classed("geometry-edited", function(d2) {
47610         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
47611       }).classed("retagged", function(d2) {
47612         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
47613       }).call(svgTagClasses()).attr("d", path);
47614       touchLayer.call(drawTargets, graph, data.stroke, filter2);
47615     }
47616     return drawAreas;
47617   }
47618
47619   // modules/svg/data.js
47620   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
47621
47622   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
47623   function $(element, tagName) {
47624     return Array.from(element.getElementsByTagName(tagName));
47625   }
47626   function normalizeId(id2) {
47627     return id2[0] === "#" ? id2 : `#${id2}`;
47628   }
47629   function $ns(element, tagName, ns) {
47630     return Array.from(element.getElementsByTagNameNS(ns, tagName));
47631   }
47632   function nodeVal(node) {
47633     node?.normalize();
47634     return node && node.textContent || "";
47635   }
47636   function get1(node, tagName, callback) {
47637     const n3 = node.getElementsByTagName(tagName);
47638     const result = n3.length ? n3[0] : null;
47639     if (result && callback)
47640       callback(result);
47641     return result;
47642   }
47643   function get3(node, tagName, callback) {
47644     const properties = {};
47645     if (!node)
47646       return properties;
47647     const n3 = node.getElementsByTagName(tagName);
47648     const result = n3.length ? n3[0] : null;
47649     if (result && callback) {
47650       return callback(result, properties);
47651     }
47652     return properties;
47653   }
47654   function val1(node, tagName, callback) {
47655     const val = nodeVal(get1(node, tagName));
47656     if (val && callback)
47657       return callback(val) || {};
47658     return {};
47659   }
47660   function $num(node, tagName, callback) {
47661     const val = parseFloat(nodeVal(get1(node, tagName)));
47662     if (isNaN(val))
47663       return void 0;
47664     if (val && callback)
47665       return callback(val) || {};
47666     return {};
47667   }
47668   function num1(node, tagName, callback) {
47669     const val = parseFloat(nodeVal(get1(node, tagName)));
47670     if (isNaN(val))
47671       return void 0;
47672     if (callback)
47673       callback(val);
47674     return val;
47675   }
47676   function getMulti(node, propertyNames) {
47677     const properties = {};
47678     for (const property of propertyNames) {
47679       val1(node, property, (val) => {
47680         properties[property] = val;
47681       });
47682     }
47683     return properties;
47684   }
47685   function isElement(node) {
47686     return node?.nodeType === 1;
47687   }
47688   function getLineStyle(node) {
47689     return get3(node, "line", (lineStyle) => {
47690       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
47691         return { stroke: `#${color2}` };
47692       }), $num(lineStyle, "opacity", (opacity) => {
47693         return { "stroke-opacity": opacity };
47694       }), $num(lineStyle, "width", (width) => {
47695         return { "stroke-width": width * 96 / 25.4 };
47696       }));
47697       return val;
47698     });
47699   }
47700   function getExtensions(node) {
47701     let values = [];
47702     if (node === null)
47703       return values;
47704     for (const child of Array.from(node.childNodes)) {
47705       if (!isElement(child))
47706         continue;
47707       const name = abbreviateName(child.nodeName);
47708       if (name === "gpxtpx:TrackPointExtension") {
47709         values = values.concat(getExtensions(child));
47710       } else {
47711         const val = nodeVal(child);
47712         values.push([name, parseNumeric(val)]);
47713       }
47714     }
47715     return values;
47716   }
47717   function abbreviateName(name) {
47718     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
47719   }
47720   function parseNumeric(val) {
47721     const num = parseFloat(val);
47722     return isNaN(num) ? val : num;
47723   }
47724   function coordPair$1(node) {
47725     const ll = [
47726       parseFloat(node.getAttribute("lon") || ""),
47727       parseFloat(node.getAttribute("lat") || "")
47728     ];
47729     if (isNaN(ll[0]) || isNaN(ll[1])) {
47730       return null;
47731     }
47732     num1(node, "ele", (val) => {
47733       ll.push(val);
47734     });
47735     const time = get1(node, "time");
47736     return {
47737       coordinates: ll,
47738       time: time ? nodeVal(time) : null,
47739       extendedValues: getExtensions(get1(node, "extensions"))
47740     };
47741   }
47742   function extractProperties(node) {
47743     const properties = getMulti(node, [
47744       "name",
47745       "cmt",
47746       "desc",
47747       "type",
47748       "time",
47749       "keywords"
47750     ]);
47751     const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
47752     for (const child of extensions) {
47753       if (child.parentNode?.parentNode === node) {
47754         properties[child.tagName.replace(":", "_")] = nodeVal(child);
47755       }
47756     }
47757     const links = $(node, "link");
47758     if (links.length) {
47759       properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
47760     }
47761     return properties;
47762   }
47763   function getPoints$1(node, pointname) {
47764     const pts = $(node, pointname);
47765     const line = [];
47766     const times = [];
47767     const extendedValues = {};
47768     for (let i3 = 0; i3 < pts.length; i3++) {
47769       const c2 = coordPair$1(pts[i3]);
47770       if (!c2) {
47771         continue;
47772       }
47773       line.push(c2.coordinates);
47774       if (c2.time)
47775         times.push(c2.time);
47776       for (const [name, val] of c2.extendedValues) {
47777         const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
47778         if (!extendedValues[plural]) {
47779           extendedValues[plural] = Array(pts.length).fill(null);
47780         }
47781         extendedValues[plural][i3] = val;
47782       }
47783     }
47784     if (line.length < 2)
47785       return;
47786     return {
47787       line,
47788       times,
47789       extendedValues
47790     };
47791   }
47792   function getRoute(node) {
47793     const line = getPoints$1(node, "rtept");
47794     if (!line)
47795       return;
47796     return {
47797       type: "Feature",
47798       properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
47799       geometry: {
47800         type: "LineString",
47801         coordinates: line.line
47802       }
47803     };
47804   }
47805   function getTrack(node) {
47806     const segments = $(node, "trkseg");
47807     const track = [];
47808     const times = [];
47809     const extractedLines = [];
47810     for (const segment of segments) {
47811       const line = getPoints$1(segment, "trkpt");
47812       if (line) {
47813         extractedLines.push(line);
47814         if (line.times && line.times.length)
47815           times.push(line.times);
47816       }
47817     }
47818     if (extractedLines.length === 0)
47819       return null;
47820     const multi = extractedLines.length > 1;
47821     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
47822       coordinateProperties: {
47823         times: multi ? times : times[0]
47824       }
47825     } : {});
47826     for (const line of extractedLines) {
47827       track.push(line.line);
47828       if (!properties.coordinateProperties) {
47829         properties.coordinateProperties = {};
47830       }
47831       const props = properties.coordinateProperties;
47832       const entries = Object.entries(line.extendedValues);
47833       for (let i3 = 0; i3 < entries.length; i3++) {
47834         const [name, val] = entries[i3];
47835         if (multi) {
47836           if (!props[name]) {
47837             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
47838           }
47839           props[name][i3] = val;
47840         } else {
47841           props[name] = val;
47842         }
47843       }
47844     }
47845     return {
47846       type: "Feature",
47847       properties,
47848       geometry: multi ? {
47849         type: "MultiLineString",
47850         coordinates: track
47851       } : {
47852         type: "LineString",
47853         coordinates: track[0]
47854       }
47855     };
47856   }
47857   function getPoint(node) {
47858     const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
47859     const pair3 = coordPair$1(node);
47860     if (!pair3)
47861       return null;
47862     return {
47863       type: "Feature",
47864       properties,
47865       geometry: {
47866         type: "Point",
47867         coordinates: pair3.coordinates
47868       }
47869     };
47870   }
47871   function* gpxGen(node) {
47872     for (const track of $(node, "trk")) {
47873       const feature3 = getTrack(track);
47874       if (feature3)
47875         yield feature3;
47876     }
47877     for (const route of $(node, "rte")) {
47878       const feature3 = getRoute(route);
47879       if (feature3)
47880         yield feature3;
47881     }
47882     for (const waypoint of $(node, "wpt")) {
47883       const point2 = getPoint(waypoint);
47884       if (point2)
47885         yield point2;
47886     }
47887   }
47888   function gpx(node) {
47889     return {
47890       type: "FeatureCollection",
47891       features: Array.from(gpxGen(node))
47892     };
47893   }
47894   function fixColor(v2, prefix) {
47895     const properties = {};
47896     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
47897     if (v2[0] === "#") {
47898       v2 = v2.substring(1);
47899     }
47900     if (v2.length === 6 || v2.length === 3) {
47901       properties[colorProp] = "#" + v2;
47902     } else if (v2.length === 8) {
47903       properties[prefix + "-opacity"] = parseInt(v2.substring(0, 2), 16) / 255;
47904       properties[colorProp] = "#" + v2.substring(6, 8) + v2.substring(4, 6) + v2.substring(2, 4);
47905     }
47906     return properties;
47907   }
47908   function numericProperty(node, source, target) {
47909     const properties = {};
47910     num1(node, source, (val) => {
47911       properties[target] = val;
47912     });
47913     return properties;
47914   }
47915   function getColor(node, output) {
47916     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
47917   }
47918   function extractIconHref(node) {
47919     return get3(node, "Icon", (icon2, properties) => {
47920       val1(icon2, "href", (href) => {
47921         properties.icon = href;
47922       });
47923       return properties;
47924     });
47925   }
47926   function extractIcon(node) {
47927     return get3(node, "IconStyle", (iconStyle) => {
47928       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
47929         const left = parseFloat(hotspot.getAttribute("x") || "");
47930         const top = parseFloat(hotspot.getAttribute("y") || "");
47931         const xunits = hotspot.getAttribute("xunits") || "";
47932         const yunits = hotspot.getAttribute("yunits") || "";
47933         if (!isNaN(left) && !isNaN(top))
47934           return {
47935             "icon-offset": [left, top],
47936             "icon-offset-units": [xunits, yunits]
47937           };
47938         return {};
47939       }), extractIconHref(iconStyle));
47940     });
47941   }
47942   function extractLabel(node) {
47943     return get3(node, "LabelStyle", (labelStyle) => {
47944       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
47945     });
47946   }
47947   function extractLine(node) {
47948     return get3(node, "LineStyle", (lineStyle) => {
47949       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
47950     });
47951   }
47952   function extractPoly(node) {
47953     return get3(node, "PolyStyle", (polyStyle, properties) => {
47954       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
47955         if (fill === "0")
47956           return { "fill-opacity": 0 };
47957       }), val1(polyStyle, "outline", (outline) => {
47958         if (outline === "0")
47959           return { "stroke-opacity": 0 };
47960       }));
47961     });
47962   }
47963   function extractStyle(node) {
47964     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
47965   }
47966   var toNumber2 = (x2) => Number(x2);
47967   var typeConverters = {
47968     string: (x2) => x2,
47969     int: toNumber2,
47970     uint: toNumber2,
47971     short: toNumber2,
47972     ushort: toNumber2,
47973     float: toNumber2,
47974     double: toNumber2,
47975     bool: (x2) => Boolean(x2)
47976   };
47977   function extractExtendedData(node, schema) {
47978     return get3(node, "ExtendedData", (extendedData, properties) => {
47979       for (const data of $(extendedData, "Data")) {
47980         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
47981       }
47982       for (const simpleData of $(extendedData, "SimpleData")) {
47983         const name = simpleData.getAttribute("name") || "";
47984         const typeConverter = schema[name] || typeConverters.string;
47985         properties[name] = typeConverter(nodeVal(simpleData));
47986       }
47987       return properties;
47988     });
47989   }
47990   function getMaybeHTMLDescription(node) {
47991     const descriptionNode = get1(node, "description");
47992     for (const c2 of Array.from(descriptionNode?.childNodes || [])) {
47993       if (c2.nodeType === 4) {
47994         return {
47995           description: {
47996             "@type": "html",
47997             value: nodeVal(c2)
47998           }
47999         };
48000       }
48001     }
48002     return {};
48003   }
48004   function extractTimeSpan(node) {
48005     return get3(node, "TimeSpan", (timeSpan) => {
48006       return {
48007         timespan: {
48008           begin: nodeVal(get1(timeSpan, "begin")),
48009           end: nodeVal(get1(timeSpan, "end"))
48010         }
48011       };
48012     });
48013   }
48014   function extractTimeStamp(node) {
48015     return get3(node, "TimeStamp", (timeStamp) => {
48016       return { timestamp: nodeVal(get1(timeStamp, "when")) };
48017     });
48018   }
48019   function extractCascadedStyle(node, styleMap) {
48020     return val1(node, "styleUrl", (styleUrl) => {
48021       styleUrl = normalizeId(styleUrl);
48022       if (styleMap[styleUrl]) {
48023         return Object.assign({ styleUrl }, styleMap[styleUrl]);
48024       }
48025       return { styleUrl };
48026     });
48027   }
48028   var removeSpace = /\s*/g;
48029   var trimSpace = /^\s*|\s*$/g;
48030   var splitSpace = /\s+/;
48031   function coord1(value) {
48032     return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
48033   }
48034   function coord(value) {
48035     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
48036       return coord2.length >= 2;
48037     });
48038   }
48039   function gxCoords(node) {
48040     let elems = $(node, "coord");
48041     if (elems.length === 0) {
48042       elems = $ns(node, "coord", "*");
48043     }
48044     const coordinates = elems.map((elem) => {
48045       return nodeVal(elem).split(" ").map(parseFloat);
48046     });
48047     if (coordinates.length === 0) {
48048       return null;
48049     }
48050     return {
48051       geometry: coordinates.length > 2 ? {
48052         type: "LineString",
48053         coordinates
48054       } : {
48055         type: "Point",
48056         coordinates: coordinates[0]
48057       },
48058       times: $(node, "when").map((elem) => nodeVal(elem))
48059     };
48060   }
48061   function fixRing(ring) {
48062     if (ring.length === 0)
48063       return ring;
48064     const first = ring[0];
48065     const last = ring[ring.length - 1];
48066     let equal = true;
48067     for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
48068       if (first[i3] !== last[i3]) {
48069         equal = false;
48070         break;
48071       }
48072     }
48073     if (!equal) {
48074       return ring.concat([ring[0]]);
48075     }
48076     return ring;
48077   }
48078   function getCoordinates(node) {
48079     return nodeVal(get1(node, "coordinates"));
48080   }
48081   function getGeometry(node) {
48082     let geometries = [];
48083     let coordTimes = [];
48084     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
48085       const child = node.childNodes.item(i3);
48086       if (isElement(child)) {
48087         switch (child.tagName) {
48088           case "MultiGeometry":
48089           case "MultiTrack":
48090           case "gx:MultiTrack": {
48091             const childGeometries = getGeometry(child);
48092             geometries = geometries.concat(childGeometries.geometries);
48093             coordTimes = coordTimes.concat(childGeometries.coordTimes);
48094             break;
48095           }
48096           case "Point": {
48097             const coordinates = coord1(getCoordinates(child));
48098             if (coordinates.length >= 2) {
48099               geometries.push({
48100                 type: "Point",
48101                 coordinates
48102               });
48103             }
48104             break;
48105           }
48106           case "LinearRing":
48107           case "LineString": {
48108             const coordinates = coord(getCoordinates(child));
48109             if (coordinates.length >= 2) {
48110               geometries.push({
48111                 type: "LineString",
48112                 coordinates
48113               });
48114             }
48115             break;
48116           }
48117           case "Polygon": {
48118             const coords = [];
48119             for (const linearRing of $(child, "LinearRing")) {
48120               const ring = fixRing(coord(getCoordinates(linearRing)));
48121               if (ring.length >= 4) {
48122                 coords.push(ring);
48123               }
48124             }
48125             if (coords.length) {
48126               geometries.push({
48127                 type: "Polygon",
48128                 coordinates: coords
48129               });
48130             }
48131             break;
48132           }
48133           case "Track":
48134           case "gx:Track": {
48135             const gx = gxCoords(child);
48136             if (!gx)
48137               break;
48138             const { times, geometry } = gx;
48139             geometries.push(geometry);
48140             if (times.length)
48141               coordTimes.push(times);
48142             break;
48143           }
48144         }
48145       }
48146     }
48147     return {
48148       geometries,
48149       coordTimes
48150     };
48151   }
48152   function geometryListToGeometry(geometries) {
48153     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
48154       type: "GeometryCollection",
48155       geometries
48156     };
48157   }
48158   function getPlacemark(node, styleMap, schema, options2) {
48159     const { coordTimes, geometries } = getGeometry(node);
48160     const geometry = geometryListToGeometry(geometries);
48161     if (!geometry && options2.skipNullGeometry) {
48162       return null;
48163     }
48164     const feature3 = {
48165       type: "Feature",
48166       geometry,
48167       properties: Object.assign(getMulti(node, [
48168         "name",
48169         "address",
48170         "visibility",
48171         "open",
48172         "phoneNumber",
48173         "description"
48174       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
48175         coordinateProperties: {
48176           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
48177         }
48178       } : {})
48179     };
48180     if (feature3.properties?.visibility !== void 0) {
48181       feature3.properties.visibility = feature3.properties.visibility !== "0";
48182     }
48183     const id2 = node.getAttribute("id");
48184     if (id2 !== null && id2 !== "")
48185       feature3.id = id2;
48186     return feature3;
48187   }
48188   function getGroundOverlayBox(node) {
48189     const latLonQuad = get1(node, "gx:LatLonQuad");
48190     if (latLonQuad) {
48191       const ring = fixRing(coord(getCoordinates(node)));
48192       return {
48193         geometry: {
48194           type: "Polygon",
48195           coordinates: [ring]
48196         }
48197       };
48198     }
48199     return getLatLonBox(node);
48200   }
48201   var DEGREES_TO_RADIANS = Math.PI / 180;
48202   function rotateBox(bbox2, coordinates, rotation) {
48203     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
48204     return [
48205       coordinates[0].map((coordinate) => {
48206         const dy = coordinate[1] - center[1];
48207         const dx = coordinate[0] - center[0];
48208         const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
48209         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
48210         return [
48211           center[0] + Math.cos(angle2) * distance,
48212           center[1] + Math.sin(angle2) * distance
48213         ];
48214       })
48215     ];
48216   }
48217   function getLatLonBox(node) {
48218     const latLonBox = get1(node, "LatLonBox");
48219     if (latLonBox) {
48220       const north = num1(latLonBox, "north");
48221       const west = num1(latLonBox, "west");
48222       const east = num1(latLonBox, "east");
48223       const south = num1(latLonBox, "south");
48224       const rotation = num1(latLonBox, "rotation");
48225       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
48226         const bbox2 = [west, south, east, north];
48227         let coordinates = [
48228           [
48229             [west, north],
48230             [east, north],
48231             [east, south],
48232             [west, south],
48233             [west, north]
48234             // top left (again)
48235           ]
48236         ];
48237         if (typeof rotation === "number") {
48238           coordinates = rotateBox(bbox2, coordinates, rotation);
48239         }
48240         return {
48241           bbox: bbox2,
48242           geometry: {
48243             type: "Polygon",
48244             coordinates
48245           }
48246         };
48247       }
48248     }
48249     return null;
48250   }
48251   function getGroundOverlay(node, styleMap, schema, options2) {
48252     const box = getGroundOverlayBox(node);
48253     const geometry = box?.geometry || null;
48254     if (!geometry && options2.skipNullGeometry) {
48255       return null;
48256     }
48257     const feature3 = {
48258       type: "Feature",
48259       geometry,
48260       properties: Object.assign(
48261         /**
48262          * Related to
48263          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
48264          */
48265         { "@geometry-type": "groundoverlay" },
48266         getMulti(node, [
48267           "name",
48268           "address",
48269           "visibility",
48270           "open",
48271           "phoneNumber",
48272           "description"
48273         ]),
48274         getMaybeHTMLDescription(node),
48275         extractCascadedStyle(node, styleMap),
48276         extractStyle(node),
48277         extractIconHref(node),
48278         extractExtendedData(node, schema),
48279         extractTimeSpan(node),
48280         extractTimeStamp(node)
48281       )
48282     };
48283     if (box?.bbox) {
48284       feature3.bbox = box.bbox;
48285     }
48286     if (feature3.properties?.visibility !== void 0) {
48287       feature3.properties.visibility = feature3.properties.visibility !== "0";
48288     }
48289     const id2 = node.getAttribute("id");
48290     if (id2 !== null && id2 !== "")
48291       feature3.id = id2;
48292     return feature3;
48293   }
48294   function getStyleId(style) {
48295     let id2 = style.getAttribute("id");
48296     const parentNode = style.parentNode;
48297     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
48298       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
48299     }
48300     return normalizeId(id2 || "");
48301   }
48302   function buildStyleMap(node) {
48303     const styleMap = {};
48304     for (const style of $(node, "Style")) {
48305       styleMap[getStyleId(style)] = extractStyle(style);
48306     }
48307     for (const map2 of $(node, "StyleMap")) {
48308       const id2 = normalizeId(map2.getAttribute("id") || "");
48309       val1(map2, "styleUrl", (styleUrl) => {
48310         styleUrl = normalizeId(styleUrl);
48311         if (styleMap[styleUrl]) {
48312           styleMap[id2] = styleMap[styleUrl];
48313         }
48314       });
48315     }
48316     return styleMap;
48317   }
48318   function buildSchema(node) {
48319     const schema = {};
48320     for (const field of $(node, "SimpleField")) {
48321       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"];
48322     }
48323     return schema;
48324   }
48325   function* kmlGen(node, options2 = {
48326     skipNullGeometry: false
48327   }) {
48328     const styleMap = buildStyleMap(node);
48329     const schema = buildSchema(node);
48330     for (const placemark of $(node, "Placemark")) {
48331       const feature3 = getPlacemark(placemark, styleMap, schema, options2);
48332       if (feature3)
48333         yield feature3;
48334     }
48335     for (const groundOverlay of $(node, "GroundOverlay")) {
48336       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
48337       if (feature3)
48338         yield feature3;
48339     }
48340   }
48341   function kml(node, options2 = {
48342     skipNullGeometry: false
48343   }) {
48344     return {
48345       type: "FeatureCollection",
48346       features: Array.from(kmlGen(node, options2))
48347     };
48348   }
48349
48350   // modules/svg/data.js
48351   var _initialized = false;
48352   var _enabled = false;
48353   var _geojson;
48354   function svgData(projection2, context, dispatch14) {
48355     var throttledRedraw = throttle_default(function() {
48356       dispatch14.call("change");
48357     }, 1e3);
48358     var _showLabels = true;
48359     var detected = utilDetect();
48360     var layer = select_default2(null);
48361     var _vtService;
48362     var _fileList;
48363     var _template;
48364     var _src;
48365     const supportedFormats = [
48366       ".gpx",
48367       ".kml",
48368       ".geojson",
48369       ".json"
48370     ];
48371     function init2() {
48372       if (_initialized)
48373         return;
48374       _geojson = {};
48375       _enabled = true;
48376       function over(d3_event) {
48377         d3_event.stopPropagation();
48378         d3_event.preventDefault();
48379         d3_event.dataTransfer.dropEffect = "copy";
48380       }
48381       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
48382         d3_event.stopPropagation();
48383         d3_event.preventDefault();
48384         if (!detected.filedrop)
48385           return;
48386         var f3 = d3_event.dataTransfer.files[0];
48387         var extension = getExtension(f3.name);
48388         if (!supportedFormats.includes(extension))
48389           return;
48390         drawData.fileList(d3_event.dataTransfer.files);
48391       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
48392       _initialized = true;
48393     }
48394     function getService() {
48395       if (services.vectorTile && !_vtService) {
48396         _vtService = services.vectorTile;
48397         _vtService.event.on("loadedData", throttledRedraw);
48398       } else if (!services.vectorTile && _vtService) {
48399         _vtService = null;
48400       }
48401       return _vtService;
48402     }
48403     function showLayer() {
48404       layerOn();
48405       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48406         dispatch14.call("change");
48407       });
48408     }
48409     function hideLayer() {
48410       throttledRedraw.cancel();
48411       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
48412     }
48413     function layerOn() {
48414       layer.style("display", "block");
48415     }
48416     function layerOff() {
48417       layer.selectAll(".viewfield-group").remove();
48418       layer.style("display", "none");
48419     }
48420     function ensureIDs(gj) {
48421       if (!gj)
48422         return null;
48423       if (gj.type === "FeatureCollection") {
48424         for (var i3 = 0; i3 < gj.features.length; i3++) {
48425           ensureFeatureID(gj.features[i3]);
48426         }
48427       } else {
48428         ensureFeatureID(gj);
48429       }
48430       return gj;
48431     }
48432     function ensureFeatureID(feature3) {
48433       if (!feature3)
48434         return;
48435       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
48436       return feature3;
48437     }
48438     function getFeatures(gj) {
48439       if (!gj)
48440         return [];
48441       if (gj.type === "FeatureCollection") {
48442         return gj.features;
48443       } else {
48444         return [gj];
48445       }
48446     }
48447     function featureKey(d2) {
48448       return d2.__featurehash__;
48449     }
48450     function isPolygon(d2) {
48451       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
48452     }
48453     function clipPathID(d2) {
48454       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
48455     }
48456     function featureClasses(d2) {
48457       return [
48458         "data" + d2.__featurehash__,
48459         d2.geometry.type,
48460         isPolygon(d2) ? "area" : "",
48461         d2.__layerID__ || ""
48462       ].filter(Boolean).join(" ");
48463     }
48464     function drawData(selection2) {
48465       var vtService = getService();
48466       var getPath = svgPath(projection2).geojson;
48467       var getAreaPath = svgPath(projection2, null, true).geojson;
48468       var hasData = drawData.hasData();
48469       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
48470       layer.exit().remove();
48471       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
48472       var surface = context.surface();
48473       if (!surface || surface.empty())
48474         return;
48475       var geoData, polygonData;
48476       if (_template && vtService) {
48477         var sourceID = _template;
48478         vtService.loadTiles(sourceID, _template, projection2);
48479         geoData = vtService.data(sourceID, projection2);
48480       } else {
48481         geoData = getFeatures(_geojson);
48482       }
48483       geoData = geoData.filter(getPath);
48484       polygonData = geoData.filter(isPolygon);
48485       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
48486       clipPaths.exit().remove();
48487       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
48488       clipPathsEnter.append("path");
48489       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
48490       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
48491       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
48492         return "datagroup datagroup-" + d2;
48493       }).merge(datagroups);
48494       var pathData = {
48495         fill: polygonData,
48496         shadow: geoData,
48497         stroke: geoData
48498       };
48499       var paths = datagroups.selectAll("path").data(function(layer2) {
48500         return pathData[layer2];
48501       }, featureKey);
48502       paths.exit().remove();
48503       paths = paths.enter().append("path").attr("class", function(d2) {
48504         var datagroup = this.parentNode.__data__;
48505         return "pathdata " + datagroup + " " + featureClasses(d2);
48506       }).attr("clip-path", function(d2) {
48507         var datagroup = this.parentNode.__data__;
48508         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
48509       }).merge(paths).attr("d", function(d2) {
48510         var datagroup = this.parentNode.__data__;
48511         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
48512       });
48513       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
48514       function drawLabels(selection3, textClass, data) {
48515         var labelPath = path_default(projection2);
48516         var labelData = data.filter(function(d2) {
48517           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
48518         });
48519         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
48520         labels.exit().remove();
48521         labels = labels.enter().append("text").attr("class", function(d2) {
48522           return textClass + " " + featureClasses(d2);
48523         }).merge(labels).text(function(d2) {
48524           return d2.properties.desc || d2.properties.name;
48525         }).attr("x", function(d2) {
48526           var centroid = labelPath.centroid(d2);
48527           return centroid[0] + 11;
48528         }).attr("y", function(d2) {
48529           var centroid = labelPath.centroid(d2);
48530           return centroid[1];
48531         });
48532       }
48533     }
48534     function getExtension(fileName) {
48535       if (!fileName)
48536         return;
48537       var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
48538       var match = fileName.toLowerCase().match(re3);
48539       return match && match.length && match[0];
48540     }
48541     function xmlToDom(textdata) {
48542       return new DOMParser().parseFromString(textdata, "text/xml");
48543     }
48544     function stringifyGeojsonProperties(feature3) {
48545       const properties = feature3.properties;
48546       for (const key in properties) {
48547         const property = properties[key];
48548         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
48549           properties[key] = property.toString();
48550         } else if (property === null) {
48551           properties[key] = "null";
48552         } else if (typeof property === "object") {
48553           properties[key] = JSON.stringify(property);
48554         }
48555       }
48556     }
48557     drawData.setFile = function(extension, data) {
48558       _template = null;
48559       _fileList = null;
48560       _geojson = null;
48561       _src = null;
48562       var gj;
48563       switch (extension) {
48564         case ".gpx":
48565           gj = gpx(xmlToDom(data));
48566           break;
48567         case ".kml":
48568           gj = kml(xmlToDom(data));
48569           break;
48570         case ".geojson":
48571         case ".json":
48572           gj = JSON.parse(data);
48573           if (gj.type === "FeatureCollection") {
48574             gj.features.forEach(stringifyGeojsonProperties);
48575           } else if (gj.type === "Feature") {
48576             stringifyGeojsonProperties(gj);
48577           }
48578           break;
48579       }
48580       gj = gj || {};
48581       if (Object.keys(gj).length) {
48582         _geojson = ensureIDs(gj);
48583         _src = extension + " data file";
48584         this.fitZoom();
48585       }
48586       dispatch14.call("change");
48587       return this;
48588     };
48589     drawData.showLabels = function(val) {
48590       if (!arguments.length)
48591         return _showLabels;
48592       _showLabels = val;
48593       return this;
48594     };
48595     drawData.enabled = function(val) {
48596       if (!arguments.length)
48597         return _enabled;
48598       _enabled = val;
48599       if (_enabled) {
48600         showLayer();
48601       } else {
48602         hideLayer();
48603       }
48604       dispatch14.call("change");
48605       return this;
48606     };
48607     drawData.hasData = function() {
48608       var gj = _geojson || {};
48609       return !!(_template || Object.keys(gj).length);
48610     };
48611     drawData.template = function(val, src) {
48612       if (!arguments.length)
48613         return _template;
48614       var osm = context.connection();
48615       if (osm) {
48616         var blocklists = osm.imageryBlocklists();
48617         var fail = false;
48618         var tested = 0;
48619         var regex;
48620         for (var i3 = 0; i3 < blocklists.length; i3++) {
48621           regex = blocklists[i3];
48622           fail = regex.test(val);
48623           tested++;
48624           if (fail)
48625             break;
48626         }
48627         if (!tested) {
48628           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
48629           fail = regex.test(val);
48630         }
48631       }
48632       _template = val;
48633       _fileList = null;
48634       _geojson = null;
48635       _src = src || "vectortile:" + val.split(/[?#]/)[0];
48636       dispatch14.call("change");
48637       return this;
48638     };
48639     drawData.geojson = function(gj, src) {
48640       if (!arguments.length)
48641         return _geojson;
48642       _template = null;
48643       _fileList = null;
48644       _geojson = null;
48645       _src = null;
48646       gj = gj || {};
48647       if (Object.keys(gj).length) {
48648         _geojson = ensureIDs(gj);
48649         _src = src || "unknown.geojson";
48650       }
48651       dispatch14.call("change");
48652       return this;
48653     };
48654     drawData.fileList = function(fileList) {
48655       if (!arguments.length)
48656         return _fileList;
48657       _template = null;
48658       _geojson = null;
48659       _src = null;
48660       _fileList = fileList;
48661       if (!fileList || !fileList.length)
48662         return this;
48663       var f3 = fileList[0];
48664       var extension = getExtension(f3.name);
48665       var reader = new FileReader();
48666       reader.onload = function() {
48667         return function(e3) {
48668           drawData.setFile(extension, e3.target.result);
48669         };
48670       }(f3);
48671       reader.readAsText(f3);
48672       return this;
48673     };
48674     drawData.url = function(url, defaultExtension) {
48675       _template = null;
48676       _fileList = null;
48677       _geojson = null;
48678       _src = null;
48679       var testUrl = url.split(/[?#]/)[0];
48680       var extension = getExtension(testUrl) || defaultExtension;
48681       if (extension) {
48682         _template = null;
48683         text_default3(url).then(function(data) {
48684           drawData.setFile(extension, data);
48685         }).catch(function() {
48686         });
48687       } else {
48688         drawData.template(url);
48689       }
48690       return this;
48691     };
48692     drawData.getSrc = function() {
48693       return _src || "";
48694     };
48695     drawData.fitZoom = function() {
48696       var features = getFeatures(_geojson);
48697       if (!features.length)
48698         return;
48699       var map2 = context.map();
48700       var viewport = map2.trimmedExtent().polygon();
48701       var coords = features.reduce(function(coords2, feature3) {
48702         var geom = feature3.geometry;
48703         if (!geom)
48704           return coords2;
48705         var c2 = geom.coordinates;
48706         switch (geom.type) {
48707           case "Point":
48708             c2 = [c2];
48709           case "MultiPoint":
48710           case "LineString":
48711             break;
48712           case "MultiPolygon":
48713             c2 = utilArrayFlatten(c2);
48714           case "Polygon":
48715           case "MultiLineString":
48716             c2 = utilArrayFlatten(c2);
48717             break;
48718         }
48719         return utilArrayUnion(coords2, c2);
48720       }, []);
48721       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
48722         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
48723         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
48724       }
48725       return this;
48726     };
48727     init2();
48728     return drawData;
48729   }
48730
48731   // modules/svg/debug.js
48732   function svgDebug(projection2, context) {
48733     function drawDebug(selection2) {
48734       const showTile = context.getDebug("tile");
48735       const showCollision = context.getDebug("collision");
48736       const showImagery = context.getDebug("imagery");
48737       const showTouchTargets = context.getDebug("target");
48738       const showDownloaded = context.getDebug("downloaded");
48739       let debugData = [];
48740       if (showTile) {
48741         debugData.push({ class: "red", label: "tile" });
48742       }
48743       if (showCollision) {
48744         debugData.push({ class: "yellow", label: "collision" });
48745       }
48746       if (showImagery) {
48747         debugData.push({ class: "orange", label: "imagery" });
48748       }
48749       if (showTouchTargets) {
48750         debugData.push({ class: "pink", label: "touchTargets" });
48751       }
48752       if (showDownloaded) {
48753         debugData.push({ class: "purple", label: "downloaded" });
48754       }
48755       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
48756       legend.exit().remove();
48757       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
48758       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
48759       legendItems.exit().remove();
48760       legendItems.enter().append("span").attr("class", (d2) => `debug-legend-item ${d2.class}`).text((d2) => d2.label);
48761       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
48762       layer.exit().remove();
48763       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
48764       const extent = context.map().extent();
48765       _mainFileFetcher.get("imagery").then((d2) => {
48766         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
48767         const features = hits.map((d4) => d4.features[d4.id]);
48768         let imagery = layer.selectAll("path.debug-imagery").data(features);
48769         imagery.exit().remove();
48770         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
48771       }).catch(() => {
48772       });
48773       const osm = context.connection();
48774       let dataDownloaded = [];
48775       if (osm && showDownloaded) {
48776         const rtree = osm.caches("get").tile.rtree;
48777         dataDownloaded = rtree.all().map((bbox2) => {
48778           return {
48779             type: "Feature",
48780             properties: { id: bbox2.id },
48781             geometry: {
48782               type: "Polygon",
48783               coordinates: [[
48784                 [bbox2.minX, bbox2.minY],
48785                 [bbox2.minX, bbox2.maxY],
48786                 [bbox2.maxX, bbox2.maxY],
48787                 [bbox2.maxX, bbox2.minY],
48788                 [bbox2.minX, bbox2.minY]
48789               ]]
48790             }
48791           };
48792         });
48793       }
48794       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
48795       downloaded.exit().remove();
48796       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
48797       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
48798     }
48799     drawDebug.enabled = function() {
48800       if (!arguments.length) {
48801         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
48802       } else {
48803         return this;
48804       }
48805     };
48806     return drawDebug;
48807   }
48808
48809   // modules/svg/defs.js
48810   function svgDefs(context) {
48811     var _defsSelection = select_default2(null);
48812     var _spritesheetIds = [
48813       "iD-sprite",
48814       "maki-sprite",
48815       "temaki-sprite",
48816       "fa-sprite",
48817       "roentgen-sprite",
48818       "community-sprite"
48819     ];
48820     function drawDefs(selection2) {
48821       _defsSelection = selection2.append("defs");
48822       _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");
48823       function addSidedMarker(name, color2, offset) {
48824         _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);
48825       }
48826       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
48827       addSidedMarker("coastline", "#77dede", 1);
48828       addSidedMarker("waterway", "#77dede", 1);
48829       addSidedMarker("barrier", "#ddd", 1);
48830       addSidedMarker("man_made", "#fff", 0);
48831       _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");
48832       _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");
48833       var patterns2 = _defsSelection.selectAll("pattern").data([
48834         // pattern name, pattern image name
48835         ["beach", "dots"],
48836         ["construction", "construction"],
48837         ["cemetery", "cemetery"],
48838         ["cemetery_christian", "cemetery_christian"],
48839         ["cemetery_buddhist", "cemetery_buddhist"],
48840         ["cemetery_muslim", "cemetery_muslim"],
48841         ["cemetery_jewish", "cemetery_jewish"],
48842         ["farmland", "farmland"],
48843         ["farmyard", "farmyard"],
48844         ["forest", "forest"],
48845         ["forest_broadleaved", "forest_broadleaved"],
48846         ["forest_needleleaved", "forest_needleleaved"],
48847         ["forest_leafless", "forest_leafless"],
48848         ["golf_green", "grass"],
48849         ["grass", "grass"],
48850         ["landfill", "landfill"],
48851         ["meadow", "grass"],
48852         ["orchard", "orchard"],
48853         ["pond", "pond"],
48854         ["quarry", "quarry"],
48855         ["scrub", "bushes"],
48856         ["vineyard", "vineyard"],
48857         ["water_standing", "lines"],
48858         ["waves", "waves"],
48859         ["wetland", "wetland"],
48860         ["wetland_marsh", "wetland_marsh"],
48861         ["wetland_swamp", "wetland_swamp"],
48862         ["wetland_bog", "wetland_bog"],
48863         ["wetland_reedbed", "wetland_reedbed"]
48864       ]).enter().append("pattern").attr("id", function(d2) {
48865         return "ideditor-pattern-" + d2[0];
48866       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
48867       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
48868         return "pattern-color-" + d2[0];
48869       });
48870       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
48871         return context.imagePath("pattern/" + d2[1] + ".png");
48872       });
48873       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
48874         return "ideditor-clip-square-" + d2;
48875       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
48876         return d2;
48877       }).attr("height", function(d2) {
48878         return d2;
48879       });
48880       addSprites(_spritesheetIds, true);
48881     }
48882     function addSprites(ids, overrideColors) {
48883       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
48884       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
48885       spritesheets.enter().append("g").attr("class", function(d2) {
48886         return "spritesheet spritesheet-" + d2;
48887       }).each(function(d2) {
48888         var url = context.imagePath(d2 + ".svg");
48889         var node = select_default2(this).node();
48890         svg(url).then(function(svg2) {
48891           node.appendChild(
48892             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
48893           );
48894           if (overrideColors && d2 !== "iD-sprite") {
48895             select_default2(node).selectAll("path").attr("fill", "currentColor");
48896           }
48897         }).catch(function() {
48898         });
48899       });
48900       spritesheets.exit().remove();
48901     }
48902     drawDefs.addSprites = addSprites;
48903     return drawDefs;
48904   }
48905
48906   // modules/svg/keepRight.js
48907   var _layerEnabled = false;
48908   var _qaService;
48909   function svgKeepRight(projection2, context, dispatch14) {
48910     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
48911     const minZoom4 = 12;
48912     let touchLayer = select_default2(null);
48913     let drawLayer = select_default2(null);
48914     let layerVisible = false;
48915     function markerPath(selection2, klass) {
48916       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");
48917     }
48918     function getService() {
48919       if (services.keepRight && !_qaService) {
48920         _qaService = services.keepRight;
48921         _qaService.on("loaded", throttledRedraw);
48922       } else if (!services.keepRight && _qaService) {
48923         _qaService = null;
48924       }
48925       return _qaService;
48926     }
48927     function editOn() {
48928       if (!layerVisible) {
48929         layerVisible = true;
48930         drawLayer.style("display", "block");
48931       }
48932     }
48933     function editOff() {
48934       if (layerVisible) {
48935         layerVisible = false;
48936         drawLayer.style("display", "none");
48937         drawLayer.selectAll(".qaItem.keepRight").remove();
48938         touchLayer.selectAll(".qaItem.keepRight").remove();
48939       }
48940     }
48941     function layerOn() {
48942       editOn();
48943       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
48944     }
48945     function layerOff() {
48946       throttledRedraw.cancel();
48947       drawLayer.interrupt();
48948       touchLayer.selectAll(".qaItem.keepRight").remove();
48949       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
48950         editOff();
48951         dispatch14.call("change");
48952       });
48953     }
48954     function updateMarkers() {
48955       if (!layerVisible || !_layerEnabled)
48956         return;
48957       const service = getService();
48958       const selectedID = context.selectedErrorID();
48959       const data = service ? service.getItems(projection2) : [];
48960       const getTransform = svgPointTransform(projection2);
48961       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
48962       markers.exit().remove();
48963       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`);
48964       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
48965       markersEnter.append("path").call(markerPath, "shadow");
48966       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");
48967       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
48968       if (touchLayer.empty())
48969         return;
48970       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
48971       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
48972       targets.exit().remove();
48973       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d2) => `qaItem ${d2.service} target ${fillClass} itemId-${d2.id}`).attr("transform", getTransform);
48974       function sortY(a2, b2) {
48975         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : a2.severity === "error" && b2.severity !== "error" ? 1 : b2.severity === "error" && a2.severity !== "error" ? -1 : b2.loc[1] - a2.loc[1];
48976       }
48977     }
48978     function drawKeepRight(selection2) {
48979       const service = getService();
48980       const surface = context.surface();
48981       if (surface && !surface.empty()) {
48982         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
48983       }
48984       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
48985       drawLayer.exit().remove();
48986       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
48987       if (_layerEnabled) {
48988         if (service && ~~context.map().zoom() >= minZoom4) {
48989           editOn();
48990           service.loadIssues(projection2);
48991           updateMarkers();
48992         } else {
48993           editOff();
48994         }
48995       }
48996     }
48997     drawKeepRight.enabled = function(val) {
48998       if (!arguments.length)
48999         return _layerEnabled;
49000       _layerEnabled = val;
49001       if (_layerEnabled) {
49002         layerOn();
49003       } else {
49004         layerOff();
49005         if (context.selectedErrorID()) {
49006           context.enter(modeBrowse(context));
49007         }
49008       }
49009       dispatch14.call("change");
49010       return this;
49011     };
49012     drawKeepRight.supported = () => !!getService();
49013     return drawKeepRight;
49014   }
49015
49016   // modules/svg/geolocate.js
49017   function svgGeolocate(projection2) {
49018     var layer = select_default2(null);
49019     var _position;
49020     function init2() {
49021       if (svgGeolocate.initialized)
49022         return;
49023       svgGeolocate.enabled = false;
49024       svgGeolocate.initialized = true;
49025     }
49026     function showLayer() {
49027       layer.style("display", "block");
49028     }
49029     function hideLayer() {
49030       layer.transition().duration(250).style("opacity", 0);
49031     }
49032     function layerOn() {
49033       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
49034     }
49035     function layerOff() {
49036       layer.style("display", "none");
49037     }
49038     function transform2(d2) {
49039       return svgPointTransform(projection2)(d2);
49040     }
49041     function accuracy(accuracy2, loc) {
49042       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
49043       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
49044     }
49045     function update() {
49046       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
49047       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
49048       groups.exit().remove();
49049       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
49050       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");
49051       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");
49052       groups.merge(pointsEnter).attr("transform", transform2);
49053       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
49054     }
49055     function drawLocation(selection2) {
49056       var enabled = svgGeolocate.enabled;
49057       layer = selection2.selectAll(".layer-geolocate").data([0]);
49058       layer.exit().remove();
49059       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
49060       layerEnter.append("g").attr("class", "geolocations");
49061       layer = layerEnter.merge(layer);
49062       if (enabled) {
49063         update();
49064       } else {
49065         layerOff();
49066       }
49067     }
49068     drawLocation.enabled = function(position, enabled) {
49069       if (!arguments.length)
49070         return svgGeolocate.enabled;
49071       _position = position;
49072       svgGeolocate.enabled = enabled;
49073       if (svgGeolocate.enabled) {
49074         showLayer();
49075         layerOn();
49076       } else {
49077         hideLayer();
49078       }
49079       return this;
49080     };
49081     init2();
49082     return drawLocation;
49083   }
49084
49085   // modules/svg/labels.js
49086   var import_rbush6 = __toESM(require_rbush_min());
49087   function svgLabels(projection2, context) {
49088     var path = path_default(projection2);
49089     var detected = utilDetect();
49090     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
49091     var _rdrawn = new import_rbush6.default();
49092     var _rskipped = new import_rbush6.default();
49093     var _textWidthCache = {};
49094     var _entitybboxes = {};
49095     var labelStack = [
49096       ["line", "aeroway", "*", 12],
49097       ["line", "highway", "motorway", 12],
49098       ["line", "highway", "trunk", 12],
49099       ["line", "highway", "primary", 12],
49100       ["line", "highway", "secondary", 12],
49101       ["line", "highway", "tertiary", 12],
49102       ["line", "highway", "*", 12],
49103       ["line", "railway", "*", 12],
49104       ["line", "waterway", "*", 12],
49105       ["area", "aeroway", "*", 12],
49106       ["area", "amenity", "*", 12],
49107       ["area", "building", "*", 12],
49108       ["area", "historic", "*", 12],
49109       ["area", "leisure", "*", 12],
49110       ["area", "man_made", "*", 12],
49111       ["area", "natural", "*", 12],
49112       ["area", "shop", "*", 12],
49113       ["area", "tourism", "*", 12],
49114       ["area", "camp_site", "*", 12],
49115       ["point", "aeroway", "*", 10],
49116       ["point", "amenity", "*", 10],
49117       ["point", "building", "*", 10],
49118       ["point", "historic", "*", 10],
49119       ["point", "leisure", "*", 10],
49120       ["point", "man_made", "*", 10],
49121       ["point", "natural", "*", 10],
49122       ["point", "shop", "*", 10],
49123       ["point", "tourism", "*", 10],
49124       ["point", "camp_site", "*", 10],
49125       ["line", "ref", "*", 12],
49126       ["area", "ref", "*", 12],
49127       ["point", "ref", "*", 10],
49128       ["line", "name", "*", 12],
49129       ["area", "name", "*", 12],
49130       ["point", "name", "*", 10]
49131     ];
49132     function shouldSkipIcon(preset) {
49133       var noIcons = ["building", "landuse", "natural"];
49134       return noIcons.some(function(s2) {
49135         return preset.id.indexOf(s2) >= 0;
49136       });
49137     }
49138     function get4(array2, prop) {
49139       return function(d2, i3) {
49140         return array2[i3][prop];
49141       };
49142     }
49143     function textWidth(text2, size, elem) {
49144       var c2 = _textWidthCache[size];
49145       if (!c2)
49146         c2 = _textWidthCache[size] = {};
49147       if (c2[text2]) {
49148         return c2[text2];
49149       } else if (elem) {
49150         c2[text2] = elem.getComputedTextLength();
49151         return c2[text2];
49152       } else {
49153         var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
49154         if (str2 === null) {
49155           return size / 3 * 2 * text2.length;
49156         } else {
49157           return size / 3 * (2 * text2.length + str2.length);
49158         }
49159       }
49160     }
49161     function drawLinePaths(selection2, entities, filter2, classes, labels) {
49162       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
49163       paths.exit().remove();
49164       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
49165         return "ideditor-labelpath-" + d2.id;
49166       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
49167     }
49168     function drawLineLabels(selection2, entities, filter2, classes, labels) {
49169       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49170       texts.exit().remove();
49171       texts.enter().append("text").attr("class", function(d2, i3) {
49172         return classes + " " + labels[i3].classes + " " + d2.id;
49173       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
49174       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
49175         return "#ideditor-labelpath-" + d2.id;
49176       }).text(utilDisplayNameForPath);
49177     }
49178     function drawPointLabels(selection2, entities, filter2, classes, labels) {
49179       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49180       texts.exit().remove();
49181       texts.enter().append("text").attr("class", function(d2, i3) {
49182         return classes + " " + labels[i3].classes + " " + d2.id;
49183       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
49184         textWidth(utilDisplayName(d2), labels[i3].height, this);
49185       });
49186     }
49187     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
49188       entities = entities.filter(hasText);
49189       labels = labels.filter(hasText);
49190       drawPointLabels(selection2, entities, filter2, classes, labels);
49191       function hasText(d2, i3) {
49192         return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
49193       }
49194     }
49195     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
49196       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
49197       icons.exit().remove();
49198       icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", get4(labels, "transform")).attr("xlink:href", function(d2) {
49199         var preset = _mainPresetIndex.match(d2, context.graph());
49200         var picon = preset && preset.icon;
49201         return picon ? "#" + picon : "";
49202       });
49203     }
49204     function drawCollisionBoxes(selection2, rtree, which) {
49205       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
49206       var gj = [];
49207       if (context.getDebug("collision")) {
49208         gj = rtree.all().map(function(d2) {
49209           return { type: "Polygon", coordinates: [[
49210             [d2.minX, d2.minY],
49211             [d2.maxX, d2.minY],
49212             [d2.maxX, d2.maxY],
49213             [d2.minX, d2.maxY],
49214             [d2.minX, d2.minY]
49215           ]] };
49216         });
49217       }
49218       var boxes = selection2.selectAll("." + which).data(gj);
49219       boxes.exit().remove();
49220       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
49221     }
49222     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
49223       var wireframe = context.surface().classed("fill-wireframe");
49224       var zoom = geoScaleToZoom(projection2.scale());
49225       var labelable = [];
49226       var renderNodeAs = {};
49227       var i3, j3, k2, entity, geometry;
49228       for (i3 = 0; i3 < labelStack.length; i3++) {
49229         labelable.push([]);
49230       }
49231       if (fullRedraw) {
49232         _rdrawn.clear();
49233         _rskipped.clear();
49234         _entitybboxes = {};
49235       } else {
49236         for (i3 = 0; i3 < entities.length; i3++) {
49237           entity = entities[i3];
49238           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
49239           for (j3 = 0; j3 < toRemove.length; j3++) {
49240             _rdrawn.remove(toRemove[j3]);
49241             _rskipped.remove(toRemove[j3]);
49242           }
49243         }
49244       }
49245       for (i3 = 0; i3 < entities.length; i3++) {
49246         entity = entities[i3];
49247         geometry = entity.geometry(graph);
49248         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
49249           var hasDirections = entity.directions(graph, projection2).length;
49250           var markerPadding;
49251           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
49252             renderNodeAs[entity.id] = "point";
49253             markerPadding = 20;
49254           } else {
49255             renderNodeAs[entity.id] = "vertex";
49256             markerPadding = 0;
49257           }
49258           var coord2 = projection2(entity.loc);
49259           var nodePadding = 10;
49260           var bbox2 = {
49261             minX: coord2[0] - nodePadding,
49262             minY: coord2[1] - nodePadding - markerPadding,
49263             maxX: coord2[0] + nodePadding,
49264             maxY: coord2[1] + nodePadding
49265           };
49266           doInsert(bbox2, entity.id + "P");
49267         }
49268         if (geometry === "vertex") {
49269           geometry = "point";
49270         }
49271         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
49272         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
49273         if (!icon2 && !utilDisplayName(entity))
49274           continue;
49275         for (k2 = 0; k2 < labelStack.length; k2++) {
49276           var matchGeom = labelStack[k2][0];
49277           var matchKey = labelStack[k2][1];
49278           var matchVal = labelStack[k2][2];
49279           var hasVal = entity.tags[matchKey];
49280           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
49281             labelable[k2].push(entity);
49282             break;
49283           }
49284         }
49285       }
49286       var positions = {
49287         point: [],
49288         line: [],
49289         area: []
49290       };
49291       var labelled = {
49292         point: [],
49293         line: [],
49294         area: []
49295       };
49296       for (k2 = 0; k2 < labelable.length; k2++) {
49297         var fontSize = labelStack[k2][3];
49298         for (i3 = 0; i3 < labelable[k2].length; i3++) {
49299           entity = labelable[k2][i3];
49300           geometry = entity.geometry(graph);
49301           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
49302           var name = getName(entity);
49303           var width = name && textWidth(name, fontSize);
49304           var p2 = null;
49305           if (geometry === "point" || geometry === "vertex") {
49306             if (wireframe)
49307               continue;
49308             var renderAs = renderNodeAs[entity.id];
49309             if (renderAs === "vertex" && zoom < 17)
49310               continue;
49311             p2 = getPointLabel(entity, width, fontSize, renderAs);
49312           } else if (geometry === "line") {
49313             p2 = getLineLabel(entity, width, fontSize);
49314           } else if (geometry === "area") {
49315             p2 = getAreaLabel(entity, width, fontSize);
49316           }
49317           if (p2) {
49318             if (geometry === "vertex") {
49319               geometry = "point";
49320             }
49321             p2.classes = geometry + " tag-" + labelStack[k2][1];
49322             positions[geometry].push(p2);
49323             labelled[geometry].push(entity);
49324           }
49325         }
49326       }
49327       function isInterestingVertex(entity2) {
49328         var selectedIDs = context.selectedIDs();
49329         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
49330           return selectedIDs.indexOf(parent.id) !== -1;
49331         });
49332       }
49333       function getPointLabel(entity2, width2, height, geometry2) {
49334         var y2 = geometry2 === "point" ? -12 : 0;
49335         var pointOffsets = {
49336           ltr: [15, y2, "start"],
49337           rtl: [-15, y2, "end"]
49338         };
49339         var textDirection = _mainLocalizer.textDirection();
49340         var coord3 = projection2(entity2.loc);
49341         var textPadding = 2;
49342         var offset = pointOffsets[textDirection];
49343         var p3 = {
49344           height,
49345           width: width2,
49346           x: coord3[0] + offset[0],
49347           y: coord3[1] + offset[1],
49348           textAnchor: offset[2]
49349         };
49350         var bbox3;
49351         if (textDirection === "rtl") {
49352           bbox3 = {
49353             minX: p3.x - width2 - textPadding,
49354             minY: p3.y - height / 2 - textPadding,
49355             maxX: p3.x + textPadding,
49356             maxY: p3.y + height / 2 + textPadding
49357           };
49358         } else {
49359           bbox3 = {
49360             minX: p3.x - textPadding,
49361             minY: p3.y - height / 2 - textPadding,
49362             maxX: p3.x + width2 + textPadding,
49363             maxY: p3.y + height / 2 + textPadding
49364           };
49365         }
49366         if (tryInsert([bbox3], entity2.id, true)) {
49367           return p3;
49368         }
49369       }
49370       function getLineLabel(entity2, width2, height) {
49371         var viewport = geoExtent(context.projection.clipExtent()).polygon();
49372         var points = graph.childNodes(entity2).map(function(node) {
49373           return projection2(node.loc);
49374         });
49375         var length = geoPathLength(points);
49376         if (length < width2 + 20)
49377           return;
49378         var lineOffsets = [
49379           50,
49380           45,
49381           55,
49382           40,
49383           60,
49384           35,
49385           65,
49386           30,
49387           70,
49388           25,
49389           75,
49390           20,
49391           80,
49392           15,
49393           95,
49394           10,
49395           90,
49396           5,
49397           95
49398         ];
49399         var padding = 3;
49400         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
49401           var offset = lineOffsets[i4];
49402           var middle = offset / 100 * length;
49403           var start2 = middle - width2 / 2;
49404           if (start2 < 0 || start2 + width2 > length)
49405             continue;
49406           var sub = subpath(points, start2, start2 + width2);
49407           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
49408             continue;
49409           }
49410           var isReverse = reverse(sub);
49411           if (isReverse) {
49412             sub = sub.reverse();
49413           }
49414           var bboxes = [];
49415           var boxsize = (height + 2) / 2;
49416           for (var j4 = 0; j4 < sub.length - 1; j4++) {
49417             var a2 = sub[j4];
49418             var b2 = sub[j4 + 1];
49419             var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
49420             for (var box = 0; box < num; box++) {
49421               var p3 = geoVecInterp(a2, b2, box / num);
49422               var x05 = p3[0] - boxsize - padding;
49423               var y05 = p3[1] - boxsize - padding;
49424               var x12 = p3[0] + boxsize + padding;
49425               var y12 = p3[1] + boxsize + padding;
49426               bboxes.push({
49427                 minX: Math.min(x05, x12),
49428                 minY: Math.min(y05, y12),
49429                 maxX: Math.max(x05, x12),
49430                 maxY: Math.max(y05, y12)
49431               });
49432             }
49433           }
49434           if (tryInsert(bboxes, entity2.id, false)) {
49435             return {
49436               "font-size": height + 2,
49437               lineString: lineString2(sub),
49438               startOffset: offset + "%"
49439             };
49440           }
49441         }
49442         function reverse(p4) {
49443           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
49444           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
49445         }
49446         function lineString2(points2) {
49447           return "M" + points2.join("L");
49448         }
49449         function subpath(points2, from, to) {
49450           var sofar = 0;
49451           var start3, end, i0, i1;
49452           for (var i5 = 0; i5 < points2.length - 1; i5++) {
49453             var a3 = points2[i5];
49454             var b3 = points2[i5 + 1];
49455             var current = geoVecLength(a3, b3);
49456             var portion;
49457             if (!start3 && sofar + current >= from) {
49458               portion = (from - sofar) / current;
49459               start3 = [
49460                 a3[0] + portion * (b3[0] - a3[0]),
49461                 a3[1] + portion * (b3[1] - a3[1])
49462               ];
49463               i0 = i5 + 1;
49464             }
49465             if (!end && sofar + current >= to) {
49466               portion = (to - sofar) / current;
49467               end = [
49468                 a3[0] + portion * (b3[0] - a3[0]),
49469                 a3[1] + portion * (b3[1] - a3[1])
49470               ];
49471               i1 = i5 + 1;
49472             }
49473             sofar += current;
49474           }
49475           var result = points2.slice(i0, i1);
49476           result.unshift(start3);
49477           result.push(end);
49478           return result;
49479         }
49480       }
49481       function getAreaLabel(entity2, width2, height) {
49482         var centroid = path.centroid(entity2.asGeoJSON(graph));
49483         var extent = entity2.extent(graph);
49484         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
49485         if (isNaN(centroid[0]) || areaWidth < 20)
49486           return;
49487         var preset2 = _mainPresetIndex.match(entity2, context.graph());
49488         var picon = preset2 && preset2.icon;
49489         var iconSize = 17;
49490         var padding = 2;
49491         var p3 = {};
49492         if (picon) {
49493           if (addIcon()) {
49494             addLabel(iconSize + padding);
49495             return p3;
49496           }
49497         } else {
49498           if (addLabel(0)) {
49499             return p3;
49500           }
49501         }
49502         function addIcon() {
49503           var iconX = centroid[0] - iconSize / 2;
49504           var iconY = centroid[1] - iconSize / 2;
49505           var bbox3 = {
49506             minX: iconX,
49507             minY: iconY,
49508             maxX: iconX + iconSize,
49509             maxY: iconY + iconSize
49510           };
49511           if (tryInsert([bbox3], entity2.id + "I", true)) {
49512             p3.transform = "translate(" + iconX + "," + iconY + ")";
49513             return true;
49514           }
49515           return false;
49516         }
49517         function addLabel(yOffset) {
49518           if (width2 && areaWidth >= width2 + 20) {
49519             var labelX = centroid[0];
49520             var labelY = centroid[1] + yOffset;
49521             var bbox3 = {
49522               minX: labelX - width2 / 2 - padding,
49523               minY: labelY - height / 2 - padding,
49524               maxX: labelX + width2 / 2 + padding,
49525               maxY: labelY + height / 2 + padding
49526             };
49527             if (tryInsert([bbox3], entity2.id, true)) {
49528               p3.x = labelX;
49529               p3.y = labelY;
49530               p3.textAnchor = "middle";
49531               p3.height = height;
49532               return true;
49533             }
49534           }
49535           return false;
49536         }
49537       }
49538       function doInsert(bbox3, id2) {
49539         bbox3.id = id2;
49540         var oldbox = _entitybboxes[id2];
49541         if (oldbox) {
49542           _rdrawn.remove(oldbox);
49543         }
49544         _entitybboxes[id2] = bbox3;
49545         _rdrawn.insert(bbox3);
49546       }
49547       function tryInsert(bboxes, id2, saveSkipped) {
49548         var skipped = false;
49549         for (var i4 = 0; i4 < bboxes.length; i4++) {
49550           var bbox3 = bboxes[i4];
49551           bbox3.id = id2;
49552           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
49553             skipped = true;
49554             break;
49555           }
49556           if (_rdrawn.collides(bbox3)) {
49557             skipped = true;
49558             break;
49559           }
49560         }
49561         _entitybboxes[id2] = bboxes;
49562         if (skipped) {
49563           if (saveSkipped) {
49564             _rskipped.load(bboxes);
49565           }
49566         } else {
49567           _rdrawn.load(bboxes);
49568         }
49569         return !skipped;
49570       }
49571       var layer = selection2.selectAll(".layer-osm.labels");
49572       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
49573         return "labels-group " + d2;
49574       });
49575       var halo = layer.selectAll(".labels-group.halo");
49576       var label = layer.selectAll(".labels-group.label");
49577       var debug2 = layer.selectAll(".labels-group.debug");
49578       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
49579       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
49580       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
49581       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
49582       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
49583       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
49584       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
49585       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
49586       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
49587       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
49588       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
49589       layer.call(filterLabels);
49590     }
49591     function filterLabels(selection2) {
49592       var drawLayer = selection2.selectAll(".layer-osm.labels");
49593       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
49594       layers.selectAll(".nolabel").classed("nolabel", false);
49595       var mouse = context.map().mouse();
49596       var graph = context.graph();
49597       var selectedIDs = context.selectedIDs();
49598       var ids = [];
49599       var pad2, bbox2;
49600       if (mouse) {
49601         pad2 = 20;
49602         bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
49603         var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
49604           return entity2.id;
49605         });
49606         ids.push.apply(ids, nearMouse);
49607       }
49608       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
49609         var entity = graph.hasEntity(selectedIDs[i3]);
49610         if (entity && entity.type === "node") {
49611           ids.push(selectedIDs[i3]);
49612         }
49613       }
49614       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
49615       var debug2 = selection2.selectAll(".labels-group.debug");
49616       var gj = [];
49617       if (context.getDebug("collision")) {
49618         gj = bbox2 ? [{
49619           type: "Polygon",
49620           coordinates: [[
49621             [bbox2.minX, bbox2.minY],
49622             [bbox2.maxX, bbox2.minY],
49623             [bbox2.maxX, bbox2.maxY],
49624             [bbox2.minX, bbox2.maxY],
49625             [bbox2.minX, bbox2.minY]
49626           ]]
49627         }] : [];
49628       }
49629       var box = debug2.selectAll(".debug-mouse").data(gj);
49630       box.exit().remove();
49631       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
49632     }
49633     var throttleFilterLabels = throttle_default(filterLabels, 100);
49634     drawLabels.observe = function(selection2) {
49635       var listener = function() {
49636         throttleFilterLabels(selection2);
49637       };
49638       selection2.on("mousemove.hidelabels", listener);
49639       context.on("enter.hidelabels", listener);
49640     };
49641     drawLabels.off = function(selection2) {
49642       throttleFilterLabels.cancel();
49643       selection2.on("mousemove.hidelabels", null);
49644       context.on("enter.hidelabels", null);
49645     };
49646     return drawLabels;
49647   }
49648
49649   // node_modules/exifr/dist/full.esm.mjs
49650   var e = "undefined" != typeof self ? self : global;
49651   var t = "undefined" != typeof navigator;
49652   var i2 = t && "undefined" == typeof HTMLImageElement;
49653   var n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
49654   var s = e.Buffer;
49655   var r = e.BigInt;
49656   var a = !!s;
49657   var o = (e3) => e3;
49658   function l(e3, t2 = o) {
49659     if (n2)
49660       try {
49661         return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
49662           /* webpackIgnore: true */
49663           e3
49664         ).then(t2);
49665       } catch (t3) {
49666         console.warn(`Couldn't load ${e3}`);
49667       }
49668   }
49669   var h = e.fetch;
49670   var u = (e3) => h = e3;
49671   if (!e.fetch) {
49672     const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
49673       let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
49674       const f3 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
49675       "" !== o2 && (f3.port = Number(o2));
49676       const d2 = ("https:" === u2 ? await t2 : await e3).request(f3, (e4) => {
49677         if (301 === e4.statusCode || 302 === e4.statusCode) {
49678           let t3 = new URL(e4.headers.location, n3).toString();
49679           return i3(t3, { headers: s2 }).then(r2).catch(a2);
49680         }
49681         r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
49682           let i4 = [];
49683           e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
49684         }) });
49685       });
49686       d2.on("error", a2), d2.end();
49687     });
49688     u(i3);
49689   }
49690   function c(e3, t2, i3) {
49691     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
49692   }
49693   var f2 = (e3) => p(e3) ? void 0 : e3;
49694   var d = (e3) => void 0 !== e3;
49695   function p(e3) {
49696     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
49697   }
49698   function g2(e3) {
49699     let t2 = new Error(e3);
49700     throw delete t2.stack, t2;
49701   }
49702   function m(e3) {
49703     return "" === (e3 = function(e4) {
49704       for (; e4.endsWith("\0"); )
49705         e4 = e4.slice(0, -1);
49706       return e4;
49707     }(e3).trim()) ? void 0 : e3;
49708   }
49709   function S(e3) {
49710     let t2 = function(e4) {
49711       let t3 = 0;
49712       return e4.ifd0.enabled && (t3 += 1024), e4.exif.enabled && (t3 += 2048), e4.makerNote && (t3 += 2048), e4.userComment && (t3 += 1024), e4.gps.enabled && (t3 += 512), e4.interop.enabled && (t3 += 100), e4.ifd1.enabled && (t3 += 1024), t3 + 2048;
49713     }(e3);
49714     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
49715   }
49716   var C = (e3) => String.fromCharCode.apply(null, e3);
49717   var y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
49718   function b(e3) {
49719     return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
49720   }
49721   var I = class _I {
49722     static from(e3, t2) {
49723       return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
49724     }
49725     constructor(e3, t2 = 0, i3, n3) {
49726       if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3)
49727         this.byteOffset = 0, this.byteLength = 0;
49728       else if (e3 instanceof ArrayBuffer) {
49729         void 0 === i3 && (i3 = e3.byteLength - t2);
49730         let n4 = new DataView(e3, t2, i3);
49731         this._swapDataView(n4);
49732       } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
49733         void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
49734         let n4 = new DataView(e3.buffer, t2, i3);
49735         this._swapDataView(n4);
49736       } else if ("number" == typeof e3) {
49737         let t3 = new DataView(new ArrayBuffer(e3));
49738         this._swapDataView(t3);
49739       } else
49740         g2("Invalid input argument for BufferView: " + e3);
49741     }
49742     _swapArrayBuffer(e3) {
49743       this._swapDataView(new DataView(e3));
49744     }
49745     _swapBuffer(e3) {
49746       this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
49747     }
49748     _swapDataView(e3) {
49749       this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
49750     }
49751     _lengthToEnd(e3) {
49752       return this.byteLength - e3;
49753     }
49754     set(e3, t2, i3 = _I) {
49755       return e3 instanceof DataView || e3 instanceof _I ? e3 = new Uint8Array(e3.buffer, e3.byteOffset, e3.byteLength) : e3 instanceof ArrayBuffer && (e3 = new Uint8Array(e3)), e3 instanceof Uint8Array || g2("BufferView.set(): Invalid data argument."), this.toUint8().set(e3, t2), new i3(this, t2, e3.byteLength);
49756     }
49757     subarray(e3, t2) {
49758       return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
49759     }
49760     toUint8() {
49761       return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
49762     }
49763     getUint8Array(e3, t2) {
49764       return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
49765     }
49766     getString(e3 = 0, t2 = this.byteLength) {
49767       return b(this.getUint8Array(e3, t2));
49768     }
49769     getLatin1String(e3 = 0, t2 = this.byteLength) {
49770       let i3 = this.getUint8Array(e3, t2);
49771       return C(i3);
49772     }
49773     getUnicodeString(e3 = 0, t2 = this.byteLength) {
49774       const i3 = [];
49775       for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2)
49776         i3.push(this.getUint16(e3 + n3));
49777       return C(i3);
49778     }
49779     getInt8(e3) {
49780       return this.dataView.getInt8(e3);
49781     }
49782     getUint8(e3) {
49783       return this.dataView.getUint8(e3);
49784     }
49785     getInt16(e3, t2 = this.le) {
49786       return this.dataView.getInt16(e3, t2);
49787     }
49788     getInt32(e3, t2 = this.le) {
49789       return this.dataView.getInt32(e3, t2);
49790     }
49791     getUint16(e3, t2 = this.le) {
49792       return this.dataView.getUint16(e3, t2);
49793     }
49794     getUint32(e3, t2 = this.le) {
49795       return this.dataView.getUint32(e3, t2);
49796     }
49797     getFloat32(e3, t2 = this.le) {
49798       return this.dataView.getFloat32(e3, t2);
49799     }
49800     getFloat64(e3, t2 = this.le) {
49801       return this.dataView.getFloat64(e3, t2);
49802     }
49803     getFloat(e3, t2 = this.le) {
49804       return this.dataView.getFloat32(e3, t2);
49805     }
49806     getDouble(e3, t2 = this.le) {
49807       return this.dataView.getFloat64(e3, t2);
49808     }
49809     getUintBytes(e3, t2, i3) {
49810       switch (t2) {
49811         case 1:
49812           return this.getUint8(e3, i3);
49813         case 2:
49814           return this.getUint16(e3, i3);
49815         case 4:
49816           return this.getUint32(e3, i3);
49817         case 8:
49818           return this.getUint64 && this.getUint64(e3, i3);
49819       }
49820     }
49821     getUint(e3, t2, i3) {
49822       switch (t2) {
49823         case 8:
49824           return this.getUint8(e3, i3);
49825         case 16:
49826           return this.getUint16(e3, i3);
49827         case 32:
49828           return this.getUint32(e3, i3);
49829         case 64:
49830           return this.getUint64 && this.getUint64(e3, i3);
49831       }
49832     }
49833     toString(e3) {
49834       return this.dataView.toString(e3, this.constructor.name);
49835     }
49836     ensureChunk() {
49837     }
49838   };
49839   function P(e3, t2) {
49840     g2(`${e3} '${t2}' was not loaded, try using full build of exifr.`);
49841   }
49842   var k = class extends Map {
49843     constructor(e3) {
49844       super(), this.kind = e3;
49845     }
49846     get(e3, t2) {
49847       return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
49848         g2(`Unknown ${e4} '${t3}'.`);
49849       }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
49850     }
49851     keyList() {
49852       return Array.from(this.keys());
49853     }
49854   };
49855   var w = new k("file parser");
49856   var T = new k("segment parser");
49857   var A = new k("file reader");
49858   function D(e3, n3) {
49859     return "string" == typeof e3 ? O(e3, n3) : t && !i2 && e3 instanceof HTMLImageElement ? O(e3.src, n3) : e3 instanceof Uint8Array || e3 instanceof ArrayBuffer || e3 instanceof DataView ? new I(e3) : t && e3 instanceof Blob ? x(e3, n3, "blob", R) : void g2("Invalid input argument");
49860   }
49861   function O(e3, i3) {
49862     return (s2 = e3).startsWith("data:") || s2.length > 1e4 ? v(e3, i3, "base64") : n2 && e3.includes("://") ? x(e3, i3, "url", M) : n2 ? v(e3, i3, "fs") : t ? x(e3, i3, "url", M) : void g2("Invalid input argument");
49863     var s2;
49864   }
49865   async function x(e3, t2, i3, n3) {
49866     return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
49867       let i4 = await t3(e4);
49868       return new I(i4);
49869     }(e3, n3) : void g2(`Parser ${i3} is not loaded`);
49870   }
49871   async function v(e3, t2, i3) {
49872     let n3 = new (A.get(i3))(e3, t2);
49873     return await n3.read(), n3;
49874   }
49875   var M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
49876   var R = (e3) => new Promise((t2, i3) => {
49877     let n3 = new FileReader();
49878     n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
49879   });
49880   var L = class extends Map {
49881     get tagKeys() {
49882       return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
49883     }
49884     get tagValues() {
49885       return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
49886     }
49887   };
49888   function U(e3, t2, i3) {
49889     let n3 = new L();
49890     for (let [e4, t3] of i3)
49891       n3.set(e4, t3);
49892     if (Array.isArray(t2))
49893       for (let i4 of t2)
49894         e3.set(i4, n3);
49895     else
49896       e3.set(t2, n3);
49897     return n3;
49898   }
49899   function F(e3, t2, i3) {
49900     let n3, s2 = e3.get(t2);
49901     for (n3 of i3)
49902       s2.set(n3[0], n3[1]);
49903   }
49904   var E = /* @__PURE__ */ new Map();
49905   var B = /* @__PURE__ */ new Map();
49906   var N = /* @__PURE__ */ new Map();
49907   var G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
49908   var V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
49909   var z = ["tiff", ...V];
49910   var H = ["ifd0", "ifd1", "exif", "gps", "interop"];
49911   var j2 = [...z, ...H];
49912   var W = ["makerNote", "userComment"];
49913   var K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
49914   var X = [...K, "sanitize", "mergeOutput", "silentErrors"];
49915   var _ = class {
49916     get translate() {
49917       return this.translateKeys || this.translateValues || this.reviveValues;
49918     }
49919   };
49920   var Y = class extends _ {
49921     get needed() {
49922       return this.enabled || this.deps.size > 0;
49923     }
49924     constructor(e3, t2, i3, n3) {
49925       if (super(), c(this, "enabled", false), c(this, "skip", /* @__PURE__ */ new Set()), c(this, "pick", /* @__PURE__ */ new Set()), c(this, "deps", /* @__PURE__ */ new Set()), c(this, "translateKeys", false), c(this, "translateValues", false), c(this, "reviveValues", false), this.key = e3, this.enabled = t2, this.parse = this.enabled, this.applyInheritables(n3), this.canBeFiltered = H.includes(e3), this.canBeFiltered && (this.dict = E.get(e3)), void 0 !== i3)
49926         if (Array.isArray(i3))
49927           this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
49928         else if ("object" == typeof i3) {
49929           if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
49930             let { pick: e4, skip: t3 } = i3;
49931             e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
49932           }
49933           this.applyInheritables(i3);
49934         } else
49935           true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2(`Invalid options argument: ${i3}`);
49936     }
49937     applyInheritables(e3) {
49938       let t2, i3;
49939       for (t2 of K)
49940         i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
49941     }
49942     translateTagSet(e3, t2) {
49943       if (this.dict) {
49944         let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
49945         for (i3 of e3)
49946           "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
49947       } else
49948         for (let i3 of e3)
49949           t2.add(i3);
49950     }
49951     finalizeFilters() {
49952       !this.enabled && this.deps.size > 0 ? (this.enabled = true, ee(this.pick, this.deps)) : this.enabled && this.pick.size > 0 && ee(this.pick, this.deps);
49953     }
49954   };
49955   var $2 = { jfif: false, tiff: true, xmp: false, icc: false, iptc: false, ifd0: true, ifd1: false, exif: true, gps: true, interop: false, ihdr: void 0, makerNote: false, userComment: false, multiSegment: false, skip: [], pick: [], translateKeys: true, translateValues: true, reviveValues: true, sanitize: true, mergeOutput: true, silentErrors: true, chunked: true, firstChunkSize: void 0, firstChunkSizeNode: 512, firstChunkSizeBrowser: 65536, chunkSize: 65536, chunkLimit: 5 };
49956   var J = /* @__PURE__ */ new Map();
49957   var q = class extends _ {
49958     static useCached(e3) {
49959       let t2 = J.get(e3);
49960       return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
49961     }
49962     constructor(e3) {
49963       super(), true === e3 ? this.setupFromTrue() : void 0 === e3 ? this.setupFromUndefined() : Array.isArray(e3) ? this.setupFromArray(e3) : "object" == typeof e3 ? this.setupFromObject(e3) : g2(`Invalid options argument ${e3}`), void 0 === this.firstChunkSize && (this.firstChunkSize = t ? this.firstChunkSizeBrowser : this.firstChunkSizeNode), this.mergeOutput && (this.ifd1.enabled = false), this.filterNestedSegmentTags(), this.traverseTiffDependencyTree(), this.checkLoadedPlugins();
49964     }
49965     setupFromUndefined() {
49966       let e3;
49967       for (e3 of G)
49968         this[e3] = $2[e3];
49969       for (e3 of X)
49970         this[e3] = $2[e3];
49971       for (e3 of W)
49972         this[e3] = $2[e3];
49973       for (e3 of j2)
49974         this[e3] = new Y(e3, $2[e3], void 0, this);
49975     }
49976     setupFromTrue() {
49977       let e3;
49978       for (e3 of G)
49979         this[e3] = $2[e3];
49980       for (e3 of X)
49981         this[e3] = $2[e3];
49982       for (e3 of W)
49983         this[e3] = true;
49984       for (e3 of j2)
49985         this[e3] = new Y(e3, true, void 0, this);
49986     }
49987     setupFromArray(e3) {
49988       let t2;
49989       for (t2 of G)
49990         this[t2] = $2[t2];
49991       for (t2 of X)
49992         this[t2] = $2[t2];
49993       for (t2 of W)
49994         this[t2] = $2[t2];
49995       for (t2 of j2)
49996         this[t2] = new Y(t2, false, void 0, this);
49997       this.setupGlobalFilters(e3, void 0, H);
49998     }
49999     setupFromObject(e3) {
50000       let t2;
50001       for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G))
50002         this[t2] = Z(e3[t2], $2[t2]);
50003       for (t2 of X)
50004         this[t2] = Z(e3[t2], $2[t2]);
50005       for (t2 of W)
50006         this[t2] = Z(e3[t2], $2[t2]);
50007       for (t2 of z)
50008         this[t2] = new Y(t2, $2[t2], e3[t2], this);
50009       for (t2 of H)
50010         this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
50011       this.setupGlobalFilters(e3.pick, e3.skip, H, j2), true === e3.tiff ? this.batchEnableWithBool(H, true) : false === e3.tiff ? this.batchEnableWithUserValue(H, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H);
50012     }
50013     batchEnableWithBool(e3, t2) {
50014       for (let i3 of e3)
50015         this[i3].enabled = t2;
50016     }
50017     batchEnableWithUserValue(e3, t2) {
50018       for (let i3 of e3) {
50019         let e4 = t2[i3];
50020         this[i3].enabled = false !== e4 && void 0 !== e4;
50021       }
50022     }
50023     setupGlobalFilters(e3, t2, i3, n3 = i3) {
50024       if (e3 && e3.length) {
50025         for (let e4 of n3)
50026           this[e4].enabled = false;
50027         let t3 = Q(e3, i3);
50028         for (let [e4, i4] of t3)
50029           ee(this[e4].pick, i4), this[e4].enabled = true;
50030       } else if (t2 && t2.length) {
50031         let e4 = Q(t2, i3);
50032         for (let [t3, i4] of e4)
50033           ee(this[t3].skip, i4);
50034       }
50035     }
50036     filterNestedSegmentTags() {
50037       let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
50038       this.makerNote ? t2.deps.add(37500) : t2.skip.add(37500), this.userComment ? t2.deps.add(37510) : t2.skip.add(37510), i3.enabled || e3.skip.add(700), n3.enabled || e3.skip.add(33723), s2.enabled || e3.skip.add(34675);
50039     }
50040     traverseTiffDependencyTree() {
50041       let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
50042       n3.needed && (t2.deps.add(40965), e3.deps.add(40965)), t2.needed && e3.deps.add(34665), i3.needed && e3.deps.add(34853), this.tiff.enabled = H.some((e4) => true === this[e4].enabled) || this.makerNote || this.userComment;
50043       for (let e4 of H)
50044         this[e4].finalizeFilters();
50045     }
50046     get onlyTiff() {
50047       return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
50048     }
50049     checkLoadedPlugins() {
50050       for (let e3 of z)
50051         this[e3].enabled && !T.has(e3) && P("segment parser", e3);
50052     }
50053   };
50054   function Q(e3, t2) {
50055     let i3, n3, s2, r2, a2 = [];
50056     for (s2 of t2) {
50057       for (r2 of (i3 = E.get(s2), n3 = [], i3))
50058         (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
50059       n3.length && a2.push([s2, n3]);
50060     }
50061     return a2;
50062   }
50063   function Z(e3, t2) {
50064     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
50065   }
50066   function ee(e3, t2) {
50067     for (let i3 of t2)
50068       e3.add(i3);
50069   }
50070   c(q, "default", $2);
50071   var te = class {
50072     constructor(e3) {
50073       c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
50074     }
50075     async read(e3) {
50076       this.file = await D(e3, this.options);
50077     }
50078     setup() {
50079       if (this.fileParser)
50080         return;
50081       let { file: e3 } = this, t2 = e3.getUint16(0);
50082       for (let [i3, n3] of w)
50083         if (n3.canHandle(e3, t2))
50084           return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
50085       this.file.close && this.file.close(), g2("Unknown file format");
50086     }
50087     async parse() {
50088       let { output: e3, errors: t2 } = this;
50089       return this.setup(), this.options.silentErrors ? (await this.executeParsers().catch(this.pushToErrors), t2.push(...this.fileParser.errors)) : await this.executeParsers(), this.file.close && this.file.close(), this.options.silentErrors && t2.length > 0 && (e3.errors = t2), f2(e3);
50090     }
50091     async executeParsers() {
50092       let { output: e3 } = this;
50093       await this.fileParser.parse();
50094       let t2 = Object.values(this.parsers).map(async (t3) => {
50095         let i3 = await t3.parse();
50096         t3.assignToOutput(e3, i3);
50097       });
50098       this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
50099     }
50100     async extractThumbnail() {
50101       this.setup();
50102       let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
50103       var n3;
50104       if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3)
50105         return;
50106       let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
50107       return t2.close && t2.close(), a2;
50108     }
50109   };
50110   async function ie(e3, t2) {
50111     let i3 = new te(t2);
50112     return await i3.read(e3), i3.parse();
50113   }
50114   var ne = Object.freeze({ __proto__: null, parse: ie, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q });
50115   var se = class {
50116     constructor(e3, t2, i3) {
50117       c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
50118         let t3 = e4.start, i4 = e4.size || 65536;
50119         if (this.file.chunked)
50120           if (this.file.available(t3, i4))
50121             e4.chunk = this.file.subarray(t3, i4);
50122           else
50123             try {
50124               e4.chunk = await this.file.readChunk(t3, i4);
50125             } catch (t4) {
50126               g2(`Couldn't read segment: ${JSON.stringify(e4)}. ${t4.message}`);
50127             }
50128         else
50129           this.file.byteLength > t3 + i4 ? e4.chunk = this.file.subarray(t3, i4) : void 0 === e4.size ? e4.chunk = this.file.subarray(t3) : g2("Segment unreachable: " + JSON.stringify(e4));
50130         return e4.chunk;
50131       }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
50132     }
50133     injectSegment(e3, t2) {
50134       this.options[e3].enabled && this.createParser(e3, t2);
50135     }
50136     createParser(e3, t2) {
50137       let i3 = new (T.get(e3))(t2, this.options, this.file);
50138       return this.parsers[e3] = i3;
50139     }
50140     createParsers(e3) {
50141       for (let t2 of e3) {
50142         let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
50143         if (n3 && n3.enabled) {
50144           let t3 = this.parsers[e4];
50145           t3 && t3.append || t3 || this.createParser(e4, i3);
50146         }
50147       }
50148     }
50149     async readSegments(e3) {
50150       let t2 = e3.map(this.ensureSegmentChunk);
50151       await Promise.all(t2);
50152     }
50153   };
50154   var re2 = class {
50155     static findPosition(e3, t2) {
50156       let i3 = e3.getUint16(t2 + 2) + 2, n3 = "function" == typeof this.headerLength ? this.headerLength(e3, t2, i3) : this.headerLength, s2 = t2 + n3, r2 = i3 - n3;
50157       return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
50158     }
50159     static parse(e3, t2 = {}) {
50160       return new this(e3, new q({ [this.type]: t2 }), e3).parse();
50161     }
50162     normalizeInput(e3) {
50163       return e3 instanceof I ? e3 : new I(e3);
50164     }
50165     constructor(e3, t2 = {}, i3) {
50166       c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
50167         if (!this.options.silentErrors)
50168           throw e4;
50169         this.errors.push(e4.message);
50170       }), this.chunk = this.normalizeInput(e3), this.file = i3, this.type = this.constructor.type, this.globalOptions = this.options = t2, this.localOptions = t2[this.type], this.canTranslate = this.localOptions && this.localOptions.translate;
50171     }
50172     translate() {
50173       this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
50174     }
50175     get output() {
50176       return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
50177     }
50178     translateBlock(e3, t2) {
50179       let i3 = N.get(t2), n3 = B.get(t2), s2 = E.get(t2), r2 = this.options[t2], a2 = r2.reviveValues && !!i3, o2 = r2.translateValues && !!n3, l2 = r2.translateKeys && !!s2, h2 = {};
50180       for (let [t3, r3] of e3)
50181         a2 && i3.has(t3) ? r3 = i3.get(t3)(r3) : o2 && n3.has(t3) && (r3 = this.translateValue(r3, n3.get(t3))), l2 && s2.has(t3) && (t3 = s2.get(t3) || t3), h2[t3] = r3;
50182       return h2;
50183     }
50184     translateValue(e3, t2) {
50185       return t2[e3] || t2.DEFAULT || e3;
50186     }
50187     assignToOutput(e3, t2) {
50188       this.assignObjectToOutput(e3, this.constructor.type, t2);
50189     }
50190     assignObjectToOutput(e3, t2, i3) {
50191       if (this.globalOptions.mergeOutput)
50192         return Object.assign(e3, i3);
50193       e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
50194     }
50195   };
50196   c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
50197   function ae(e3) {
50198     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
50199   }
50200   function oe(e3) {
50201     return e3 >= 224 && e3 <= 239;
50202   }
50203   function le(e3, t2, i3) {
50204     for (let [n3, s2] of T)
50205       if (s2.canHandle(e3, t2, i3))
50206         return n3;
50207   }
50208   var he = class extends se {
50209     constructor(...e3) {
50210       super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
50211     }
50212     static canHandle(e3, t2) {
50213       return 65496 === t2;
50214     }
50215     async parse() {
50216       await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
50217     }
50218     setupSegmentFinderArgs(e3) {
50219       true === e3 ? (this.findAll = true, this.wanted = new Set(T.keyList())) : (e3 = void 0 === e3 ? T.keyList().filter((e4) => this.options[e4].enabled) : e3.filter((e4) => this.options[e4].enabled && T.has(e4)), this.findAll = false, this.remaining = new Set(e3), this.wanted = new Set(e3)), this.unfinishedMultiSegment = false;
50220     }
50221     async findAppSegments(e3 = 0, t2) {
50222       this.setupSegmentFinderArgs(t2);
50223       let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
50224       if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
50225         let t3 = T.get(e4), i4 = this.options[e4];
50226         return t3.multiSegment && i4.multiSegment;
50227       }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
50228         let t3 = false;
50229         for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
50230           let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
50231           if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength)))
50232             return;
50233         }
50234       }
50235     }
50236     findAppSegmentsInRange(e3, t2) {
50237       t2 -= 2;
50238       let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f3 } = this;
50239       for (; e3 < t2; e3++)
50240         if (255 === l2.getUint8(e3)) {
50241           if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
50242             if (n3 = l2.getUint16(e3 + 2), s2 = le(l2, e3, n3), s2 && u2.has(s2) && (r2 = T.get(s2), a2 = r2.findPosition(l2, e3), o2 = f3[s2], a2.type = s2, this.appSegments.push(a2), !h2 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a2.chunkNumber < a2.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size)))
50243               break;
50244             f3.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
50245           } else if (ae(i3)) {
50246             if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f3.stopAfterSos)
50247               return;
50248             f3.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
50249           }
50250         }
50251       return e3;
50252     }
50253     mergeMultiSegments() {
50254       if (!this.appSegments.some((e4) => e4.multiSegment))
50255         return;
50256       let e3 = function(e4, t2) {
50257         let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
50258         for (let a2 = 0; a2 < e4.length; a2++)
50259           i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
50260         return Array.from(r2);
50261       }(this.appSegments, "type");
50262       this.mergedAppSegments = e3.map(([e4, t2]) => {
50263         let i3 = T.get(e4, this.options);
50264         if (i3.handleMultiSegments) {
50265           return { type: e4, chunk: i3.handleMultiSegments(t2) };
50266         }
50267         return t2[0];
50268       });
50269     }
50270     getSegment(e3) {
50271       return this.appSegments.find((t2) => t2.type === e3);
50272     }
50273     async getOrFindSegment(e3) {
50274       let t2 = this.getSegment(e3);
50275       return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
50276     }
50277   };
50278   c(he, "type", "jpeg"), w.set("jpeg", he);
50279   var ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
50280   var ce = class extends re2 {
50281     parseHeader() {
50282       var e3 = this.chunk.getUint16();
50283       18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
50284     }
50285     parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
50286       let { pick: n3, skip: s2 } = this.options[t2];
50287       n3 = new Set(n3);
50288       let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
50289       e3 += 2;
50290       for (let l2 = 0; l2 < o2; l2++) {
50291         let o3 = this.chunk.getUint16(e3);
50292         if (r2) {
50293           if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size))
50294             break;
50295         } else
50296           !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
50297         e3 += 12;
50298       }
50299       return i3;
50300     }
50301     parseTag(e3, t2, i3) {
50302       let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
50303       if (a2 * r2 <= 4 ? e3 += 8 : e3 = n3.getUint32(e3 + 8), (s2 < 1 || s2 > 13) && g2(`Invalid TIFF value type. block: ${i3.toUpperCase()}, tag: ${t2.toString(16)}, type: ${s2}, offset ${e3}`), e3 > n3.byteLength && g2(`Invalid TIFF value offset. block: ${i3.toUpperCase()}, tag: ${t2.toString(16)}, type: ${s2}, offset ${e3} is outside of chunk size ${n3.byteLength}`), 1 === s2)
50304         return n3.getUint8Array(e3, r2);
50305       if (2 === s2)
50306         return m(n3.getString(e3, r2));
50307       if (7 === s2)
50308         return n3.getUint8Array(e3, r2);
50309       if (1 === r2)
50310         return this.parseTagValue(s2, e3);
50311       {
50312         let t3 = new (function(e4) {
50313           switch (e4) {
50314             case 1:
50315               return Uint8Array;
50316             case 3:
50317               return Uint16Array;
50318             case 4:
50319               return Uint32Array;
50320             case 5:
50321               return Array;
50322             case 6:
50323               return Int8Array;
50324             case 8:
50325               return Int16Array;
50326             case 9:
50327               return Int32Array;
50328             case 10:
50329               return Array;
50330             case 11:
50331               return Float32Array;
50332             case 12:
50333               return Float64Array;
50334             default:
50335               return Array;
50336           }
50337         }(s2))(r2), i4 = a2;
50338         for (let n4 = 0; n4 < r2; n4++)
50339           t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
50340         return t3;
50341       }
50342     }
50343     parseTagValue(e3, t2) {
50344       let { chunk: i3 } = this;
50345       switch (e3) {
50346         case 1:
50347           return i3.getUint8(t2);
50348         case 3:
50349           return i3.getUint16(t2);
50350         case 4:
50351           return i3.getUint32(t2);
50352         case 5:
50353           return i3.getUint32(t2) / i3.getUint32(t2 + 4);
50354         case 6:
50355           return i3.getInt8(t2);
50356         case 8:
50357           return i3.getInt16(t2);
50358         case 9:
50359           return i3.getInt32(t2);
50360         case 10:
50361           return i3.getInt32(t2) / i3.getInt32(t2 + 4);
50362         case 11:
50363           return i3.getFloat(t2);
50364         case 12:
50365           return i3.getDouble(t2);
50366         case 13:
50367           return i3.getUint32(t2);
50368         default:
50369           g2(`Invalid tiff type ${e3}`);
50370       }
50371     }
50372   };
50373   var fe = class extends ce {
50374     static canHandle(e3, t2) {
50375       return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
50376     }
50377     async parse() {
50378       this.parseHeader();
50379       let { options: e3 } = this;
50380       return e3.ifd0.enabled && await this.parseIfd0Block(), e3.exif.enabled && await this.safeParse("parseExifBlock"), e3.gps.enabled && await this.safeParse("parseGpsBlock"), e3.interop.enabled && await this.safeParse("parseInteropBlock"), e3.ifd1.enabled && await this.safeParse("parseThumbnailBlock"), this.createOutput();
50381     }
50382     safeParse(e3) {
50383       let t2 = this[e3]();
50384       return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
50385     }
50386     findIfd0Offset() {
50387       void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
50388     }
50389     findIfd1Offset() {
50390       if (void 0 === this.ifd1Offset) {
50391         this.findIfd0Offset();
50392         let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
50393         this.ifd1Offset = this.chunk.getUint32(t2);
50394       }
50395     }
50396     parseBlock(e3, t2) {
50397       let i3 = /* @__PURE__ */ new Map();
50398       return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
50399     }
50400     async parseIfd0Block() {
50401       if (this.ifd0)
50402         return;
50403       let { file: e3 } = this;
50404       this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2(`IFD0 offset points to outside of file.
50405 this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S(this.options));
50406       let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
50407       return 0 !== t2.size ? (this.exifOffset = t2.get(34665), this.interopOffset = t2.get(40965), this.gpsOffset = t2.get(34853), this.xmp = t2.get(700), this.iptc = t2.get(33723), this.icc = t2.get(34675), this.options.sanitize && (t2.delete(34665), t2.delete(40965), t2.delete(34853), t2.delete(700), t2.delete(33723), t2.delete(34675)), t2) : void 0;
50408     }
50409     async parseExifBlock() {
50410       if (this.exif)
50411         return;
50412       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset)
50413         return;
50414       this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
50415       let e3 = this.parseBlock(this.exifOffset, "exif");
50416       return this.interopOffset || (this.interopOffset = e3.get(40965)), this.makerNote = e3.get(37500), this.userComment = e3.get(37510), this.options.sanitize && (e3.delete(40965), e3.delete(37500), e3.delete(37510)), this.unpack(e3, 41728), this.unpack(e3, 41729), e3;
50417     }
50418     unpack(e3, t2) {
50419       let i3 = e3.get(t2);
50420       i3 && 1 === i3.length && e3.set(t2, i3[0]);
50421     }
50422     async parseGpsBlock() {
50423       if (this.gps)
50424         return;
50425       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset)
50426         return;
50427       let e3 = this.parseBlock(this.gpsOffset, "gps");
50428       return e3 && e3.has(2) && e3.has(4) && (e3.set("latitude", de(...e3.get(2), e3.get(1))), e3.set("longitude", de(...e3.get(4), e3.get(3)))), e3;
50429     }
50430     async parseInteropBlock() {
50431       if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset))
50432         return this.parseBlock(this.interopOffset, "interop");
50433     }
50434     async parseThumbnailBlock(e3 = false) {
50435       if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3))
50436         return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
50437     }
50438     async extractThumbnail() {
50439       if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1)
50440         return;
50441       let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
50442       return this.chunk.getUint8Array(e3, t2);
50443     }
50444     get image() {
50445       return this.ifd0;
50446     }
50447     get thumbnail() {
50448       return this.ifd1;
50449     }
50450     createOutput() {
50451       let e3, t2, i3, n3 = {};
50452       for (t2 of H)
50453         if (e3 = this[t2], !p(e3))
50454           if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
50455             if ("ifd1" === t2)
50456               continue;
50457             Object.assign(n3, i3);
50458           } else
50459             n3[t2] = i3;
50460       return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
50461     }
50462     assignToOutput(e3, t2) {
50463       if (this.globalOptions.mergeOutput)
50464         Object.assign(e3, t2);
50465       else
50466         for (let [i3, n3] of Object.entries(t2))
50467           this.assignObjectToOutput(e3, i3, n3);
50468     }
50469   };
50470   function de(e3, t2, i3, n3) {
50471     var s2 = e3 + t2 / 60 + i3 / 3600;
50472     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
50473   }
50474   c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
50475   var pe = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie });
50476   var ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
50477   var me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
50478   async function Se(e3) {
50479     let t2 = new te(me);
50480     await t2.read(e3);
50481     let i3 = await t2.parse();
50482     if (i3 && i3.gps) {
50483       let { latitude: e4, longitude: t3 } = i3.gps;
50484       return { latitude: e4, longitude: t3 };
50485     }
50486   }
50487   var Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
50488   async function ye(e3) {
50489     let t2 = new te(Ce);
50490     await t2.read(e3);
50491     let i3 = await t2.extractThumbnail();
50492     return i3 && a ? s.from(i3) : i3;
50493   }
50494   async function be(e3) {
50495     let t2 = await this.thumbnail(e3);
50496     if (void 0 !== t2) {
50497       let e4 = new Blob([t2]);
50498       return URL.createObjectURL(e4);
50499     }
50500   }
50501   var Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
50502   async function Pe(e3) {
50503     let t2 = new te(Ie);
50504     await t2.read(e3);
50505     let i3 = await t2.parse();
50506     if (i3 && i3.ifd0)
50507       return i3.ifd0[274];
50508   }
50509   var ke = Object.freeze({ 1: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 0, rad: 0 }, 2: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 0, rad: 0 }, 3: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 4: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 5: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 90, rad: 90 * Math.PI / 180 }, 6: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 90, rad: 90 * Math.PI / 180 }, 7: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 270, rad: 270 * Math.PI / 180 }, 8: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 270, rad: 270 * Math.PI / 180 } });
50510   var we = true;
50511   var Te = true;
50512   if ("object" == typeof navigator) {
50513     let e3 = navigator.userAgent;
50514     if (e3.includes("iPad") || e3.includes("iPhone")) {
50515       let t2 = e3.match(/OS (\d+)_(\d+)/);
50516       if (t2) {
50517         let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
50518         we = n3 < 13.4, Te = false;
50519       }
50520     } else if (e3.includes("OS X 10")) {
50521       let [, t2] = e3.match(/OS X 10[_.](\d+)/);
50522       we = Te = Number(t2) < 15;
50523     }
50524     if (e3.includes("Chrome/")) {
50525       let [, t2] = e3.match(/Chrome\/(\d+)/);
50526       we = Te = Number(t2) < 81;
50527     } else if (e3.includes("Firefox/")) {
50528       let [, t2] = e3.match(/Firefox\/(\d+)/);
50529       we = Te = Number(t2) < 77;
50530     }
50531   }
50532   async function Ae(e3) {
50533     let t2 = await Pe(e3);
50534     return Object.assign({ canvas: we, css: Te }, ke[t2]);
50535   }
50536   var De = class extends I {
50537     constructor(...e3) {
50538       super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
50539     }
50540     _tryExtend(e3, t2, i3) {
50541       if (0 === e3 && 0 === this.byteLength && i3) {
50542         let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
50543         this._swapDataView(e4);
50544       } else {
50545         let i4 = e3 + t2;
50546         if (i4 > this.byteLength) {
50547           let { dataView: e4 } = this._extend(i4);
50548           this._swapDataView(e4);
50549         }
50550       }
50551     }
50552     _extend(e3) {
50553       let t2;
50554       t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
50555       let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
50556       return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
50557     }
50558     subarray(e3, t2, i3 = false) {
50559       return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
50560     }
50561     set(e3, t2, i3 = false) {
50562       i3 && this._tryExtend(t2, e3.byteLength, e3);
50563       let n3 = super.set(e3, t2);
50564       return this.ranges.add(t2, n3.byteLength), n3;
50565     }
50566     async ensureChunk(e3, t2) {
50567       this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
50568     }
50569     available(e3, t2) {
50570       return this.ranges.available(e3, t2);
50571     }
50572   };
50573   var Oe = class {
50574     constructor() {
50575       c(this, "list", []);
50576     }
50577     get length() {
50578       return this.list.length;
50579     }
50580     add(e3, t2, i3 = 0) {
50581       let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
50582       if (s2.length > 0) {
50583         e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
50584         let i4 = s2.shift();
50585         i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
50586       } else
50587         this.list.push({ offset: e3, length: t2, end: n3 });
50588     }
50589     available(e3, t2) {
50590       let i3 = e3 + t2;
50591       return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
50592     }
50593   };
50594   function xe(e3, t2, i3) {
50595     return e3 <= t2 && t2 <= i3;
50596   }
50597   var ve = class extends De {
50598     constructor(e3, t2) {
50599       super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
50600     }
50601     async readWhole() {
50602       this.chunked = false, await this.readChunk(this.nextChunkOffset);
50603     }
50604     async readChunked() {
50605       this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
50606     }
50607     async readNextChunk(e3 = this.nextChunkOffset) {
50608       if (this.fullyRead)
50609         return this.chunksRead++, false;
50610       let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
50611       return !!i3 && i3.byteLength === t2;
50612     }
50613     async readChunk(e3, t2) {
50614       if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2)))
50615         return this._readChunk(e3, t2);
50616     }
50617     safeWrapAddress(e3, t2) {
50618       return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
50619     }
50620     get nextChunkOffset() {
50621       if (0 !== this.ranges.list.length)
50622         return this.ranges.list[0].length;
50623     }
50624     get canReadNextChunk() {
50625       return this.chunksRead < this.options.chunkLimit;
50626     }
50627     get fullyRead() {
50628       return void 0 !== this.size && this.nextChunkOffset === this.size;
50629     }
50630     read() {
50631       return this.options.chunked ? this.readChunked() : this.readWhole();
50632     }
50633     close() {
50634     }
50635   };
50636   A.set("blob", class extends ve {
50637     async readWhole() {
50638       this.chunked = false;
50639       let e3 = await R(this.input);
50640       this._swapArrayBuffer(e3);
50641     }
50642     readChunked() {
50643       return this.chunked = true, this.size = this.input.size, super.readChunked();
50644     }
50645     async _readChunk(e3, t2) {
50646       let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
50647       return this.set(s2, e3, true);
50648     }
50649   });
50650   var Me = Object.freeze({ __proto__: null, default: pe, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
50651     return we;
50652   }, get rotateCss() {
50653     return Te;
50654   }, rotation: Ae });
50655   A.set("url", class extends ve {
50656     async readWhole() {
50657       this.chunked = false;
50658       let e3 = await M(this.input);
50659       e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
50660     }
50661     async _readChunk(e3, t2) {
50662       let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
50663       (e3 || i3) && (n3.range = `bytes=${[e3, i3].join("-")}`);
50664       let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
50665       if (416 !== s2.status)
50666         return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
50667     }
50668   });
50669   I.prototype.getUint64 = function(e3) {
50670     let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
50671     return t2 < 1048575 ? t2 << 32 | i3 : void 0 !== typeof r ? (console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."), r(t2) << r(32) | r(i3)) : void g2("Trying to read 64b value but JS can only handle 53b numbers.");
50672   };
50673   var Re = class extends se {
50674     parseBoxes(e3 = 0) {
50675       let t2 = [];
50676       for (; e3 < this.file.byteLength - 4; ) {
50677         let i3 = this.parseBoxHead(e3);
50678         if (t2.push(i3), 0 === i3.length)
50679           break;
50680         e3 += i3.length;
50681       }
50682       return t2;
50683     }
50684     parseSubBoxes(e3) {
50685       e3.boxes = this.parseBoxes(e3.start);
50686     }
50687     findBox(e3, t2) {
50688       return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
50689     }
50690     parseBoxHead(e3) {
50691       let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
50692       return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
50693     }
50694     parseBoxFullHead(e3) {
50695       if (void 0 !== e3.version)
50696         return;
50697       let t2 = this.file.getUint32(e3.start);
50698       e3.version = t2 >> 24, e3.start += 4;
50699     }
50700   };
50701   var Le = class extends Re {
50702     static canHandle(e3, t2) {
50703       if (0 !== t2)
50704         return false;
50705       let i3 = e3.getUint16(2);
50706       if (i3 > 50)
50707         return false;
50708       let n3 = 16, s2 = [];
50709       for (; n3 < i3; )
50710         s2.push(e3.getString(n3, 4)), n3 += 4;
50711       return s2.includes(this.type);
50712     }
50713     async parse() {
50714       let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
50715       for (; "meta" !== t2.kind; )
50716         e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
50717       await this.file.ensureChunk(t2.offset, t2.length), this.parseBoxFullHead(t2), this.parseSubBoxes(t2), this.options.icc.enabled && await this.findIcc(t2), this.options.tiff.enabled && await this.findExif(t2);
50718     }
50719     async registerSegment(e3, t2, i3) {
50720       await this.file.ensureChunk(t2, i3);
50721       let n3 = this.file.subarray(t2, i3);
50722       this.createParser(e3, n3);
50723     }
50724     async findIcc(e3) {
50725       let t2 = this.findBox(e3, "iprp");
50726       if (void 0 === t2)
50727         return;
50728       let i3 = this.findBox(t2, "ipco");
50729       if (void 0 === i3)
50730         return;
50731       let n3 = this.findBox(i3, "colr");
50732       void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
50733     }
50734     async findExif(e3) {
50735       let t2 = this.findBox(e3, "iinf");
50736       if (void 0 === t2)
50737         return;
50738       let i3 = this.findBox(e3, "iloc");
50739       if (void 0 === i3)
50740         return;
50741       let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
50742       if (void 0 === s2)
50743         return;
50744       let [r2, a2] = s2;
50745       await this.file.ensureChunk(r2, a2);
50746       let o2 = 4 + this.file.getUint32(r2);
50747       r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
50748     }
50749     findExifLocIdInIinf(e3) {
50750       this.parseBoxFullHead(e3);
50751       let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
50752       for (r2 += 2; a2--; ) {
50753         if (t2 = this.parseBoxHead(r2), this.parseBoxFullHead(t2), i3 = t2.start, t2.version >= 2 && (n3 = 3 === t2.version ? 4 : 2, s2 = this.file.getString(i3 + n3 + 2, 4), "Exif" === s2))
50754           return this.file.getUintBytes(i3, n3);
50755         r2 += t2.length;
50756       }
50757     }
50758     get8bits(e3) {
50759       let t2 = this.file.getUint8(e3);
50760       return [t2 >> 4, 15 & t2];
50761     }
50762     findExtentInIloc(e3, t2) {
50763       this.parseBoxFullHead(e3);
50764       let i3 = e3.start, [n3, s2] = this.get8bits(i3++), [r2, a2] = this.get8bits(i3++), o2 = 2 === e3.version ? 4 : 2, l2 = 1 === e3.version || 2 === e3.version ? 2 : 0, h2 = a2 + n3 + s2, u2 = 2 === e3.version ? 4 : 2, c2 = this.file.getUintBytes(i3, u2);
50765       for (i3 += u2; c2--; ) {
50766         let e4 = this.file.getUintBytes(i3, o2);
50767         i3 += o2 + l2 + 2 + r2;
50768         let u3 = this.file.getUint16(i3);
50769         if (i3 += 2, e4 === t2)
50770           return u3 > 1 && console.warn("ILOC box has more than one extent but we're only processing one\nPlease create an issue at https://github.com/MikeKovarik/exifr with this file"), [this.file.getUintBytes(i3 + a2, n3), this.file.getUintBytes(i3 + a2 + n3, s2)];
50771         i3 += u3 * h2;
50772       }
50773     }
50774   };
50775   var Ue = class extends Le {
50776   };
50777   c(Ue, "type", "heic");
50778   var Fe = class extends Le {
50779   };
50780   c(Fe, "type", "avif"), w.set("heic", Ue), w.set("avif", Fe), U(E, ["ifd0", "ifd1"], [[256, "ImageWidth"], [257, "ImageHeight"], [258, "BitsPerSample"], [259, "Compression"], [262, "PhotometricInterpretation"], [270, "ImageDescription"], [271, "Make"], [272, "Model"], [273, "StripOffsets"], [274, "Orientation"], [277, "SamplesPerPixel"], [278, "RowsPerStrip"], [279, "StripByteCounts"], [282, "XResolution"], [283, "YResolution"], [284, "PlanarConfiguration"], [296, "ResolutionUnit"], [301, "TransferFunction"], [305, "Software"], [306, "ModifyDate"], [315, "Artist"], [316, "HostComputer"], [317, "Predictor"], [318, "WhitePoint"], [319, "PrimaryChromaticities"], [513, "ThumbnailOffset"], [514, "ThumbnailLength"], [529, "YCbCrCoefficients"], [530, "YCbCrSubSampling"], [531, "YCbCrPositioning"], [532, "ReferenceBlackWhite"], [700, "ApplicationNotes"], [33432, "Copyright"], [33723, "IPTC"], [34665, "ExifIFD"], [34675, "ICC"], [34853, "GpsIFD"], [330, "SubIFD"], [40965, "InteropIFD"], [40091, "XPTitle"], [40092, "XPComment"], [40093, "XPAuthor"], [40094, "XPKeywords"], [40095, "XPSubject"]]), U(E, "exif", [[33434, "ExposureTime"], [33437, "FNumber"], [34850, "ExposureProgram"], [34852, "SpectralSensitivity"], [34855, "ISO"], [34858, "TimeZoneOffset"], [34859, "SelfTimerMode"], [34864, "SensitivityType"], [34865, "StandardOutputSensitivity"], [34866, "RecommendedExposureIndex"], [34867, "ISOSpeed"], [34868, "ISOSpeedLatitudeyyy"], [34869, "ISOSpeedLatitudezzz"], [36864, "ExifVersion"], [36867, "DateTimeOriginal"], [36868, "CreateDate"], [36873, "GooglePlusUploadCode"], [36880, "OffsetTime"], [36881, "OffsetTimeOriginal"], [36882, "OffsetTimeDigitized"], [37121, "ComponentsConfiguration"], [37122, "CompressedBitsPerPixel"], [37377, "ShutterSpeedValue"], [37378, "ApertureValue"], [37379, "BrightnessValue"], [37380, "ExposureCompensation"], [37381, "MaxApertureValue"], [37382, "SubjectDistance"], [37383, "MeteringMode"], [37384, "LightSource"], [37385, "Flash"], [37386, "FocalLength"], [37393, "ImageNumber"], [37394, "SecurityClassification"], [37395, "ImageHistory"], [37396, "SubjectArea"], [37500, "MakerNote"], [37510, "UserComment"], [37520, "SubSecTime"], [37521, "SubSecTimeOriginal"], [37522, "SubSecTimeDigitized"], [37888, "AmbientTemperature"], [37889, "Humidity"], [37890, "Pressure"], [37891, "WaterDepth"], [37892, "Acceleration"], [37893, "CameraElevationAngle"], [40960, "FlashpixVersion"], [40961, "ColorSpace"], [40962, "ExifImageWidth"], [40963, "ExifImageHeight"], [40964, "RelatedSoundFile"], [41483, "FlashEnergy"], [41486, "FocalPlaneXResolution"], [41487, "FocalPlaneYResolution"], [41488, "FocalPlaneResolutionUnit"], [41492, "SubjectLocation"], [41493, "ExposureIndex"], [41495, "SensingMethod"], [41728, "FileSource"], [41729, "SceneType"], [41730, "CFAPattern"], [41985, "CustomRendered"], [41986, "ExposureMode"], [41987, "WhiteBalance"], [41988, "DigitalZoomRatio"], [41989, "FocalLengthIn35mmFormat"], [41990, "SceneCaptureType"], [41991, "GainControl"], [41992, "Contrast"], [41993, "Saturation"], [41994, "Sharpness"], [41996, "SubjectDistanceRange"], [42016, "ImageUniqueID"], [42032, "OwnerName"], [42033, "SerialNumber"], [42034, "LensInfo"], [42035, "LensMake"], [42036, "LensModel"], [42037, "LensSerialNumber"], [42080, "CompositeImage"], [42081, "CompositeImageCount"], [42082, "CompositeImageExposureTimes"], [42240, "Gamma"], [59932, "Padding"], [59933, "OffsetSchema"], [65e3, "OwnerName"], [65001, "SerialNumber"], [65002, "Lens"], [65100, "RawFile"], [65101, "Converter"], [65102, "WhiteBalance"], [65105, "Exposure"], [65106, "Shadows"], [65107, "Brightness"], [65108, "Contrast"], [65109, "Saturation"], [65110, "Sharpness"], [65111, "Smoothness"], [65112, "MoireFilter"], [40965, "InteropIFD"]]), U(E, "gps", [[0, "GPSVersionID"], [1, "GPSLatitudeRef"], [2, "GPSLatitude"], [3, "GPSLongitudeRef"], [4, "GPSLongitude"], [5, "GPSAltitudeRef"], [6, "GPSAltitude"], [7, "GPSTimeStamp"], [8, "GPSSatellites"], [9, "GPSStatus"], [10, "GPSMeasureMode"], [11, "GPSDOP"], [12, "GPSSpeedRef"], [13, "GPSSpeed"], [14, "GPSTrackRef"], [15, "GPSTrack"], [16, "GPSImgDirectionRef"], [17, "GPSImgDirection"], [18, "GPSMapDatum"], [19, "GPSDestLatitudeRef"], [20, "GPSDestLatitude"], [21, "GPSDestLongitudeRef"], [22, "GPSDestLongitude"], [23, "GPSDestBearingRef"], [24, "GPSDestBearing"], [25, "GPSDestDistanceRef"], [26, "GPSDestDistance"], [27, "GPSProcessingMethod"], [28, "GPSAreaInformation"], [29, "GPSDateStamp"], [30, "GPSDifferential"], [31, "GPSHPositioningError"]]), U(B, ["ifd0", "ifd1"], [[274, { 1: "Horizontal (normal)", 2: "Mirror horizontal", 3: "Rotate 180", 4: "Mirror vertical", 5: "Mirror horizontal and rotate 270 CW", 6: "Rotate 90 CW", 7: "Mirror horizontal and rotate 90 CW", 8: "Rotate 270 CW" }], [296, { 1: "None", 2: "inches", 3: "cm" }]]);
50781   var Ee = U(B, "exif", [[34850, { 0: "Not defined", 1: "Manual", 2: "Normal program", 3: "Aperture priority", 4: "Shutter priority", 5: "Creative program", 6: "Action program", 7: "Portrait mode", 8: "Landscape mode" }], [37121, { 0: "-", 1: "Y", 2: "Cb", 3: "Cr", 4: "R", 5: "G", 6: "B" }], [37383, { 0: "Unknown", 1: "Average", 2: "CenterWeightedAverage", 3: "Spot", 4: "MultiSpot", 5: "Pattern", 6: "Partial", 255: "Other" }], [37384, { 0: "Unknown", 1: "Daylight", 2: "Fluorescent", 3: "Tungsten (incandescent light)", 4: "Flash", 9: "Fine weather", 10: "Cloudy weather", 11: "Shade", 12: "Daylight fluorescent (D 5700 - 7100K)", 13: "Day white fluorescent (N 4600 - 5400K)", 14: "Cool white fluorescent (W 3900 - 4500K)", 15: "White fluorescent (WW 3200 - 3700K)", 17: "Standard light A", 18: "Standard light B", 19: "Standard light C", 20: "D55", 21: "D65", 22: "D75", 23: "D50", 24: "ISO studio tungsten", 255: "Other" }], [37385, { 0: "Flash did not fire", 1: "Flash fired", 5: "Strobe return light not detected", 7: "Strobe return light detected", 9: "Flash fired, compulsory flash mode", 13: "Flash fired, compulsory flash mode, return light not detected", 15: "Flash fired, compulsory flash mode, return light detected", 16: "Flash did not fire, compulsory flash mode", 24: "Flash did not fire, auto mode", 25: "Flash fired, auto mode", 29: "Flash fired, auto mode, return light not detected", 31: "Flash fired, auto mode, return light detected", 32: "No flash function", 65: "Flash fired, red-eye reduction mode", 69: "Flash fired, red-eye reduction mode, return light not detected", 71: "Flash fired, red-eye reduction mode, return light detected", 73: "Flash fired, compulsory flash mode, red-eye reduction mode", 77: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected", 79: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected", 89: "Flash fired, auto mode, red-eye reduction mode", 93: "Flash fired, auto mode, return light not detected, red-eye reduction mode", 95: "Flash fired, auto mode, return light detected, red-eye reduction mode" }], [41495, { 1: "Not defined", 2: "One-chip color area sensor", 3: "Two-chip color area sensor", 4: "Three-chip color area sensor", 5: "Color sequential area sensor", 7: "Trilinear sensor", 8: "Color sequential linear sensor" }], [41728, { 1: "Film Scanner", 2: "Reflection Print Scanner", 3: "Digital Camera" }], [41729, { 1: "Directly photographed" }], [41985, { 0: "Normal", 1: "Custom", 2: "HDR (no original saved)", 3: "HDR (original saved)", 4: "Original (for HDR)", 6: "Panorama", 7: "Portrait HDR", 8: "Portrait" }], [41986, { 0: "Auto", 1: "Manual", 2: "Auto bracket" }], [41987, { 0: "Auto", 1: "Manual" }], [41990, { 0: "Standard", 1: "Landscape", 2: "Portrait", 3: "Night", 4: "Other" }], [41991, { 0: "None", 1: "Low gain up", 2: "High gain up", 3: "Low gain down", 4: "High gain down" }], [41996, { 0: "Unknown", 1: "Macro", 2: "Close", 3: "Distant" }], [42080, { 0: "Unknown", 1: "Not a Composite Image", 2: "General Composite Image", 3: "Composite Image Captured While Shooting" }]]);
50782   var Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
50783   Ee.set(37392, Be), Ee.set(41488, Be);
50784   var Ne = { 0: "Normal", 1: "Low", 2: "High" };
50785   function Ge(e3) {
50786     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
50787   }
50788   function Ve(e3) {
50789     let t2 = Array.from(e3).slice(1);
50790     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
50791   }
50792   function ze(e3) {
50793     if ("string" == typeof e3) {
50794       var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
50795       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
50796     }
50797   }
50798   function He(e3) {
50799     if ("string" == typeof e3)
50800       return e3;
50801     let t2 = [];
50802     if (0 === e3[1] && 0 === e3[e3.length - 1])
50803       for (let i3 = 0; i3 < e3.length; i3 += 2)
50804         t2.push(je(e3[i3 + 1], e3[i3]));
50805     else
50806       for (let i3 = 0; i3 < e3.length; i3 += 2)
50807         t2.push(je(e3[i3], e3[i3 + 1]));
50808     return m(String.fromCodePoint(...t2));
50809   }
50810   function je(e3, t2) {
50811     return e3 << 8 | t2;
50812   }
50813   Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
50814     return "string" != typeof e3 ? b(e3) : e3;
50815   }], [306, ze], [40091, He], [40092, He], [40093, He], [40094, He], [40095, He]]), U(N, "exif", [[40960, Ve], [36864, Ve], [36867, ze], [36868, ze], [40962, Ge], [40963, Ge]]), U(N, "gps", [[0, (e3) => Array.from(e3).join(".")], [7, (e3) => Array.from(e3).join(":")]]);
50816   var We = class extends re2 {
50817     static canHandle(e3, t2) {
50818       return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
50819     }
50820     static headerLength(e3, t2) {
50821       return "http://ns.adobe.com/xmp/extension/" === e3.getString(t2 + 4, "http://ns.adobe.com/xmp/extension/".length) ? 79 : 4 + "http://ns.adobe.com/xap/1.0/".length + 1;
50822     }
50823     static findPosition(e3, t2) {
50824       let i3 = super.findPosition(e3, t2);
50825       return i3.multiSegment = i3.extended = 79 === i3.headerLength, i3.multiSegment ? (i3.chunkCount = e3.getUint8(t2 + 72), i3.chunkNumber = e3.getUint8(t2 + 76), 0 !== e3.getUint8(t2 + 77) && i3.chunkNumber++) : (i3.chunkCount = 1 / 0, i3.chunkNumber = -1), i3;
50826     }
50827     static handleMultiSegments(e3) {
50828       return e3.map((e4) => e4.chunk.getString()).join("");
50829     }
50830     normalizeInput(e3) {
50831       return "string" == typeof e3 ? e3 : I.from(e3).getString();
50832     }
50833     parse(e3 = this.chunk) {
50834       if (!this.localOptions.parse)
50835         return e3;
50836       e3 = function(e4) {
50837         let t3 = {}, i4 = {};
50838         for (let e6 of Ze)
50839           t3[e6] = [], i4[e6] = 0;
50840         return e4.replace(et, (e6, n4, s2) => {
50841           if ("<" === n4) {
50842             let n5 = ++i4[s2];
50843             return t3[s2].push(n5), `${e6}#${n5}`;
50844           }
50845           return `${e6}#${t3[s2].pop()}`;
50846         });
50847       }(e3);
50848       let t2 = Xe.findAll(e3, "rdf", "Description");
50849       0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
50850       let i3, n3 = {};
50851       for (let e4 of t2)
50852         for (let t3 of e4.properties)
50853           i3 = Je(t3.ns, n3), _e(t3, i3);
50854       return function(e4) {
50855         let t3;
50856         for (let i4 in e4)
50857           t3 = e4[i4] = f2(e4[i4]), void 0 === t3 && delete e4[i4];
50858         return f2(e4);
50859       }(n3);
50860     }
50861     assignToOutput(e3, t2) {
50862       if (this.localOptions.parse)
50863         for (let [i3, n3] of Object.entries(t2))
50864           switch (i3) {
50865             case "tiff":
50866               this.assignObjectToOutput(e3, "ifd0", n3);
50867               break;
50868             case "exif":
50869               this.assignObjectToOutput(e3, "exif", n3);
50870               break;
50871             case "xmlns":
50872               break;
50873             default:
50874               this.assignObjectToOutput(e3, i3, n3);
50875           }
50876       else
50877         e3.xmp = t2;
50878     }
50879   };
50880   c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
50881   var Ke = class _Ke {
50882     static findAll(e3) {
50883       return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
50884     }
50885     static unpackMatch(e3) {
50886       let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
50887       return n3 = Qe(n3), new _Ke(t2, i3, n3);
50888     }
50889     constructor(e3, t2, i3) {
50890       this.ns = e3, this.name = t2, this.value = i3;
50891     }
50892     serialize() {
50893       return this.value;
50894     }
50895   };
50896   var Xe = class _Xe {
50897     static findAll(e3, t2, i3) {
50898       if (void 0 !== t2 || void 0 !== i3) {
50899         t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
50900         var n3 = new RegExp(`<(${t2}):(${i3})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`, "gm");
50901       } else
50902         n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
50903       return qe(e3, n3).map(_Xe.unpackMatch);
50904     }
50905     static unpackMatch(e3) {
50906       let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
50907       return new _Xe(t2, i3, n3, s2);
50908     }
50909     constructor(e3, t2, i3, n3) {
50910       this.ns = e3, this.name = t2, this.attrString = i3, this.innerXml = n3, this.attrs = Ke.findAll(i3), this.children = _Xe.findAll(n3), this.value = 0 === this.children.length ? Qe(n3) : void 0, this.properties = [...this.attrs, ...this.children];
50911     }
50912     get isPrimitive() {
50913       return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
50914     }
50915     get isListContainer() {
50916       return 1 === this.children.length && this.children[0].isList;
50917     }
50918     get isList() {
50919       let { ns: e3, name: t2 } = this;
50920       return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
50921     }
50922     get isListItem() {
50923       return "rdf" === this.ns && "li" === this.name;
50924     }
50925     serialize() {
50926       if (0 === this.properties.length && void 0 === this.value)
50927         return;
50928       if (this.isPrimitive)
50929         return this.value;
50930       if (this.isListContainer)
50931         return this.children[0].serialize();
50932       if (this.isList)
50933         return $e(this.children.map(Ye));
50934       if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length)
50935         return this.children[0].serialize();
50936       let e3 = {};
50937       for (let t2 of this.properties)
50938         _e(t2, e3);
50939       return void 0 !== this.value && (e3.value = this.value), f2(e3);
50940     }
50941   };
50942   function _e(e3, t2) {
50943     let i3 = e3.serialize();
50944     void 0 !== i3 && (t2[e3.name] = i3);
50945   }
50946   var Ye = (e3) => e3.serialize();
50947   var $e = (e3) => 1 === e3.length ? e3[0] : e3;
50948   var Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
50949   function qe(e3, t2) {
50950     let i3, n3 = [];
50951     if (!e3)
50952       return n3;
50953     for (; null !== (i3 = t2.exec(e3)); )
50954       n3.push(i3);
50955     return n3;
50956   }
50957   function Qe(e3) {
50958     if (function(e4) {
50959       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
50960     }(e3))
50961       return;
50962     let t2 = Number(e3);
50963     if (!Number.isNaN(t2))
50964       return t2;
50965     let i3 = e3.toLowerCase();
50966     return "true" === i3 || "false" !== i3 && e3.trim();
50967   }
50968   var Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
50969   var et = new RegExp(`(<|\\/)(${Ze.join("|")})`, "g");
50970   var tt = Object.freeze({ __proto__: null, default: Me, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
50971     return we;
50972   }, get rotateCss() {
50973     return Te;
50974   }, rotation: Ae });
50975   var at = l("fs", (e3) => e3.promises);
50976   A.set("fs", class extends ve {
50977     async readWhole() {
50978       this.chunked = false, this.fs = await at;
50979       let e3 = await this.fs.readFile(this.input);
50980       this._swapBuffer(e3);
50981     }
50982     async readChunked() {
50983       this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
50984     }
50985     async open() {
50986       void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
50987     }
50988     async _readChunk(e3, t2) {
50989       void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
50990       var i3 = this.subarray(e3, t2, true);
50991       return await this.fh.read(i3.dataView, 0, t2, e3), i3;
50992     }
50993     async close() {
50994       if (this.fh) {
50995         let e3 = this.fh;
50996         this.fh = void 0, await e3.close();
50997       }
50998     }
50999   });
51000   A.set("base64", class extends ve {
51001     constructor(...e3) {
51002       super(...e3), this.input = this.input.replace(/^data:([^;]+);base64,/gim, ""), this.size = this.input.length / 4 * 3, this.input.endsWith("==") ? this.size -= 2 : this.input.endsWith("=") && (this.size -= 1);
51003     }
51004     async _readChunk(e3, t2) {
51005       let i3, n3, r2 = this.input;
51006       void 0 === e3 ? (e3 = 0, i3 = 0, n3 = 0) : (i3 = 4 * Math.floor(e3 / 3), n3 = e3 - i3 / 4 * 3), void 0 === t2 && (t2 = this.size);
51007       let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
51008       r2 = r2.slice(i3, l2);
51009       let h2 = Math.min(t2, this.size - e3);
51010       if (a) {
51011         let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
51012         return this.set(t3, e3, true);
51013       }
51014       {
51015         let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
51016         for (let e4 = 0; e4 < h2; e4++)
51017           s2[e4] = i4.charCodeAt(n3 + e4);
51018         return t3;
51019       }
51020     }
51021   });
51022   var ot = class extends se {
51023     static canHandle(e3, t2) {
51024       return 18761 === t2 || 19789 === t2;
51025     }
51026     extendOptions(e3) {
51027       let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
51028       i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
51029     }
51030     async parse() {
51031       let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
51032       if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
51033         let e4 = Math.max(S(this.options), this.options.chunkSize);
51034         await this.file.ensureChunk(0, e4), this.createParser("tiff", this.file), this.parsers.tiff.parseHeader(), await this.parsers.tiff.parseIfd0Block(), this.adaptTiffPropAsSegment("xmp"), this.adaptTiffPropAsSegment("iptc"), this.adaptTiffPropAsSegment("icc");
51035       }
51036     }
51037     adaptTiffPropAsSegment(e3) {
51038       if (this.parsers.tiff[e3]) {
51039         let t2 = this.parsers.tiff[e3];
51040         this.injectSegment(e3, t2);
51041       }
51042     }
51043   };
51044   c(ot, "type", "tiff"), w.set("tiff", ot);
51045   var lt = l("zlib");
51046   var ht = ["ihdr", "iccp", "text", "itxt", "exif"];
51047   var ut = class extends se {
51048     constructor(...e3) {
51049       super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
51050     }
51051     static canHandle(e3, t2) {
51052       return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
51053     }
51054     async parse() {
51055       let { file: e3 } = this;
51056       await this.findPngChunksInRange("\x89PNG\r\n\1a\n".length, e3.byteLength), await this.readSegments(this.metaChunks), this.findIhdr(), this.parseTextChunks(), await this.findExif().catch(this.catchError), await this.findXmp().catch(this.catchError), await this.findIcc().catch(this.catchError);
51057     }
51058     async findPngChunksInRange(e3, t2) {
51059       let { file: i3 } = this;
51060       for (; e3 < t2; ) {
51061         let t3 = i3.getUint32(e3), n3 = i3.getUint32(e3 + 4), s2 = i3.getString(e3 + 4, 4).toLowerCase(), r2 = t3 + 4 + 4 + 4, a2 = { type: s2, offset: e3, length: r2, start: e3 + 4 + 4, size: t3, marker: n3 };
51062         ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
51063       }
51064     }
51065     parseTextChunks() {
51066       let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
51067       for (let t2 of e3) {
51068         let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
51069         this.injectKeyValToIhdr(e4, i3);
51070       }
51071     }
51072     injectKeyValToIhdr(e3, t2) {
51073       let i3 = this.parsers.ihdr;
51074       i3 && i3.raw.set(e3, t2);
51075     }
51076     findIhdr() {
51077       let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
51078       e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
51079     }
51080     async findExif() {
51081       let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
51082       e3 && this.injectSegment("tiff", e3.chunk);
51083     }
51084     async findXmp() {
51085       let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
51086       for (let t2 of e3) {
51087         "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
51088       }
51089     }
51090     async findIcc() {
51091       let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
51092       if (!e3)
51093         return;
51094       let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
51095       for (; s2 < 80 && 0 !== i3[s2]; )
51096         s2++;
51097       let r2 = s2 + 2, a2 = t2.getString(0, s2);
51098       if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
51099         let e4 = await lt, i4 = t2.getUint8Array(r2);
51100         i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
51101       }
51102     }
51103   };
51104   c(ut, "type", "png"), w.set("png", ut), U(E, "interop", [[1, "InteropIndex"], [2, "InteropVersion"], [4096, "RelatedImageFileFormat"], [4097, "RelatedImageWidth"], [4098, "RelatedImageHeight"]]), F(E, "ifd0", [[11, "ProcessingSoftware"], [254, "SubfileType"], [255, "OldSubfileType"], [263, "Thresholding"], [264, "CellWidth"], [265, "CellLength"], [266, "FillOrder"], [269, "DocumentName"], [280, "MinSampleValue"], [281, "MaxSampleValue"], [285, "PageName"], [286, "XPosition"], [287, "YPosition"], [290, "GrayResponseUnit"], [297, "PageNumber"], [321, "HalftoneHints"], [322, "TileWidth"], [323, "TileLength"], [332, "InkSet"], [337, "TargetPrinter"], [18246, "Rating"], [18249, "RatingPercent"], [33550, "PixelScale"], [34264, "ModelTransform"], [34377, "PhotoshopSettings"], [50706, "DNGVersion"], [50707, "DNGBackwardVersion"], [50708, "UniqueCameraModel"], [50709, "LocalizedCameraModel"], [50736, "DNGLensInfo"], [50739, "ShadowScale"], [50740, "DNGPrivateData"], [33920, "IntergraphMatrix"], [33922, "ModelTiePoint"], [34118, "SEMInfo"], [34735, "GeoTiffDirectory"], [34736, "GeoTiffDoubleParams"], [34737, "GeoTiffAsciiParams"], [50341, "PrintIM"], [50721, "ColorMatrix1"], [50722, "ColorMatrix2"], [50723, "CameraCalibration1"], [50724, "CameraCalibration2"], [50725, "ReductionMatrix1"], [50726, "ReductionMatrix2"], [50727, "AnalogBalance"], [50728, "AsShotNeutral"], [50729, "AsShotWhiteXY"], [50730, "BaselineExposure"], [50731, "BaselineNoise"], [50732, "BaselineSharpness"], [50734, "LinearResponseLimit"], [50735, "CameraSerialNumber"], [50741, "MakerNoteSafety"], [50778, "CalibrationIlluminant1"], [50779, "CalibrationIlluminant2"], [50781, "RawDataUniqueID"], [50827, "OriginalRawFileName"], [50828, "OriginalRawFileData"], [50831, "AsShotICCProfile"], [50832, "AsShotPreProfileMatrix"], [50833, "CurrentICCProfile"], [50834, "CurrentPreProfileMatrix"], [50879, "ColorimetricReference"], [50885, "SRawType"], [50898, "PanasonicTitle"], [50899, "PanasonicTitle2"], [50931, "CameraCalibrationSig"], [50932, "ProfileCalibrationSig"], [50933, "ProfileIFD"], [50934, "AsShotProfileName"], [50936, "ProfileName"], [50937, "ProfileHueSatMapDims"], [50938, "ProfileHueSatMapData1"], [50939, "ProfileHueSatMapData2"], [50940, "ProfileToneCurve"], [50941, "ProfileEmbedPolicy"], [50942, "ProfileCopyright"], [50964, "ForwardMatrix1"], [50965, "ForwardMatrix2"], [50966, "PreviewApplicationName"], [50967, "PreviewApplicationVersion"], [50968, "PreviewSettingsName"], [50969, "PreviewSettingsDigest"], [50970, "PreviewColorSpace"], [50971, "PreviewDateTime"], [50972, "RawImageDigest"], [50973, "OriginalRawFileDigest"], [50981, "ProfileLookTableDims"], [50982, "ProfileLookTableData"], [51043, "TimeCodes"], [51044, "FrameRate"], [51058, "TStop"], [51081, "ReelName"], [51089, "OriginalDefaultFinalSize"], [51090, "OriginalBestQualitySize"], [51091, "OriginalDefaultCropSize"], [51105, "CameraLabel"], [51107, "ProfileHueSatMapEncoding"], [51108, "ProfileLookTableEncoding"], [51109, "BaselineExposureOffset"], [51110, "DefaultBlackRender"], [51111, "NewRawImageDigest"], [51112, "RawToPreviewGain"]]);
51105   var ct = [[273, "StripOffsets"], [279, "StripByteCounts"], [288, "FreeOffsets"], [289, "FreeByteCounts"], [291, "GrayResponseCurve"], [292, "T4Options"], [293, "T6Options"], [300, "ColorResponseUnit"], [320, "ColorMap"], [324, "TileOffsets"], [325, "TileByteCounts"], [326, "BadFaxLines"], [327, "CleanFaxData"], [328, "ConsecutiveBadFaxLines"], [330, "SubIFD"], [333, "InkNames"], [334, "NumberofInks"], [336, "DotRange"], [338, "ExtraSamples"], [339, "SampleFormat"], [340, "SMinSampleValue"], [341, "SMaxSampleValue"], [342, "TransferRange"], [343, "ClipPath"], [344, "XClipPathUnits"], [345, "YClipPathUnits"], [346, "Indexed"], [347, "JPEGTables"], [351, "OPIProxy"], [400, "GlobalParametersIFD"], [401, "ProfileType"], [402, "FaxProfile"], [403, "CodingMethods"], [404, "VersionYear"], [405, "ModeNumber"], [433, "Decode"], [434, "DefaultImageColor"], [435, "T82Options"], [437, "JPEGTables"], [512, "JPEGProc"], [515, "JPEGRestartInterval"], [517, "JPEGLosslessPredictors"], [518, "JPEGPointTransforms"], [519, "JPEGQTables"], [520, "JPEGDCTables"], [521, "JPEGACTables"], [559, "StripRowCounts"], [999, "USPTOMiscellaneous"], [18247, "XP_DIP_XML"], [18248, "StitchInfo"], [28672, "SonyRawFileType"], [28688, "SonyToneCurve"], [28721, "VignettingCorrection"], [28722, "VignettingCorrParams"], [28724, "ChromaticAberrationCorrection"], [28725, "ChromaticAberrationCorrParams"], [28726, "DistortionCorrection"], [28727, "DistortionCorrParams"], [29895, "SonyCropTopLeft"], [29896, "SonyCropSize"], [32781, "ImageID"], [32931, "WangTag1"], [32932, "WangAnnotation"], [32933, "WangTag3"], [32934, "WangTag4"], [32953, "ImageReferencePoints"], [32954, "RegionXformTackPoint"], [32955, "WarpQuadrilateral"], [32956, "AffineTransformMat"], [32995, "Matteing"], [32996, "DataType"], [32997, "ImageDepth"], [32998, "TileDepth"], [33300, "ImageFullWidth"], [33301, "ImageFullHeight"], [33302, "TextureFormat"], [33303, "WrapModes"], [33304, "FovCot"], [33305, "MatrixWorldToScreen"], [33306, "MatrixWorldToCamera"], [33405, "Model2"], [33421, "CFARepeatPatternDim"], [33422, "CFAPattern2"], [33423, "BatteryLevel"], [33424, "KodakIFD"], [33445, "MDFileTag"], [33446, "MDScalePixel"], [33447, "MDColorTable"], [33448, "MDLabName"], [33449, "MDSampleInfo"], [33450, "MDPrepDate"], [33451, "MDPrepTime"], [33452, "MDFileUnits"], [33589, "AdventScale"], [33590, "AdventRevision"], [33628, "UIC1Tag"], [33629, "UIC2Tag"], [33630, "UIC3Tag"], [33631, "UIC4Tag"], [33918, "IntergraphPacketData"], [33919, "IntergraphFlagRegisters"], [33921, "INGRReserved"], [34016, "Site"], [34017, "ColorSequence"], [34018, "IT8Header"], [34019, "RasterPadding"], [34020, "BitsPerRunLength"], [34021, "BitsPerExtendedRunLength"], [34022, "ColorTable"], [34023, "ImageColorIndicator"], [34024, "BackgroundColorIndicator"], [34025, "ImageColorValue"], [34026, "BackgroundColorValue"], [34027, "PixelIntensityRange"], [34028, "TransparencyIndicator"], [34029, "ColorCharacterization"], [34030, "HCUsage"], [34031, "TrapIndicator"], [34032, "CMYKEquivalent"], [34152, "AFCP_IPTC"], [34232, "PixelMagicJBIGOptions"], [34263, "JPLCartoIFD"], [34306, "WB_GRGBLevels"], [34310, "LeafData"], [34687, "TIFF_FXExtensions"], [34688, "MultiProfiles"], [34689, "SharedData"], [34690, "T88Options"], [34732, "ImageLayer"], [34750, "JBIGOptions"], [34856, "Opto-ElectricConvFactor"], [34857, "Interlace"], [34908, "FaxRecvParams"], [34909, "FaxSubAddress"], [34910, "FaxRecvTime"], [34929, "FedexEDR"], [34954, "LeafSubIFD"], [37387, "FlashEnergy"], [37388, "SpatialFrequencyResponse"], [37389, "Noise"], [37390, "FocalPlaneXResolution"], [37391, "FocalPlaneYResolution"], [37392, "FocalPlaneResolutionUnit"], [37397, "ExposureIndex"], [37398, "TIFF-EPStandardID"], [37399, "SensingMethod"], [37434, "CIP3DataFile"], [37435, "CIP3Sheet"], [37436, "CIP3Side"], [37439, "StoNits"], [37679, "MSDocumentText"], [37680, "MSPropertySetStorage"], [37681, "MSDocumentTextPosition"], [37724, "ImageSourceData"], [40965, "InteropIFD"], [40976, "SamsungRawPointersOffset"], [40977, "SamsungRawPointersLength"], [41217, "SamsungRawByteOrder"], [41218, "SamsungRawUnknown"], [41484, "SpatialFrequencyResponse"], [41485, "Noise"], [41489, "ImageNumber"], [41490, "SecurityClassification"], [41491, "ImageHistory"], [41494, "TIFF-EPStandardID"], [41995, "DeviceSettingDescription"], [42112, "GDALMetadata"], [42113, "GDALNoData"], [44992, "ExpandSoftware"], [44993, "ExpandLens"], [44994, "ExpandFilm"], [44995, "ExpandFilterLens"], [44996, "ExpandScanner"], [44997, "ExpandFlashLamp"], [46275, "HasselbladRawImage"], [48129, "PixelFormat"], [48130, "Transformation"], [48131, "Uncompressed"], [48132, "ImageType"], [48256, "ImageWidth"], [48257, "ImageHeight"], [48258, "WidthResolution"], [48259, "HeightResolution"], [48320, "ImageOffset"], [48321, "ImageByteCount"], [48322, "AlphaOffset"], [48323, "AlphaByteCount"], [48324, "ImageDataDiscard"], [48325, "AlphaDataDiscard"], [50215, "OceScanjobDesc"], [50216, "OceApplicationSelector"], [50217, "OceIDNumber"], [50218, "OceImageLogic"], [50255, "Annotations"], [50459, "HasselbladExif"], [50547, "OriginalFileName"], [50560, "USPTOOriginalContentType"], [50656, "CR2CFAPattern"], [50710, "CFAPlaneColor"], [50711, "CFALayout"], [50712, "LinearizationTable"], [50713, "BlackLevelRepeatDim"], [50714, "BlackLevel"], [50715, "BlackLevelDeltaH"], [50716, "BlackLevelDeltaV"], [50717, "WhiteLevel"], [50718, "DefaultScale"], [50719, "DefaultCropOrigin"], [50720, "DefaultCropSize"], [50733, "BayerGreenSplit"], [50737, "ChromaBlurRadius"], [50738, "AntiAliasStrength"], [50752, "RawImageSegmentation"], [50780, "BestQualityScale"], [50784, "AliasLayerMetadata"], [50829, "ActiveArea"], [50830, "MaskedAreas"], [50935, "NoiseReductionApplied"], [50974, "SubTileBlockSize"], [50975, "RowInterleaveFactor"], [51008, "OpcodeList1"], [51009, "OpcodeList2"], [51022, "OpcodeList3"], [51041, "NoiseProfile"], [51114, "CacheVersion"], [51125, "DefaultUserCrop"], [51157, "NikonNEFInfo"], [65024, "KdcIFD"]];
51106   F(E, "ifd0", ct), F(E, "exif", ct), U(B, "gps", [[23, { M: "Magnetic North", T: "True North" }], [25, { K: "Kilometers", M: "Miles", N: "Nautical Miles" }]]);
51107   var ft = class extends re2 {
51108     static canHandle(e3, t2) {
51109       return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
51110     }
51111     parse() {
51112       return this.parseTags(), this.translate(), this.output;
51113     }
51114     parseTags() {
51115       this.raw = /* @__PURE__ */ new Map([[0, this.chunk.getUint16(0)], [2, this.chunk.getUint8(2)], [3, this.chunk.getUint16(3)], [5, this.chunk.getUint16(5)], [7, this.chunk.getUint8(7)], [8, this.chunk.getUint8(8)]]);
51116     }
51117   };
51118   c(ft, "type", "jfif"), c(ft, "headerLength", 9), T.set("jfif", ft), U(E, "jfif", [[0, "JFIFVersion"], [2, "ResolutionUnit"], [3, "XResolution"], [5, "YResolution"], [7, "ThumbnailWidth"], [8, "ThumbnailHeight"]]);
51119   var dt = class extends re2 {
51120     parse() {
51121       return this.parseTags(), this.translate(), this.output;
51122     }
51123     parseTags() {
51124       this.raw = new Map([[0, this.chunk.getUint32(0)], [4, this.chunk.getUint32(4)], [8, this.chunk.getUint8(8)], [9, this.chunk.getUint8(9)], [10, this.chunk.getUint8(10)], [11, this.chunk.getUint8(11)], [12, this.chunk.getUint8(12)], ...Array.from(this.raw)]);
51125     }
51126   };
51127   c(dt, "type", "ihdr"), T.set("ihdr", dt), U(E, "ihdr", [[0, "ImageWidth"], [4, "ImageHeight"], [8, "BitDepth"], [9, "ColorType"], [10, "Compression"], [11, "Filter"], [12, "Interlace"]]), U(B, "ihdr", [[9, { 0: "Grayscale", 2: "RGB", 3: "Palette", 4: "Grayscale with Alpha", 6: "RGB with Alpha", DEFAULT: "Unknown" }], [10, { 0: "Deflate/Inflate", DEFAULT: "Unknown" }], [11, { 0: "Adaptive", DEFAULT: "Unknown" }], [12, { 0: "Noninterlaced", 1: "Adam7 Interlace", DEFAULT: "Unknown" }]]);
51128   var pt = class extends re2 {
51129     static canHandle(e3, t2) {
51130       return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
51131     }
51132     static findPosition(e3, t2) {
51133       let i3 = super.findPosition(e3, t2);
51134       return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
51135     }
51136     static handleMultiSegments(e3) {
51137       return function(e4) {
51138         let t2 = function(e6) {
51139           let t3 = e6[0].constructor, i3 = 0;
51140           for (let t4 of e6)
51141             i3 += t4.length;
51142           let n3 = new t3(i3), s2 = 0;
51143           for (let t4 of e6)
51144             n3.set(t4, s2), s2 += t4.length;
51145           return n3;
51146         }(e4.map((e6) => e6.chunk.toUint8()));
51147         return new I(t2);
51148       }(e3);
51149     }
51150     parse() {
51151       return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
51152     }
51153     parseHeader() {
51154       let { raw: e3 } = this;
51155       this.chunk.byteLength < 84 && g2("ICC header is too short");
51156       for (let [t2, i3] of Object.entries(gt)) {
51157         t2 = parseInt(t2, 10);
51158         let n3 = i3(this.chunk, t2);
51159         "\0\0\0\0" !== n3 && e3.set(t2, n3);
51160       }
51161     }
51162     parseTags() {
51163       let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
51164       for (; a2--; ) {
51165         if (e3 = this.chunk.getString(o2, 4), t2 = this.chunk.getUint32(o2 + 4), i3 = this.chunk.getUint32(o2 + 8), n3 = this.chunk.getString(t2, 4), t2 + i3 > l2)
51166           return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
51167         s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
51168       }
51169     }
51170     parseTag(e3, t2, i3) {
51171       switch (e3) {
51172         case "desc":
51173           return this.parseDesc(t2);
51174         case "mluc":
51175           return this.parseMluc(t2);
51176         case "text":
51177           return this.parseText(t2, i3);
51178         case "sig ":
51179           return this.parseSig(t2);
51180       }
51181       if (!(t2 + i3 > this.chunk.byteLength))
51182         return this.chunk.getUint8Array(t2, i3);
51183     }
51184     parseDesc(e3) {
51185       let t2 = this.chunk.getUint32(e3 + 8) - 1;
51186       return m(this.chunk.getString(e3 + 12, t2));
51187     }
51188     parseText(e3, t2) {
51189       return m(this.chunk.getString(e3 + 8, t2 - 8));
51190     }
51191     parseSig(e3) {
51192       return m(this.chunk.getString(e3 + 8, 4));
51193     }
51194     parseMluc(e3) {
51195       let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
51196       for (let a2 = 0; a2 < i3; a2++) {
51197         let i4 = t2.getString(s2 + 0, 2), a3 = t2.getString(s2 + 2, 2), o2 = t2.getUint32(s2 + 4), l2 = t2.getUint32(s2 + 8) + e3, h2 = m(t2.getUnicodeString(l2, o2));
51198         r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
51199       }
51200       return 1 === i3 ? r2[0].text : r2;
51201     }
51202     translateValue(e3, t2) {
51203       return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
51204     }
51205   };
51206   c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
51207   var gt = { 4: mt, 8: function(e3, t2) {
51208     return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
51209   }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
51210     const i3 = e3.getUint16(t2), n3 = e3.getUint16(t2 + 2) - 1, s2 = e3.getUint16(t2 + 4), r2 = e3.getUint16(t2 + 6), a2 = e3.getUint16(t2 + 8), o2 = e3.getUint16(t2 + 10);
51211     return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
51212   }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
51213   function mt(e3, t2) {
51214     return m(e3.getString(t2, 4));
51215   }
51216   T.set("icc", pt), U(E, "icc", [[4, "ProfileCMMType"], [8, "ProfileVersion"], [12, "ProfileClass"], [16, "ColorSpaceData"], [20, "ProfileConnectionSpace"], [24, "ProfileDateTime"], [36, "ProfileFileSignature"], [40, "PrimaryPlatform"], [44, "CMMFlags"], [48, "DeviceManufacturer"], [52, "DeviceModel"], [56, "DeviceAttributes"], [64, "RenderingIntent"], [68, "ConnectionSpaceIlluminant"], [80, "ProfileCreator"], [84, "ProfileID"], ["Header", "ProfileHeader"], ["MS00", "WCSProfiles"], ["bTRC", "BlueTRC"], ["bXYZ", "BlueMatrixColumn"], ["bfd", "UCRBG"], ["bkpt", "MediaBlackPoint"], ["calt", "CalibrationDateTime"], ["chad", "ChromaticAdaptation"], ["chrm", "Chromaticity"], ["ciis", "ColorimetricIntentImageState"], ["clot", "ColorantTableOut"], ["clro", "ColorantOrder"], ["clrt", "ColorantTable"], ["cprt", "ProfileCopyright"], ["crdi", "CRDInfo"], ["desc", "ProfileDescription"], ["devs", "DeviceSettings"], ["dmdd", "DeviceModelDesc"], ["dmnd", "DeviceMfgDesc"], ["dscm", "ProfileDescriptionML"], ["fpce", "FocalPlaneColorimetryEstimates"], ["gTRC", "GreenTRC"], ["gXYZ", "GreenMatrixColumn"], ["gamt", "Gamut"], ["kTRC", "GrayTRC"], ["lumi", "Luminance"], ["meas", "Measurement"], ["meta", "Metadata"], ["mmod", "MakeAndModel"], ["ncl2", "NamedColor2"], ["ncol", "NamedColor"], ["ndin", "NativeDisplayInfo"], ["pre0", "Preview0"], ["pre1", "Preview1"], ["pre2", "Preview2"], ["ps2i", "PS2RenderingIntent"], ["ps2s", "PostScript2CSA"], ["psd0", "PostScript2CRD0"], ["psd1", "PostScript2CRD1"], ["psd2", "PostScript2CRD2"], ["psd3", "PostScript2CRD3"], ["pseq", "ProfileSequenceDesc"], ["psid", "ProfileSequenceIdentifier"], ["psvm", "PS2CRDVMSize"], ["rTRC", "RedTRC"], ["rXYZ", "RedMatrixColumn"], ["resp", "OutputResponse"], ["rhoc", "ReflectionHardcopyOrigColorimetry"], ["rig0", "PerceptualRenderingIntentGamut"], ["rig2", "SaturationRenderingIntentGamut"], ["rpoc", "ReflectionPrintOutputColorimetry"], ["sape", "SceneAppearanceEstimates"], ["scoe", "SceneColorimetryEstimates"], ["scrd", "ScreeningDesc"], ["scrn", "Screening"], ["targ", "CharTarget"], ["tech", "Technology"], ["vcgt", "VideoCardGamma"], ["view", "ViewingConditions"], ["vued", "ViewingCondDesc"], ["wtpt", "MediaWhitePoint"]]);
51217   var St = { "4d2p": "Erdt Systems", AAMA: "Aamazing Technologies", ACER: "Acer", ACLT: "Acolyte Color Research", ACTI: "Actix Sytems", ADAR: "Adara Technology", ADBE: "Adobe", ADI: "ADI Systems", AGFA: "Agfa Graphics", ALMD: "Alps Electric", ALPS: "Alps Electric", ALWN: "Alwan Color Expertise", AMTI: "Amiable Technologies", AOC: "AOC International", APAG: "Apago", APPL: "Apple Computer", AST: "AST", "AT&T": "AT&T", BAEL: "BARBIERI electronic", BRCO: "Barco NV", BRKP: "Breakpoint", BROT: "Brother", BULL: "Bull", BUS: "Bus Computer Systems", "C-IT": "C-Itoh", CAMR: "Intel", CANO: "Canon", CARR: "Carroll Touch", CASI: "Casio", CBUS: "Colorbus PL", CEL: "Crossfield", CELx: "Crossfield", CGS: "CGS Publishing Technologies International", CHM: "Rochester Robotics", CIGL: "Colour Imaging Group, London", CITI: "Citizen", CL00: "Candela", CLIQ: "Color IQ", CMCO: "Chromaco", CMiX: "CHROMiX", COLO: "Colorgraphic Communications", COMP: "Compaq", COMp: "Compeq/Focus Technology", CONR: "Conrac Display Products", CORD: "Cordata Technologies", CPQ: "Compaq", CPRO: "ColorPro", CRN: "Cornerstone", CTX: "CTX International", CVIS: "ColorVision", CWC: "Fujitsu Laboratories", DARI: "Darius Technology", DATA: "Dataproducts", DCP: "Dry Creek Photo", DCRC: "Digital Contents Resource Center, Chung-Ang University", DELL: "Dell Computer", DIC: "Dainippon Ink and Chemicals", DICO: "Diconix", DIGI: "Digital", "DL&C": "Digital Light & Color", DPLG: "Doppelganger", DS: "Dainippon Screen", DSOL: "DOOSOL", DUPN: "DuPont", EPSO: "Epson", ESKO: "Esko-Graphics", ETRI: "Electronics and Telecommunications Research Institute", EVER: "Everex Systems", EXAC: "ExactCODE", Eizo: "Eizo", FALC: "Falco Data Products", FF: "Fuji Photo Film", FFEI: "FujiFilm Electronic Imaging", FNRD: "Fnord Software", FORA: "Fora", FORE: "Forefront Technology", FP: "Fujitsu", FPA: "WayTech Development", FUJI: "Fujitsu", FX: "Fuji Xerox", GCC: "GCC Technologies", GGSL: "Global Graphics Software", GMB: "Gretagmacbeth", GMG: "GMG", GOLD: "GoldStar Technology", GOOG: "Google", GPRT: "Giantprint", GTMB: "Gretagmacbeth", GVC: "WayTech Development", GW2K: "Sony", HCI: "HCI", HDM: "Heidelberger Druckmaschinen", HERM: "Hermes", HITA: "Hitachi America", HP: "Hewlett-Packard", HTC: "Hitachi", HiTi: "HiTi Digital", IBM: "IBM", IDNT: "Scitex", IEC: "Hewlett-Packard", IIYA: "Iiyama North America", IKEG: "Ikegami Electronics", IMAG: "Image Systems", IMI: "Ingram Micro", INTC: "Intel", INTL: "N/A (INTL)", INTR: "Intra Electronics", IOCO: "Iocomm International Technology", IPS: "InfoPrint Solutions Company", IRIS: "Scitex", ISL: "Ichikawa Soft Laboratory", ITNL: "N/A (ITNL)", IVM: "IVM", IWAT: "Iwatsu Electric", Idnt: "Scitex", Inca: "Inca Digital Printers", Iris: "Scitex", JPEG: "Joint Photographic Experts Group", JSFT: "Jetsoft Development", JVC: "JVC Information Products", KART: "Scitex", KFC: "KFC Computek Components", KLH: "KLH Computers", KMHD: "Konica Minolta", KNCA: "Konica", KODA: "Kodak", KYOC: "Kyocera", Kart: "Scitex", LCAG: "Leica", LCCD: "Leeds Colour", LDAK: "Left Dakota", LEAD: "Leading Technology", LEXM: "Lexmark International", LINK: "Link Computer", LINO: "Linotronic", LITE: "Lite-On", Leaf: "Leaf", Lino: "Linotronic", MAGC: "Mag Computronic", MAGI: "MAG Innovision", MANN: "Mannesmann", MICN: "Micron Technology", MICR: "Microtek", MICV: "Microvitec", MINO: "Minolta", MITS: "Mitsubishi Electronics America", MITs: "Mitsuba", MNLT: "Minolta", MODG: "Modgraph", MONI: "Monitronix", MONS: "Monaco Systems", MORS: "Morse Technology", MOTI: "Motive Systems", MSFT: "Microsoft", MUTO: "MUTOH INDUSTRIES", Mits: "Mitsubishi Electric", NANA: "NANAO", NEC: "NEC", NEXP: "NexPress Solutions", NISS: "Nissei Sangyo America", NKON: "Nikon", NONE: "none", OCE: "Oce Technologies", OCEC: "OceColor", OKI: "Oki", OKID: "Okidata", OKIP: "Okidata", OLIV: "Olivetti", OLYM: "Olympus", ONYX: "Onyx Graphics", OPTI: "Optiquest", PACK: "Packard Bell", PANA: "Matsushita Electric Industrial", PANT: "Pantone", PBN: "Packard Bell", PFU: "PFU", PHIL: "Philips Consumer Electronics", PNTX: "HOYA", POne: "Phase One A/S", PREM: "Premier Computer Innovations", PRIN: "Princeton Graphic Systems", PRIP: "Princeton Publishing Labs", QLUX: "Hong Kong", QMS: "QMS", QPCD: "QPcard AB", QUAD: "QuadLaser", QUME: "Qume", RADI: "Radius", RDDx: "Integrated Color Solutions", RDG: "Roland DG", REDM: "REDMS Group", RELI: "Relisys", RGMS: "Rolf Gierling Multitools", RICO: "Ricoh", RNLD: "Edmund Ronald", ROYA: "Royal", RPC: "Ricoh Printing Systems", RTL: "Royal Information Electronics", SAMP: "Sampo", SAMS: "Samsung", SANT: "Jaime Santana Pomares", SCIT: "Scitex", SCRN: "Dainippon Screen", SDP: "Scitex", SEC: "Samsung", SEIK: "Seiko Instruments", SEIk: "Seikosha", SGUY: "ScanGuy.com", SHAR: "Sharp Laboratories", SICC: "International Color Consortium", SONY: "Sony", SPCL: "SpectraCal", STAR: "Star", STC: "Sampo Technology", Scit: "Scitex", Sdp: "Scitex", Sony: "Sony", TALO: "Talon Technology", TAND: "Tandy", TATU: "Tatung", TAXA: "TAXAN America", TDS: "Tokyo Denshi Sekei", TECO: "TECO Information Systems", TEGR: "Tegra", TEKT: "Tektronix", TI: "Texas Instruments", TMKR: "TypeMaker", TOSB: "Toshiba", TOSH: "Toshiba", TOTK: "TOTOKU ELECTRIC", TRIU: "Triumph", TSBT: "Toshiba", TTX: "TTX Computer Products", TVM: "TVM Professional Monitor", TW: "TW Casper", ULSX: "Ulead Systems", UNIS: "Unisys", UTZF: "Utz Fehlau & Sohn", VARI: "Varityper", VIEW: "Viewsonic", VISL: "Visual communication", VIVO: "Vivo Mobile Communication", WANG: "Wang", WLBR: "Wilbur Imaging", WTG2: "Ware To Go", WYSE: "WYSE Technology", XERX: "Xerox", XRIT: "X-Rite", ZRAN: "Zoran", Zebr: "Zebra Technologies", appl: "Apple Computer", bICC: "basICColor", berg: "bergdesign", ceyd: "Integrated Color Solutions", clsp: "MacDermid ColorSpan", ds: "Dainippon Screen", dupn: "DuPont", ffei: "FujiFilm Electronic Imaging", flux: "FluxData", iris: "Scitex", kart: "Scitex", lcms: "Little CMS", lino: "Linotronic", none: "none", ob4d: "Erdt Systems", obic: "Medigraph", quby: "Qubyx Sarl", scit: "Scitex", scrn: "Dainippon Screen", sdp: "Scitex", siwi: "SIWI GRAFIKA", yxym: "YxyMaster" };
51218   var Ct = { scnr: "Scanner", mntr: "Monitor", prtr: "Printer", link: "Device Link", abst: "Abstract", spac: "Color Space Conversion Profile", nmcl: "Named Color", cenc: "ColorEncodingSpace profile", mid: "MultiplexIdentification profile", mlnk: "MultiplexLink profile", mvis: "MultiplexVisualization profile", nkpf: "Nikon Input Device Profile (NON-STANDARD!)" };
51219   U(B, "icc", [[4, St], [12, Ct], [40, Object.assign({}, St, Ct)], [48, St], [80, St], [64, { 0: "Perceptual", 1: "Relative Colorimetric", 2: "Saturation", 3: "Absolute Colorimetric" }], ["tech", { amd: "Active Matrix Display", crt: "Cathode Ray Tube Display", kpcd: "Photo CD", pmd: "Passive Matrix Display", dcam: "Digital Camera", dcpj: "Digital Cinema Projector", dmpc: "Digital Motion Picture Camera", dsub: "Dye Sublimation Printer", epho: "Electrophotographic Printer", esta: "Electrostatic Printer", flex: "Flexography", fprn: "Film Writer", fscn: "Film Scanner", grav: "Gravure", ijet: "Ink Jet Printer", imgs: "Photo Image Setter", mpfr: "Motion Picture Film Recorder", mpfs: "Motion Picture Film Scanner", offs: "Offset Lithography", pjtv: "Projection Television", rpho: "Photographic Paper Printer", rscn: "Reflective Scanner", silk: "Silkscreen", twax: "Thermal Wax Printer", vidc: "Video Camera", vidm: "Video Monitor" }]]);
51220   var yt = class extends re2 {
51221     static canHandle(e3, t2, i3) {
51222       return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
51223     }
51224     static headerLength(e3, t2, i3) {
51225       let n3, s2 = this.containsIptc8bim(e3, t2, i3);
51226       if (void 0 !== s2)
51227         return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
51228     }
51229     static containsIptc8bim(e3, t2, i3) {
51230       for (let n3 = 0; n3 < i3; n3++)
51231         if (this.isIptcSegmentHead(e3, t2 + n3))
51232           return n3;
51233     }
51234     static isIptcSegmentHead(e3, t2) {
51235       return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
51236     }
51237     parse() {
51238       let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
51239       for (let n3 = 0; n3 < t2; n3++)
51240         if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
51241           i3 = true;
51242           let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
51243           e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
51244         } else if (i3)
51245           break;
51246       return this.translate(), this.output;
51247     }
51248     pluralizeValue(e3, t2) {
51249       return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
51250     }
51251   };
51252   c(yt, "type", "iptc"), c(yt, "translateValues", false), c(yt, "reviveValues", false), T.set("iptc", yt), U(E, "iptc", [[0, "ApplicationRecordVersion"], [3, "ObjectTypeReference"], [4, "ObjectAttributeReference"], [5, "ObjectName"], [7, "EditStatus"], [8, "EditorialUpdate"], [10, "Urgency"], [12, "SubjectReference"], [15, "Category"], [20, "SupplementalCategories"], [22, "FixtureIdentifier"], [25, "Keywords"], [26, "ContentLocationCode"], [27, "ContentLocationName"], [30, "ReleaseDate"], [35, "ReleaseTime"], [37, "ExpirationDate"], [38, "ExpirationTime"], [40, "SpecialInstructions"], [42, "ActionAdvised"], [45, "ReferenceService"], [47, "ReferenceDate"], [50, "ReferenceNumber"], [55, "DateCreated"], [60, "TimeCreated"], [62, "DigitalCreationDate"], [63, "DigitalCreationTime"], [65, "OriginatingProgram"], [70, "ProgramVersion"], [75, "ObjectCycle"], [80, "Byline"], [85, "BylineTitle"], [90, "City"], [92, "Sublocation"], [95, "State"], [100, "CountryCode"], [101, "Country"], [103, "OriginalTransmissionReference"], [105, "Headline"], [110, "Credit"], [115, "Source"], [116, "CopyrightNotice"], [118, "Contact"], [120, "Caption"], [121, "LocalCaption"], [122, "Writer"], [125, "RasterizedCaption"], [130, "ImageType"], [131, "ImageOrientation"], [135, "LanguageIdentifier"], [150, "AudioType"], [151, "AudioSamplingRate"], [152, "AudioSamplingResolution"], [153, "AudioDuration"], [154, "AudioOutcue"], [184, "JobID"], [185, "MasterDocumentID"], [186, "ShortDocumentID"], [187, "UniqueDocumentID"], [188, "OwnerID"], [200, "ObjectPreviewFileFormat"], [201, "ObjectPreviewFileVersion"], [202, "ObjectPreviewData"], [221, "Prefs"], [225, "ClassifyState"], [228, "SimilarityIndex"], [230, "DocumentNotes"], [231, "DocumentHistory"], [232, "ExifCameraInfo"], [255, "CatalogSets"]]), U(B, "iptc", [[10, { 0: "0 (reserved)", 1: "1 (most urgent)", 2: "2", 3: "3", 4: "4", 5: "5 (normal urgency)", 6: "6", 7: "7", 8: "8 (least urgent)", 9: "9 (user-defined priority)" }], [75, { a: "Morning", b: "Both Morning and Evening", p: "Evening" }], [131, { L: "Landscape", P: "Portrait", S: "Square" }]]);
51253   var full_esm_default = tt;
51254
51255   // modules/services/plane_photo.js
51256   var dispatch6 = dispatch_default("viewerChanged");
51257   var _photo;
51258   var _wrapper;
51259   var imgZoom;
51260   var _widthOverflow;
51261   function zoomPan(d3_event) {
51262     let t2 = d3_event.transform;
51263     _photo.call(utilSetTransform, t2.x, t2.y, t2.k);
51264   }
51265   function zoomBeahvior() {
51266     const { width: wrapperWidth, height: wrapperHeight } = _wrapper.node().getBoundingClientRect();
51267     const { naturalHeight, naturalWidth } = _photo.node();
51268     const intrinsicRatio = naturalWidth / naturalHeight;
51269     _widthOverflow = wrapperHeight * intrinsicRatio - wrapperWidth;
51270     return zoom_default2().extent([[0, 0], [wrapperWidth, wrapperHeight]]).translateExtent([[0, 0], [wrapperWidth + _widthOverflow, wrapperHeight]]).scaleExtent([1, 15]).on("zoom", zoomPan);
51271   }
51272   function loadImage(selection2, path) {
51273     return new Promise((resolve) => {
51274       selection2.attr("src", path);
51275       selection2.on("load", () => {
51276         resolve(selection2);
51277       });
51278     });
51279   }
51280   var plane_photo_default = {
51281     init: async function(context, selection2) {
51282       this.event = utilRebind(this, dispatch6, "on");
51283       _wrapper = selection2.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
51284       _photo = _wrapper.append("img").attr("class", "plane-photo");
51285       context.ui().photoviewer.on("resize.plane", () => {
51286         imgZoom = zoomBeahvior();
51287         _wrapper.call(imgZoom);
51288       });
51289       await Promise.resolve();
51290       return this;
51291     },
51292     showPhotoFrame: function(context) {
51293       const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
51294       if (isHidden) {
51295         context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
51296         context.selectAll(".photo-frame.plane-frame").classed("hide", false);
51297       }
51298       return this;
51299     },
51300     hidePhotoFrame: function(context) {
51301       context.select("photo-frame.plane-frame").classed("hide", false);
51302       return this;
51303     },
51304     selectPhoto: function(data, keepOrientation) {
51305       dispatch6.call("viewerChanged");
51306       loadImage(_photo, "");
51307       loadImage(_photo, data.image_path).then(() => {
51308         if (!keepOrientation) {
51309           imgZoom = zoomBeahvior();
51310           _wrapper.call(imgZoom);
51311           _wrapper.call(imgZoom.transform, identity2.translate(-_widthOverflow / 2, 0));
51312         }
51313       });
51314       return this;
51315     },
51316     getYaw: function() {
51317       return 0;
51318     }
51319   };
51320
51321   // modules/svg/local_photos.js
51322   var _initialized2 = false;
51323   var _enabled2 = false;
51324   var minViewfieldZoom = 16;
51325   function svgLocalPhotos(projection2, context, dispatch14) {
51326     const detected = utilDetect();
51327     let layer = select_default2(null);
51328     let _fileList;
51329     let _photos = [];
51330     let _idAutoinc = 0;
51331     let _photoFrame;
51332     function init2() {
51333       if (_initialized2)
51334         return;
51335       _enabled2 = true;
51336       function over(d3_event) {
51337         d3_event.stopPropagation();
51338         d3_event.preventDefault();
51339         d3_event.dataTransfer.dropEffect = "copy";
51340       }
51341       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
51342         d3_event.stopPropagation();
51343         d3_event.preventDefault();
51344         if (!detected.filedrop)
51345           return;
51346         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
51347           if (loaded.length > 0) {
51348             drawPhotos.fitZoom(false);
51349           }
51350         });
51351       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
51352       _initialized2 = true;
51353     }
51354     function ensureViewerLoaded(context2) {
51355       if (_photoFrame) {
51356         return Promise.resolve(_photoFrame);
51357       }
51358       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
51359       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
51360       viewerEnter.append("div").attr("class", "photo-attribution fillD");
51361       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
51362         _photoFrame = planePhotoFrame;
51363       });
51364     }
51365     function click(d3_event, image, zoomTo) {
51366       ensureViewerLoaded(context).then(() => {
51367         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
51368         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
51369         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
51370         if (image.name) {
51371           attribution.append("span").classed("filename", true).text(image.name);
51372         }
51373         _photoFrame.selectPhoto({ image_path: "" });
51374         image.getSrc().then((src) => {
51375           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
51376           setStyles();
51377         });
51378       });
51379       if (zoomTo) {
51380         context.map().centerEase(image.loc);
51381       }
51382     }
51383     function transform2(d2) {
51384       var svgpoint = projection2(d2.loc);
51385       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
51386     }
51387     function setStyles(hovered) {
51388       const viewer = context.container().select(".photoviewer");
51389       const selected = viewer.empty() ? void 0 : viewer.datum();
51390       context.container().selectAll(".layer-local-photos .viewfield-group").classed("hovered", (d2) => d2.id === hovered?.id).classed("highlighted", (d2) => d2.id === hovered?.id || d2.id === selected?.id).classed("currentView", (d2) => d2.id === selected?.id);
51391     }
51392     function display_markers(imageList) {
51393       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
51394       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
51395         return d2.id;
51396       });
51397       groups.exit().remove();
51398       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
51399       groupsEnter.append("g").attr("class", "viewfield-scale");
51400       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
51401       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
51402       const showViewfields = context.map().zoom() >= minViewfieldZoom;
51403       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
51404       viewfields.exit().remove();
51405       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
51406         const d2 = this.parentNode.__data__;
51407         return `rotate(${Math.round(d2.direction ?? 0)},0,0),scale(1.5,1.5),translate(-8,-13)`;
51408       }).attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z").style("visibility", function() {
51409         const d2 = this.parentNode.__data__;
51410         return isNumber_default(d2.direction) ? "visible" : "hidden";
51411       });
51412     }
51413     function drawPhotos(selection2) {
51414       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
51415       layer.exit().remove();
51416       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
51417       layerEnter.append("g").attr("class", "markers");
51418       layer = layerEnter.merge(layer);
51419       if (_photos && _photos.length !== 0) {
51420         display_markers(_photos);
51421       }
51422     }
51423     function readFileAsDataURL(file) {
51424       return new Promise((resolve, reject) => {
51425         const reader = new FileReader();
51426         reader.onload = () => resolve(reader.result);
51427         reader.onerror = (error) => reject(error);
51428         reader.readAsDataURL(file);
51429       });
51430     }
51431     async function readmultifiles(files, callback) {
51432       const loaded = [];
51433       for (const file of files) {
51434         try {
51435           const exifData = await full_esm_default.parse(file);
51436           const photo = {
51437             id: _idAutoinc++,
51438             name: file.name,
51439             getSrc: () => readFileAsDataURL(file),
51440             file,
51441             loc: [exifData.longitude, exifData.latitude],
51442             direction: exifData.GPSImgDirection
51443           };
51444           loaded.push(photo);
51445           const sameName = _photos.filter((i3) => i3.name === photo.name);
51446           if (sameName.length === 0) {
51447             _photos.push(photo);
51448           } else {
51449             const thisContent = await photo.getSrc();
51450             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
51451             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
51452               _photos.push(photo);
51453             }
51454           }
51455         } catch (err) {
51456         }
51457       }
51458       if (typeof callback === "function")
51459         callback(loaded);
51460       dispatch14.call("change");
51461     }
51462     drawPhotos.setFiles = function(fileList, callback) {
51463       readmultifiles(Array.from(fileList), callback);
51464       return this;
51465     };
51466     drawPhotos.fileList = function(fileList, callback) {
51467       if (!arguments.length)
51468         return _fileList;
51469       _fileList = fileList;
51470       if (!fileList || !fileList.length)
51471         return this;
51472       drawPhotos.setFiles(_fileList, callback);
51473       return this;
51474     };
51475     drawPhotos.getPhotos = function() {
51476       return _photos;
51477     };
51478     drawPhotos.removePhoto = function(id2) {
51479       _photos = _photos.filter((i3) => i3.id !== id2);
51480       dispatch14.call("change");
51481       return _photos;
51482     };
51483     drawPhotos.openPhoto = click;
51484     drawPhotos.fitZoom = function(force) {
51485       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
51486       if (coords.length === 0)
51487         return;
51488       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
51489       const map2 = context.map();
51490       var viewport = map2.trimmedExtent().polygon();
51491       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
51492         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
51493       }
51494     };
51495     function showLayer() {
51496       layer.style("display", "block");
51497       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51498         dispatch14.call("change");
51499       });
51500     }
51501     function hideLayer() {
51502       layer.transition().duration(250).style("opacity", 0).on("end", () => {
51503         layer.selectAll(".viewfield-group").remove();
51504         layer.style("display", "none");
51505       });
51506     }
51507     drawPhotos.enabled = function(val) {
51508       if (!arguments.length)
51509         return _enabled2;
51510       _enabled2 = val;
51511       if (_enabled2) {
51512         showLayer();
51513       } else {
51514         hideLayer();
51515       }
51516       dispatch14.call("change");
51517       return this;
51518     };
51519     drawPhotos.hasData = function() {
51520       return isArray_default(_photos) && _photos.length > 0;
51521     };
51522     init2();
51523     return drawPhotos;
51524   }
51525
51526   // modules/svg/improveOSM.js
51527   var _layerEnabled2 = false;
51528   var _qaService2;
51529   function svgImproveOSM(projection2, context, dispatch14) {
51530     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51531     const minZoom4 = 12;
51532     let touchLayer = select_default2(null);
51533     let drawLayer = select_default2(null);
51534     let layerVisible = false;
51535     function markerPath(selection2, klass) {
51536       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");
51537     }
51538     function getService() {
51539       if (services.improveOSM && !_qaService2) {
51540         _qaService2 = services.improveOSM;
51541         _qaService2.on("loaded", throttledRedraw);
51542       } else if (!services.improveOSM && _qaService2) {
51543         _qaService2 = null;
51544       }
51545       return _qaService2;
51546     }
51547     function editOn() {
51548       if (!layerVisible) {
51549         layerVisible = true;
51550         drawLayer.style("display", "block");
51551       }
51552     }
51553     function editOff() {
51554       if (layerVisible) {
51555         layerVisible = false;
51556         drawLayer.style("display", "none");
51557         drawLayer.selectAll(".qaItem.improveOSM").remove();
51558         touchLayer.selectAll(".qaItem.improveOSM").remove();
51559       }
51560     }
51561     function layerOn() {
51562       editOn();
51563       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
51564     }
51565     function layerOff() {
51566       throttledRedraw.cancel();
51567       drawLayer.interrupt();
51568       touchLayer.selectAll(".qaItem.improveOSM").remove();
51569       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
51570         editOff();
51571         dispatch14.call("change");
51572       });
51573     }
51574     function updateMarkers() {
51575       if (!layerVisible || !_layerEnabled2)
51576         return;
51577       const service = getService();
51578       const selectedID = context.selectedErrorID();
51579       const data = service ? service.getItems(projection2) : [];
51580       const getTransform = svgPointTransform(projection2);
51581       const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
51582       markers.exit().remove();
51583       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
51584       markersEnter.append("polygon").call(markerPath, "shadow");
51585       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
51586       markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
51587       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
51588       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
51589       if (touchLayer.empty())
51590         return;
51591       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
51592       const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
51593       targets.exit().remove();
51594       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d2) => `qaItem ${d2.service} target ${fillClass} itemId-${d2.id}`).attr("transform", getTransform);
51595       function sortY(a2, b2) {
51596         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
51597       }
51598     }
51599     function drawImproveOSM(selection2) {
51600       const service = getService();
51601       const surface = context.surface();
51602       if (surface && !surface.empty()) {
51603         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
51604       }
51605       drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
51606       drawLayer.exit().remove();
51607       drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
51608       if (_layerEnabled2) {
51609         if (service && ~~context.map().zoom() >= minZoom4) {
51610           editOn();
51611           service.loadIssues(projection2);
51612           updateMarkers();
51613         } else {
51614           editOff();
51615         }
51616       }
51617     }
51618     drawImproveOSM.enabled = function(val) {
51619       if (!arguments.length)
51620         return _layerEnabled2;
51621       _layerEnabled2 = val;
51622       if (_layerEnabled2) {
51623         layerOn();
51624       } else {
51625         layerOff();
51626         if (context.selectedErrorID()) {
51627           context.enter(modeBrowse(context));
51628         }
51629       }
51630       dispatch14.call("change");
51631       return this;
51632     };
51633     drawImproveOSM.supported = () => !!getService();
51634     return drawImproveOSM;
51635   }
51636
51637   // modules/svg/osmose.js
51638   var _layerEnabled3 = false;
51639   var _qaService3;
51640   function svgOsmose(projection2, context, dispatch14) {
51641     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51642     const minZoom4 = 12;
51643     let touchLayer = select_default2(null);
51644     let drawLayer = select_default2(null);
51645     let layerVisible = false;
51646     function markerPath(selection2, klass) {
51647       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");
51648     }
51649     function getService() {
51650       if (services.osmose && !_qaService3) {
51651         _qaService3 = services.osmose;
51652         _qaService3.on("loaded", throttledRedraw);
51653       } else if (!services.osmose && _qaService3) {
51654         _qaService3 = null;
51655       }
51656       return _qaService3;
51657     }
51658     function editOn() {
51659       if (!layerVisible) {
51660         layerVisible = true;
51661         drawLayer.style("display", "block");
51662       }
51663     }
51664     function editOff() {
51665       if (layerVisible) {
51666         layerVisible = false;
51667         drawLayer.style("display", "none");
51668         drawLayer.selectAll(".qaItem.osmose").remove();
51669         touchLayer.selectAll(".qaItem.osmose").remove();
51670       }
51671     }
51672     function layerOn() {
51673       editOn();
51674       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
51675     }
51676     function layerOff() {
51677       throttledRedraw.cancel();
51678       drawLayer.interrupt();
51679       touchLayer.selectAll(".qaItem.osmose").remove();
51680       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
51681         editOff();
51682         dispatch14.call("change");
51683       });
51684     }
51685     function updateMarkers() {
51686       if (!layerVisible || !_layerEnabled3)
51687         return;
51688       const service = getService();
51689       const selectedID = context.selectedErrorID();
51690       const data = service ? service.getItems(projection2) : [];
51691       const getTransform = svgPointTransform(projection2);
51692       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
51693       markers.exit().remove();
51694       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
51695       markersEnter.append("polygon").call(markerPath, "shadow");
51696       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
51697       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
51698       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
51699       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
51700       if (touchLayer.empty())
51701         return;
51702       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
51703       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
51704       targets.exit().remove();
51705       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d2) => `qaItem ${d2.service} target ${fillClass} itemId-${d2.id}`).attr("transform", getTransform);
51706       function sortY(a2, b2) {
51707         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
51708       }
51709     }
51710     function drawOsmose(selection2) {
51711       const service = getService();
51712       const surface = context.surface();
51713       if (surface && !surface.empty()) {
51714         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
51715       }
51716       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
51717       drawLayer.exit().remove();
51718       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
51719       if (_layerEnabled3) {
51720         if (service && ~~context.map().zoom() >= minZoom4) {
51721           editOn();
51722           service.loadIssues(projection2);
51723           updateMarkers();
51724         } else {
51725           editOff();
51726         }
51727       }
51728     }
51729     drawOsmose.enabled = function(val) {
51730       if (!arguments.length)
51731         return _layerEnabled3;
51732       _layerEnabled3 = val;
51733       if (_layerEnabled3) {
51734         getService().loadStrings().then(layerOn).catch((err) => {
51735           console.log(err);
51736         });
51737       } else {
51738         layerOff();
51739         if (context.selectedErrorID()) {
51740           context.enter(modeBrowse(context));
51741         }
51742       }
51743       dispatch14.call("change");
51744       return this;
51745     };
51746     drawOsmose.supported = () => !!getService();
51747     return drawOsmose;
51748   }
51749
51750   // modules/svg/streetside.js
51751   function svgStreetside(projection2, context, dispatch14) {
51752     var throttledRedraw = throttle_default(function() {
51753       dispatch14.call("change");
51754     }, 1e3);
51755     var minZoom4 = 14;
51756     var minMarkerZoom = 16;
51757     var minViewfieldZoom2 = 18;
51758     var layer = select_default2(null);
51759     var _viewerYaw = 0;
51760     var _selectedSequence = null;
51761     var _streetside;
51762     function init2() {
51763       if (svgStreetside.initialized)
51764         return;
51765       svgStreetside.enabled = false;
51766       svgStreetside.initialized = true;
51767     }
51768     function getService() {
51769       if (services.streetside && !_streetside) {
51770         _streetside = services.streetside;
51771         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
51772       } else if (!services.streetside && _streetside) {
51773         _streetside = null;
51774       }
51775       return _streetside;
51776     }
51777     function showLayer() {
51778       var service = getService();
51779       if (!service)
51780         return;
51781       editOn();
51782       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51783         dispatch14.call("change");
51784       });
51785     }
51786     function hideLayer() {
51787       throttledRedraw.cancel();
51788       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
51789     }
51790     function editOn() {
51791       layer.style("display", "block");
51792     }
51793     function editOff() {
51794       layer.selectAll(".viewfield-group").remove();
51795       layer.style("display", "none");
51796     }
51797     function click(d3_event, d2) {
51798       var service = getService();
51799       if (!service)
51800         return;
51801       if (d2.sequenceKey !== _selectedSequence) {
51802         _viewerYaw = 0;
51803       }
51804       _selectedSequence = d2.sequenceKey;
51805       service.ensureViewerLoaded(context).then(function() {
51806         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
51807       });
51808       context.map().centerEase(d2.loc);
51809     }
51810     function mouseover(d3_event, d2) {
51811       var service = getService();
51812       if (service)
51813         service.setStyles(context, d2);
51814     }
51815     function mouseout() {
51816       var service = getService();
51817       if (service)
51818         service.setStyles(context, null);
51819     }
51820     function transform2(d2) {
51821       var t2 = svgPointTransform(projection2)(d2);
51822       var rot = d2.ca + _viewerYaw;
51823       if (rot) {
51824         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
51825       }
51826       return t2;
51827     }
51828     function viewerChanged() {
51829       var service = getService();
51830       if (!service)
51831         return;
51832       var viewer = service.viewer();
51833       if (!viewer)
51834         return;
51835       _viewerYaw = viewer.getYaw();
51836       if (context.map().isTransformed())
51837         return;
51838       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
51839     }
51840     function filterBubbles(bubbles) {
51841       var fromDate = context.photos().fromDate();
51842       var toDate = context.photos().toDate();
51843       var usernames = context.photos().usernames();
51844       if (fromDate) {
51845         var fromTimestamp = new Date(fromDate).getTime();
51846         bubbles = bubbles.filter(function(bubble) {
51847           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
51848         });
51849       }
51850       if (toDate) {
51851         var toTimestamp = new Date(toDate).getTime();
51852         bubbles = bubbles.filter(function(bubble) {
51853           return new Date(bubble.captured_at).getTime() <= toTimestamp;
51854         });
51855       }
51856       if (usernames) {
51857         bubbles = bubbles.filter(function(bubble) {
51858           return usernames.indexOf(bubble.captured_by) !== -1;
51859         });
51860       }
51861       return bubbles;
51862     }
51863     function filterSequences(sequences) {
51864       var fromDate = context.photos().fromDate();
51865       var toDate = context.photos().toDate();
51866       var usernames = context.photos().usernames();
51867       if (fromDate) {
51868         var fromTimestamp = new Date(fromDate).getTime();
51869         sequences = sequences.filter(function(sequences2) {
51870           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
51871         });
51872       }
51873       if (toDate) {
51874         var toTimestamp = new Date(toDate).getTime();
51875         sequences = sequences.filter(function(sequences2) {
51876           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
51877         });
51878       }
51879       if (usernames) {
51880         sequences = sequences.filter(function(sequences2) {
51881           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
51882         });
51883       }
51884       return sequences;
51885     }
51886     function update() {
51887       var viewer = context.container().select(".photoviewer");
51888       var selected = viewer.empty() ? void 0 : viewer.datum();
51889       var z2 = ~~context.map().zoom();
51890       var showMarkers = z2 >= minMarkerZoom;
51891       var showViewfields = z2 >= minViewfieldZoom2;
51892       var service = getService();
51893       var sequences = [];
51894       var bubbles = [];
51895       if (context.photos().showsPanoramic()) {
51896         sequences = service ? service.sequences(projection2) : [];
51897         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
51898         sequences = filterSequences(sequences);
51899         bubbles = filterBubbles(bubbles);
51900       }
51901       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
51902         return d2.properties.key;
51903       });
51904       traces.exit().remove();
51905       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
51906       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
51907         return d2.key + (d2.sequenceKey ? "v1" : "v0");
51908       });
51909       groups.exit().remove();
51910       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
51911       groupsEnter.append("g").attr("class", "viewfield-scale");
51912       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
51913         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
51914       }).attr("transform", transform2).select(".viewfield-scale");
51915       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
51916       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
51917       viewfields.exit().remove();
51918       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
51919       function viewfieldPath() {
51920         var d2 = this.parentNode.__data__;
51921         if (d2.pano) {
51922           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
51923         } else {
51924           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
51925         }
51926       }
51927     }
51928     function drawImages(selection2) {
51929       var enabled = svgStreetside.enabled;
51930       var service = getService();
51931       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
51932       layer.exit().remove();
51933       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
51934       layerEnter.append("g").attr("class", "sequences");
51935       layerEnter.append("g").attr("class", "markers");
51936       layer = layerEnter.merge(layer);
51937       if (enabled) {
51938         if (service && ~~context.map().zoom() >= minZoom4) {
51939           editOn();
51940           update();
51941           service.loadBubbles(projection2);
51942         } else {
51943           editOff();
51944         }
51945       }
51946     }
51947     drawImages.enabled = function(_2) {
51948       if (!arguments.length)
51949         return svgStreetside.enabled;
51950       svgStreetside.enabled = _2;
51951       if (svgStreetside.enabled) {
51952         showLayer();
51953         context.photos().on("change.streetside", update);
51954       } else {
51955         hideLayer();
51956         context.photos().on("change.streetside", null);
51957       }
51958       dispatch14.call("change");
51959       return this;
51960     };
51961     drawImages.supported = function() {
51962       return !!getService();
51963     };
51964     drawImages.rendered = function(zoom) {
51965       return zoom >= minZoom4;
51966     };
51967     init2();
51968     return drawImages;
51969   }
51970
51971   // modules/svg/vegbilder.js
51972   function svgVegbilder(projection2, context, dispatch14) {
51973     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51974     const minZoom4 = 14;
51975     const minMarkerZoom = 16;
51976     const minViewfieldZoom2 = 18;
51977     let layer = select_default2(null);
51978     let _viewerYaw = 0;
51979     let _vegbilder;
51980     function init2() {
51981       if (svgVegbilder.initialized)
51982         return;
51983       svgVegbilder.enabled = false;
51984       svgVegbilder.initialized = true;
51985     }
51986     function getService() {
51987       if (services.vegbilder && !_vegbilder) {
51988         _vegbilder = services.vegbilder;
51989         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
51990       } else if (!services.vegbilder && _vegbilder) {
51991         _vegbilder = null;
51992       }
51993       return _vegbilder;
51994     }
51995     function showLayer() {
51996       const service = getService();
51997       if (!service)
51998         return;
51999       editOn();
52000       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
52001     }
52002     function hideLayer() {
52003       throttledRedraw.cancel();
52004       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52005     }
52006     function editOn() {
52007       layer.style("display", "block");
52008     }
52009     function editOff() {
52010       layer.selectAll(".viewfield-group").remove();
52011       layer.style("display", "none");
52012     }
52013     function click(d3_event, d2) {
52014       const service = getService();
52015       if (!service)
52016         return;
52017       service.ensureViewerLoaded(context).then(() => {
52018         service.selectImage(context, d2.key).showViewer(context);
52019       });
52020       context.map().centerEase(d2.loc);
52021     }
52022     function mouseover(d3_event, d2) {
52023       const service = getService();
52024       if (service)
52025         service.setStyles(context, d2);
52026     }
52027     function mouseout() {
52028       const service = getService();
52029       if (service)
52030         service.setStyles(context, null);
52031     }
52032     function transform2(d2, selected) {
52033       let t2 = svgPointTransform(projection2)(d2);
52034       let rot = d2.ca;
52035       if (d2 === selected) {
52036         rot += _viewerYaw;
52037       }
52038       if (rot) {
52039         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
52040       }
52041       return t2;
52042     }
52043     function viewerChanged() {
52044       const service = getService();
52045       if (!service)
52046         return;
52047       const frame2 = service.photoFrame();
52048       _viewerYaw = frame2.getYaw();
52049       if (context.map().isTransformed())
52050         return;
52051       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
52052     }
52053     function filterImages(images) {
52054       const photoContext = context.photos();
52055       const fromDateString = photoContext.fromDate();
52056       const toDateString = photoContext.toDate();
52057       const showsFlat = photoContext.showsFlat();
52058       const showsPano = photoContext.showsPanoramic();
52059       if (fromDateString) {
52060         const fromDate = new Date(fromDateString);
52061         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
52062       }
52063       if (toDateString) {
52064         const toDate = new Date(toDateString);
52065         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
52066       }
52067       if (!showsPano) {
52068         images = images.filter((image) => !image.is_sphere);
52069       }
52070       if (!showsFlat) {
52071         images = images.filter((image) => image.is_sphere);
52072       }
52073       return images;
52074     }
52075     function filterSequences(sequences) {
52076       const photoContext = context.photos();
52077       const fromDateString = photoContext.fromDate();
52078       const toDateString = photoContext.toDate();
52079       const showsFlat = photoContext.showsFlat();
52080       const showsPano = photoContext.showsPanoramic();
52081       if (fromDateString) {
52082         const fromDate = new Date(fromDateString);
52083         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
52084       }
52085       if (toDateString) {
52086         const toDate = new Date(toDateString);
52087         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
52088       }
52089       if (!showsPano) {
52090         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
52091       }
52092       if (!showsFlat) {
52093         sequences = sequences.filter(({ images }) => images[0].is_sphere);
52094       }
52095       return sequences;
52096     }
52097     function update() {
52098       const viewer = context.container().select(".photoviewer");
52099       const selected = viewer.empty() ? void 0 : viewer.datum();
52100       const z2 = ~~context.map().zoom();
52101       const showMarkers = z2 >= minMarkerZoom;
52102       const showViewfields = z2 >= minViewfieldZoom2;
52103       const service = getService();
52104       let sequences = [];
52105       let images = [];
52106       if (service) {
52107         service.loadImages(context);
52108         sequences = service.sequences(projection2);
52109         images = showMarkers ? service.images(projection2) : [];
52110         images = filterImages(images);
52111         sequences = filterSequences(sequences);
52112       }
52113       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
52114       traces.exit().remove();
52115       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52116       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
52117       groups.exit().remove();
52118       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52119       groupsEnter.append("g").attr("class", "viewfield-scale");
52120       const markers = groups.merge(groupsEnter).sort((a2, b2) => {
52121         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
52122       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
52123       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52124       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52125       viewfields.exit().remove();
52126       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
52127       function viewfieldPath() {
52128         const d2 = this.parentNode.__data__;
52129         if (d2.is_sphere) {
52130           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
52131         } else {
52132           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
52133         }
52134       }
52135     }
52136     function drawImages(selection2) {
52137       const enabled = svgVegbilder.enabled;
52138       const service = getService();
52139       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
52140       layer.exit().remove();
52141       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
52142       layerEnter.append("g").attr("class", "sequences");
52143       layerEnter.append("g").attr("class", "markers");
52144       layer = layerEnter.merge(layer);
52145       if (enabled) {
52146         if (service && ~~context.map().zoom() >= minZoom4) {
52147           editOn();
52148           update();
52149           service.loadImages(context);
52150         } else {
52151           editOff();
52152         }
52153       }
52154     }
52155     drawImages.enabled = function(_2) {
52156       if (!arguments.length)
52157         return svgVegbilder.enabled;
52158       svgVegbilder.enabled = _2;
52159       if (svgVegbilder.enabled) {
52160         showLayer();
52161         context.photos().on("change.vegbilder", update);
52162       } else {
52163         hideLayer();
52164         context.photos().on("change.vegbilder", null);
52165       }
52166       dispatch14.call("change");
52167       return this;
52168     };
52169     drawImages.supported = function() {
52170       return !!getService();
52171     };
52172     drawImages.rendered = function(zoom) {
52173       return zoom >= minZoom4;
52174     };
52175     drawImages.validHere = function(extent, zoom) {
52176       return zoom >= minZoom4 - 2 && getService().validHere(extent);
52177     };
52178     init2();
52179     return drawImages;
52180   }
52181
52182   // modules/svg/mapillary_images.js
52183   function svgMapillaryImages(projection2, context, dispatch14) {
52184     const throttledRedraw = throttle_default(function() {
52185       dispatch14.call("change");
52186     }, 1e3);
52187     const minZoom4 = 12;
52188     const minMarkerZoom = 16;
52189     const minViewfieldZoom2 = 18;
52190     let layer = select_default2(null);
52191     let _mapillary;
52192     function init2() {
52193       if (svgMapillaryImages.initialized)
52194         return;
52195       svgMapillaryImages.enabled = false;
52196       svgMapillaryImages.initialized = true;
52197     }
52198     function getService() {
52199       if (services.mapillary && !_mapillary) {
52200         _mapillary = services.mapillary;
52201         _mapillary.event.on("loadedImages", throttledRedraw);
52202       } else if (!services.mapillary && _mapillary) {
52203         _mapillary = null;
52204       }
52205       return _mapillary;
52206     }
52207     function showLayer() {
52208       const service = getService();
52209       if (!service)
52210         return;
52211       editOn();
52212       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52213         dispatch14.call("change");
52214       });
52215     }
52216     function hideLayer() {
52217       throttledRedraw.cancel();
52218       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52219     }
52220     function editOn() {
52221       layer.style("display", "block");
52222     }
52223     function editOff() {
52224       layer.selectAll(".viewfield-group").remove();
52225       layer.style("display", "none");
52226     }
52227     function click(d3_event, image) {
52228       const service = getService();
52229       if (!service)
52230         return;
52231       service.ensureViewerLoaded(context).then(function() {
52232         service.selectImage(context, image.id).showViewer(context);
52233       });
52234       context.map().centerEase(image.loc);
52235     }
52236     function mouseover(d3_event, image) {
52237       const service = getService();
52238       if (service)
52239         service.setStyles(context, image);
52240     }
52241     function mouseout() {
52242       const service = getService();
52243       if (service)
52244         service.setStyles(context, null);
52245     }
52246     function transform2(d2) {
52247       let t2 = svgPointTransform(projection2)(d2);
52248       if (d2.ca) {
52249         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52250       }
52251       return t2;
52252     }
52253     function filterImages(images) {
52254       const showsPano = context.photos().showsPanoramic();
52255       const showsFlat = context.photos().showsFlat();
52256       const fromDate = context.photos().fromDate();
52257       const toDate = context.photos().toDate();
52258       if (!showsPano || !showsFlat) {
52259         images = images.filter(function(image) {
52260           if (image.is_pano)
52261             return showsPano;
52262           return showsFlat;
52263         });
52264       }
52265       if (fromDate) {
52266         images = images.filter(function(image) {
52267           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
52268         });
52269       }
52270       if (toDate) {
52271         images = images.filter(function(image) {
52272           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
52273         });
52274       }
52275       return images;
52276     }
52277     function filterSequences(sequences) {
52278       const showsPano = context.photos().showsPanoramic();
52279       const showsFlat = context.photos().showsFlat();
52280       const fromDate = context.photos().fromDate();
52281       const toDate = context.photos().toDate();
52282       if (!showsPano || !showsFlat) {
52283         sequences = sequences.filter(function(sequence) {
52284           if (sequence.properties.hasOwnProperty("is_pano")) {
52285             if (sequence.properties.is_pano)
52286               return showsPano;
52287             return showsFlat;
52288           }
52289           return false;
52290         });
52291       }
52292       if (fromDate) {
52293         sequences = sequences.filter(function(sequence) {
52294           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
52295         });
52296       }
52297       if (toDate) {
52298         sequences = sequences.filter(function(sequence) {
52299           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
52300         });
52301       }
52302       return sequences;
52303     }
52304     function update() {
52305       const z2 = ~~context.map().zoom();
52306       const showMarkers = z2 >= minMarkerZoom;
52307       const showViewfields = z2 >= minViewfieldZoom2;
52308       const service = getService();
52309       let sequences = service ? service.sequences(projection2) : [];
52310       let images = service && showMarkers ? service.images(projection2) : [];
52311       images = filterImages(images);
52312       sequences = filterSequences(sequences, service);
52313       service.filterViewer(context);
52314       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
52315         return d2.properties.id;
52316       });
52317       traces.exit().remove();
52318       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52319       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
52320         return d2.id;
52321       });
52322       groups.exit().remove();
52323       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52324       groupsEnter.append("g").attr("class", "viewfield-scale");
52325       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
52326         return b2.loc[1] - a2.loc[1];
52327       }).attr("transform", transform2).select(".viewfield-scale");
52328       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52329       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52330       viewfields.exit().remove();
52331       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
52332         return this.parentNode.__data__.is_pano;
52333       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
52334       function viewfieldPath() {
52335         if (this.parentNode.__data__.is_pano) {
52336           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
52337         } else {
52338           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
52339         }
52340       }
52341     }
52342     function drawImages(selection2) {
52343       const enabled = svgMapillaryImages.enabled;
52344       const service = getService();
52345       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
52346       layer.exit().remove();
52347       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
52348       layerEnter.append("g").attr("class", "sequences");
52349       layerEnter.append("g").attr("class", "markers");
52350       layer = layerEnter.merge(layer);
52351       if (enabled) {
52352         if (service && ~~context.map().zoom() >= minZoom4) {
52353           editOn();
52354           update();
52355           service.loadImages(projection2);
52356         } else {
52357           editOff();
52358         }
52359       }
52360     }
52361     drawImages.enabled = function(_2) {
52362       if (!arguments.length)
52363         return svgMapillaryImages.enabled;
52364       svgMapillaryImages.enabled = _2;
52365       if (svgMapillaryImages.enabled) {
52366         showLayer();
52367         context.photos().on("change.mapillary_images", update);
52368       } else {
52369         hideLayer();
52370         context.photos().on("change.mapillary_images", null);
52371       }
52372       dispatch14.call("change");
52373       return this;
52374     };
52375     drawImages.supported = function() {
52376       return !!getService();
52377     };
52378     drawImages.rendered = function(zoom) {
52379       return zoom >= minZoom4;
52380     };
52381     init2();
52382     return drawImages;
52383   }
52384
52385   // modules/svg/mapillary_position.js
52386   function svgMapillaryPosition(projection2, context) {
52387     const throttledRedraw = throttle_default(function() {
52388       update();
52389     }, 1e3);
52390     const minZoom4 = 12;
52391     const minViewfieldZoom2 = 18;
52392     let layer = select_default2(null);
52393     let _mapillary;
52394     let viewerCompassAngle;
52395     function init2() {
52396       if (svgMapillaryPosition.initialized)
52397         return;
52398       svgMapillaryPosition.initialized = true;
52399     }
52400     function getService() {
52401       if (services.mapillary && !_mapillary) {
52402         _mapillary = services.mapillary;
52403         _mapillary.event.on("imageChanged", throttledRedraw);
52404         _mapillary.event.on("bearingChanged", function(e3) {
52405           viewerCompassAngle = e3.bearing;
52406           if (context.map().isTransformed())
52407             return;
52408           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
52409             return d2.is_pano;
52410           }).attr("transform", transform2);
52411         });
52412       } else if (!services.mapillary && _mapillary) {
52413         _mapillary = null;
52414       }
52415       return _mapillary;
52416     }
52417     function editOn() {
52418       layer.style("display", "block");
52419     }
52420     function editOff() {
52421       layer.selectAll(".viewfield-group").remove();
52422       layer.style("display", "none");
52423     }
52424     function transform2(d2) {
52425       let t2 = svgPointTransform(projection2)(d2);
52426       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
52427         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
52428       } else if (d2.ca) {
52429         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52430       }
52431       return t2;
52432     }
52433     function update() {
52434       const z2 = ~~context.map().zoom();
52435       const showViewfields = z2 >= minViewfieldZoom2;
52436       const service = getService();
52437       const image = service && service.getActiveImage();
52438       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
52439         return d2.id;
52440       });
52441       groups.exit().remove();
52442       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
52443       groupsEnter.append("g").attr("class", "viewfield-scale");
52444       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
52445       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52446       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52447       viewfields.exit().remove();
52448       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");
52449     }
52450     function drawImages(selection2) {
52451       const service = getService();
52452       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
52453       layer.exit().remove();
52454       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
52455       layerEnter.append("g").attr("class", "markers");
52456       layer = layerEnter.merge(layer);
52457       if (service && ~~context.map().zoom() >= minZoom4) {
52458         editOn();
52459         update();
52460       } else {
52461         editOff();
52462       }
52463     }
52464     drawImages.enabled = function() {
52465       update();
52466       return this;
52467     };
52468     drawImages.supported = function() {
52469       return !!getService();
52470     };
52471     drawImages.rendered = function(zoom) {
52472       return zoom >= minZoom4;
52473     };
52474     init2();
52475     return drawImages;
52476   }
52477
52478   // modules/svg/mapillary_signs.js
52479   function svgMapillarySigns(projection2, context, dispatch14) {
52480     const throttledRedraw = throttle_default(function() {
52481       dispatch14.call("change");
52482     }, 1e3);
52483     const minZoom4 = 12;
52484     let layer = select_default2(null);
52485     let _mapillary;
52486     function init2() {
52487       if (svgMapillarySigns.initialized)
52488         return;
52489       svgMapillarySigns.enabled = false;
52490       svgMapillarySigns.initialized = true;
52491     }
52492     function getService() {
52493       if (services.mapillary && !_mapillary) {
52494         _mapillary = services.mapillary;
52495         _mapillary.event.on("loadedSigns", throttledRedraw);
52496       } else if (!services.mapillary && _mapillary) {
52497         _mapillary = null;
52498       }
52499       return _mapillary;
52500     }
52501     function showLayer() {
52502       const service = getService();
52503       if (!service)
52504         return;
52505       service.loadSignResources(context);
52506       editOn();
52507     }
52508     function hideLayer() {
52509       throttledRedraw.cancel();
52510       editOff();
52511     }
52512     function editOn() {
52513       layer.style("display", "block");
52514     }
52515     function editOff() {
52516       layer.selectAll(".icon-sign").remove();
52517       layer.style("display", "none");
52518     }
52519     function click(d3_event, d2) {
52520       const service = getService();
52521       if (!service)
52522         return;
52523       context.map().centerEase(d2.loc);
52524       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
52525       service.getDetections(d2.id).then((detections) => {
52526         if (detections.length) {
52527           const imageId = detections[0].image.id;
52528           if (imageId === selectedImageId) {
52529             service.highlightDetection(detections[0]).selectImage(context, imageId);
52530           } else {
52531             service.ensureViewerLoaded(context).then(function() {
52532               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
52533             });
52534           }
52535         }
52536       });
52537     }
52538     function filterData(detectedFeatures) {
52539       var fromDate = context.photos().fromDate();
52540       var toDate = context.photos().toDate();
52541       if (fromDate) {
52542         var fromTimestamp = new Date(fromDate).getTime();
52543         detectedFeatures = detectedFeatures.filter(function(feature3) {
52544           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
52545         });
52546       }
52547       if (toDate) {
52548         var toTimestamp = new Date(toDate).getTime();
52549         detectedFeatures = detectedFeatures.filter(function(feature3) {
52550           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
52551         });
52552       }
52553       return detectedFeatures;
52554     }
52555     function update() {
52556       const service = getService();
52557       let data = service ? service.signs(projection2) : [];
52558       data = filterData(data);
52559       const transform2 = svgPointTransform(projection2);
52560       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
52561         return d2.id;
52562       });
52563       signs.exit().remove();
52564       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
52565       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
52566         return "#" + d2.value;
52567       });
52568       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
52569       signs.merge(enter).attr("transform", transform2);
52570     }
52571     function drawSigns(selection2) {
52572       const enabled = svgMapillarySigns.enabled;
52573       const service = getService();
52574       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
52575       layer.exit().remove();
52576       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
52577       if (enabled) {
52578         if (service && ~~context.map().zoom() >= minZoom4) {
52579           editOn();
52580           update();
52581           service.loadSigns(projection2);
52582           service.showSignDetections(true);
52583         } else {
52584           editOff();
52585         }
52586       } else if (service) {
52587         service.showSignDetections(false);
52588       }
52589     }
52590     drawSigns.enabled = function(_2) {
52591       if (!arguments.length)
52592         return svgMapillarySigns.enabled;
52593       svgMapillarySigns.enabled = _2;
52594       if (svgMapillarySigns.enabled) {
52595         showLayer();
52596         context.photos().on("change.mapillary_signs", update);
52597       } else {
52598         hideLayer();
52599         context.photos().on("change.mapillary_signs", null);
52600       }
52601       dispatch14.call("change");
52602       return this;
52603     };
52604     drawSigns.supported = function() {
52605       return !!getService();
52606     };
52607     drawSigns.rendered = function(zoom) {
52608       return zoom >= minZoom4;
52609     };
52610     init2();
52611     return drawSigns;
52612   }
52613
52614   // modules/svg/mapillary_map_features.js
52615   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
52616     const throttledRedraw = throttle_default(function() {
52617       dispatch14.call("change");
52618     }, 1e3);
52619     const minZoom4 = 12;
52620     let layer = select_default2(null);
52621     let _mapillary;
52622     function init2() {
52623       if (svgMapillaryMapFeatures.initialized)
52624         return;
52625       svgMapillaryMapFeatures.enabled = false;
52626       svgMapillaryMapFeatures.initialized = true;
52627     }
52628     function getService() {
52629       if (services.mapillary && !_mapillary) {
52630         _mapillary = services.mapillary;
52631         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
52632       } else if (!services.mapillary && _mapillary) {
52633         _mapillary = null;
52634       }
52635       return _mapillary;
52636     }
52637     function showLayer() {
52638       const service = getService();
52639       if (!service)
52640         return;
52641       service.loadObjectResources(context);
52642       editOn();
52643     }
52644     function hideLayer() {
52645       throttledRedraw.cancel();
52646       editOff();
52647     }
52648     function editOn() {
52649       layer.style("display", "block");
52650     }
52651     function editOff() {
52652       layer.selectAll(".icon-map-feature").remove();
52653       layer.style("display", "none");
52654     }
52655     function click(d3_event, d2) {
52656       const service = getService();
52657       if (!service)
52658         return;
52659       context.map().centerEase(d2.loc);
52660       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
52661       service.getDetections(d2.id).then((detections) => {
52662         if (detections.length) {
52663           const imageId = detections[0].image.id;
52664           if (imageId === selectedImageId) {
52665             service.highlightDetection(detections[0]).selectImage(context, imageId);
52666           } else {
52667             service.ensureViewerLoaded(context).then(function() {
52668               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
52669             });
52670           }
52671         }
52672       });
52673     }
52674     function filterData(detectedFeatures) {
52675       const fromDate = context.photos().fromDate();
52676       const toDate = context.photos().toDate();
52677       if (fromDate) {
52678         detectedFeatures = detectedFeatures.filter(function(feature3) {
52679           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
52680         });
52681       }
52682       if (toDate) {
52683         detectedFeatures = detectedFeatures.filter(function(feature3) {
52684           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
52685         });
52686       }
52687       return detectedFeatures;
52688     }
52689     function update() {
52690       const service = getService();
52691       let data = service ? service.mapFeatures(projection2) : [];
52692       data = filterData(data);
52693       const transform2 = svgPointTransform(projection2);
52694       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
52695         return d2.id;
52696       });
52697       mapFeatures.exit().remove();
52698       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
52699       enter.append("title").text(function(d2) {
52700         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
52701         return _t("mapillary_map_features." + id2);
52702       });
52703       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
52704         if (d2.value === "object--billboard") {
52705           return "#object--sign--advertisement";
52706         }
52707         return "#" + d2.value;
52708       });
52709       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
52710       mapFeatures.merge(enter).attr("transform", transform2);
52711     }
52712     function drawMapFeatures(selection2) {
52713       const enabled = svgMapillaryMapFeatures.enabled;
52714       const service = getService();
52715       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
52716       layer.exit().remove();
52717       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
52718       if (enabled) {
52719         if (service && ~~context.map().zoom() >= minZoom4) {
52720           editOn();
52721           update();
52722           service.loadMapFeatures(projection2);
52723           service.showFeatureDetections(true);
52724         } else {
52725           editOff();
52726         }
52727       } else if (service) {
52728         service.showFeatureDetections(false);
52729       }
52730     }
52731     drawMapFeatures.enabled = function(_2) {
52732       if (!arguments.length)
52733         return svgMapillaryMapFeatures.enabled;
52734       svgMapillaryMapFeatures.enabled = _2;
52735       if (svgMapillaryMapFeatures.enabled) {
52736         showLayer();
52737         context.photos().on("change.mapillary_map_features", update);
52738       } else {
52739         hideLayer();
52740         context.photos().on("change.mapillary_map_features", null);
52741       }
52742       dispatch14.call("change");
52743       return this;
52744     };
52745     drawMapFeatures.supported = function() {
52746       return !!getService();
52747     };
52748     drawMapFeatures.rendered = function(zoom) {
52749       return zoom >= minZoom4;
52750     };
52751     init2();
52752     return drawMapFeatures;
52753   }
52754
52755   // modules/svg/kartaview_images.js
52756   function svgKartaviewImages(projection2, context, dispatch14) {
52757     var throttledRedraw = throttle_default(function() {
52758       dispatch14.call("change");
52759     }, 1e3);
52760     var minZoom4 = 12;
52761     var minMarkerZoom = 16;
52762     var minViewfieldZoom2 = 18;
52763     var layer = select_default2(null);
52764     var _kartaview;
52765     function init2() {
52766       if (svgKartaviewImages.initialized)
52767         return;
52768       svgKartaviewImages.enabled = false;
52769       svgKartaviewImages.initialized = true;
52770     }
52771     function getService() {
52772       if (services.kartaview && !_kartaview) {
52773         _kartaview = services.kartaview;
52774         _kartaview.event.on("loadedImages", throttledRedraw);
52775       } else if (!services.kartaview && _kartaview) {
52776         _kartaview = null;
52777       }
52778       return _kartaview;
52779     }
52780     function showLayer() {
52781       var service = getService();
52782       if (!service)
52783         return;
52784       editOn();
52785       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52786         dispatch14.call("change");
52787       });
52788     }
52789     function hideLayer() {
52790       throttledRedraw.cancel();
52791       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52792     }
52793     function editOn() {
52794       layer.style("display", "block");
52795     }
52796     function editOff() {
52797       layer.selectAll(".viewfield-group").remove();
52798       layer.style("display", "none");
52799     }
52800     function click(d3_event, d2) {
52801       var service = getService();
52802       if (!service)
52803         return;
52804       service.ensureViewerLoaded(context).then(function() {
52805         service.selectImage(context, d2.key).showViewer(context);
52806       });
52807       context.map().centerEase(d2.loc);
52808     }
52809     function mouseover(d3_event, d2) {
52810       var service = getService();
52811       if (service)
52812         service.setStyles(context, d2);
52813     }
52814     function mouseout() {
52815       var service = getService();
52816       if (service)
52817         service.setStyles(context, null);
52818     }
52819     function transform2(d2) {
52820       var t2 = svgPointTransform(projection2)(d2);
52821       if (d2.ca) {
52822         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52823       }
52824       return t2;
52825     }
52826     function filterImages(images) {
52827       var fromDate = context.photos().fromDate();
52828       var toDate = context.photos().toDate();
52829       var usernames = context.photos().usernames();
52830       if (fromDate) {
52831         var fromTimestamp = new Date(fromDate).getTime();
52832         images = images.filter(function(item) {
52833           return new Date(item.captured_at).getTime() >= fromTimestamp;
52834         });
52835       }
52836       if (toDate) {
52837         var toTimestamp = new Date(toDate).getTime();
52838         images = images.filter(function(item) {
52839           return new Date(item.captured_at).getTime() <= toTimestamp;
52840         });
52841       }
52842       if (usernames) {
52843         images = images.filter(function(item) {
52844           return usernames.indexOf(item.captured_by) !== -1;
52845         });
52846       }
52847       return images;
52848     }
52849     function filterSequences(sequences) {
52850       var fromDate = context.photos().fromDate();
52851       var toDate = context.photos().toDate();
52852       var usernames = context.photos().usernames();
52853       if (fromDate) {
52854         var fromTimestamp = new Date(fromDate).getTime();
52855         sequences = sequences.filter(function(image) {
52856           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
52857         });
52858       }
52859       if (toDate) {
52860         var toTimestamp = new Date(toDate).getTime();
52861         sequences = sequences.filter(function(image) {
52862           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
52863         });
52864       }
52865       if (usernames) {
52866         sequences = sequences.filter(function(image) {
52867           return usernames.indexOf(image.properties.captured_by) !== -1;
52868         });
52869       }
52870       return sequences;
52871     }
52872     function update() {
52873       var viewer = context.container().select(".photoviewer");
52874       var selected = viewer.empty() ? void 0 : viewer.datum();
52875       var z2 = ~~context.map().zoom();
52876       var showMarkers = z2 >= minMarkerZoom;
52877       var showViewfields = z2 >= minViewfieldZoom2;
52878       var service = getService();
52879       var sequences = [];
52880       var images = [];
52881       if (context.photos().showsFlat()) {
52882         sequences = service ? service.sequences(projection2) : [];
52883         images = service && showMarkers ? service.images(projection2) : [];
52884         sequences = filterSequences(sequences);
52885         images = filterImages(images);
52886       }
52887       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
52888         return d2.properties.key;
52889       });
52890       traces.exit().remove();
52891       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52892       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
52893         return d2.key;
52894       });
52895       groups.exit().remove();
52896       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52897       groupsEnter.append("g").attr("class", "viewfield-scale");
52898       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
52899         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
52900       }).attr("transform", transform2).select(".viewfield-scale");
52901       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52902       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52903       viewfields.exit().remove();
52904       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");
52905     }
52906     function drawImages(selection2) {
52907       var enabled = svgKartaviewImages.enabled, service = getService();
52908       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
52909       layer.exit().remove();
52910       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
52911       layerEnter.append("g").attr("class", "sequences");
52912       layerEnter.append("g").attr("class", "markers");
52913       layer = layerEnter.merge(layer);
52914       if (enabled) {
52915         if (service && ~~context.map().zoom() >= minZoom4) {
52916           editOn();
52917           update();
52918           service.loadImages(projection2);
52919         } else {
52920           editOff();
52921         }
52922       }
52923     }
52924     drawImages.enabled = function(_2) {
52925       if (!arguments.length)
52926         return svgKartaviewImages.enabled;
52927       svgKartaviewImages.enabled = _2;
52928       if (svgKartaviewImages.enabled) {
52929         showLayer();
52930         context.photos().on("change.kartaview_images", update);
52931       } else {
52932         hideLayer();
52933         context.photos().on("change.kartaview_images", null);
52934       }
52935       dispatch14.call("change");
52936       return this;
52937     };
52938     drawImages.supported = function() {
52939       return !!getService();
52940     };
52941     drawImages.rendered = function(zoom) {
52942       return zoom >= minZoom4;
52943     };
52944     init2();
52945     return drawImages;
52946   }
52947
52948   // modules/svg/mapilio_images.js
52949   function svgMapilioImages(projection2, context, dispatch14) {
52950     const throttledRedraw = throttle_default(function() {
52951       dispatch14.call("change");
52952     }, 1e3);
52953     const minZoom4 = 12;
52954     let layer = select_default2(null);
52955     let _mapilio;
52956     const viewFieldZoomLevel = 18;
52957     function init2() {
52958       if (svgMapilioImages.initialized)
52959         return;
52960       svgMapilioImages.enabled = false;
52961       svgMapilioImages.initialized = true;
52962     }
52963     function getService() {
52964       if (services.mapilio && !_mapilio) {
52965         _mapilio = services.mapilio;
52966         _mapilio.event.on("loadedImages", throttledRedraw);
52967       } else if (!services.mapilio && _mapilio) {
52968         _mapilio = null;
52969       }
52970       return _mapilio;
52971     }
52972     function showLayer() {
52973       const service = getService();
52974       if (!service)
52975         return;
52976       editOn();
52977       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52978         dispatch14.call("change");
52979       });
52980     }
52981     function hideLayer() {
52982       throttledRedraw.cancel();
52983       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52984     }
52985     function transform2(d2) {
52986       let t2 = svgPointTransform(projection2)(d2);
52987       if (d2.heading) {
52988         t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
52989       }
52990       return t2;
52991     }
52992     function editOn() {
52993       layer.style("display", "block");
52994     }
52995     function editOff() {
52996       layer.selectAll(".viewfield-group").remove();
52997       layer.style("display", "none");
52998     }
52999     function click(d3_event, image) {
53000       const service = getService();
53001       if (!service)
53002         return;
53003       service.ensureViewerLoaded(context, image.id).then(function() {
53004         service.selectImage(context, image.id).showViewer(context);
53005       });
53006       context.map().centerEase(image.loc);
53007     }
53008     function mouseover(d3_event, image) {
53009       const service = getService();
53010       if (service)
53011         service.setStyles(context, image);
53012     }
53013     function mouseout() {
53014       const service = getService();
53015       if (service)
53016         service.setStyles(context, null);
53017     }
53018     function update() {
53019       const z2 = ~~context.map().zoom();
53020       const showViewfields = z2 >= viewFieldZoomLevel;
53021       const service = getService();
53022       let sequences = service ? service.sequences(projection2) : [];
53023       let images = service ? service.images(projection2) : [];
53024       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53025         return d2.properties.id;
53026       });
53027       traces.exit().remove();
53028       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53029       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
53030         return d2.id;
53031       });
53032       groups.exit().remove();
53033       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53034       groupsEnter.append("g").attr("class", "viewfield-scale");
53035       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53036         return b2.loc[1] - a2.loc[1];
53037       }).attr("transform", transform2).select(".viewfield-scale");
53038       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53039       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53040       viewfields.exit().remove();
53041       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53042       function viewfieldPath() {
53043         if (this.parentNode.__data__.isPano) {
53044           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53045         } else {
53046           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53047         }
53048       }
53049     }
53050     function drawImages(selection2) {
53051       const enabled = svgMapilioImages.enabled;
53052       const service = getService();
53053       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
53054       layer.exit().remove();
53055       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
53056       layerEnter.append("g").attr("class", "sequences");
53057       layerEnter.append("g").attr("class", "markers");
53058       layer = layerEnter.merge(layer);
53059       if (enabled) {
53060         if (service && ~~context.map().zoom() >= minZoom4) {
53061           editOn();
53062           update();
53063           service.loadImages(projection2);
53064           service.loadLines(projection2);
53065         } else {
53066           editOff();
53067         }
53068       }
53069     }
53070     drawImages.enabled = function(_2) {
53071       if (!arguments.length)
53072         return svgMapilioImages.enabled;
53073       svgMapilioImages.enabled = _2;
53074       if (svgMapilioImages.enabled) {
53075         showLayer();
53076         context.photos().on("change.mapilio_images", null);
53077       } else {
53078         hideLayer();
53079         context.photos().on("change.mapilio_images", null);
53080       }
53081       dispatch14.call("change");
53082       return this;
53083     };
53084     drawImages.supported = function() {
53085       return !!getService();
53086     };
53087     drawImages.rendered = function(zoom) {
53088       return zoom >= minZoom4;
53089     };
53090     init2();
53091     return drawImages;
53092   }
53093
53094   // modules/svg/osm.js
53095   function svgOsm(projection2, context, dispatch14) {
53096     var enabled = true;
53097     function drawOsm(selection2) {
53098       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
53099         return "layer-osm " + d2;
53100       });
53101       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d2) {
53102         return "points-group " + d2;
53103       });
53104     }
53105     function showLayer() {
53106       var layer = context.surface().selectAll(".data-layer.osm");
53107       layer.interrupt();
53108       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
53109         dispatch14.call("change");
53110       });
53111     }
53112     function hideLayer() {
53113       var layer = context.surface().selectAll(".data-layer.osm");
53114       layer.interrupt();
53115       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
53116         layer.classed("disabled", true);
53117         dispatch14.call("change");
53118       });
53119     }
53120     drawOsm.enabled = function(val) {
53121       if (!arguments.length)
53122         return enabled;
53123       enabled = val;
53124       if (enabled) {
53125         showLayer();
53126       } else {
53127         hideLayer();
53128       }
53129       dispatch14.call("change");
53130       return this;
53131     };
53132     return drawOsm;
53133   }
53134
53135   // modules/svg/notes.js
53136   var _notesEnabled = false;
53137   var _osmService;
53138   function svgNotes(projection2, context, dispatch14) {
53139     if (!dispatch14) {
53140       dispatch14 = dispatch_default("change");
53141     }
53142     var throttledRedraw = throttle_default(function() {
53143       dispatch14.call("change");
53144     }, 1e3);
53145     var minZoom4 = 12;
53146     var touchLayer = select_default2(null);
53147     var drawLayer = select_default2(null);
53148     var _notesVisible = false;
53149     function markerPath(selection2, klass) {
53150       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");
53151     }
53152     function getService() {
53153       if (services.osm && !_osmService) {
53154         _osmService = services.osm;
53155         _osmService.on("loadedNotes", throttledRedraw);
53156       } else if (!services.osm && _osmService) {
53157         _osmService = null;
53158       }
53159       return _osmService;
53160     }
53161     function editOn() {
53162       if (!_notesVisible) {
53163         _notesVisible = true;
53164         drawLayer.style("display", "block");
53165       }
53166     }
53167     function editOff() {
53168       if (_notesVisible) {
53169         _notesVisible = false;
53170         drawLayer.style("display", "none");
53171         drawLayer.selectAll(".note").remove();
53172         touchLayer.selectAll(".note").remove();
53173       }
53174     }
53175     function layerOn() {
53176       editOn();
53177       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
53178         dispatch14.call("change");
53179       });
53180     }
53181     function layerOff() {
53182       throttledRedraw.cancel();
53183       drawLayer.interrupt();
53184       touchLayer.selectAll(".note").remove();
53185       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
53186         editOff();
53187         dispatch14.call("change");
53188       });
53189     }
53190     function updateMarkers() {
53191       if (!_notesVisible || !_notesEnabled)
53192         return;
53193       var service = getService();
53194       var selectedID = context.selectedNoteID();
53195       var data = service ? service.notes(projection2) : [];
53196       var getTransform = svgPointTransform(projection2);
53197       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
53198         return d2.status + d2.id;
53199       });
53200       notes.exit().remove();
53201       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
53202         return "note note-" + d2.id + " " + d2.status;
53203       }).classed("new", function(d2) {
53204         return d2.id < 0;
53205       });
53206       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
53207       notesEnter.append("path").call(markerPath, "shadow");
53208       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");
53209       notesEnter.selectAll(".icon-annotation").data(function(d2) {
53210         return [d2];
53211       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
53212         if (d2.id < 0)
53213           return "#iD-icon-plus";
53214         if (d2.status === "open")
53215           return "#iD-icon-close";
53216         return "#iD-icon-apply";
53217       });
53218       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
53219         var mode = context.mode();
53220         var isMoving = mode && mode.id === "drag-note";
53221         return !isMoving && d2.id === selectedID;
53222       }).attr("transform", getTransform);
53223       if (touchLayer.empty())
53224         return;
53225       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53226       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
53227         return d2.id;
53228       });
53229       targets.exit().remove();
53230       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
53231         var newClass = d2.id < 0 ? "new" : "";
53232         return "note target note-" + d2.id + " " + fillClass + newClass;
53233       }).attr("transform", getTransform);
53234       function sortY(a2, b2) {
53235         if (a2.id === selectedID)
53236           return 1;
53237         if (b2.id === selectedID)
53238           return -1;
53239         return b2.loc[1] - a2.loc[1];
53240       }
53241     }
53242     function drawNotes(selection2) {
53243       var service = getService();
53244       var surface = context.surface();
53245       if (surface && !surface.empty()) {
53246         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
53247       }
53248       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
53249       drawLayer.exit().remove();
53250       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
53251       if (_notesEnabled) {
53252         if (service && ~~context.map().zoom() >= minZoom4) {
53253           editOn();
53254           service.loadNotes(projection2);
53255           updateMarkers();
53256         } else {
53257           editOff();
53258         }
53259       }
53260     }
53261     drawNotes.enabled = function(val) {
53262       if (!arguments.length)
53263         return _notesEnabled;
53264       _notesEnabled = val;
53265       if (_notesEnabled) {
53266         layerOn();
53267       } else {
53268         layerOff();
53269         if (context.selectedNoteID()) {
53270           context.enter(modeBrowse(context));
53271         }
53272       }
53273       dispatch14.call("change");
53274       return this;
53275     };
53276     return drawNotes;
53277   }
53278
53279   // modules/svg/touch.js
53280   function svgTouch() {
53281     function drawTouch(selection2) {
53282       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
53283         return "layer-touch " + d2;
53284       });
53285     }
53286     return drawTouch;
53287   }
53288
53289   // modules/util/dimensions.js
53290   function refresh(selection2, node) {
53291     var cr = node.getBoundingClientRect();
53292     var prop = [cr.width, cr.height];
53293     selection2.property("__dimensions__", prop);
53294     return prop;
53295   }
53296   function utilGetDimensions(selection2, force) {
53297     if (!selection2 || selection2.empty()) {
53298       return [0, 0];
53299     }
53300     var node = selection2.node(), cached = selection2.property("__dimensions__");
53301     return !cached || force ? refresh(selection2, node) : cached;
53302   }
53303   function utilSetDimensions(selection2, dimensions) {
53304     if (!selection2 || selection2.empty()) {
53305       return selection2;
53306     }
53307     var node = selection2.node();
53308     if (dimensions === null) {
53309       refresh(selection2, node);
53310       return selection2;
53311     }
53312     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
53313   }
53314
53315   // modules/svg/layers.js
53316   function svgLayers(projection2, context) {
53317     var dispatch14 = dispatch_default("change");
53318     var svg2 = select_default2(null);
53319     var _layers = [
53320       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
53321       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
53322       { id: "data", layer: svgData(projection2, context, dispatch14) },
53323       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
53324       { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch14) },
53325       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
53326       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
53327       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
53328       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
53329       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
53330       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
53331       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
53332       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
53333       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
53334       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
53335       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
53336       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
53337       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
53338     ];
53339     function drawLayers(selection2) {
53340       svg2 = selection2.selectAll(".surface").data([0]);
53341       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
53342       var defs = svg2.selectAll(".surface-defs").data([0]);
53343       defs.enter().append("defs").attr("class", "surface-defs");
53344       var groups = svg2.selectAll(".data-layer").data(_layers);
53345       groups.exit().remove();
53346       groups.enter().append("g").attr("class", function(d2) {
53347         return "data-layer " + d2.id;
53348       }).merge(groups).each(function(d2) {
53349         select_default2(this).call(d2.layer);
53350       });
53351     }
53352     drawLayers.all = function() {
53353       return _layers;
53354     };
53355     drawLayers.layer = function(id2) {
53356       var obj = _layers.find(function(o2) {
53357         return o2.id === id2;
53358       });
53359       return obj && obj.layer;
53360     };
53361     drawLayers.only = function(what) {
53362       var arr = [].concat(what);
53363       var all = _layers.map(function(layer) {
53364         return layer.id;
53365       });
53366       return drawLayers.remove(utilArrayDifference(all, arr));
53367     };
53368     drawLayers.remove = function(what) {
53369       var arr = [].concat(what);
53370       arr.forEach(function(id2) {
53371         _layers = _layers.filter(function(o2) {
53372           return o2.id !== id2;
53373         });
53374       });
53375       dispatch14.call("change");
53376       return this;
53377     };
53378     drawLayers.add = function(what) {
53379       var arr = [].concat(what);
53380       arr.forEach(function(obj) {
53381         if ("id" in obj && "layer" in obj) {
53382           _layers.push(obj);
53383         }
53384       });
53385       dispatch14.call("change");
53386       return this;
53387     };
53388     drawLayers.dimensions = function(val) {
53389       if (!arguments.length)
53390         return utilGetDimensions(svg2);
53391       utilSetDimensions(svg2, val);
53392       return this;
53393     };
53394     return utilRebind(drawLayers, dispatch14, "on");
53395   }
53396
53397   // modules/svg/lines.js
53398   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
53399   function svgLines(projection2, context) {
53400     var detected = utilDetect();
53401     var highway_stack = {
53402       motorway: 0,
53403       motorway_link: 1,
53404       trunk: 2,
53405       trunk_link: 3,
53406       primary: 4,
53407       primary_link: 5,
53408       secondary: 6,
53409       tertiary: 7,
53410       unclassified: 8,
53411       residential: 9,
53412       service: 10,
53413       footway: 11
53414     };
53415     function drawTargets(selection2, graph, entities, filter2) {
53416       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
53417       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
53418       var getPath = svgPath(projection2).geojson;
53419       var activeID = context.activeID();
53420       var base = context.history().base();
53421       var data = { targets: [], nopes: [] };
53422       entities.forEach(function(way) {
53423         var features = svgSegmentWay(way, graph, activeID);
53424         data.targets.push.apply(data.targets, features.passive);
53425         data.nopes.push.apply(data.nopes, features.active);
53426       });
53427       var targetData = data.targets.filter(getPath);
53428       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
53429         return filter2(d2.properties.entity);
53430       }).data(targetData, function key(d2) {
53431         return d2.id;
53432       });
53433       targets.exit().remove();
53434       var segmentWasEdited = function(d2) {
53435         var wayID = d2.properties.entity.id;
53436         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
53437           return false;
53438         }
53439         return d2.properties.nodes.some(function(n3) {
53440           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
53441         });
53442       };
53443       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
53444         return "way line target target-allowed " + targetClass + d2.id;
53445       }).classed("segment-edited", segmentWasEdited);
53446       var nopeData = data.nopes.filter(getPath);
53447       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
53448         return filter2(d2.properties.entity);
53449       }).data(nopeData, function key(d2) {
53450         return d2.id;
53451       });
53452       nopes.exit().remove();
53453       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
53454         return "way line target target-nope " + nopeClass + d2.id;
53455       }).classed("segment-edited", segmentWasEdited);
53456     }
53457     function drawLines(selection2, graph, entities, filter2) {
53458       var base = context.history().base();
53459       function waystack(a2, b2) {
53460         var selected = context.selectedIDs();
53461         var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
53462         var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
53463         if (a2.tags.highway) {
53464           scoreA -= highway_stack[a2.tags.highway];
53465         }
53466         if (b2.tags.highway) {
53467           scoreB -= highway_stack[b2.tags.highway];
53468         }
53469         return scoreA - scoreB;
53470       }
53471       function drawLineGroup(selection3, klass, isSelected) {
53472         var mode = context.mode();
53473         var isDrawing = mode && /^draw/.test(mode.id);
53474         var selectedClass = !isDrawing && isSelected ? "selected " : "";
53475         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
53476         lines.exit().remove();
53477         lines.enter().append("path").attr("class", function(d2) {
53478           var prefix = "way line";
53479           if (!d2.hasInterestingTags()) {
53480             var parentRelations = graph.parentRelations(d2);
53481             var parentMultipolygons = parentRelations.filter(function(relation) {
53482               return relation.isMultipolygon();
53483             });
53484             if (parentMultipolygons.length > 0 && // and only multipolygon relations
53485             parentRelations.length === parentMultipolygons.length) {
53486               prefix = "relation area";
53487             }
53488           }
53489           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
53490           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
53491         }).classed("added", function(d2) {
53492           return !base.entities[d2.id];
53493         }).classed("geometry-edited", function(d2) {
53494           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
53495         }).classed("retagged", function(d2) {
53496           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
53497         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
53498         return selection3;
53499       }
53500       function getPathData(isSelected) {
53501         return function() {
53502           var layer = this.parentNode.__data__;
53503           var data = pathdata[layer] || [];
53504           return data.filter(function(d2) {
53505             if (isSelected) {
53506               return context.selectedIDs().indexOf(d2.id) !== -1;
53507             } else {
53508               return context.selectedIDs().indexOf(d2.id) === -1;
53509             }
53510           });
53511         };
53512       }
53513       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
53514         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
53515         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
53516         var markers = markergroup.selectAll("path").filter(filter2).data(
53517           function data() {
53518             return groupdata[this.parentNode.__data__] || [];
53519           },
53520           function key(d2) {
53521             return [d2.id, d2.index];
53522           }
53523         );
53524         markers.exit().remove();
53525         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
53526           return d2.d;
53527         });
53528         if (detected.ie) {
53529           markers.each(function() {
53530             this.parentNode.insertBefore(this, this);
53531           });
53532         }
53533       }
53534       var getPath = svgPath(projection2, graph);
53535       var ways = [];
53536       var onewaydata = {};
53537       var sideddata = {};
53538       var oldMultiPolygonOuters = {};
53539       for (var i3 = 0; i3 < entities.length; i3++) {
53540         var entity = entities[i3];
53541         var outer = osmOldMultipolygonOuterMember(entity, graph);
53542         if (outer) {
53543           ways.push(entity.mergeTags(outer.tags));
53544           oldMultiPolygonOuters[outer.id] = true;
53545         } else if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
53546           ways.push(entity);
53547         }
53548       }
53549       ways = ways.filter(getPath);
53550       var pathdata = utilArrayGroupBy(ways, function(way) {
53551         return way.layer();
53552       });
53553       Object.keys(pathdata).forEach(function(k2) {
53554         var v2 = pathdata[k2];
53555         var onewayArr = v2.filter(function(d2) {
53556           return d2.isOneWay();
53557         });
53558         var onewaySegments = svgMarkerSegments(
53559           projection2,
53560           graph,
53561           35,
53562           function shouldReverse(entity2) {
53563             return entity2.tags.oneway === "-1";
53564           },
53565           function bothDirections(entity2) {
53566             return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
53567           }
53568         );
53569         onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
53570         var sidedArr = v2.filter(function(d2) {
53571           return d2.isSided();
53572         });
53573         var sidedSegments = svgMarkerSegments(
53574           projection2,
53575           graph,
53576           30,
53577           function shouldReverse() {
53578             return false;
53579           },
53580           function bothDirections() {
53581             return false;
53582           }
53583         );
53584         sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
53585       });
53586       var covered = selection2.selectAll(".layer-osm.covered");
53587       var uncovered = selection2.selectAll(".layer-osm.lines");
53588       var touchLayer = selection2.selectAll(".layer-touch.lines");
53589       [covered, uncovered].forEach(function(selection3) {
53590         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
53591         var layergroup = selection3.selectAll("g.layergroup").data(range3);
53592         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
53593           return "layergroup layer" + String(d2);
53594         }).merge(layergroup);
53595         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
53596           return "linegroup line-" + d2;
53597         });
53598         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
53599         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
53600         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
53601         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
53602         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
53603         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
53604         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
53605         addMarkers(
53606           layergroup,
53607           "sided",
53608           "sidedgroup",
53609           sideddata,
53610           function marker(d2) {
53611             var category = graph.entity(d2.id).sidednessIdentifier();
53612             return "url(#ideditor-sided-marker-" + category + ")";
53613           }
53614         );
53615       });
53616       touchLayer.call(drawTargets, graph, ways, filter2);
53617     }
53618     return drawLines;
53619   }
53620
53621   // modules/svg/midpoints.js
53622   function svgMidpoints(projection2, context) {
53623     var targetRadius = 8;
53624     function drawTargets(selection2, graph, entities, filter2) {
53625       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53626       var getTransform = svgPointTransform(projection2).geojson;
53627       var data = entities.map(function(midpoint) {
53628         return {
53629           type: "Feature",
53630           id: midpoint.id,
53631           properties: {
53632             target: true,
53633             entity: midpoint
53634           },
53635           geometry: {
53636             type: "Point",
53637             coordinates: midpoint.loc
53638           }
53639         };
53640       });
53641       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
53642         return filter2(d2.properties.entity);
53643       }).data(data, function key(d2) {
53644         return d2.id;
53645       });
53646       targets.exit().remove();
53647       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
53648         return "node midpoint target " + fillClass + d2.id;
53649       }).attr("transform", getTransform);
53650     }
53651     function drawMidpoints(selection2, graph, entities, filter2, extent) {
53652       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
53653       var touchLayer = selection2.selectAll(".layer-touch.points");
53654       var mode = context.mode();
53655       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
53656         drawLayer.selectAll(".midpoint").remove();
53657         touchLayer.selectAll(".midpoint.target").remove();
53658         return;
53659       }
53660       var poly = extent.polygon();
53661       var midpoints = {};
53662       for (var i3 = 0; i3 < entities.length; i3++) {
53663         var entity = entities[i3];
53664         if (entity.type !== "way")
53665           continue;
53666         if (!filter2(entity))
53667           continue;
53668         if (context.selectedIDs().indexOf(entity.id) < 0)
53669           continue;
53670         var nodes = graph.childNodes(entity);
53671         for (var j3 = 0; j3 < nodes.length - 1; j3++) {
53672           var a2 = nodes[j3];
53673           var b2 = nodes[j3 + 1];
53674           var id2 = [a2.id, b2.id].sort().join("-");
53675           if (midpoints[id2]) {
53676             midpoints[id2].parents.push(entity);
53677           } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
53678             var point2 = geoVecInterp(a2.loc, b2.loc, 0.5);
53679             var loc = null;
53680             if (extent.intersects(point2)) {
53681               loc = point2;
53682             } else {
53683               for (var k2 = 0; k2 < 4; k2++) {
53684                 point2 = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
53685                 if (point2 && geoVecLength(projection2(a2.loc), projection2(point2)) > 20 && geoVecLength(projection2(b2.loc), projection2(point2)) > 20) {
53686                   loc = point2;
53687                   break;
53688                 }
53689               }
53690             }
53691             if (loc) {
53692               midpoints[id2] = {
53693                 type: "midpoint",
53694                 id: id2,
53695                 loc,
53696                 edge: [a2.id, b2.id],
53697                 parents: [entity]
53698               };
53699             }
53700           }
53701         }
53702       }
53703       function midpointFilter(d2) {
53704         if (midpoints[d2.id])
53705           return true;
53706         for (var i4 = 0; i4 < d2.parents.length; i4++) {
53707           if (filter2(d2.parents[i4])) {
53708             return true;
53709           }
53710         }
53711         return false;
53712       }
53713       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
53714         return d2.id;
53715       });
53716       groups.exit().remove();
53717       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
53718       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
53719       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
53720       groups = groups.merge(enter).attr("transform", function(d2) {
53721         var translate = svgPointTransform(projection2);
53722         var a3 = graph.entity(d2.edge[0]);
53723         var b3 = graph.entity(d2.edge[1]);
53724         var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
53725         return translate(d2) + " rotate(" + angle2 + ")";
53726       }).call(svgTagClasses().tags(
53727         function(d2) {
53728           return d2.parents[0].tags;
53729         }
53730       ));
53731       groups.select("polygon.shadow");
53732       groups.select("polygon.fill");
53733       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
53734     }
53735     return drawMidpoints;
53736   }
53737
53738   // modules/svg/points.js
53739   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
53740   function svgPoints(projection2, context) {
53741     function markerPath(selection2, klass) {
53742       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");
53743     }
53744     function sortY(a2, b2) {
53745       return b2.loc[1] - a2.loc[1];
53746     }
53747     function fastEntityKey(d2) {
53748       var mode = context.mode();
53749       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
53750       return isMoving ? d2.id : osmEntity.key(d2);
53751     }
53752     function drawTargets(selection2, graph, entities, filter2) {
53753       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53754       var getTransform = svgPointTransform(projection2).geojson;
53755       var activeID = context.activeID();
53756       var data = [];
53757       entities.forEach(function(node) {
53758         if (activeID === node.id)
53759           return;
53760         data.push({
53761           type: "Feature",
53762           id: node.id,
53763           properties: {
53764             target: true,
53765             entity: node
53766           },
53767           geometry: node.asGeoJSON()
53768         });
53769       });
53770       var targets = selection2.selectAll(".point.target").filter(function(d2) {
53771         return filter2(d2.properties.entity);
53772       }).data(data, function key(d2) {
53773         return d2.id;
53774       });
53775       targets.exit().remove();
53776       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
53777         return "node point target " + fillClass + d2.id;
53778       }).attr("transform", getTransform);
53779     }
53780     function drawPoints(selection2, graph, entities, filter2) {
53781       var wireframe = context.surface().classed("fill-wireframe");
53782       var zoom = geoScaleToZoom(projection2.scale());
53783       var base = context.history().base();
53784       function renderAsPoint(entity) {
53785         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
53786       }
53787       var points = wireframe ? [] : entities.filter(renderAsPoint);
53788       points.sort(sortY);
53789       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
53790       var touchLayer = selection2.selectAll(".layer-touch.points");
53791       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
53792       groups.exit().remove();
53793       var enter = groups.enter().append("g").attr("class", function(d2) {
53794         return "node point " + d2.id;
53795       }).order();
53796       enter.append("path").call(markerPath, "shadow");
53797       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
53798       enter.append("path").call(markerPath, "stroke");
53799       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
53800       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
53801         return !base.entities[d2.id];
53802       }).classed("moved", function(d2) {
53803         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
53804       }).classed("retagged", function(d2) {
53805         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
53806       }).call(svgTagClasses());
53807       groups.select(".shadow");
53808       groups.select(".stroke");
53809       groups.select(".icon").attr("xlink:href", function(entity) {
53810         var preset = _mainPresetIndex.match(entity, graph);
53811         var picon = preset && preset.icon;
53812         return picon ? "#" + picon : "";
53813       });
53814       touchLayer.call(drawTargets, graph, points, filter2);
53815     }
53816     return drawPoints;
53817   }
53818
53819   // modules/svg/turns.js
53820   function svgTurns(projection2, context) {
53821     function icon2(turn) {
53822       var u2 = turn.u ? "-u" : "";
53823       if (turn.no)
53824         return "#iD-turn-no" + u2;
53825       if (turn.only)
53826         return "#iD-turn-only" + u2;
53827       return "#iD-turn-yes" + u2;
53828     }
53829     function drawTurns(selection2, graph, turns) {
53830       function turnTransform(d2) {
53831         var pxRadius = 50;
53832         var toWay = graph.entity(d2.to.way);
53833         var toPoints = graph.childNodes(toWay).map(function(n3) {
53834           return n3.loc;
53835         }).map(projection2);
53836         var toLength = geoPathLength(toPoints);
53837         var mid = toLength / 2;
53838         var toNode = graph.entity(d2.to.node);
53839         var toVertex = graph.entity(d2.to.vertex);
53840         var a2 = geoAngle(toVertex, toNode, projection2);
53841         var o2 = projection2(toVertex.loc);
53842         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
53843         return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
53844       }
53845       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
53846       var touchLayer = selection2.selectAll(".layer-touch.turns");
53847       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
53848         return d2.key;
53849       });
53850       groups.exit().remove();
53851       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
53852         return "turn " + d2.key;
53853       });
53854       var turnsEnter = groupsEnter.filter(function(d2) {
53855         return !d2.u;
53856       });
53857       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53858       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53859       var uEnter = groupsEnter.filter(function(d2) {
53860         return d2.u;
53861       });
53862       uEnter.append("circle").attr("r", "16");
53863       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
53864       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
53865         return d2.direct === false ? "0.7" : null;
53866       }).attr("transform", turnTransform);
53867       groups.select("use").attr("xlink:href", icon2);
53868       groups.select("rect");
53869       groups.select("circle");
53870       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53871       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
53872         return d2.key;
53873       });
53874       groups.exit().remove();
53875       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
53876         return "turn " + d2.key;
53877       });
53878       turnsEnter = groupsEnter.filter(function(d2) {
53879         return !d2.u;
53880       });
53881       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53882       uEnter = groupsEnter.filter(function(d2) {
53883         return d2.u;
53884       });
53885       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
53886       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
53887       groups.select("rect");
53888       groups.select("circle");
53889       return this;
53890     }
53891     return drawTurns;
53892   }
53893
53894   // modules/svg/vertices.js
53895   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
53896   function svgVertices(projection2, context) {
53897     var radiuses = {
53898       //       z16-, z17,   z18+,  w/icon
53899       shadow: [6, 7.5, 7.5, 12],
53900       stroke: [2.5, 3.5, 3.5, 8],
53901       fill: [1, 1.5, 1.5, 1.5]
53902     };
53903     var _currHoverTarget;
53904     var _currPersistent = {};
53905     var _currHover = {};
53906     var _prevHover = {};
53907     var _currSelected = {};
53908     var _prevSelected = {};
53909     var _radii = {};
53910     function sortY(a2, b2) {
53911       return b2.loc[1] - a2.loc[1];
53912     }
53913     function fastEntityKey(d2) {
53914       var mode = context.mode();
53915       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
53916       return isMoving ? d2.id : osmEntity.key(d2);
53917     }
53918     function draw(selection2, graph, vertices, sets2, filter2) {
53919       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
53920       var icons = {};
53921       var directions = {};
53922       var wireframe = context.surface().classed("fill-wireframe");
53923       var zoom = geoScaleToZoom(projection2.scale());
53924       var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
53925       var activeID = context.activeID();
53926       var base = context.history().base();
53927       function getIcon(d2) {
53928         var entity = graph.entity(d2.id);
53929         if (entity.id in icons)
53930           return icons[entity.id];
53931         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
53932         return icons[entity.id];
53933       }
53934       function getDirections(entity) {
53935         if (entity.id in directions)
53936           return directions[entity.id];
53937         var angles = entity.directions(graph, projection2);
53938         directions[entity.id] = angles.length ? angles : false;
53939         return angles;
53940       }
53941       function updateAttributes(selection3) {
53942         ["shadow", "stroke", "fill"].forEach(function(klass) {
53943           var rads = radiuses[klass];
53944           selection3.selectAll("." + klass).each(function(entity) {
53945             var i3 = z2 && getIcon(entity);
53946             var r2 = rads[i3 ? 3 : z2];
53947             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
53948               r2 += 1.5;
53949             }
53950             if (klass === "shadow") {
53951               _radii[entity.id] = r2;
53952             }
53953             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
53954           });
53955         });
53956       }
53957       vertices.sort(sortY);
53958       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
53959       groups.exit().remove();
53960       var enter = groups.enter().append("g").attr("class", function(d2) {
53961         return "node vertex " + d2.id;
53962       }).order();
53963       enter.append("circle").attr("class", "shadow");
53964       enter.append("circle").attr("class", "stroke");
53965       enter.filter(function(d2) {
53966         return d2.hasInterestingTags();
53967       }).append("circle").attr("class", "fill");
53968       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
53969         return d2.id in sets2.selected;
53970       }).classed("shared", function(d2) {
53971         return graph.isShared(d2);
53972       }).classed("endpoint", function(d2) {
53973         return d2.isEndpoint(graph);
53974       }).classed("added", function(d2) {
53975         return !base.entities[d2.id];
53976       }).classed("moved", function(d2) {
53977         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
53978       }).classed("retagged", function(d2) {
53979         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
53980       }).call(updateAttributes);
53981       var iconUse = groups.selectAll(".icon").data(function data(d2) {
53982         return zoom >= 17 && getIcon(d2) ? [d2] : [];
53983       }, fastEntityKey);
53984       iconUse.exit().remove();
53985       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
53986         var picon = getIcon(d2);
53987         return picon ? "#" + picon : "";
53988       });
53989       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
53990         return zoom >= 18 && getDirections(d2) ? [d2] : [];
53991       }, fastEntityKey);
53992       dgroups.exit().remove();
53993       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
53994       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
53995         return osmEntity.key(d2);
53996       });
53997       viewfields.exit().remove();
53998       viewfields.enter().append("path").attr("class", "viewfield").attr("d", "M0,0H0").merge(viewfields).attr("marker-start", "url(#ideditor-viewfield-marker" + (wireframe ? "-wireframe" : "") + ")").attr("transform", function(d2) {
53999         return "rotate(" + d2 + ")";
54000       });
54001     }
54002     function drawTargets(selection2, graph, entities, filter2) {
54003       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
54004       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
54005       var getTransform = svgPointTransform(projection2).geojson;
54006       var activeID = context.activeID();
54007       var data = { targets: [], nopes: [] };
54008       entities.forEach(function(node) {
54009         if (activeID === node.id)
54010           return;
54011         var vertexType = svgPassiveVertex(node, graph, activeID);
54012         if (vertexType !== 0) {
54013           data.targets.push({
54014             type: "Feature",
54015             id: node.id,
54016             properties: {
54017               target: true,
54018               entity: node
54019             },
54020             geometry: node.asGeoJSON()
54021           });
54022         } else {
54023           data.nopes.push({
54024             type: "Feature",
54025             id: node.id + "-nope",
54026             properties: {
54027               nope: true,
54028               target: true,
54029               entity: node
54030             },
54031             geometry: node.asGeoJSON()
54032           });
54033         }
54034       });
54035       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
54036         return filter2(d2.properties.entity);
54037       }).data(data.targets, function key(d2) {
54038         return d2.id;
54039       });
54040       targets.exit().remove();
54041       targets.enter().append("circle").attr("r", function(d2) {
54042         return _radii[d2.id] || radiuses.shadow[3];
54043       }).merge(targets).attr("class", function(d2) {
54044         return "node vertex target target-allowed " + targetClass + d2.id;
54045       }).attr("transform", getTransform);
54046       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
54047         return filter2(d2.properties.entity);
54048       }).data(data.nopes, function key(d2) {
54049         return d2.id;
54050       });
54051       nopes.exit().remove();
54052       nopes.enter().append("circle").attr("r", function(d2) {
54053         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
54054       }).merge(nopes).attr("class", function(d2) {
54055         return "node vertex target target-nope " + nopeClass + d2.id;
54056       }).attr("transform", getTransform);
54057     }
54058     function renderAsVertex(entity, graph, wireframe, zoom) {
54059       var geometry = entity.geometry(graph);
54060       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
54061     }
54062     function isEditedNode(node, base, head) {
54063       var baseNode = base.entities[node.id];
54064       var headNode = head.entities[node.id];
54065       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
54066     }
54067     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
54068       var results = {};
54069       var seenIds = {};
54070       function addChildVertices(entity) {
54071         if (seenIds[entity.id])
54072           return;
54073         seenIds[entity.id] = true;
54074         var geometry = entity.geometry(graph);
54075         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
54076           var i3;
54077           if (entity.type === "way") {
54078             for (i3 = 0; i3 < entity.nodes.length; i3++) {
54079               var child = graph.hasEntity(entity.nodes[i3]);
54080               if (child) {
54081                 addChildVertices(child);
54082               }
54083             }
54084           } else if (entity.type === "relation") {
54085             for (i3 = 0; i3 < entity.members.length; i3++) {
54086               var member = graph.hasEntity(entity.members[i3].id);
54087               if (member) {
54088                 addChildVertices(member);
54089               }
54090             }
54091           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
54092             results[entity.id] = entity;
54093           }
54094         }
54095       }
54096       ids.forEach(function(id2) {
54097         var entity = graph.hasEntity(id2);
54098         if (!entity)
54099           return;
54100         if (entity.type === "node") {
54101           if (renderAsVertex(entity, graph, wireframe, zoom)) {
54102             results[entity.id] = entity;
54103             graph.parentWays(entity).forEach(function(entity2) {
54104               addChildVertices(entity2);
54105             });
54106           }
54107         } else {
54108           addChildVertices(entity);
54109         }
54110       });
54111       return results;
54112     }
54113     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
54114       var wireframe = context.surface().classed("fill-wireframe");
54115       var visualDiff = context.surface().classed("highlight-edited");
54116       var zoom = geoScaleToZoom(projection2.scale());
54117       var mode = context.mode();
54118       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
54119       var base = context.history().base();
54120       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
54121       var touchLayer = selection2.selectAll(".layer-touch.points");
54122       if (fullRedraw) {
54123         _currPersistent = {};
54124         _radii = {};
54125       }
54126       for (var i3 = 0; i3 < entities.length; i3++) {
54127         var entity = entities[i3];
54128         var geometry = entity.geometry(graph);
54129         var keep = false;
54130         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
54131           _currPersistent[entity.id] = entity;
54132           keep = true;
54133         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
54134           _currPersistent[entity.id] = entity;
54135           keep = true;
54136         }
54137         if (!keep && !fullRedraw) {
54138           delete _currPersistent[entity.id];
54139         }
54140       }
54141       var sets2 = {
54142         persistent: _currPersistent,
54143         // persistent = important vertices (render always)
54144         selected: _currSelected,
54145         // selected + siblings of selected (render always)
54146         hovered: _currHover
54147         // hovered + siblings of hovered (render only in draw modes)
54148       };
54149       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
54150       var filterRendered = function(d2) {
54151         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
54152       };
54153       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
54154       var filterTouch = function(d2) {
54155         return isMoving ? true : filterRendered(d2);
54156       };
54157       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
54158       function currentVisible(which) {
54159         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
54160           return entity2 && entity2.intersects(extent, graph);
54161         });
54162       }
54163     }
54164     drawVertices.drawSelected = function(selection2, graph, extent) {
54165       var wireframe = context.surface().classed("fill-wireframe");
54166       var zoom = geoScaleToZoom(projection2.scale());
54167       _prevSelected = _currSelected || {};
54168       if (context.map().isInWideSelection()) {
54169         _currSelected = {};
54170         context.selectedIDs().forEach(function(id2) {
54171           var entity = graph.hasEntity(id2);
54172           if (!entity)
54173             return;
54174           if (entity.type === "node") {
54175             if (renderAsVertex(entity, graph, wireframe, zoom)) {
54176               _currSelected[entity.id] = entity;
54177             }
54178           }
54179         });
54180       } else {
54181         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
54182       }
54183       var filter2 = function(d2) {
54184         return d2.id in _prevSelected;
54185       };
54186       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
54187     };
54188     drawVertices.drawHover = function(selection2, graph, target, extent) {
54189       if (target === _currHoverTarget)
54190         return;
54191       var wireframe = context.surface().classed("fill-wireframe");
54192       var zoom = geoScaleToZoom(projection2.scale());
54193       _prevHover = _currHover || {};
54194       _currHoverTarget = target;
54195       var entity = target && target.properties && target.properties.entity;
54196       if (entity) {
54197         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
54198       } else {
54199         _currHover = {};
54200       }
54201       var filter2 = function(d2) {
54202         return d2.id in _prevHover;
54203       };
54204       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
54205     };
54206     return drawVertices;
54207   }
54208
54209   // modules/util/bind_once.js
54210   function utilBindOnce(target, type2, listener, capture) {
54211     var typeOnce = type2 + ".once";
54212     function one2() {
54213       target.on(typeOnce, null);
54214       listener.apply(this, arguments);
54215     }
54216     target.on(typeOnce, one2, capture);
54217     return this;
54218   }
54219
54220   // modules/util/zoom_pan.js
54221   function defaultFilter3(d3_event) {
54222     return !d3_event.ctrlKey && !d3_event.button;
54223   }
54224   function defaultExtent2() {
54225     var e3 = this;
54226     if (e3 instanceof SVGElement) {
54227       e3 = e3.ownerSVGElement || e3;
54228       if (e3.hasAttribute("viewBox")) {
54229         e3 = e3.viewBox.baseVal;
54230         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
54231       }
54232       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
54233     }
54234     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
54235   }
54236   function defaultWheelDelta2(d3_event) {
54237     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
54238   }
54239   function defaultConstrain2(transform2, extent, translateExtent) {
54240     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];
54241     return transform2.translate(
54242       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
54243       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
54244     );
54245   }
54246   function utilZoomPan() {
54247     var filter2 = defaultFilter3, extent = defaultExtent2, constrain = defaultConstrain2, wheelDelta = defaultWheelDelta2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], interpolate = zoom_default, dispatch14 = dispatch_default("start", "zoom", "end"), _wheelDelay = 150, _transform = identity2, _activeGesture;
54248     function zoom(selection2) {
54249       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
54250       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
54251     }
54252     zoom.transform = function(collection, transform2, point2) {
54253       var selection2 = collection.selection ? collection.selection() : collection;
54254       if (collection !== selection2) {
54255         schedule(collection, transform2, point2);
54256       } else {
54257         selection2.interrupt().each(function() {
54258           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
54259         });
54260       }
54261     };
54262     zoom.scaleBy = function(selection2, k2, p2) {
54263       zoom.scaleTo(selection2, function() {
54264         var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
54265         return k0 * k1;
54266       }, p2);
54267     };
54268     zoom.scaleTo = function(selection2, k2, p2) {
54269       zoom.transform(selection2, function() {
54270         var e3 = extent.apply(this, arguments), t0 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t0.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
54271         return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
54272       }, p2);
54273     };
54274     zoom.translateBy = function(selection2, x2, y2) {
54275       zoom.transform(selection2, function() {
54276         return constrain(_transform.translate(
54277           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
54278           typeof y2 === "function" ? y2.apply(this, arguments) : y2
54279         ), extent.apply(this, arguments), translateExtent);
54280       });
54281     };
54282     zoom.translateTo = function(selection2, x2, y2, p2) {
54283       zoom.transform(selection2, function() {
54284         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
54285         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
54286           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
54287           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
54288         ), e3, translateExtent);
54289       }, p2);
54290     };
54291     function scale(transform2, k2) {
54292       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
54293       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
54294     }
54295     function translate(transform2, p02, p1) {
54296       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
54297       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
54298     }
54299     function centroid(extent2) {
54300       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
54301     }
54302     function schedule(transition2, transform2, point2) {
54303       transition2.on("start.zoom", function() {
54304         gesture(this, arguments).start(null);
54305       }).on("interrupt.zoom end.zoom", function() {
54306         gesture(this, arguments).end(null);
54307       }).tween("zoom", function() {
54308         var that = this, args = arguments, g3 = gesture(that, args), e3 = extent.apply(that, args), p2 = !point2 ? centroid(e3) : typeof point2 === "function" ? point2.apply(that, args) : point2, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = _transform, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
54309         return function(t2) {
54310           if (t2 === 1) {
54311             t2 = b2;
54312           } else {
54313             var l2 = i3(t2);
54314             var k2 = w2 / l2[2];
54315             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
54316           }
54317           g3.zoom(null, null, t2);
54318         };
54319       });
54320     }
54321     function gesture(that, args, clean2) {
54322       return !clean2 && _activeGesture || new Gesture(that, args);
54323     }
54324     function Gesture(that, args) {
54325       this.that = that;
54326       this.args = args;
54327       this.active = 0;
54328       this.extent = extent.apply(that, args);
54329     }
54330     Gesture.prototype = {
54331       start: function(d3_event) {
54332         if (++this.active === 1) {
54333           _activeGesture = this;
54334           dispatch14.call("start", this, d3_event);
54335         }
54336         return this;
54337       },
54338       zoom: function(d3_event, key, transform2) {
54339         if (this.mouse && key !== "mouse")
54340           this.mouse[1] = transform2.invert(this.mouse[0]);
54341         if (this.pointer0 && key !== "touch")
54342           this.pointer0[1] = transform2.invert(this.pointer0[0]);
54343         if (this.pointer1 && key !== "touch")
54344           this.pointer1[1] = transform2.invert(this.pointer1[0]);
54345         _transform = transform2;
54346         dispatch14.call("zoom", this, d3_event, key, transform2);
54347         return this;
54348       },
54349       end: function(d3_event) {
54350         if (--this.active === 0) {
54351           _activeGesture = null;
54352           dispatch14.call("end", this, d3_event);
54353         }
54354         return this;
54355       }
54356     };
54357     function wheeled(d3_event) {
54358       if (!filter2.apply(this, arguments))
54359         return;
54360       var g3 = gesture(this, arguments), t2 = _transform, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = utilFastMouse(this)(d3_event);
54361       if (g3.wheel) {
54362         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
54363           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
54364         }
54365         clearTimeout(g3.wheel);
54366       } else {
54367         g3.mouse = [p2, t2.invert(p2)];
54368         interrupt_default(this);
54369         g3.start(d3_event);
54370       }
54371       d3_event.preventDefault();
54372       d3_event.stopImmediatePropagation();
54373       g3.wheel = setTimeout(wheelidled, _wheelDelay);
54374       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
54375       function wheelidled() {
54376         g3.wheel = null;
54377         g3.end(d3_event);
54378       }
54379     }
54380     var _downPointerIDs = /* @__PURE__ */ new Set();
54381     var _pointerLocGetter;
54382     function pointerdown(d3_event) {
54383       _downPointerIDs.add(d3_event.pointerId);
54384       if (!filter2.apply(this, arguments))
54385         return;
54386       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
54387       var started;
54388       d3_event.stopImmediatePropagation();
54389       _pointerLocGetter = utilFastMouse(this);
54390       var loc = _pointerLocGetter(d3_event);
54391       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
54392       if (!g3.pointer0) {
54393         g3.pointer0 = p2;
54394         started = true;
54395       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
54396         g3.pointer1 = p2;
54397       }
54398       if (started) {
54399         interrupt_default(this);
54400         g3.start(d3_event);
54401       }
54402     }
54403     function pointermove(d3_event) {
54404       if (!_downPointerIDs.has(d3_event.pointerId))
54405         return;
54406       if (!_activeGesture || !_pointerLocGetter)
54407         return;
54408       var g3 = gesture(this, arguments);
54409       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
54410       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
54411       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
54412         if (g3.pointer0)
54413           _downPointerIDs.delete(g3.pointer0[2]);
54414         if (g3.pointer1)
54415           _downPointerIDs.delete(g3.pointer1[2]);
54416         g3.end(d3_event);
54417         return;
54418       }
54419       d3_event.preventDefault();
54420       d3_event.stopImmediatePropagation();
54421       var loc = _pointerLocGetter(d3_event);
54422       var t2, p2, l2;
54423       if (isPointer0)
54424         g3.pointer0[0] = loc;
54425       else if (isPointer1)
54426         g3.pointer1[0] = loc;
54427       t2 = _transform;
54428       if (g3.pointer1) {
54429         var p02 = g3.pointer0[0], l0 = g3.pointer0[1], p1 = g3.pointer1[0], l1 = g3.pointer1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
54430         t2 = scale(t2, Math.sqrt(dp / dl));
54431         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
54432         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
54433       } else if (g3.pointer0) {
54434         p2 = g3.pointer0[0];
54435         l2 = g3.pointer0[1];
54436       } else {
54437         return;
54438       }
54439       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
54440     }
54441     function pointerup(d3_event) {
54442       if (!_downPointerIDs.has(d3_event.pointerId))
54443         return;
54444       _downPointerIDs.delete(d3_event.pointerId);
54445       if (!_activeGesture)
54446         return;
54447       var g3 = gesture(this, arguments);
54448       d3_event.stopImmediatePropagation();
54449       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId)
54450         delete g3.pointer0;
54451       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId)
54452         delete g3.pointer1;
54453       if (g3.pointer1 && !g3.pointer0) {
54454         g3.pointer0 = g3.pointer1;
54455         delete g3.pointer1;
54456       }
54457       if (g3.pointer0) {
54458         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
54459       } else {
54460         g3.end(d3_event);
54461       }
54462     }
54463     zoom.wheelDelta = function(_2) {
54464       return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
54465     };
54466     zoom.filter = function(_2) {
54467       return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
54468     };
54469     zoom.extent = function(_2) {
54470       return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
54471     };
54472     zoom.scaleExtent = function(_2) {
54473       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
54474     };
54475     zoom.translateExtent = function(_2) {
54476       return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
54477     };
54478     zoom.constrain = function(_2) {
54479       return arguments.length ? (constrain = _2, zoom) : constrain;
54480     };
54481     zoom.interpolate = function(_2) {
54482       return arguments.length ? (interpolate = _2, zoom) : interpolate;
54483     };
54484     zoom._transform = function(_2) {
54485       return arguments.length ? (_transform = _2, zoom) : _transform;
54486     };
54487     return utilRebind(zoom, dispatch14, "on");
54488   }
54489
54490   // modules/util/double_up.js
54491   function utilDoubleUp() {
54492     var dispatch14 = dispatch_default("doubleUp");
54493     var _maxTimespan = 500;
54494     var _maxDistance = 20;
54495     var _pointer;
54496     function pointerIsValidFor(loc) {
54497       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
54498       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
54499     }
54500     function pointerdown(d3_event) {
54501       if (d3_event.ctrlKey || d3_event.button === 2)
54502         return;
54503       var loc = [d3_event.clientX, d3_event.clientY];
54504       if (_pointer && !pointerIsValidFor(loc)) {
54505         _pointer = void 0;
54506       }
54507       if (!_pointer) {
54508         _pointer = {
54509           startLoc: loc,
54510           startTime: (/* @__PURE__ */ new Date()).getTime(),
54511           upCount: 0,
54512           pointerId: d3_event.pointerId
54513         };
54514       } else {
54515         _pointer.pointerId = d3_event.pointerId;
54516       }
54517     }
54518     function pointerup(d3_event) {
54519       if (d3_event.ctrlKey || d3_event.button === 2)
54520         return;
54521       if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
54522         return;
54523       _pointer.upCount += 1;
54524       if (_pointer.upCount === 2) {
54525         var loc = [d3_event.clientX, d3_event.clientY];
54526         if (pointerIsValidFor(loc)) {
54527           var locInThis = utilFastMouse(this)(d3_event);
54528           dispatch14.call("doubleUp", this, d3_event, locInThis);
54529         }
54530         _pointer = void 0;
54531       }
54532     }
54533     function doubleUp(selection2) {
54534       if ("PointerEvent" in window) {
54535         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
54536       } else {
54537         selection2.on("dblclick.doubleUp", function(d3_event) {
54538           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
54539         });
54540       }
54541     }
54542     doubleUp.off = function(selection2) {
54543       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
54544     };
54545     return utilRebind(doubleUp, dispatch14, "on");
54546   }
54547
54548   // modules/renderer/map.js
54549   var TILESIZE = 256;
54550   var minZoom2 = 2;
54551   var maxZoom = 24;
54552   var kMin = geoZoomToScale(minZoom2, TILESIZE);
54553   var kMax = geoZoomToScale(maxZoom, TILESIZE);
54554   function clamp(num, min3, max3) {
54555     return Math.max(min3, Math.min(num, max3));
54556   }
54557   function rendererMap(context) {
54558     var dispatch14 = dispatch_default(
54559       "move",
54560       "drawn",
54561       "crossEditableZoom",
54562       "hitMinZoom",
54563       "changeHighlighting",
54564       "changeAreaFill"
54565     );
54566     var projection2 = context.projection;
54567     var curtainProjection = context.curtainProjection;
54568     var drawLayers;
54569     var drawPoints;
54570     var drawVertices;
54571     var drawLines;
54572     var drawAreas;
54573     var drawMidpoints;
54574     var drawLabels;
54575     var _selection = select_default2(null);
54576     var supersurface = select_default2(null);
54577     var wrapper = select_default2(null);
54578     var surface = select_default2(null);
54579     var _dimensions = [1, 1];
54580     var _dblClickZoomEnabled = true;
54581     var _redrawEnabled = true;
54582     var _gestureTransformStart;
54583     var _transformStart = projection2.transform();
54584     var _transformLast;
54585     var _isTransformed = false;
54586     var _minzoom = 0;
54587     var _getMouseCoords;
54588     var _lastPointerEvent;
54589     var _lastWithinEditableZoom;
54590     var _pointerDown = false;
54591     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
54592     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
54593     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
54594       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
54595     }).on("end.map", function() {
54596       _pointerDown = false;
54597     });
54598     var _doubleUpHandler = utilDoubleUp();
54599     var scheduleRedraw = throttle_default(redraw, 750);
54600     function cancelPendingRedraw() {
54601       scheduleRedraw.cancel();
54602     }
54603     function map2(selection2) {
54604       _selection = selection2;
54605       context.on("change.map", immediateRedraw);
54606       var osm = context.connection();
54607       if (osm) {
54608         osm.on("change.map", immediateRedraw);
54609       }
54610       function didUndoOrRedo(targetTransform) {
54611         var mode = context.mode().id;
54612         if (mode !== "browse" && mode !== "select")
54613           return;
54614         if (targetTransform) {
54615           map2.transformEase(targetTransform);
54616         }
54617       }
54618       context.history().on("merge.map", function() {
54619         scheduleRedraw();
54620       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
54621         didUndoOrRedo(fromStack.transform);
54622       }).on("redone.map", function(stack) {
54623         didUndoOrRedo(stack.transform);
54624       });
54625       context.background().on("change.map", immediateRedraw);
54626       context.features().on("redraw.map", immediateRedraw);
54627       drawLayers.on("change.map", function() {
54628         context.background().updateImagery();
54629         immediateRedraw();
54630       });
54631       selection2.on("wheel.map mousewheel.map", function(d3_event) {
54632         d3_event.preventDefault();
54633       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
54634       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
54635       wrapper = supersurface.append("div").attr("class", "layer layer-data");
54636       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
54637       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
54638         _lastPointerEvent = d3_event;
54639         if (d3_event.button === 2) {
54640           d3_event.stopPropagation();
54641         }
54642       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
54643         _lastPointerEvent = d3_event;
54644         if (resetTransform()) {
54645           immediateRedraw();
54646         }
54647       }).on(_pointerPrefix + "move.map", function(d3_event) {
54648         _lastPointerEvent = d3_event;
54649       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
54650         if (map2.editableDataEnabled() && !_isTransformed) {
54651           var hover = d3_event.target.__data__;
54652           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
54653           dispatch14.call("drawn", this, { full: false });
54654         }
54655       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
54656         if (map2.editableDataEnabled() && !_isTransformed) {
54657           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
54658           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
54659           dispatch14.call("drawn", this, { full: false });
54660         }
54661       });
54662       var detected = utilDetect();
54663       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
54664       // but we only need to do this on desktop Safari anyway. – #7694
54665       !detected.isMobileWebKit) {
54666         surface.on("gesturestart.surface", function(d3_event) {
54667           d3_event.preventDefault();
54668           _gestureTransformStart = projection2.transform();
54669         }).on("gesturechange.surface", gestureChange);
54670       }
54671       updateAreaFill();
54672       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
54673         if (!_dblClickZoomEnabled)
54674           return;
54675         if (typeof d3_event.target.__data__ === "object" && // or area fills
54676         !select_default2(d3_event.target).classed("fill"))
54677           return;
54678         var zoomOut2 = d3_event.shiftKey;
54679         var t2 = projection2.transform();
54680         var p1 = t2.invert(p02);
54681         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
54682         t2.x = p02[0] - p1[0] * t2.k;
54683         t2.y = p02[1] - p1[1] * t2.k;
54684         map2.transformEase(t2);
54685       });
54686       context.on("enter.map", function() {
54687         if (!map2.editableDataEnabled(
54688           true
54689           /* skip zoom check */
54690         ))
54691           return;
54692         if (_isTransformed)
54693           return;
54694         var graph = context.graph();
54695         var selectedAndParents = {};
54696         context.selectedIDs().forEach(function(id2) {
54697           var entity = graph.hasEntity(id2);
54698           if (entity) {
54699             selectedAndParents[entity.id] = entity;
54700             if (entity.type === "node") {
54701               graph.parentWays(entity).forEach(function(parent) {
54702                 selectedAndParents[parent.id] = parent;
54703               });
54704             }
54705           }
54706         });
54707         var data = Object.values(selectedAndParents);
54708         var filter2 = function(d2) {
54709           return d2.id in selectedAndParents;
54710         };
54711         data = context.features().filter(data, graph);
54712         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
54713         dispatch14.call("drawn", this, { full: false });
54714         scheduleRedraw();
54715       });
54716       map2.dimensions(utilGetDimensions(selection2));
54717     }
54718     function zoomEventFilter(d3_event) {
54719       if (d3_event.type === "mousedown") {
54720         var hasOrphan = false;
54721         var listeners = window.__on;
54722         for (var i3 = 0; i3 < listeners.length; i3++) {
54723           var listener = listeners[i3];
54724           if (listener.name === "zoom" && listener.type === "mouseup") {
54725             hasOrphan = true;
54726             break;
54727           }
54728         }
54729         if (hasOrphan) {
54730           var event = window.CustomEvent;
54731           if (event) {
54732             event = new event("mouseup");
54733           } else {
54734             event = window.document.createEvent("Event");
54735             event.initEvent("mouseup", false, false);
54736           }
54737           event.view = window;
54738           window.dispatchEvent(event);
54739         }
54740       }
54741       return d3_event.button !== 2;
54742     }
54743     function pxCenter() {
54744       return [_dimensions[0] / 2, _dimensions[1] / 2];
54745     }
54746     function drawEditable(difference, extent) {
54747       var mode = context.mode();
54748       var graph = context.graph();
54749       var features = context.features();
54750       var all = context.history().intersects(map2.extent());
54751       var fullRedraw = false;
54752       var data;
54753       var set3;
54754       var filter2;
54755       var applyFeatureLayerFilters = true;
54756       if (map2.isInWideSelection()) {
54757         data = [];
54758         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
54759           var entity = context.hasEntity(id2);
54760           if (entity)
54761             data.push(entity);
54762         });
54763         fullRedraw = true;
54764         filter2 = utilFunctor(true);
54765         applyFeatureLayerFilters = false;
54766       } else if (difference) {
54767         var complete = difference.complete(map2.extent());
54768         data = Object.values(complete).filter(Boolean);
54769         set3 = new Set(Object.keys(complete));
54770         filter2 = function(d2) {
54771           return set3.has(d2.id);
54772         };
54773         features.clear(data);
54774       } else {
54775         if (features.gatherStats(all, graph, _dimensions)) {
54776           extent = void 0;
54777         }
54778         if (extent) {
54779           data = context.history().intersects(map2.extent().intersection(extent));
54780           set3 = new Set(data.map(function(entity) {
54781             return entity.id;
54782           }));
54783           filter2 = function(d2) {
54784             return set3.has(d2.id);
54785           };
54786         } else {
54787           data = all;
54788           fullRedraw = true;
54789           filter2 = utilFunctor(true);
54790         }
54791       }
54792       if (applyFeatureLayerFilters) {
54793         data = features.filter(data, graph);
54794       } else {
54795         context.features().resetStats();
54796       }
54797       if (mode && mode.id === "select") {
54798         surface.call(drawVertices.drawSelected, graph, map2.extent());
54799       }
54800       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);
54801       dispatch14.call("drawn", this, { full: true });
54802     }
54803     map2.init = function() {
54804       drawLayers = svgLayers(projection2, context);
54805       drawPoints = svgPoints(projection2, context);
54806       drawVertices = svgVertices(projection2, context);
54807       drawLines = svgLines(projection2, context);
54808       drawAreas = svgAreas(projection2, context);
54809       drawMidpoints = svgMidpoints(projection2, context);
54810       drawLabels = svgLabels(projection2, context);
54811     };
54812     function editOff() {
54813       context.features().resetStats();
54814       surface.selectAll(".layer-osm *").remove();
54815       surface.selectAll(".layer-touch:not(.markers) *").remove();
54816       var allowed = {
54817         "browse": true,
54818         "save": true,
54819         "select-note": true,
54820         "select-data": true,
54821         "select-error": true
54822       };
54823       var mode = context.mode();
54824       if (mode && !allowed[mode.id]) {
54825         context.enter(modeBrowse(context));
54826       }
54827       dispatch14.call("drawn", this, { full: true });
54828     }
54829     function gestureChange(d3_event) {
54830       var e3 = d3_event;
54831       e3.preventDefault();
54832       var props = {
54833         deltaMode: 0,
54834         // dummy values to ignore in zoomPan
54835         deltaY: 1,
54836         // dummy values to ignore in zoomPan
54837         clientX: e3.clientX,
54838         clientY: e3.clientY,
54839         screenX: e3.screenX,
54840         screenY: e3.screenY,
54841         x: e3.x,
54842         y: e3.y
54843       };
54844       var e22 = new WheelEvent("wheel", props);
54845       e22._scale = e3.scale;
54846       e22._rotation = e3.rotation;
54847       _selection.node().dispatchEvent(e22);
54848     }
54849     function zoomPan2(event, key, transform2) {
54850       var source = event && event.sourceEvent || event;
54851       var eventTransform = transform2 || event && event.transform;
54852       var x2 = eventTransform.x;
54853       var y2 = eventTransform.y;
54854       var k2 = eventTransform.k;
54855       if (source && source.type === "wheel") {
54856         if (_pointerDown)
54857           return;
54858         var detected = utilDetect();
54859         var dX = source.deltaX;
54860         var dY = source.deltaY;
54861         var x22 = x2;
54862         var y22 = y2;
54863         var k22 = k2;
54864         var t0, p02, p1;
54865         if (source.deltaMode === 1) {
54866           var lines = Math.abs(source.deltaY);
54867           var sign2 = source.deltaY > 0 ? 1 : -1;
54868           dY = sign2 * clamp(
54869             Math.exp((lines - 1) * 0.75) * 4.000244140625,
54870             4.000244140625,
54871             // min
54872             350.000244140625
54873             // max
54874           );
54875           if (detected.os !== "mac") {
54876             dY *= 5;
54877           }
54878           t0 = _isTransformed ? _transformLast : _transformStart;
54879           p02 = _getMouseCoords(source);
54880           p1 = t0.invert(p02);
54881           k22 = t0.k * Math.pow(2, -dY / 500);
54882           k22 = clamp(k22, kMin, kMax);
54883           x22 = p02[0] - p1[0] * k22;
54884           y22 = p02[1] - p1[1] * k22;
54885         } else if (source._scale) {
54886           t0 = _gestureTransformStart;
54887           p02 = _getMouseCoords(source);
54888           p1 = t0.invert(p02);
54889           k22 = t0.k * source._scale;
54890           k22 = clamp(k22, kMin, kMax);
54891           x22 = p02[0] - p1[0] * k22;
54892           y22 = p02[1] - p1[1] * k22;
54893         } else if (source.ctrlKey && !isInteger(dY)) {
54894           dY *= 6;
54895           t0 = _isTransformed ? _transformLast : _transformStart;
54896           p02 = _getMouseCoords(source);
54897           p1 = t0.invert(p02);
54898           k22 = t0.k * Math.pow(2, -dY / 500);
54899           k22 = clamp(k22, kMin, kMax);
54900           x22 = p02[0] - p1[0] * k22;
54901           y22 = p02[1] - p1[1] * k22;
54902         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
54903           t0 = _isTransformed ? _transformLast : _transformStart;
54904           p02 = _getMouseCoords(source);
54905           p1 = t0.invert(p02);
54906           k22 = t0.k * Math.pow(2, -dY / 500);
54907           k22 = clamp(k22, kMin, kMax);
54908           x22 = p02[0] - p1[0] * k22;
54909           y22 = p02[1] - p1[1] * k22;
54910         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
54911           p1 = projection2.translate();
54912           x22 = p1[0] - dX;
54913           y22 = p1[1] - dY;
54914           k22 = projection2.scale();
54915           k22 = clamp(k22, kMin, kMax);
54916         }
54917         if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
54918           x2 = x22;
54919           y2 = y22;
54920           k2 = k22;
54921           eventTransform = identity2.translate(x22, y22).scale(k22);
54922           if (_zoomerPanner._transform) {
54923             _zoomerPanner._transform(eventTransform);
54924           } else {
54925             _selection.node().__zoom = eventTransform;
54926           }
54927         }
54928       }
54929       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
54930         return;
54931       }
54932       if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
54933         surface.interrupt();
54934         dispatch14.call("hitMinZoom", this, map2);
54935         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
54936         scheduleRedraw();
54937         dispatch14.call("move", this, map2);
54938         return;
54939       }
54940       projection2.transform(eventTransform);
54941       var withinEditableZoom = map2.withinEditableZoom();
54942       if (_lastWithinEditableZoom !== withinEditableZoom) {
54943         if (_lastWithinEditableZoom !== void 0) {
54944           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
54945         }
54946         _lastWithinEditableZoom = withinEditableZoom;
54947       }
54948       var scale = k2 / _transformStart.k;
54949       var tX = (x2 / scale - _transformStart.x) * scale;
54950       var tY = (y2 / scale - _transformStart.y) * scale;
54951       if (context.inIntro()) {
54952         curtainProjection.transform({
54953           x: x2 - tX,
54954           y: y2 - tY,
54955           k: k2
54956         });
54957       }
54958       if (source) {
54959         _lastPointerEvent = event;
54960       }
54961       _isTransformed = true;
54962       _transformLast = eventTransform;
54963       utilSetTransform(supersurface, tX, tY, scale);
54964       scheduleRedraw();
54965       dispatch14.call("move", this, map2);
54966       function isInteger(val) {
54967         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
54968       }
54969     }
54970     function resetTransform() {
54971       if (!_isTransformed)
54972         return false;
54973       utilSetTransform(supersurface, 0, 0);
54974       _isTransformed = false;
54975       if (context.inIntro()) {
54976         curtainProjection.transform(projection2.transform());
54977       }
54978       return true;
54979     }
54980     function redraw(difference, extent) {
54981       if (surface.empty() || !_redrawEnabled)
54982         return;
54983       if (resetTransform()) {
54984         difference = extent = void 0;
54985       }
54986       var zoom = map2.zoom();
54987       var z2 = String(~~zoom);
54988       if (surface.attr("data-zoom") !== z2) {
54989         surface.attr("data-zoom", z2);
54990       }
54991       var lat = map2.center()[1];
54992       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
54993       surface.classed("low-zoom", zoom <= lowzoom(lat));
54994       if (!difference) {
54995         supersurface.call(context.background());
54996         wrapper.call(drawLayers);
54997       }
54998       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
54999         context.loadTiles(projection2);
55000         drawEditable(difference, extent);
55001       } else {
55002         editOff();
55003       }
55004       _transformStart = projection2.transform();
55005       return map2;
55006     }
55007     var immediateRedraw = function(difference, extent) {
55008       if (!difference && !extent)
55009         cancelPendingRedraw();
55010       redraw(difference, extent);
55011     };
55012     map2.lastPointerEvent = function() {
55013       return _lastPointerEvent;
55014     };
55015     map2.mouse = function(d3_event) {
55016       var event = d3_event || _lastPointerEvent;
55017       if (event) {
55018         var s2;
55019         while (s2 = event.sourceEvent) {
55020           event = s2;
55021         }
55022         return _getMouseCoords(event);
55023       }
55024       return null;
55025     };
55026     map2.mouseCoordinates = function() {
55027       var coord2 = map2.mouse() || pxCenter();
55028       return projection2.invert(coord2);
55029     };
55030     map2.dblclickZoomEnable = function(val) {
55031       if (!arguments.length)
55032         return _dblClickZoomEnabled;
55033       _dblClickZoomEnabled = val;
55034       return map2;
55035     };
55036     map2.redrawEnable = function(val) {
55037       if (!arguments.length)
55038         return _redrawEnabled;
55039       _redrawEnabled = val;
55040       return map2;
55041     };
55042     map2.isTransformed = function() {
55043       return _isTransformed;
55044     };
55045     function setTransform(t2, duration, force) {
55046       var t3 = projection2.transform();
55047       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y)
55048         return false;
55049       if (duration) {
55050         _selection.transition().duration(duration).on("start", function() {
55051           map2.startEase();
55052         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
55053       } else {
55054         projection2.transform(t2);
55055         _transformStart = t2;
55056         _selection.call(_zoomerPanner.transform, _transformStart);
55057       }
55058       return true;
55059     }
55060     function setCenterZoom(loc2, z2, duration, force) {
55061       var c2 = map2.center();
55062       var z3 = map2.zoom();
55063       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force)
55064         return false;
55065       var proj = geoRawMercator().transform(projection2.transform());
55066       var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
55067       proj.scale(k2);
55068       var t2 = proj.translate();
55069       var point2 = proj(loc2);
55070       var center = pxCenter();
55071       t2[0] += center[0] - point2[0];
55072       t2[1] += center[1] - point2[1];
55073       return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
55074     }
55075     map2.pan = function(delta, duration) {
55076       var t2 = projection2.translate();
55077       var k2 = projection2.scale();
55078       t2[0] += delta[0];
55079       t2[1] += delta[1];
55080       if (duration) {
55081         _selection.transition().duration(duration).on("start", function() {
55082           map2.startEase();
55083         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
55084       } else {
55085         projection2.translate(t2);
55086         _transformStart = projection2.transform();
55087         _selection.call(_zoomerPanner.transform, _transformStart);
55088         dispatch14.call("move", this, map2);
55089         immediateRedraw();
55090       }
55091       return map2;
55092     };
55093     map2.dimensions = function(val) {
55094       if (!arguments.length)
55095         return _dimensions;
55096       _dimensions = val;
55097       drawLayers.dimensions(_dimensions);
55098       context.background().dimensions(_dimensions);
55099       projection2.clipExtent([[0, 0], _dimensions]);
55100       _getMouseCoords = utilFastMouse(supersurface.node());
55101       scheduleRedraw();
55102       return map2;
55103     };
55104     function zoomIn(delta) {
55105       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
55106     }
55107     function zoomOut(delta) {
55108       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
55109     }
55110     map2.zoomIn = function() {
55111       zoomIn(1);
55112     };
55113     map2.zoomInFurther = function() {
55114       zoomIn(4);
55115     };
55116     map2.canZoomIn = function() {
55117       return map2.zoom() < maxZoom;
55118     };
55119     map2.zoomOut = function() {
55120       zoomOut(1);
55121     };
55122     map2.zoomOutFurther = function() {
55123       zoomOut(4);
55124     };
55125     map2.canZoomOut = function() {
55126       return map2.zoom() > minZoom2;
55127     };
55128     map2.center = function(loc2) {
55129       if (!arguments.length) {
55130         return projection2.invert(pxCenter());
55131       }
55132       if (setCenterZoom(loc2, map2.zoom())) {
55133         dispatch14.call("move", this, map2);
55134       }
55135       scheduleRedraw();
55136       return map2;
55137     };
55138     map2.unobscuredCenterZoomEase = function(loc, zoom) {
55139       var offset = map2.unobscuredOffsetPx();
55140       var proj = geoRawMercator().transform(projection2.transform());
55141       proj.scale(geoZoomToScale(zoom, TILESIZE));
55142       var locPx = proj(loc);
55143       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
55144       var offsetLoc = proj.invert(offsetLocPx);
55145       map2.centerZoomEase(offsetLoc, zoom);
55146     };
55147     map2.unobscuredOffsetPx = function() {
55148       var openPane = context.container().select(".map-panes .map-pane.shown");
55149       if (!openPane.empty()) {
55150         return [openPane.node().offsetWidth / 2, 0];
55151       }
55152       return [0, 0];
55153     };
55154     map2.zoom = function(z2) {
55155       if (!arguments.length) {
55156         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
55157       }
55158       if (z2 < _minzoom) {
55159         surface.interrupt();
55160         dispatch14.call("hitMinZoom", this, map2);
55161         z2 = context.minEditableZoom();
55162       }
55163       if (setCenterZoom(map2.center(), z2)) {
55164         dispatch14.call("move", this, map2);
55165       }
55166       scheduleRedraw();
55167       return map2;
55168     };
55169     map2.centerZoom = function(loc2, z2) {
55170       if (setCenterZoom(loc2, z2)) {
55171         dispatch14.call("move", this, map2);
55172       }
55173       scheduleRedraw();
55174       return map2;
55175     };
55176     map2.zoomTo = function(entity) {
55177       var extent = entity.extent(context.graph());
55178       if (!isFinite(extent.area()))
55179         return map2;
55180       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
55181       return map2.centerZoom(extent.center(), z2);
55182     };
55183     map2.centerEase = function(loc2, duration) {
55184       duration = duration || 250;
55185       setCenterZoom(loc2, map2.zoom(), duration);
55186       return map2;
55187     };
55188     map2.zoomEase = function(z2, duration) {
55189       duration = duration || 250;
55190       setCenterZoom(map2.center(), z2, duration, false);
55191       return map2;
55192     };
55193     map2.centerZoomEase = function(loc2, z2, duration) {
55194       duration = duration || 250;
55195       setCenterZoom(loc2, z2, duration, false);
55196       return map2;
55197     };
55198     map2.transformEase = function(t2, duration) {
55199       duration = duration || 250;
55200       setTransform(
55201         t2,
55202         duration,
55203         false
55204         /* don't force */
55205       );
55206       return map2;
55207     };
55208     map2.zoomToEase = function(obj, duration) {
55209       var extent;
55210       if (Array.isArray(obj)) {
55211         obj.forEach(function(entity) {
55212           var entityExtent = entity.extent(context.graph());
55213           if (!extent) {
55214             extent = entityExtent;
55215           } else {
55216             extent = extent.extend(entityExtent);
55217           }
55218         });
55219       } else {
55220         extent = obj.extent(context.graph());
55221       }
55222       if (!isFinite(extent.area()))
55223         return map2;
55224       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
55225       return map2.centerZoomEase(extent.center(), z2, duration);
55226     };
55227     map2.startEase = function() {
55228       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
55229         map2.cancelEase();
55230       });
55231       return map2;
55232     };
55233     map2.cancelEase = function() {
55234       _selection.interrupt();
55235       return map2;
55236     };
55237     map2.extent = function(val) {
55238       if (!arguments.length) {
55239         return new geoExtent(
55240           projection2.invert([0, _dimensions[1]]),
55241           projection2.invert([_dimensions[0], 0])
55242         );
55243       } else {
55244         var extent = geoExtent(val);
55245         map2.centerZoom(extent.center(), map2.extentZoom(extent));
55246       }
55247     };
55248     map2.trimmedExtent = function(val) {
55249       if (!arguments.length) {
55250         var headerY = 71;
55251         var footerY = 30;
55252         var pad2 = 10;
55253         return new geoExtent(
55254           projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
55255           projection2.invert([_dimensions[0] - pad2, headerY + pad2])
55256         );
55257       } else {
55258         var extent = geoExtent(val);
55259         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
55260       }
55261     };
55262     function calcExtentZoom(extent, dim) {
55263       var tl = projection2([extent[0][0], extent[1][1]]);
55264       var br = projection2([extent[1][0], extent[0][1]]);
55265       var hFactor = (br[0] - tl[0]) / dim[0];
55266       var vFactor = (br[1] - tl[1]) / dim[1];
55267       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
55268       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
55269       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
55270       return newZoom;
55271     }
55272     map2.extentZoom = function(val) {
55273       return calcExtentZoom(geoExtent(val), _dimensions);
55274     };
55275     map2.trimmedExtentZoom = function(val) {
55276       var trimY = 120;
55277       var trimX = 40;
55278       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
55279       return calcExtentZoom(geoExtent(val), trimmed);
55280     };
55281     map2.withinEditableZoom = function() {
55282       return map2.zoom() >= context.minEditableZoom();
55283     };
55284     map2.isInWideSelection = function() {
55285       return !map2.withinEditableZoom() && context.selectedIDs().length;
55286     };
55287     map2.editableDataEnabled = function(skipZoomCheck) {
55288       var layer = context.layers().layer("osm");
55289       if (!layer || !layer.enabled())
55290         return false;
55291       return skipZoomCheck || map2.withinEditableZoom();
55292     };
55293     map2.notesEditable = function() {
55294       var layer = context.layers().layer("notes");
55295       if (!layer || !layer.enabled())
55296         return false;
55297       return map2.withinEditableZoom();
55298     };
55299     map2.minzoom = function(val) {
55300       if (!arguments.length)
55301         return _minzoom;
55302       _minzoom = val;
55303       return map2;
55304     };
55305     map2.toggleHighlightEdited = function() {
55306       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
55307       map2.pan([0, 0]);
55308       dispatch14.call("changeHighlighting", this);
55309     };
55310     map2.areaFillOptions = ["wireframe", "partial", "full"];
55311     map2.activeAreaFill = function(val) {
55312       if (!arguments.length)
55313         return corePreferences("area-fill") || "partial";
55314       corePreferences("area-fill", val);
55315       if (val !== "wireframe") {
55316         corePreferences("area-fill-toggle", val);
55317       }
55318       updateAreaFill();
55319       map2.pan([0, 0]);
55320       dispatch14.call("changeAreaFill", this);
55321       return map2;
55322     };
55323     map2.toggleWireframe = function() {
55324       var activeFill = map2.activeAreaFill();
55325       if (activeFill === "wireframe") {
55326         activeFill = corePreferences("area-fill-toggle") || "partial";
55327       } else {
55328         activeFill = "wireframe";
55329       }
55330       map2.activeAreaFill(activeFill);
55331     };
55332     function updateAreaFill() {
55333       var activeFill = map2.activeAreaFill();
55334       map2.areaFillOptions.forEach(function(opt) {
55335         surface.classed("fill-" + opt, Boolean(opt === activeFill));
55336       });
55337     }
55338     map2.layers = () => drawLayers;
55339     map2.doubleUpHandler = function() {
55340       return _doubleUpHandler;
55341     };
55342     return utilRebind(map2, dispatch14, "on");
55343   }
55344
55345   // modules/renderer/photos.js
55346   function rendererPhotos(context) {
55347     var dispatch14 = dispatch_default("change");
55348     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder"];
55349     var _allPhotoTypes = ["flat", "panoramic"];
55350     var _shownPhotoTypes = _allPhotoTypes.slice();
55351     var _dateFilters = ["fromDate", "toDate"];
55352     var _fromDate;
55353     var _toDate;
55354     var _usernames;
55355     function photos() {
55356     }
55357     function updateStorage() {
55358       if (window.mocha)
55359         return;
55360       var hash = utilStringQs(window.location.hash);
55361       var enabled = context.layers().all().filter(function(d2) {
55362         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
55363       }).map(function(d2) {
55364         return d2.id;
55365       });
55366       if (enabled.length) {
55367         hash.photo_overlay = enabled.join(",");
55368       } else {
55369         delete hash.photo_overlay;
55370       }
55371       window.location.replace("#" + utilQsString(hash, true));
55372     }
55373     photos.overlayLayerIDs = function() {
55374       return _layerIDs;
55375     };
55376     photos.allPhotoTypes = function() {
55377       return _allPhotoTypes;
55378     };
55379     photos.dateFilters = function() {
55380       return _dateFilters;
55381     };
55382     photos.dateFilterValue = function(val) {
55383       return val === _dateFilters[0] ? _fromDate : _toDate;
55384     };
55385     photos.setDateFilter = function(type2, val, updateUrl) {
55386       var date = val && new Date(val);
55387       if (date && !isNaN(date)) {
55388         val = date.toISOString().slice(0, 10);
55389       } else {
55390         val = null;
55391       }
55392       if (type2 === _dateFilters[0]) {
55393         _fromDate = val;
55394         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
55395           _toDate = _fromDate;
55396         }
55397       }
55398       if (type2 === _dateFilters[1]) {
55399         _toDate = val;
55400         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
55401           _fromDate = _toDate;
55402         }
55403       }
55404       dispatch14.call("change", this);
55405       if (updateUrl) {
55406         var rangeString;
55407         if (_fromDate || _toDate) {
55408           rangeString = (_fromDate || "") + "_" + (_toDate || "");
55409         }
55410         setUrlFilterValue("photo_dates", rangeString);
55411       }
55412     };
55413     photos.setUsernameFilter = function(val, updateUrl) {
55414       if (val && typeof val === "string")
55415         val = val.replace(/;/g, ",").split(",");
55416       if (val) {
55417         val = val.map((d2) => d2.trim()).filter(Boolean);
55418         if (!val.length) {
55419           val = null;
55420         }
55421       }
55422       _usernames = val;
55423       dispatch14.call("change", this);
55424       if (updateUrl) {
55425         var hashString;
55426         if (_usernames) {
55427           hashString = _usernames.join(",");
55428         }
55429         setUrlFilterValue("photo_username", hashString);
55430       }
55431     };
55432     function setUrlFilterValue(property, val) {
55433       if (!window.mocha) {
55434         var hash = utilStringQs(window.location.hash);
55435         if (val) {
55436           if (hash[property] === val)
55437             return;
55438           hash[property] = val;
55439         } else {
55440           if (!(property in hash))
55441             return;
55442           delete hash[property];
55443         }
55444         window.location.replace("#" + utilQsString(hash, true));
55445       }
55446     }
55447     function showsLayer(id2) {
55448       var layer = context.layers().layer(id2);
55449       return layer && layer.supported() && layer.enabled();
55450     }
55451     photos.shouldFilterByDate = function() {
55452       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside") || showsLayer("vegbilder");
55453     };
55454     photos.shouldFilterByPhotoType = function() {
55455       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder");
55456     };
55457     photos.shouldFilterByUsername = function() {
55458       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
55459     };
55460     photos.showsPhotoType = function(val) {
55461       if (!photos.shouldFilterByPhotoType())
55462         return true;
55463       return _shownPhotoTypes.indexOf(val) !== -1;
55464     };
55465     photos.showsFlat = function() {
55466       return photos.showsPhotoType("flat");
55467     };
55468     photos.showsPanoramic = function() {
55469       return photos.showsPhotoType("panoramic");
55470     };
55471     photos.fromDate = function() {
55472       return _fromDate;
55473     };
55474     photos.toDate = function() {
55475       return _toDate;
55476     };
55477     photos.togglePhotoType = function(val) {
55478       var index = _shownPhotoTypes.indexOf(val);
55479       if (index !== -1) {
55480         _shownPhotoTypes.splice(index, 1);
55481       } else {
55482         _shownPhotoTypes.push(val);
55483       }
55484       dispatch14.call("change", this);
55485       return photos;
55486     };
55487     photos.usernames = function() {
55488       return _usernames;
55489     };
55490     photos.init = function() {
55491       var hash = utilStringQs(window.location.hash);
55492       if (hash.photo_dates) {
55493         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
55494         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
55495         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
55496       }
55497       if (hash.photo_username) {
55498         this.setUsernameFilter(hash.photo_username, false);
55499       }
55500       if (hash.photo_overlay) {
55501         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
55502         hashOverlayIDs.forEach(function(id2) {
55503           if (id2 === "openstreetcam")
55504             id2 = "kartaview";
55505           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
55506           if (layer2 && !layer2.enabled())
55507             layer2.enabled(true);
55508         });
55509       }
55510       if (hash.photo) {
55511         var photoIds = hash.photo.replace(/;/g, ",").split(",");
55512         var photoId = photoIds.length && photoIds[0].trim();
55513         var results = /(.*)\/(.*)/g.exec(photoId);
55514         if (results && results.length >= 3) {
55515           var serviceId = results[1];
55516           if (serviceId === "openstreetcam")
55517             serviceId = "kartaview";
55518           var photoKey = results[2];
55519           var service = services[serviceId];
55520           if (service && service.ensureViewerLoaded) {
55521             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
55522             if (layer && !layer.enabled())
55523               layer.enabled(true);
55524             var baselineTime = Date.now();
55525             service.on("loadedImages.rendererPhotos", function() {
55526               if (Date.now() - baselineTime > 45e3) {
55527                 service.on("loadedImages.rendererPhotos", null);
55528                 return;
55529               }
55530               if (!service.cachedImage(photoKey))
55531                 return;
55532               service.on("loadedImages.rendererPhotos", null);
55533               service.ensureViewerLoaded(context).then(function() {
55534                 service.selectImage(context, photoKey).showViewer(context);
55535               });
55536             });
55537           }
55538         }
55539       }
55540       context.layers().on("change.rendererPhotos", updateStorage);
55541     };
55542     return utilRebind(photos, dispatch14, "on");
55543   }
55544
55545   // modules/ui/account.js
55546   function uiAccount(context) {
55547     const osm = context.connection();
55548     function updateUserDetails(selection2) {
55549       if (!osm)
55550         return;
55551       if (!osm.authenticated()) {
55552         render(selection2, null);
55553       } else {
55554         osm.userDetails((err, user) => render(selection2, user));
55555       }
55556     }
55557     function render(selection2, user) {
55558       let userInfo = selection2.select(".userInfo");
55559       let loginLogout = selection2.select(".loginLogout");
55560       if (user) {
55561         userInfo.html("").classed("hide", false);
55562         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
55563         if (user.image_url) {
55564           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
55565         } else {
55566           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
55567         }
55568         userLink.append("span").attr("class", "label").html(user.display_name);
55569         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
55570           e3.preventDefault();
55571           osm.logout();
55572           tryLogout();
55573         });
55574       } else {
55575         userInfo.html("").classed("hide", true);
55576         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
55577           e3.preventDefault();
55578           osm.authenticate();
55579         });
55580       }
55581     }
55582     function tryLogout() {
55583       if (!osm)
55584         return;
55585       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
55586       const w2 = 600;
55587       const h2 = 550;
55588       const settings = [
55589         ["width", w2],
55590         ["height", h2],
55591         ["left", window.screen.width / 2 - w2 / 2],
55592         ["top", window.screen.height / 2 - h2 / 2]
55593       ].map((x2) => x2.join("=")).join(",");
55594       window.open(url, "_blank", settings);
55595     }
55596     return function(selection2) {
55597       if (!osm)
55598         return;
55599       selection2.append("li").attr("class", "userInfo").classed("hide", true);
55600       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
55601       osm.on("change.account", () => updateUserDetails(selection2));
55602       updateUserDetails(selection2);
55603     };
55604   }
55605
55606   // modules/ui/attribution.js
55607   function uiAttribution(context) {
55608     let _selection = select_default2(null);
55609     function render(selection2, data, klass) {
55610       let div = selection2.selectAll(`.${klass}`).data([0]);
55611       div = div.enter().append("div").attr("class", klass).merge(div);
55612       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
55613       attributions.exit().remove();
55614       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
55615         let attribution = select_default2(nodes[i3]);
55616         if (d2.terms_html) {
55617           attribution.html(d2.terms_html);
55618           return;
55619         }
55620         if (d2.terms_url) {
55621           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
55622         }
55623         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
55624         const terms_text = _t(
55625           `imagery.${sourceID}.attribution.text`,
55626           { default: d2.terms_text || d2.id || d2.name() }
55627         );
55628         if (d2.icon && !d2.overlay) {
55629           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
55630         }
55631         attribution.append("span").attr("class", "attribution-text").text(terms_text);
55632       }).merge(attributions);
55633       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
55634         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
55635         return notice ? [notice] : [];
55636       });
55637       copyright.exit().remove();
55638       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
55639       copyright.text(String);
55640     }
55641     function update() {
55642       let baselayer = context.background().baseLayerSource();
55643       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
55644       const z2 = context.map().zoom();
55645       let overlays = context.background().overlayLayerSources() || [];
55646       _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
55647     }
55648     return function(selection2) {
55649       _selection = selection2;
55650       context.background().on("change.attribution", update);
55651       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
55652       update();
55653     };
55654   }
55655
55656   // modules/ui/contributors.js
55657   function uiContributors(context) {
55658     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
55659       update();
55660     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
55661     function update() {
55662       if (!osm)
55663         return;
55664       var users = {}, entities = context.history().intersects(context.map().extent());
55665       entities.forEach(function(entity) {
55666         if (entity && entity.user)
55667           users[entity.user] = true;
55668       });
55669       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
55670       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
55671       var userList = select_default2(document.createElement("span"));
55672       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
55673         return osm.userURL(d2);
55674       }).attr("target", "_blank").text(String);
55675       if (u2.length > limit) {
55676         var count = select_default2(document.createElement("span"));
55677         var othersNum = u2.length - limit + 1;
55678         count.append("a").attr("target", "_blank").attr("href", function() {
55679           return osm.changesetsURL(context.map().center(), context.map().zoom());
55680         }).text(othersNum);
55681         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
55682       } else {
55683         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
55684       }
55685       if (!u2.length) {
55686         hidden = true;
55687         wrap2.transition().style("opacity", 0);
55688       } else if (hidden) {
55689         wrap2.transition().style("opacity", 1);
55690       }
55691     }
55692     return function(selection2) {
55693       if (!osm)
55694         return;
55695       wrap2 = selection2;
55696       update();
55697       osm.on("loaded.contributors", debouncedUpdate);
55698       context.map().on("move.contributors", debouncedUpdate);
55699     };
55700   }
55701
55702   // modules/ui/popover.js
55703   var _popoverID = 0;
55704   function uiPopover(klass) {
55705     var _id = _popoverID++;
55706     var _anchorSelection = select_default2(null);
55707     var popover = function(selection2) {
55708       _anchorSelection = selection2;
55709       selection2.each(setup);
55710     };
55711     var _animation = utilFunctor(false);
55712     var _placement = utilFunctor("top");
55713     var _alignment = utilFunctor("center");
55714     var _scrollContainer = utilFunctor(select_default2(null));
55715     var _content;
55716     var _displayType = utilFunctor("");
55717     var _hasArrow = utilFunctor(true);
55718     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
55719     popover.displayType = function(val) {
55720       if (arguments.length) {
55721         _displayType = utilFunctor(val);
55722         return popover;
55723       } else {
55724         return _displayType;
55725       }
55726     };
55727     popover.hasArrow = function(val) {
55728       if (arguments.length) {
55729         _hasArrow = utilFunctor(val);
55730         return popover;
55731       } else {
55732         return _hasArrow;
55733       }
55734     };
55735     popover.placement = function(val) {
55736       if (arguments.length) {
55737         _placement = utilFunctor(val);
55738         return popover;
55739       } else {
55740         return _placement;
55741       }
55742     };
55743     popover.alignment = function(val) {
55744       if (arguments.length) {
55745         _alignment = utilFunctor(val);
55746         return popover;
55747       } else {
55748         return _alignment;
55749       }
55750     };
55751     popover.scrollContainer = function(val) {
55752       if (arguments.length) {
55753         _scrollContainer = utilFunctor(val);
55754         return popover;
55755       } else {
55756         return _scrollContainer;
55757       }
55758     };
55759     popover.content = function(val) {
55760       if (arguments.length) {
55761         _content = val;
55762         return popover;
55763       } else {
55764         return _content;
55765       }
55766     };
55767     popover.isShown = function() {
55768       var popoverSelection = _anchorSelection.select(".popover-" + _id);
55769       return !popoverSelection.empty() && popoverSelection.classed("in");
55770     };
55771     popover.show = function() {
55772       _anchorSelection.each(show);
55773     };
55774     popover.updateContent = function() {
55775       _anchorSelection.each(updateContent);
55776     };
55777     popover.hide = function() {
55778       _anchorSelection.each(hide);
55779     };
55780     popover.toggle = function() {
55781       _anchorSelection.each(toggle);
55782     };
55783     popover.destroy = function(selection2, selector) {
55784       selector = selector || ".popover-" + _id;
55785       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() {
55786         return this.getAttribute("data-original-title") || this.getAttribute("title");
55787       }).attr("data-original-title", null).selectAll(selector).remove();
55788     };
55789     popover.destroyAny = function(selection2) {
55790       selection2.call(popover.destroy, ".popover");
55791     };
55792     function setup() {
55793       var anchor = select_default2(this);
55794       var animate = _animation.apply(this, arguments);
55795       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
55796       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
55797       enter.append("div").attr("class", "popover-arrow");
55798       enter.append("div").attr("class", "popover-inner");
55799       popoverSelection = enter.merge(popoverSelection);
55800       if (animate) {
55801         popoverSelection.classed("fade", true);
55802       }
55803       var display = _displayType.apply(this, arguments);
55804       if (display === "hover") {
55805         var _lastNonMouseEnterTime;
55806         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
55807           if (d3_event.pointerType) {
55808             if (d3_event.pointerType !== "mouse") {
55809               _lastNonMouseEnterTime = d3_event.timeStamp;
55810               return;
55811             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
55812               return;
55813             }
55814           }
55815           if (d3_event.buttons !== 0)
55816             return;
55817           show.apply(this, arguments);
55818         }).on(_pointerPrefix + "leave.popover", function() {
55819           hide.apply(this, arguments);
55820         }).on("focus.popover", function() {
55821           show.apply(this, arguments);
55822         }).on("blur.popover", function() {
55823           hide.apply(this, arguments);
55824         });
55825       } else if (display === "clickFocus") {
55826         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
55827           d3_event.preventDefault();
55828           d3_event.stopPropagation();
55829         }).on(_pointerPrefix + "up.popover", function(d3_event) {
55830           d3_event.preventDefault();
55831           d3_event.stopPropagation();
55832         }).on("click.popover", toggle);
55833         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
55834           anchor.each(function() {
55835             hide.apply(this, arguments);
55836           });
55837         });
55838       }
55839     }
55840     function show() {
55841       var anchor = select_default2(this);
55842       var popoverSelection = anchor.selectAll(".popover-" + _id);
55843       if (popoverSelection.empty()) {
55844         anchor.call(popover.destroy);
55845         anchor.each(setup);
55846         popoverSelection = anchor.selectAll(".popover-" + _id);
55847       }
55848       popoverSelection.classed("in", true);
55849       var displayType = _displayType.apply(this, arguments);
55850       if (displayType === "clickFocus") {
55851         anchor.classed("active", true);
55852         popoverSelection.node().focus();
55853       }
55854       anchor.each(updateContent);
55855     }
55856     function updateContent() {
55857       var anchor = select_default2(this);
55858       if (_content) {
55859         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
55860       }
55861       updatePosition.apply(this, arguments);
55862       updatePosition.apply(this, arguments);
55863       updatePosition.apply(this, arguments);
55864     }
55865     function updatePosition() {
55866       var anchor = select_default2(this);
55867       var popoverSelection = anchor.selectAll(".popover-" + _id);
55868       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
55869       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
55870       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
55871       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
55872       var placement = _placement.apply(this, arguments);
55873       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
55874       var alignment = _alignment.apply(this, arguments);
55875       var alignFactor = 0.5;
55876       if (alignment === "leading") {
55877         alignFactor = 0;
55878       } else if (alignment === "trailing") {
55879         alignFactor = 1;
55880       }
55881       var anchorFrame = getFrame(anchor.node());
55882       var popoverFrame = getFrame(popoverSelection.node());
55883       var position;
55884       switch (placement) {
55885         case "top":
55886           position = {
55887             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
55888             y: anchorFrame.y - popoverFrame.h
55889           };
55890           break;
55891         case "bottom":
55892           position = {
55893             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
55894             y: anchorFrame.y + anchorFrame.h
55895           };
55896           break;
55897         case "left":
55898           position = {
55899             x: anchorFrame.x - popoverFrame.w,
55900             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
55901           };
55902           break;
55903         case "right":
55904           position = {
55905             x: anchorFrame.x + anchorFrame.w,
55906             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
55907           };
55908           break;
55909       }
55910       if (position) {
55911         if (scrollNode && (placement === "top" || placement === "bottom")) {
55912           var initialPosX = position.x;
55913           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
55914             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
55915           } else if (position.x < 10) {
55916             position.x = 10;
55917           }
55918           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
55919           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
55920           arrow.style("left", ~~arrowPosX + "px");
55921         }
55922         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
55923       } else {
55924         popoverSelection.style("left", null).style("top", null);
55925       }
55926       function getFrame(node) {
55927         var positionStyle = select_default2(node).style("position");
55928         if (positionStyle === "absolute" || positionStyle === "static") {
55929           return {
55930             x: node.offsetLeft - scrollLeft,
55931             y: node.offsetTop - scrollTop,
55932             w: node.offsetWidth,
55933             h: node.offsetHeight
55934           };
55935         } else {
55936           return {
55937             x: 0,
55938             y: 0,
55939             w: node.offsetWidth,
55940             h: node.offsetHeight
55941           };
55942         }
55943       }
55944     }
55945     function hide() {
55946       var anchor = select_default2(this);
55947       if (_displayType.apply(this, arguments) === "clickFocus") {
55948         anchor.classed("active", false);
55949       }
55950       anchor.selectAll(".popover-" + _id).classed("in", false);
55951     }
55952     function toggle() {
55953       if (select_default2(this).select(".popover-" + _id).classed("in")) {
55954         hide.apply(this, arguments);
55955       } else {
55956         show.apply(this, arguments);
55957       }
55958     }
55959     return popover;
55960   }
55961
55962   // modules/ui/tooltip.js
55963   function uiTooltip(klass) {
55964     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
55965     var _title = function() {
55966       var title = this.getAttribute("data-original-title");
55967       if (title) {
55968         return title;
55969       } else {
55970         title = this.getAttribute("title");
55971         this.removeAttribute("title");
55972         this.setAttribute("data-original-title", title);
55973       }
55974       return title;
55975     };
55976     var _heading = utilFunctor(null);
55977     var _keys = utilFunctor(null);
55978     tooltip.title = function(val) {
55979       if (!arguments.length)
55980         return _title;
55981       _title = utilFunctor(val);
55982       return tooltip;
55983     };
55984     tooltip.heading = function(val) {
55985       if (!arguments.length)
55986         return _heading;
55987       _heading = utilFunctor(val);
55988       return tooltip;
55989     };
55990     tooltip.keys = function(val) {
55991       if (!arguments.length)
55992         return _keys;
55993       _keys = utilFunctor(val);
55994       return tooltip;
55995     };
55996     tooltip.content(function() {
55997       var heading = _heading.apply(this, arguments);
55998       var text2 = _title.apply(this, arguments);
55999       var keys2 = _keys.apply(this, arguments);
56000       var headingCallback = typeof heading === "function" ? heading : (s2) => s2.text(heading);
56001       var textCallback = typeof text2 === "function" ? text2 : (s2) => s2.text(text2);
56002       return function(selection2) {
56003         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
56004         headingSelect.exit().remove();
56005         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
56006         var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
56007         textSelect.exit().remove();
56008         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
56009         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
56010         keyhintWrap.exit().remove();
56011         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
56012         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
56013         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
56014         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
56015           return d2;
56016         });
56017       };
56018     });
56019     return tooltip;
56020   }
56021
56022   // modules/ui/edit_menu.js
56023   function uiEditMenu(context) {
56024     var dispatch14 = dispatch_default("toggled");
56025     var _menu = select_default2(null);
56026     var _operations = [];
56027     var _anchorLoc = [0, 0];
56028     var _anchorLocLonLat = [0, 0];
56029     var _triggerType = "";
56030     var _vpTopMargin = 85;
56031     var _vpBottomMargin = 45;
56032     var _vpSideMargin = 35;
56033     var _menuTop = false;
56034     var _menuHeight;
56035     var _menuWidth;
56036     var _verticalPadding = 4;
56037     var _tooltipWidth = 210;
56038     var _menuSideMargin = 10;
56039     var _tooltips = [];
56040     var editMenu = function(selection2) {
56041       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
56042       var ops = _operations.filter(function(op) {
56043         return !isTouchMenu || !op.mouseOnly;
56044       });
56045       if (!ops.length)
56046         return;
56047       _tooltips = [];
56048       _menuTop = isTouchMenu;
56049       var showLabels = isTouchMenu;
56050       var buttonHeight = showLabels ? 32 : 34;
56051       if (showLabels) {
56052         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
56053           return op.title.length;
56054         })));
56055       } else {
56056         _menuWidth = 44;
56057       }
56058       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
56059       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
56060       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
56061       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
56062         return "edit-menu-item edit-menu-item-" + d2.id;
56063       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
56064         d3_event.stopPropagation();
56065       }).on("mouseenter.highlight", function(d3_event, d2) {
56066         if (!d2.relatedEntityIds || select_default2(this).classed("disabled"))
56067           return;
56068         utilHighlightEntities(d2.relatedEntityIds(), true, context);
56069       }).on("mouseleave.highlight", function(d3_event, d2) {
56070         if (!d2.relatedEntityIds)
56071           return;
56072         utilHighlightEntities(d2.relatedEntityIds(), false, context);
56073       });
56074       buttonsEnter.each(function(d2) {
56075         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
56076         _tooltips.push(tooltip);
56077         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
56078       });
56079       if (showLabels) {
56080         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
56081           select_default2(this).call(d2.title);
56082         });
56083       }
56084       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
56085         return d2.disabled();
56086       });
56087       updatePosition();
56088       var initialScale = context.projection.scale();
56089       context.map().on("move.edit-menu", function() {
56090         if (initialScale !== context.projection.scale()) {
56091           editMenu.close();
56092         }
56093       }).on("drawn.edit-menu", function(info) {
56094         if (info.full)
56095           updatePosition();
56096       });
56097       var lastPointerUpType;
56098       function pointerup(d3_event) {
56099         lastPointerUpType = d3_event.pointerType;
56100       }
56101       function click(d3_event, operation) {
56102         d3_event.stopPropagation();
56103         if (operation.relatedEntityIds) {
56104           utilHighlightEntities(operation.relatedEntityIds(), false, context);
56105         }
56106         if (operation.disabled()) {
56107           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56108             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip())();
56109           }
56110         } else {
56111           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56112             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
56113           }
56114           operation();
56115           editMenu.close();
56116         }
56117         lastPointerUpType = null;
56118       }
56119       dispatch14.call("toggled", this, true);
56120     };
56121     function updatePosition() {
56122       if (!_menu || _menu.empty())
56123         return;
56124       var anchorLoc = context.projection(_anchorLocLonLat);
56125       var viewport = context.surfaceRect();
56126       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
56127         editMenu.close();
56128         return;
56129       }
56130       var menuLeft = displayOnLeft(viewport);
56131       var offset = [0, 0];
56132       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
56133       if (_menuTop) {
56134         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
56135           offset[1] = -anchorLoc[1] + _vpTopMargin;
56136         } else {
56137           offset[1] = -_menuHeight;
56138         }
56139       } else {
56140         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
56141           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
56142         } else {
56143           offset[1] = 0;
56144         }
56145       }
56146       var origin = geoVecAdd(anchorLoc, offset);
56147       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
56148       var tooltipSide = tooltipPosition(viewport, menuLeft);
56149       _tooltips.forEach(function(tooltip) {
56150         tooltip.placement(tooltipSide);
56151       });
56152       function displayOnLeft(viewport2) {
56153         if (_mainLocalizer.textDirection() === "ltr") {
56154           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
56155             return true;
56156           }
56157           return false;
56158         } else {
56159           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
56160             return false;
56161           }
56162           return true;
56163         }
56164       }
56165       function tooltipPosition(viewport2, menuLeft2) {
56166         if (_mainLocalizer.textDirection() === "ltr") {
56167           if (menuLeft2) {
56168             return "left";
56169           }
56170           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
56171             return "left";
56172           }
56173           return "right";
56174         } else {
56175           if (!menuLeft2) {
56176             return "right";
56177           }
56178           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
56179             return "right";
56180           }
56181           return "left";
56182         }
56183       }
56184     }
56185     editMenu.close = function() {
56186       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
56187       _menu.remove();
56188       _tooltips = [];
56189       dispatch14.call("toggled", this, false);
56190     };
56191     editMenu.anchorLoc = function(val) {
56192       if (!arguments.length)
56193         return _anchorLoc;
56194       _anchorLoc = val;
56195       _anchorLocLonLat = context.projection.invert(_anchorLoc);
56196       return editMenu;
56197     };
56198     editMenu.triggerType = function(val) {
56199       if (!arguments.length)
56200         return _triggerType;
56201       _triggerType = val;
56202       return editMenu;
56203     };
56204     editMenu.operations = function(val) {
56205       if (!arguments.length)
56206         return _operations;
56207       _operations = val;
56208       return editMenu;
56209     };
56210     return utilRebind(editMenu, dispatch14, "on");
56211   }
56212
56213   // modules/ui/feature_info.js
56214   function uiFeatureInfo(context) {
56215     function update(selection2) {
56216       var features = context.features();
56217       var stats = features.stats();
56218       var count = 0;
56219       var hiddenList = features.hidden().map(function(k2) {
56220         if (stats[k2]) {
56221           count += stats[k2];
56222           return _t.append("inspector.title_count", {
56223             title: _t("feature." + k2 + ".description"),
56224             count: stats[k2]
56225           });
56226         }
56227         return null;
56228       }).filter(Boolean);
56229       selection2.text("");
56230       if (hiddenList.length) {
56231         var tooltipBehavior = uiTooltip().placement("top").title(function() {
56232           return (selection3) => {
56233             hiddenList.forEach((hiddenFeature) => {
56234               selection3.append("div").call(hiddenFeature);
56235             });
56236           };
56237         });
56238         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
56239           tooltipBehavior.hide();
56240           d3_event.preventDefault();
56241           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
56242         });
56243       }
56244       selection2.classed("hide", !hiddenList.length);
56245     }
56246     return function(selection2) {
56247       update(selection2);
56248       context.features().on("change.feature_info", function() {
56249         update(selection2);
56250       });
56251     };
56252   }
56253
56254   // modules/ui/flash.js
56255   function uiFlash(context) {
56256     var _flashTimer;
56257     var _duration = 2e3;
56258     var _iconName = "#iD-icon-no";
56259     var _iconClass = "disabled";
56260     var _label = (s2) => s2.text("");
56261     function flash() {
56262       if (_flashTimer) {
56263         _flashTimer.stop();
56264       }
56265       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
56266       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
56267       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
56268       var contentEnter = content.enter().append("div").attr("class", "flash-content");
56269       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
56270       iconEnter.append("circle").attr("r", 9);
56271       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
56272       contentEnter.append("div").attr("class", "flash-text");
56273       content = content.merge(contentEnter);
56274       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
56275       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
56276       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
56277       _flashTimer = timeout_default(function() {
56278         _flashTimer = null;
56279         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
56280         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
56281       }, _duration);
56282       return content;
56283     }
56284     flash.duration = function(_2) {
56285       if (!arguments.length)
56286         return _duration;
56287       _duration = _2;
56288       return flash;
56289     };
56290     flash.label = function(_2) {
56291       if (!arguments.length)
56292         return _label;
56293       if (typeof _2 !== "function") {
56294         _label = (selection2) => selection2.text(_2);
56295       } else {
56296         _label = (selection2) => selection2.text("").call(_2);
56297       }
56298       return flash;
56299     };
56300     flash.iconName = function(_2) {
56301       if (!arguments.length)
56302         return _iconName;
56303       _iconName = _2;
56304       return flash;
56305     };
56306     flash.iconClass = function(_2) {
56307       if (!arguments.length)
56308         return _iconClass;
56309       _iconClass = _2;
56310       return flash;
56311     };
56312     return flash;
56313   }
56314
56315   // modules/ui/full_screen.js
56316   function uiFullScreen(context) {
56317     var element = context.container().node();
56318     function getFullScreenFn() {
56319       if (element.requestFullscreen) {
56320         return element.requestFullscreen;
56321       } else if (element.msRequestFullscreen) {
56322         return element.msRequestFullscreen;
56323       } else if (element.mozRequestFullScreen) {
56324         return element.mozRequestFullScreen;
56325       } else if (element.webkitRequestFullscreen) {
56326         return element.webkitRequestFullscreen;
56327       }
56328     }
56329     function getExitFullScreenFn() {
56330       if (document.exitFullscreen) {
56331         return document.exitFullscreen;
56332       } else if (document.msExitFullscreen) {
56333         return document.msExitFullscreen;
56334       } else if (document.mozCancelFullScreen) {
56335         return document.mozCancelFullScreen;
56336       } else if (document.webkitExitFullscreen) {
56337         return document.webkitExitFullscreen;
56338       }
56339     }
56340     function isFullScreen() {
56341       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
56342     }
56343     function isSupported() {
56344       return !!getFullScreenFn();
56345     }
56346     function fullScreen(d3_event) {
56347       d3_event.preventDefault();
56348       if (!isFullScreen()) {
56349         getFullScreenFn().apply(element);
56350       } else {
56351         getExitFullScreenFn().apply(document);
56352       }
56353     }
56354     return function() {
56355       if (!isSupported())
56356         return;
56357       var detected = utilDetect();
56358       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
56359       context.keybinding().on(keys2, fullScreen);
56360     };
56361   }
56362
56363   // modules/ui/geolocate.js
56364   function uiGeolocate(context) {
56365     var _geolocationOptions = {
56366       // prioritize speed and power usage over precision
56367       enableHighAccuracy: false,
56368       // don't hang indefinitely getting the location
56369       timeout: 6e3
56370       // 6sec
56371     };
56372     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
56373     var _layer = context.layers().layer("geolocate");
56374     var _position;
56375     var _extent;
56376     var _timeoutID;
56377     var _button = select_default2(null);
56378     function click() {
56379       if (context.inIntro())
56380         return;
56381       if (!_layer.enabled() && !_locating.isShown()) {
56382         _timeoutID = setTimeout(
56383           error,
56384           1e4
56385           /* 10sec */
56386         );
56387         context.container().call(_locating);
56388         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
56389       } else {
56390         _locating.close();
56391         _layer.enabled(null, false);
56392         updateButtonState();
56393       }
56394     }
56395     function zoomTo() {
56396       context.enter(modeBrowse(context));
56397       var map2 = context.map();
56398       _layer.enabled(_position, true);
56399       updateButtonState();
56400       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
56401     }
56402     function success(geolocation) {
56403       _position = geolocation;
56404       var coords = _position.coords;
56405       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
56406       zoomTo();
56407       finish();
56408     }
56409     function error() {
56410       if (_position) {
56411         zoomTo();
56412       } else {
56413         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
56414       }
56415       finish();
56416     }
56417     function finish() {
56418       _locating.close();
56419       if (_timeoutID) {
56420         clearTimeout(_timeoutID);
56421       }
56422       _timeoutID = void 0;
56423     }
56424     function updateButtonState() {
56425       _button.classed("active", _layer.enabled());
56426       _button.attr("aria-pressed", _layer.enabled());
56427     }
56428     return function(selection2) {
56429       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
56430         return;
56431       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
56432         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
56433       );
56434       context.keybinding().on(_t("geolocate.key"), click);
56435     };
56436   }
56437
56438   // modules/ui/panels/background.js
56439   function uiPanelBackground(context) {
56440     var background = context.background();
56441     var _currSourceName = null;
56442     var _metadata = {};
56443     var _metadataKeys = [
56444       "zoom",
56445       "vintage",
56446       "source",
56447       "description",
56448       "resolution",
56449       "accuracy"
56450     ];
56451     var debouncedRedraw = debounce_default(redraw, 250);
56452     function redraw(selection2) {
56453       var source = background.baseLayerSource();
56454       if (!source)
56455         return;
56456       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
56457       var sourceLabel = source.label();
56458       if (_currSourceName !== sourceLabel) {
56459         _currSourceName = sourceLabel;
56460         _metadata = {};
56461       }
56462       selection2.text("");
56463       var list = selection2.append("ul").attr("class", "background-info");
56464       list.append("li").call(_currSourceName);
56465       _metadataKeys.forEach(function(k2) {
56466         if (isDG && k2 === "vintage")
56467           return;
56468         list.append("li").attr("class", "background-info-list-" + k2).classed("hide", !_metadata[k2]).call(_t.append("info_panels.background." + k2, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k2).text(_metadata[k2]);
56469       });
56470       debouncedGetMetadata(selection2);
56471       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
56472       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
56473         d3_event.preventDefault();
56474         context.setDebug("tile", !context.getDebug("tile"));
56475         selection2.call(redraw);
56476       });
56477       if (isDG) {
56478         var key = source.id + "-vintage";
56479         var sourceVintage = context.background().findSource(key);
56480         var showsVintage = context.background().showsLayer(sourceVintage);
56481         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
56482         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
56483           d3_event.preventDefault();
56484           context.background().toggleOverlayLayer(sourceVintage);
56485           selection2.call(redraw);
56486         });
56487       }
56488       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
56489         if (source.id !== layerId) {
56490           var key2 = layerId + "-vintage";
56491           var sourceVintage2 = context.background().findSource(key2);
56492           if (context.background().showsLayer(sourceVintage2)) {
56493             context.background().toggleOverlayLayer(sourceVintage2);
56494           }
56495         }
56496       });
56497     }
56498     var debouncedGetMetadata = debounce_default(getMetadata, 250);
56499     function getMetadata(selection2) {
56500       var tile = context.container().select(".layer-background img.tile-center");
56501       if (tile.empty())
56502         return;
56503       var sourceName = _currSourceName;
56504       var d2 = tile.datum();
56505       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
56506       var center = context.map().center();
56507       _metadata.zoom = String(zoom);
56508       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
56509       if (!d2 || !d2.length >= 3)
56510         return;
56511       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
56512         if (err || _currSourceName !== sourceName)
56513           return;
56514         var vintage = result.vintage;
56515         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
56516         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
56517         _metadataKeys.forEach(function(k2) {
56518           if (k2 === "zoom" || k2 === "vintage")
56519             return;
56520           var val = result[k2];
56521           _metadata[k2] = val;
56522           selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
56523         });
56524       });
56525     }
56526     var panel = function(selection2) {
56527       selection2.call(redraw);
56528       context.map().on("drawn.info-background", function() {
56529         selection2.call(debouncedRedraw);
56530       }).on("move.info-background", function() {
56531         selection2.call(debouncedGetMetadata);
56532       });
56533     };
56534     panel.off = function() {
56535       context.map().on("drawn.info-background", null).on("move.info-background", null);
56536     };
56537     panel.id = "background";
56538     panel.label = _t.append("info_panels.background.title");
56539     panel.key = _t("info_panels.background.key");
56540     return panel;
56541   }
56542
56543   // modules/ui/panels/history.js
56544   function uiPanelHistory(context) {
56545     var osm;
56546     function displayTimestamp(timestamp) {
56547       if (!timestamp)
56548         return _t("info_panels.history.unknown");
56549       var options2 = {
56550         day: "numeric",
56551         month: "short",
56552         year: "numeric",
56553         hour: "numeric",
56554         minute: "numeric",
56555         second: "numeric"
56556       };
56557       var d2 = new Date(timestamp);
56558       if (isNaN(d2.getTime()))
56559         return _t("info_panels.history.unknown");
56560       return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
56561     }
56562     function displayUser(selection2, userName) {
56563       if (!userName) {
56564         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56565         return;
56566       }
56567       selection2.append("span").attr("class", "user-name").text(userName);
56568       var links = selection2.append("div").attr("class", "links");
56569       if (osm) {
56570         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
56571       }
56572       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
56573     }
56574     function displayChangeset(selection2, changeset) {
56575       if (!changeset) {
56576         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56577         return;
56578       }
56579       selection2.append("span").attr("class", "changeset-id").text(changeset);
56580       var links = selection2.append("div").attr("class", "links");
56581       if (osm) {
56582         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
56583       }
56584       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
56585       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
56586     }
56587     function redraw(selection2) {
56588       var selectedNoteID = context.selectedNoteID();
56589       osm = context.connection();
56590       var selected, note, entity;
56591       if (selectedNoteID && osm) {
56592         selected = [_t.html("note.note") + " " + selectedNoteID];
56593         note = osm.getNote(selectedNoteID);
56594       } else {
56595         selected = context.selectedIDs().filter(function(e3) {
56596           return context.hasEntity(e3);
56597         });
56598         if (selected.length) {
56599           entity = context.entity(selected[0]);
56600         }
56601       }
56602       var singular = selected.length === 1 ? selected[0] : null;
56603       selection2.html("");
56604       if (singular) {
56605         selection2.append("h4").attr("class", "history-heading").html(singular);
56606       } else {
56607         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
56608       }
56609       if (!singular)
56610         return;
56611       if (entity) {
56612         selection2.call(redrawEntity, entity);
56613       } else if (note) {
56614         selection2.call(redrawNote, note);
56615       }
56616     }
56617     function redrawNote(selection2, note) {
56618       if (!note || note.isNew()) {
56619         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
56620         return;
56621       }
56622       var list = selection2.append("ul");
56623       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
56624       if (note.comments.length) {
56625         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
56626         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
56627       }
56628       if (osm) {
56629         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"));
56630       }
56631     }
56632     function redrawEntity(selection2, entity) {
56633       if (!entity || entity.isNew()) {
56634         selection2.append("div").call(_t.append("info_panels.history.no_history"));
56635         return;
56636       }
56637       var links = selection2.append("div").attr("class", "links");
56638       if (osm) {
56639         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"));
56640       }
56641       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");
56642       var list = selection2.append("ul");
56643       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
56644       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
56645       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
56646       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
56647     }
56648     var panel = function(selection2) {
56649       selection2.call(redraw);
56650       context.map().on("drawn.info-history", function() {
56651         selection2.call(redraw);
56652       });
56653       context.on("enter.info-history", function() {
56654         selection2.call(redraw);
56655       });
56656     };
56657     panel.off = function() {
56658       context.map().on("drawn.info-history", null);
56659       context.on("enter.info-history", null);
56660     };
56661     panel.id = "history";
56662     panel.label = _t.append("info_panels.history.title");
56663     panel.key = _t("info_panels.history.key");
56664     return panel;
56665   }
56666
56667   // modules/util/units.js
56668   var OSM_PRECISION = 7;
56669   function displayLength(m2, isImperial) {
56670     var d2 = m2 * (isImperial ? 3.28084 : 1);
56671     var unit2;
56672     if (isImperial) {
56673       if (d2 >= 5280) {
56674         d2 /= 5280;
56675         unit2 = "miles";
56676       } else {
56677         unit2 = "feet";
56678       }
56679     } else {
56680       if (d2 >= 1e3) {
56681         d2 /= 1e3;
56682         unit2 = "kilometers";
56683       } else {
56684         unit2 = "meters";
56685       }
56686     }
56687     return _t("units." + unit2, {
56688       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
56689         maximumSignificantDigits: 4
56690       })
56691     });
56692   }
56693   function displayArea(m2, isImperial) {
56694     var locale2 = _mainLocalizer.localeCode();
56695     var d2 = m2 * (isImperial ? 10.7639111056 : 1);
56696     var d1, d22, area;
56697     var unit1 = "";
56698     var unit2 = "";
56699     if (isImperial) {
56700       if (d2 >= 6969600) {
56701         d1 = d2 / 27878400;
56702         unit1 = "square_miles";
56703       } else {
56704         d1 = d2;
56705         unit1 = "square_feet";
56706       }
56707       if (d2 > 4356 && d2 < 4356e4) {
56708         d22 = d2 / 43560;
56709         unit2 = "acres";
56710       }
56711     } else {
56712       if (d2 >= 25e4) {
56713         d1 = d2 / 1e6;
56714         unit1 = "square_kilometers";
56715       } else {
56716         d1 = d2;
56717         unit1 = "square_meters";
56718       }
56719       if (d2 > 1e3 && d2 < 1e7) {
56720         d22 = d2 / 1e4;
56721         unit2 = "hectares";
56722       }
56723     }
56724     area = _t("units." + unit1, {
56725       quantity: d1.toLocaleString(locale2, {
56726         maximumSignificantDigits: 4
56727       })
56728     });
56729     if (d22) {
56730       return _t("units.area_pair", {
56731         area1: area,
56732         area2: _t("units." + unit2, {
56733           quantity: d22.toLocaleString(locale2, {
56734             maximumSignificantDigits: 2
56735           })
56736         })
56737       });
56738     } else {
56739       return area;
56740     }
56741   }
56742   function wrap(x2, min3, max3) {
56743     var d2 = max3 - min3;
56744     return ((x2 - min3) % d2 + d2) % d2 + min3;
56745   }
56746   function clamp2(x2, min3, max3) {
56747     return Math.max(min3, Math.min(x2, max3));
56748   }
56749   function displayCoordinate(deg, pos, neg) {
56750     var locale2 = _mainLocalizer.localeCode();
56751     var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
56752     var sec = (min3 - Math.floor(min3)) * 60;
56753     var displayDegrees = _t("units.arcdegrees", {
56754       quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
56755     });
56756     var displayCoordinate2;
56757     if (Math.floor(sec) > 0) {
56758       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
56759         quantity: Math.floor(min3).toLocaleString(locale2)
56760       }) + _t("units.arcseconds", {
56761         quantity: Math.round(sec).toLocaleString(locale2)
56762       });
56763     } else if (Math.floor(min3) > 0) {
56764       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
56765         quantity: Math.round(min3).toLocaleString(locale2)
56766       });
56767     } else {
56768       displayCoordinate2 = _t("units.arcdegrees", {
56769         quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
56770       });
56771     }
56772     if (deg === 0) {
56773       return displayCoordinate2;
56774     } else {
56775       return _t("units.coordinate", {
56776         coordinate: displayCoordinate2,
56777         direction: _t("units." + (deg > 0 ? pos : neg))
56778       });
56779     }
56780   }
56781   function dmsCoordinatePair(coord2) {
56782     return _t("units.coordinate_pair", {
56783       latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
56784       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
56785     });
56786   }
56787   function decimalCoordinatePair(coord2) {
56788     return _t("units.coordinate_pair", {
56789       latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
56790       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
56791     });
56792   }
56793
56794   // modules/ui/panels/location.js
56795   function uiPanelLocation(context) {
56796     var currLocation = "";
56797     function redraw(selection2) {
56798       selection2.html("");
56799       var list = selection2.append("ul");
56800       var coord2 = context.map().mouseCoordinates();
56801       if (coord2.some(isNaN)) {
56802         coord2 = context.map().center();
56803       }
56804       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
56805       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
56806       debouncedGetLocation(selection2, coord2);
56807     }
56808     var debouncedGetLocation = debounce_default(getLocation, 250);
56809     function getLocation(selection2, coord2) {
56810       if (!services.geocoder) {
56811         currLocation = _t("info_panels.location.unknown_location");
56812         selection2.selectAll(".location-info").text(currLocation);
56813       } else {
56814         services.geocoder.reverse(coord2, function(err, result) {
56815           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
56816           selection2.selectAll(".location-info").text(currLocation);
56817         });
56818       }
56819     }
56820     var panel = function(selection2) {
56821       selection2.call(redraw);
56822       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
56823         selection2.call(redraw);
56824       });
56825     };
56826     panel.off = function() {
56827       context.surface().on(".info-location", null);
56828     };
56829     panel.id = "location";
56830     panel.label = _t.append("info_panels.location.title");
56831     panel.key = _t("info_panels.location.key");
56832     return panel;
56833   }
56834
56835   // modules/ui/panels/measurement.js
56836   function uiPanelMeasurement(context) {
56837     function radiansToMeters(r2) {
56838       return r2 * 63710071809e-4;
56839     }
56840     function steradiansToSqmeters(r2) {
56841       return r2 / (4 * Math.PI) * 510065621724e3;
56842     }
56843     function toLineString(feature3) {
56844       if (feature3.type === "LineString")
56845         return feature3;
56846       var result = { type: "LineString", coordinates: [] };
56847       if (feature3.type === "Polygon") {
56848         result.coordinates = feature3.coordinates[0];
56849       } else if (feature3.type === "MultiPolygon") {
56850         result.coordinates = feature3.coordinates[0][0];
56851       }
56852       return result;
56853     }
56854     var _isImperial = !_mainLocalizer.usesMetric();
56855     function redraw(selection2) {
56856       var graph = context.graph();
56857       var selectedNoteID = context.selectedNoteID();
56858       var osm = services.osm;
56859       var localeCode = _mainLocalizer.localeCode();
56860       var heading;
56861       var center, location, centroid;
56862       var closed, geometry;
56863       var totalNodeCount, length = 0, area = 0, distance;
56864       if (selectedNoteID && osm) {
56865         var note = osm.getNote(selectedNoteID);
56866         heading = _t.html("note.note") + " " + selectedNoteID;
56867         location = note.loc;
56868         geometry = "note";
56869       } else {
56870         var selectedIDs = context.selectedIDs().filter(function(id2) {
56871           return context.hasEntity(id2);
56872         });
56873         var selected = selectedIDs.map(function(id2) {
56874           return context.entity(id2);
56875         });
56876         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
56877         if (selected.length) {
56878           var extent = geoExtent();
56879           for (var i3 in selected) {
56880             var entity = selected[i3];
56881             extent._extend(entity.extent(graph));
56882             geometry = entity.geometry(graph);
56883             if (geometry === "line" || geometry === "area") {
56884               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
56885               var feature3 = entity.asGeoJSON(graph);
56886               length += radiansToMeters(length_default(toLineString(feature3)));
56887               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
56888               centroid = centroid && context.projection.invert(centroid);
56889               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
56890                 centroid = entity.extent(graph).center();
56891               }
56892               if (closed) {
56893                 area += steradiansToSqmeters(entity.area(graph));
56894               }
56895             }
56896           }
56897           if (selected.length > 1) {
56898             geometry = null;
56899             closed = null;
56900             centroid = null;
56901           }
56902           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
56903             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
56904           }
56905           if (selected.length === 1 && selected[0].type === "node") {
56906             location = selected[0].loc;
56907           } else {
56908             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
56909           }
56910           if (!location && !centroid) {
56911             center = extent.center();
56912           }
56913         }
56914       }
56915       selection2.html("");
56916       if (heading) {
56917         selection2.append("h4").attr("class", "measurement-heading").html(heading);
56918       }
56919       var list = selection2.append("ul");
56920       var coordItem;
56921       if (geometry) {
56922         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
56923           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
56924         );
56925       }
56926       if (totalNodeCount) {
56927         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
56928       }
56929       if (area) {
56930         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
56931       }
56932       if (length) {
56933         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
56934       }
56935       if (typeof distance === "number") {
56936         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
56937       }
56938       if (location) {
56939         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
56940         coordItem.append("span").text(dmsCoordinatePair(location));
56941         coordItem.append("span").text(decimalCoordinatePair(location));
56942       }
56943       if (centroid) {
56944         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
56945         coordItem.append("span").text(dmsCoordinatePair(centroid));
56946         coordItem.append("span").text(decimalCoordinatePair(centroid));
56947       }
56948       if (center) {
56949         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
56950         coordItem.append("span").text(dmsCoordinatePair(center));
56951         coordItem.append("span").text(decimalCoordinatePair(center));
56952       }
56953       if (length || area || typeof distance === "number") {
56954         var toggle = _isImperial ? "imperial" : "metric";
56955         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
56956           d3_event.preventDefault();
56957           _isImperial = !_isImperial;
56958           selection2.call(redraw);
56959         });
56960       }
56961     }
56962     var panel = function(selection2) {
56963       selection2.call(redraw);
56964       context.map().on("drawn.info-measurement", function() {
56965         selection2.call(redraw);
56966       });
56967       context.on("enter.info-measurement", function() {
56968         selection2.call(redraw);
56969       });
56970     };
56971     panel.off = function() {
56972       context.map().on("drawn.info-measurement", null);
56973       context.on("enter.info-measurement", null);
56974     };
56975     panel.id = "measurement";
56976     panel.label = _t.append("info_panels.measurement.title");
56977     panel.key = _t("info_panels.measurement.key");
56978     return panel;
56979   }
56980
56981   // modules/ui/panels/index.js
56982   var uiInfoPanels = {
56983     background: uiPanelBackground,
56984     history: uiPanelHistory,
56985     location: uiPanelLocation,
56986     measurement: uiPanelMeasurement
56987   };
56988
56989   // modules/ui/info.js
56990   function uiInfo(context) {
56991     var ids = Object.keys(uiInfoPanels);
56992     var wasActive = ["measurement"];
56993     var panels = {};
56994     var active = {};
56995     ids.forEach(function(k2) {
56996       if (!panels[k2]) {
56997         panels[k2] = uiInfoPanels[k2](context);
56998         active[k2] = false;
56999       }
57000     });
57001     function info(selection2) {
57002       function redraw() {
57003         var activeids = ids.filter(function(k2) {
57004           return active[k2];
57005         }).sort();
57006         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
57007           return k2;
57008         });
57009         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
57010           select_default2(this).call(panels[d2].off).remove();
57011         });
57012         var enter = containers.enter().append("div").attr("class", function(d2) {
57013           return "fillD2 panel-container panel-container-" + d2;
57014         });
57015         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
57016         var title = enter.append("div").attr("class", "panel-title fillD2");
57017         title.append("h3").each(function(d2) {
57018           return panels[d2].label(select_default2(this));
57019         });
57020         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
57021           d3_event.stopImmediatePropagation();
57022           d3_event.preventDefault();
57023           info.toggle(d2);
57024         }).call(svgIcon("#iD-icon-close"));
57025         enter.append("div").attr("class", function(d2) {
57026           return "panel-content panel-content-" + d2;
57027         });
57028         infoPanels.selectAll(".panel-content").each(function(d2) {
57029           select_default2(this).call(panels[d2]);
57030         });
57031       }
57032       info.toggle = function(which) {
57033         var activeids = ids.filter(function(k2) {
57034           return active[k2];
57035         });
57036         if (which) {
57037           active[which] = !active[which];
57038           if (activeids.length === 1 && activeids[0] === which) {
57039             wasActive = [which];
57040           }
57041           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
57042         } else {
57043           if (activeids.length) {
57044             wasActive = activeids;
57045             activeids.forEach(function(k2) {
57046               active[k2] = false;
57047             });
57048           } else {
57049             wasActive.forEach(function(k2) {
57050               active[k2] = true;
57051             });
57052           }
57053         }
57054         redraw();
57055       };
57056       var infoPanels = selection2.selectAll(".info-panels").data([0]);
57057       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
57058       redraw();
57059       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
57060         d3_event.stopImmediatePropagation();
57061         d3_event.preventDefault();
57062         info.toggle();
57063       });
57064       ids.forEach(function(k2) {
57065         var key = _t("info_panels." + k2 + ".key", { default: null });
57066         if (!key)
57067           return;
57068         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
57069           d3_event.stopImmediatePropagation();
57070           d3_event.preventDefault();
57071           info.toggle(k2);
57072         });
57073       });
57074     }
57075     return info;
57076   }
57077
57078   // modules/ui/intro/helper.js
57079   function pointBox(loc, context) {
57080     var rect = context.surfaceRect();
57081     var point2 = context.curtainProjection(loc);
57082     return {
57083       left: point2[0] + rect.left - 40,
57084       top: point2[1] + rect.top - 60,
57085       width: 80,
57086       height: 90
57087     };
57088   }
57089   function pad(locOrBox, padding, context) {
57090     var box;
57091     if (locOrBox instanceof Array) {
57092       var rect = context.surfaceRect();
57093       var point2 = context.curtainProjection(locOrBox);
57094       box = {
57095         left: point2[0] + rect.left,
57096         top: point2[1] + rect.top
57097       };
57098     } else {
57099       box = locOrBox;
57100     }
57101     return {
57102       left: box.left - padding,
57103       top: box.top - padding,
57104       width: (box.width || 0) + 2 * padding,
57105       height: (box.width || 0) + 2 * padding
57106     };
57107   }
57108   function icon(name, svgklass, useklass) {
57109     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
57110   }
57111   var helpStringReplacements;
57112   function helpHtml(id2, replacements) {
57113     if (!helpStringReplacements) {
57114       helpStringReplacements = {
57115         // insert icons corresponding to various UI elements
57116         point_icon: icon("#iD-icon-point", "inline"),
57117         line_icon: icon("#iD-icon-line", "inline"),
57118         area_icon: icon("#iD-icon-area", "inline"),
57119         note_icon: icon("#iD-icon-note", "inline add-note"),
57120         plus: icon("#iD-icon-plus", "inline"),
57121         minus: icon("#iD-icon-minus", "inline"),
57122         layers_icon: icon("#iD-icon-layers", "inline"),
57123         data_icon: icon("#iD-icon-data", "inline"),
57124         inspect: icon("#iD-icon-inspect", "inline"),
57125         help_icon: icon("#iD-icon-help", "inline"),
57126         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
57127         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
57128         save_icon: icon("#iD-icon-save", "inline"),
57129         // operation icons
57130         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
57131         continue_icon: icon("#iD-operation-continue", "inline operation"),
57132         copy_icon: icon("#iD-operation-copy", "inline operation"),
57133         delete_icon: icon("#iD-operation-delete", "inline operation"),
57134         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
57135         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
57136         extract_icon: icon("#iD-operation-extract", "inline operation"),
57137         merge_icon: icon("#iD-operation-merge", "inline operation"),
57138         move_icon: icon("#iD-operation-move", "inline operation"),
57139         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
57140         paste_icon: icon("#iD-operation-paste", "inline operation"),
57141         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
57142         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
57143         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
57144         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
57145         split_icon: icon("#iD-operation-split", "inline operation"),
57146         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
57147         // interaction icons
57148         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
57149         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
57150         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
57151         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
57152         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
57153         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
57154         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
57155         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
57156         // insert keys; may be localized and platform-dependent
57157         shift: uiCmd.display("\u21E7"),
57158         alt: uiCmd.display("\u2325"),
57159         return: uiCmd.display("\u21B5"),
57160         esc: _t.html("shortcuts.key.esc"),
57161         space: _t.html("shortcuts.key.space"),
57162         add_note_key: _t.html("modes.add_note.key"),
57163         help_key: _t.html("help.key"),
57164         shortcuts_key: _t.html("shortcuts.toggle.key"),
57165         // reference localized UI labels directly so that they'll always match
57166         save: _t.html("save.title"),
57167         undo: _t.html("undo.title"),
57168         redo: _t.html("redo.title"),
57169         upload: _t.html("commit.save"),
57170         point: _t.html("modes.add_point.title"),
57171         line: _t.html("modes.add_line.title"),
57172         area: _t.html("modes.add_area.title"),
57173         note: _t.html("modes.add_note.label"),
57174         circularize: _t.html("operations.circularize.title"),
57175         continue: _t.html("operations.continue.title"),
57176         copy: _t.html("operations.copy.title"),
57177         delete: _t.html("operations.delete.title"),
57178         disconnect: _t.html("operations.disconnect.title"),
57179         downgrade: _t.html("operations.downgrade.title"),
57180         extract: _t.html("operations.extract.title"),
57181         merge: _t.html("operations.merge.title"),
57182         move: _t.html("operations.move.title"),
57183         orthogonalize: _t.html("operations.orthogonalize.title"),
57184         paste: _t.html("operations.paste.title"),
57185         reflect_long: _t.html("operations.reflect.title.long"),
57186         reflect_short: _t.html("operations.reflect.title.short"),
57187         reverse: _t.html("operations.reverse.title"),
57188         rotate: _t.html("operations.rotate.title"),
57189         split: _t.html("operations.split.title"),
57190         straighten: _t.html("operations.straighten.title"),
57191         map_data: _t.html("map_data.title"),
57192         osm_notes: _t.html("map_data.layers.notes.title"),
57193         fields: _t.html("inspector.fields"),
57194         tags: _t.html("inspector.tags"),
57195         relations: _t.html("inspector.relations"),
57196         new_relation: _t.html("inspector.new_relation"),
57197         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
57198         background_settings: _t.html("background.description"),
57199         imagery_offset: _t.html("background.fix_misalignment"),
57200         start_the_walkthrough: _t.html("splash.walkthrough"),
57201         help: _t.html("help.title"),
57202         ok: _t.html("intro.ok")
57203       };
57204       for (var key in helpStringReplacements) {
57205         helpStringReplacements[key] = { html: helpStringReplacements[key] };
57206       }
57207     }
57208     var reps;
57209     if (replacements) {
57210       reps = Object.assign(replacements, helpStringReplacements);
57211     } else {
57212       reps = helpStringReplacements;
57213     }
57214     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
57215   }
57216   function slugify(text2) {
57217     return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
57218   }
57219   var missingStrings = {};
57220   function checkKey(key, text2) {
57221     if (_t(key, { default: void 0 }) === void 0) {
57222       if (missingStrings.hasOwnProperty(key))
57223         return;
57224       missingStrings[key] = text2;
57225       var missing = key + ": " + text2;
57226       if (typeof console !== "undefined")
57227         console.log(missing);
57228     }
57229   }
57230   function localize(obj) {
57231     var key;
57232     var name = obj.tags && obj.tags.name;
57233     if (name) {
57234       key = "intro.graph.name." + slugify(name);
57235       obj.tags.name = _t(key, { default: name });
57236       checkKey(key, name);
57237     }
57238     var street = obj.tags && obj.tags["addr:street"];
57239     if (street) {
57240       key = "intro.graph.name." + slugify(street);
57241       obj.tags["addr:street"] = _t(key, { default: street });
57242       checkKey(key, street);
57243       var addrTags = [
57244         "block_number",
57245         "city",
57246         "county",
57247         "district",
57248         "hamlet",
57249         "neighbourhood",
57250         "postcode",
57251         "province",
57252         "quarter",
57253         "state",
57254         "subdistrict",
57255         "suburb"
57256       ];
57257       addrTags.forEach(function(k2) {
57258         var key2 = "intro.graph." + k2;
57259         var tag = "addr:" + k2;
57260         var val = obj.tags && obj.tags[tag];
57261         var str2 = _t(key2, { default: val });
57262         if (str2) {
57263           if (str2.match(/^<.*>$/) !== null) {
57264             delete obj.tags[tag];
57265           } else {
57266             obj.tags[tag] = str2;
57267           }
57268         }
57269       });
57270     }
57271     return obj;
57272   }
57273   function isMostlySquare(points) {
57274     var threshold = 15;
57275     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
57276     var upperBound = Math.cos(threshold * Math.PI / 180);
57277     for (var i3 = 0; i3 < points.length; i3++) {
57278       var a2 = points[(i3 - 1 + points.length) % points.length];
57279       var origin = points[i3];
57280       var b2 = points[(i3 + 1) % points.length];
57281       var dotp = geoVecNormalizedDot(a2, b2, origin);
57282       var mag = Math.abs(dotp);
57283       if (mag > lowerBound && mag < upperBound) {
57284         return false;
57285       }
57286     }
57287     return true;
57288   }
57289   function selectMenuItem(context, operation) {
57290     return context.container().select(".edit-menu .edit-menu-item-" + operation);
57291   }
57292   function transitionTime(point1, point2) {
57293     var distance = geoSphericalDistance(point1, point2);
57294     if (distance === 0) {
57295       return 0;
57296     } else if (distance < 80) {
57297       return 500;
57298     } else {
57299       return 1e3;
57300     }
57301   }
57302
57303   // modules/ui/toggle.js
57304   function uiToggle(show, callback) {
57305     return function(selection2) {
57306       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
57307         select_default2(this).classed("hide", !show).style("opacity", null);
57308         if (callback)
57309           callback.apply(this);
57310       });
57311     };
57312   }
57313
57314   // modules/ui/curtain.js
57315   function uiCurtain(containerNode) {
57316     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
57317     function curtain(selection2) {
57318       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
57319       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
57320       select_default2(window).on("resize.curtain", resize);
57321       tooltip = selection2.append("div").attr("class", "tooltip");
57322       tooltip.append("div").attr("class", "popover-arrow");
57323       tooltip.append("div").attr("class", "popover-inner");
57324       resize();
57325       function resize() {
57326         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
57327         curtain.cut(darkness.datum());
57328       }
57329     }
57330     curtain.reveal = function(box, html2, options2) {
57331       options2 = options2 || {};
57332       if (typeof box === "string") {
57333         box = select_default2(box).node();
57334       }
57335       if (box && box.getBoundingClientRect) {
57336         box = copyBox(box.getBoundingClientRect());
57337         var containerRect = containerNode.getBoundingClientRect();
57338         box.top -= containerRect.top;
57339         box.left -= containerRect.left;
57340       }
57341       if (box && options2.padding) {
57342         box.top -= options2.padding;
57343         box.left -= options2.padding;
57344         box.bottom += options2.padding;
57345         box.right += options2.padding;
57346         box.height += options2.padding * 2;
57347         box.width += options2.padding * 2;
57348       }
57349       var tooltipBox;
57350       if (options2.tooltipBox) {
57351         tooltipBox = options2.tooltipBox;
57352         if (typeof tooltipBox === "string") {
57353           tooltipBox = select_default2(tooltipBox).node();
57354         }
57355         if (tooltipBox && tooltipBox.getBoundingClientRect) {
57356           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
57357         }
57358       } else {
57359         tooltipBox = box;
57360       }
57361       if (tooltipBox && html2) {
57362         if (html2.indexOf("**") !== -1) {
57363           if (html2.indexOf("<span") === 0) {
57364             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
57365           } else {
57366             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
57367           }
57368           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
57369         }
57370         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
57371         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
57372         if (options2.buttonText && options2.buttonCallback) {
57373           html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
57374         }
57375         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
57376         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
57377         if (options2.buttonText && options2.buttonCallback) {
57378           var button = tooltip.selectAll(".button-section .button.action");
57379           button.on("click", function(d3_event) {
57380             d3_event.preventDefault();
57381             options2.buttonCallback();
57382           });
57383         }
57384         var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
57385         if (options2.tooltipClass === "intro-mouse") {
57386           tip.height += 80;
57387         }
57388         if (tooltipBox.top + tooltipBox.height > h2) {
57389           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
57390         }
57391         if (tooltipBox.left + tooltipBox.width > w2) {
57392           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
57393         }
57394         if (tooltipBox.top + tooltipBox.height < 100) {
57395           side = "bottom";
57396           pos = [
57397             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57398             tooltipBox.top + tooltipBox.height
57399           ];
57400         } else if (tooltipBox.top > h2 - 140) {
57401           side = "top";
57402           pos = [
57403             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57404             tooltipBox.top - tip.height
57405           ];
57406         } else {
57407           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
57408           if (_mainLocalizer.textDirection() === "rtl") {
57409             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
57410               side = "right";
57411               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57412             } else {
57413               side = "left";
57414               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57415             }
57416           } else {
57417             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
57418               side = "left";
57419               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57420             } else {
57421               side = "right";
57422               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57423             }
57424           }
57425         }
57426         if (options2.duration !== 0 || !tooltip.classed(side)) {
57427           tooltip.call(uiToggle(true));
57428         }
57429         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
57430         var shiftY = 0;
57431         if (side === "left" || side === "right") {
57432           if (pos[1] < 60) {
57433             shiftY = 60 - pos[1];
57434           } else if (pos[1] + tip.height > h2 - 100) {
57435             shiftY = h2 - pos[1] - tip.height - 100;
57436           }
57437         }
57438         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
57439       } else {
57440         tooltip.classed("in", false).call(uiToggle(false));
57441       }
57442       curtain.cut(box, options2.duration);
57443       return tooltip;
57444     };
57445     curtain.cut = function(datum2, duration) {
57446       darkness.datum(datum2).interrupt();
57447       var selection2;
57448       if (duration === 0) {
57449         selection2 = darkness;
57450       } else {
57451         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
57452       }
57453       selection2.attr("d", function(d2) {
57454         var containerWidth = containerNode.clientWidth;
57455         var containerHeight = containerNode.clientHeight;
57456         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
57457         if (!d2)
57458           return string;
57459         return string + "M" + d2.left + "," + d2.top + "L" + d2.left + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + d2.top + "Z";
57460       });
57461     };
57462     curtain.remove = function() {
57463       surface.remove();
57464       tooltip.remove();
57465       select_default2(window).on("resize.curtain", null);
57466     };
57467     function copyBox(src) {
57468       return {
57469         top: src.top,
57470         right: src.right,
57471         bottom: src.bottom,
57472         left: src.left,
57473         width: src.width,
57474         height: src.height
57475       };
57476     }
57477     return curtain;
57478   }
57479
57480   // modules/ui/intro/welcome.js
57481   function uiIntroWelcome(context, reveal) {
57482     var dispatch14 = dispatch_default("done");
57483     var chapter = {
57484       title: "intro.welcome.title"
57485     };
57486     function welcome() {
57487       context.map().centerZoom([-85.63591, 41.94285], 19);
57488       reveal(
57489         ".intro-nav-wrap .chapter-welcome",
57490         helpHtml("intro.welcome.welcome"),
57491         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
57492       );
57493     }
57494     function practice() {
57495       reveal(
57496         ".intro-nav-wrap .chapter-welcome",
57497         helpHtml("intro.welcome.practice"),
57498         { buttonText: _t.html("intro.ok"), buttonCallback: words }
57499       );
57500     }
57501     function words() {
57502       reveal(
57503         ".intro-nav-wrap .chapter-welcome",
57504         helpHtml("intro.welcome.words"),
57505         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
57506       );
57507     }
57508     function chapters() {
57509       dispatch14.call("done");
57510       reveal(
57511         ".intro-nav-wrap .chapter-navigation",
57512         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
57513       );
57514     }
57515     chapter.enter = function() {
57516       welcome();
57517     };
57518     chapter.exit = function() {
57519       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
57520     };
57521     chapter.restart = function() {
57522       chapter.exit();
57523       chapter.enter();
57524     };
57525     return utilRebind(chapter, dispatch14, "on");
57526   }
57527
57528   // modules/ui/intro/navigation.js
57529   function uiIntroNavigation(context, reveal) {
57530     var dispatch14 = dispatch_default("done");
57531     var timeouts = [];
57532     var hallId = "n2061";
57533     var townHall = [-85.63591, 41.94285];
57534     var springStreetId = "w397";
57535     var springStreetEndId = "n1834";
57536     var springStreet = [-85.63582, 41.94255];
57537     var onewayField = _mainPresetIndex.field("oneway");
57538     var maxspeedField = _mainPresetIndex.field("maxspeed");
57539     var chapter = {
57540       title: "intro.navigation.title"
57541     };
57542     function timeout2(f3, t2) {
57543       timeouts.push(window.setTimeout(f3, t2));
57544     }
57545     function eventCancel(d3_event) {
57546       d3_event.stopPropagation();
57547       d3_event.preventDefault();
57548     }
57549     function isTownHallSelected() {
57550       var ids = context.selectedIDs();
57551       return ids.length === 1 && ids[0] === hallId;
57552     }
57553     function dragMap() {
57554       context.enter(modeBrowse(context));
57555       context.history().reset("initial");
57556       var msec = transitionTime(townHall, context.map().center());
57557       if (msec) {
57558         reveal(null, null, { duration: 0 });
57559       }
57560       context.map().centerZoomEase(townHall, 19, msec);
57561       timeout2(function() {
57562         var centerStart = context.map().center();
57563         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
57564         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
57565         reveal(".surface", dragString);
57566         context.map().on("drawn.intro", function() {
57567           reveal(".surface", dragString, { duration: 0 });
57568         });
57569         context.map().on("move.intro", function() {
57570           var centerNow = context.map().center();
57571           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
57572             context.map().on("move.intro", null);
57573             timeout2(function() {
57574               continueTo(zoomMap);
57575             }, 3e3);
57576           }
57577         });
57578       }, msec + 100);
57579       function continueTo(nextStep) {
57580         context.map().on("move.intro drawn.intro", null);
57581         nextStep();
57582       }
57583     }
57584     function zoomMap() {
57585       var zoomStart = context.map().zoom();
57586       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
57587       var zoomString = helpHtml("intro.navigation." + textId);
57588       reveal(".surface", zoomString);
57589       context.map().on("drawn.intro", function() {
57590         reveal(".surface", zoomString, { duration: 0 });
57591       });
57592       context.map().on("move.intro", function() {
57593         if (context.map().zoom() !== zoomStart) {
57594           context.map().on("move.intro", null);
57595           timeout2(function() {
57596             continueTo(features);
57597           }, 3e3);
57598         }
57599       });
57600       function continueTo(nextStep) {
57601         context.map().on("move.intro drawn.intro", null);
57602         nextStep();
57603       }
57604     }
57605     function features() {
57606       var onClick = function() {
57607         continueTo(pointsLinesAreas);
57608       };
57609       reveal(
57610         ".surface",
57611         helpHtml("intro.navigation.features"),
57612         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57613       );
57614       context.map().on("drawn.intro", function() {
57615         reveal(
57616           ".surface",
57617           helpHtml("intro.navigation.features"),
57618           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57619         );
57620       });
57621       function continueTo(nextStep) {
57622         context.map().on("drawn.intro", null);
57623         nextStep();
57624       }
57625     }
57626     function pointsLinesAreas() {
57627       var onClick = function() {
57628         continueTo(nodesWays);
57629       };
57630       reveal(
57631         ".surface",
57632         helpHtml("intro.navigation.points_lines_areas"),
57633         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57634       );
57635       context.map().on("drawn.intro", function() {
57636         reveal(
57637           ".surface",
57638           helpHtml("intro.navigation.points_lines_areas"),
57639           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57640         );
57641       });
57642       function continueTo(nextStep) {
57643         context.map().on("drawn.intro", null);
57644         nextStep();
57645       }
57646     }
57647     function nodesWays() {
57648       var onClick = function() {
57649         continueTo(clickTownHall);
57650       };
57651       reveal(
57652         ".surface",
57653         helpHtml("intro.navigation.nodes_ways"),
57654         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57655       );
57656       context.map().on("drawn.intro", function() {
57657         reveal(
57658           ".surface",
57659           helpHtml("intro.navigation.nodes_ways"),
57660           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57661         );
57662       });
57663       function continueTo(nextStep) {
57664         context.map().on("drawn.intro", null);
57665         nextStep();
57666       }
57667     }
57668     function clickTownHall() {
57669       context.enter(modeBrowse(context));
57670       context.history().reset("initial");
57671       var entity = context.hasEntity(hallId);
57672       if (!entity)
57673         return;
57674       reveal(null, null, { duration: 0 });
57675       context.map().centerZoomEase(entity.loc, 19, 500);
57676       timeout2(function() {
57677         var entity2 = context.hasEntity(hallId);
57678         if (!entity2)
57679           return;
57680         var box = pointBox(entity2.loc, context);
57681         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
57682         reveal(box, helpHtml("intro.navigation." + textId));
57683         context.map().on("move.intro drawn.intro", function() {
57684           var entity3 = context.hasEntity(hallId);
57685           if (!entity3)
57686             return;
57687           var box2 = pointBox(entity3.loc, context);
57688           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
57689         });
57690         context.on("enter.intro", function() {
57691           if (isTownHallSelected())
57692             continueTo(selectedTownHall);
57693         });
57694       }, 550);
57695       context.history().on("change.intro", function() {
57696         if (!context.hasEntity(hallId)) {
57697           continueTo(clickTownHall);
57698         }
57699       });
57700       function continueTo(nextStep) {
57701         context.on("enter.intro", null);
57702         context.map().on("move.intro drawn.intro", null);
57703         context.history().on("change.intro", null);
57704         nextStep();
57705       }
57706     }
57707     function selectedTownHall() {
57708       if (!isTownHallSelected())
57709         return clickTownHall();
57710       var entity = context.hasEntity(hallId);
57711       if (!entity)
57712         return clickTownHall();
57713       var box = pointBox(entity.loc, context);
57714       var onClick = function() {
57715         continueTo(editorTownHall);
57716       };
57717       reveal(
57718         box,
57719         helpHtml("intro.navigation.selected_townhall"),
57720         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57721       );
57722       context.map().on("move.intro drawn.intro", function() {
57723         var entity2 = context.hasEntity(hallId);
57724         if (!entity2)
57725           return;
57726         var box2 = pointBox(entity2.loc, context);
57727         reveal(
57728           box2,
57729           helpHtml("intro.navigation.selected_townhall"),
57730           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57731         );
57732       });
57733       context.history().on("change.intro", function() {
57734         if (!context.hasEntity(hallId)) {
57735           continueTo(clickTownHall);
57736         }
57737       });
57738       function continueTo(nextStep) {
57739         context.map().on("move.intro drawn.intro", null);
57740         context.history().on("change.intro", null);
57741         nextStep();
57742       }
57743     }
57744     function editorTownHall() {
57745       if (!isTownHallSelected())
57746         return clickTownHall();
57747       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57748       var onClick = function() {
57749         continueTo(presetTownHall);
57750       };
57751       reveal(
57752         ".entity-editor-pane",
57753         helpHtml("intro.navigation.editor_townhall"),
57754         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57755       );
57756       context.on("exit.intro", function() {
57757         continueTo(clickTownHall);
57758       });
57759       context.history().on("change.intro", function() {
57760         if (!context.hasEntity(hallId)) {
57761           continueTo(clickTownHall);
57762         }
57763       });
57764       function continueTo(nextStep) {
57765         context.on("exit.intro", null);
57766         context.history().on("change.intro", null);
57767         context.container().select(".inspector-wrap").on("wheel.intro", null);
57768         nextStep();
57769       }
57770     }
57771     function presetTownHall() {
57772       if (!isTownHallSelected())
57773         return clickTownHall();
57774       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57775       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57776       var entity = context.entity(context.selectedIDs()[0]);
57777       var preset = _mainPresetIndex.match(entity, context.graph());
57778       var onClick = function() {
57779         continueTo(fieldsTownHall);
57780       };
57781       reveal(
57782         ".entity-editor-pane .section-feature-type",
57783         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
57784         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57785       );
57786       context.on("exit.intro", function() {
57787         continueTo(clickTownHall);
57788       });
57789       context.history().on("change.intro", function() {
57790         if (!context.hasEntity(hallId)) {
57791           continueTo(clickTownHall);
57792         }
57793       });
57794       function continueTo(nextStep) {
57795         context.on("exit.intro", null);
57796         context.history().on("change.intro", null);
57797         context.container().select(".inspector-wrap").on("wheel.intro", null);
57798         nextStep();
57799       }
57800     }
57801     function fieldsTownHall() {
57802       if (!isTownHallSelected())
57803         return clickTownHall();
57804       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57805       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57806       var onClick = function() {
57807         continueTo(closeTownHall);
57808       };
57809       reveal(
57810         ".entity-editor-pane .section-preset-fields",
57811         helpHtml("intro.navigation.fields_townhall"),
57812         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57813       );
57814       context.on("exit.intro", function() {
57815         continueTo(clickTownHall);
57816       });
57817       context.history().on("change.intro", function() {
57818         if (!context.hasEntity(hallId)) {
57819           continueTo(clickTownHall);
57820         }
57821       });
57822       function continueTo(nextStep) {
57823         context.on("exit.intro", null);
57824         context.history().on("change.intro", null);
57825         context.container().select(".inspector-wrap").on("wheel.intro", null);
57826         nextStep();
57827       }
57828     }
57829     function closeTownHall() {
57830       if (!isTownHallSelected())
57831         return clickTownHall();
57832       var selector = ".entity-editor-pane button.close svg use";
57833       var href = select_default2(selector).attr("href") || "#iD-icon-close";
57834       reveal(
57835         ".entity-editor-pane",
57836         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
57837       );
57838       context.on("exit.intro", function() {
57839         continueTo(searchStreet);
57840       });
57841       context.history().on("change.intro", function() {
57842         var selector2 = ".entity-editor-pane button.close svg use";
57843         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57844         reveal(
57845           ".entity-editor-pane",
57846           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
57847           { duration: 0 }
57848         );
57849       });
57850       function continueTo(nextStep) {
57851         context.on("exit.intro", null);
57852         context.history().on("change.intro", null);
57853         nextStep();
57854       }
57855     }
57856     function searchStreet() {
57857       context.enter(modeBrowse(context));
57858       context.history().reset("initial");
57859       var msec = transitionTime(springStreet, context.map().center());
57860       if (msec) {
57861         reveal(null, null, { duration: 0 });
57862       }
57863       context.map().centerZoomEase(springStreet, 19, msec);
57864       timeout2(function() {
57865         reveal(
57866           ".search-header input",
57867           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
57868         );
57869         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
57870       }, msec + 100);
57871     }
57872     function checkSearchResult() {
57873       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
57874       var firstName = first.select(".entity-name");
57875       var name = _t("intro.graph.name.spring-street");
57876       if (!firstName.empty() && firstName.html() === name) {
57877         reveal(
57878           first.node(),
57879           helpHtml("intro.navigation.choose_street", { name }),
57880           { duration: 300 }
57881         );
57882         context.on("exit.intro", function() {
57883           continueTo(selectedStreet);
57884         });
57885         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
57886       }
57887       function continueTo(nextStep) {
57888         context.on("exit.intro", null);
57889         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
57890         nextStep();
57891       }
57892     }
57893     function selectedStreet() {
57894       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57895         return searchStreet();
57896       }
57897       var onClick = function() {
57898         continueTo(editorStreet);
57899       };
57900       var entity = context.entity(springStreetEndId);
57901       var box = pointBox(entity.loc, context);
57902       box.height = 500;
57903       reveal(
57904         box,
57905         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57906         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57907       );
57908       timeout2(function() {
57909         context.map().on("move.intro drawn.intro", function() {
57910           var entity2 = context.hasEntity(springStreetEndId);
57911           if (!entity2)
57912             return;
57913           var box2 = pointBox(entity2.loc, context);
57914           box2.height = 500;
57915           reveal(
57916             box2,
57917             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57918             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57919           );
57920         });
57921       }, 600);
57922       context.on("enter.intro", function(mode) {
57923         if (!context.hasEntity(springStreetId)) {
57924           return continueTo(searchStreet);
57925         }
57926         var ids = context.selectedIDs();
57927         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
57928           context.enter(modeSelect(context, [springStreetId]));
57929         }
57930       });
57931       context.history().on("change.intro", function() {
57932         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57933           timeout2(function() {
57934             continueTo(searchStreet);
57935           }, 300);
57936         }
57937       });
57938       function continueTo(nextStep) {
57939         context.map().on("move.intro drawn.intro", null);
57940         context.on("enter.intro", null);
57941         context.history().on("change.intro", null);
57942         nextStep();
57943       }
57944     }
57945     function editorStreet() {
57946       var selector = ".entity-editor-pane button.close svg use";
57947       var href = select_default2(selector).attr("href") || "#iD-icon-close";
57948       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57949         button: { html: icon(href, "inline") },
57950         field1: onewayField.title(),
57951         field2: maxspeedField.title()
57952       }));
57953       context.on("exit.intro", function() {
57954         continueTo(play);
57955       });
57956       context.history().on("change.intro", function() {
57957         var selector2 = ".entity-editor-pane button.close svg use";
57958         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57959         reveal(
57960           ".entity-editor-pane",
57961           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57962             button: { html: icon(href2, "inline") },
57963             field1: onewayField.title(),
57964             field2: maxspeedField.title()
57965           }),
57966           { duration: 0 }
57967         );
57968       });
57969       function continueTo(nextStep) {
57970         context.on("exit.intro", null);
57971         context.history().on("change.intro", null);
57972         nextStep();
57973       }
57974     }
57975     function play() {
57976       dispatch14.call("done");
57977       reveal(
57978         ".ideditor",
57979         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
57980         {
57981           tooltipBox: ".intro-nav-wrap .chapter-point",
57982           buttonText: _t.html("intro.ok"),
57983           buttonCallback: function() {
57984             reveal(".ideditor");
57985           }
57986         }
57987       );
57988     }
57989     chapter.enter = function() {
57990       dragMap();
57991     };
57992     chapter.exit = function() {
57993       timeouts.forEach(window.clearTimeout);
57994       context.on("enter.intro exit.intro", null);
57995       context.map().on("move.intro drawn.intro", null);
57996       context.history().on("change.intro", null);
57997       context.container().select(".inspector-wrap").on("wheel.intro", null);
57998       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
57999     };
58000     chapter.restart = function() {
58001       chapter.exit();
58002       chapter.enter();
58003     };
58004     return utilRebind(chapter, dispatch14, "on");
58005   }
58006
58007   // modules/ui/intro/point.js
58008   function uiIntroPoint(context, reveal) {
58009     var dispatch14 = dispatch_default("done");
58010     var timeouts = [];
58011     var intersection = [-85.63279, 41.94394];
58012     var building = [-85.632422, 41.944045];
58013     var cafePreset = _mainPresetIndex.item("amenity/cafe");
58014     var _pointID = null;
58015     var chapter = {
58016       title: "intro.points.title"
58017     };
58018     function timeout2(f3, t2) {
58019       timeouts.push(window.setTimeout(f3, t2));
58020     }
58021     function eventCancel(d3_event) {
58022       d3_event.stopPropagation();
58023       d3_event.preventDefault();
58024     }
58025     function addPoint() {
58026       context.enter(modeBrowse(context));
58027       context.history().reset("initial");
58028       var msec = transitionTime(intersection, context.map().center());
58029       if (msec) {
58030         reveal(null, null, { duration: 0 });
58031       }
58032       context.map().centerZoomEase(intersection, 19, msec);
58033       timeout2(function() {
58034         var tooltip = reveal(
58035           "button.add-point",
58036           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
58037         );
58038         _pointID = null;
58039         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
58040         context.on("enter.intro", function(mode) {
58041           if (mode.id !== "add-point")
58042             return;
58043           continueTo(placePoint);
58044         });
58045       }, msec + 100);
58046       function continueTo(nextStep) {
58047         context.on("enter.intro", null);
58048         nextStep();
58049       }
58050     }
58051     function placePoint() {
58052       if (context.mode().id !== "add-point") {
58053         return chapter.restart();
58054       }
58055       var pointBox2 = pad(building, 150, context);
58056       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
58057       reveal(pointBox2, helpHtml("intro.points." + textId));
58058       context.map().on("move.intro drawn.intro", function() {
58059         pointBox2 = pad(building, 150, context);
58060         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
58061       });
58062       context.on("enter.intro", function(mode) {
58063         if (mode.id !== "select")
58064           return chapter.restart();
58065         _pointID = context.mode().selectedIDs()[0];
58066         continueTo(searchPreset);
58067       });
58068       function continueTo(nextStep) {
58069         context.map().on("move.intro drawn.intro", null);
58070         context.on("enter.intro", null);
58071         nextStep();
58072       }
58073     }
58074     function searchPreset() {
58075       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58076         return addPoint();
58077       }
58078       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58079       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58080       reveal(
58081         ".preset-search-input",
58082         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58083       );
58084       context.on("enter.intro", function(mode) {
58085         if (!_pointID || !context.hasEntity(_pointID)) {
58086           return continueTo(addPoint);
58087         }
58088         var ids = context.selectedIDs();
58089         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
58090           context.enter(modeSelect(context, [_pointID]));
58091           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58092           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58093           reveal(
58094             ".preset-search-input",
58095             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58096           );
58097           context.history().on("change.intro", null);
58098         }
58099       });
58100       function checkPresetSearch() {
58101         var first = context.container().select(".preset-list-item:first-child");
58102         if (first.classed("preset-amenity-cafe")) {
58103           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58104           reveal(
58105             first.select(".preset-list-button").node(),
58106             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
58107             { duration: 300 }
58108           );
58109           context.history().on("change.intro", function() {
58110             continueTo(aboutFeatureEditor);
58111           });
58112         }
58113       }
58114       function continueTo(nextStep) {
58115         context.on("enter.intro", null);
58116         context.history().on("change.intro", null);
58117         context.container().select(".inspector-wrap").on("wheel.intro", null);
58118         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58119         nextStep();
58120       }
58121     }
58122     function aboutFeatureEditor() {
58123       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58124         return addPoint();
58125       }
58126       timeout2(function() {
58127         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
58128           tooltipClass: "intro-points-describe",
58129           buttonText: _t.html("intro.ok"),
58130           buttonCallback: function() {
58131             continueTo(addName);
58132           }
58133         });
58134       }, 400);
58135       context.on("exit.intro", function() {
58136         continueTo(reselectPoint);
58137       });
58138       function continueTo(nextStep) {
58139         context.on("exit.intro", null);
58140         nextStep();
58141       }
58142     }
58143     function addName() {
58144       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58145         return addPoint();
58146       }
58147       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58148       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
58149       timeout2(function() {
58150         var entity = context.entity(_pointID);
58151         if (entity.tags.name) {
58152           var tooltip = reveal(".entity-editor-pane", addNameString, {
58153             tooltipClass: "intro-points-describe",
58154             buttonText: _t.html("intro.ok"),
58155             buttonCallback: function() {
58156               continueTo(addCloseEditor);
58157             }
58158           });
58159           tooltip.select(".instruction").style("display", "none");
58160         } else {
58161           reveal(
58162             ".entity-editor-pane",
58163             addNameString,
58164             { tooltipClass: "intro-points-describe" }
58165           );
58166         }
58167       }, 400);
58168       context.history().on("change.intro", function() {
58169         continueTo(addCloseEditor);
58170       });
58171       context.on("exit.intro", function() {
58172         continueTo(reselectPoint);
58173       });
58174       function continueTo(nextStep) {
58175         context.on("exit.intro", null);
58176         context.history().on("change.intro", null);
58177         nextStep();
58178       }
58179     }
58180     function addCloseEditor() {
58181       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58182       var selector = ".entity-editor-pane button.close svg use";
58183       var href = select_default2(selector).attr("href") || "#iD-icon-close";
58184       context.on("exit.intro", function() {
58185         continueTo(reselectPoint);
58186       });
58187       reveal(
58188         ".entity-editor-pane",
58189         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
58190       );
58191       function continueTo(nextStep) {
58192         context.on("exit.intro", null);
58193         nextStep();
58194       }
58195     }
58196     function reselectPoint() {
58197       if (!_pointID)
58198         return chapter.restart();
58199       var entity = context.hasEntity(_pointID);
58200       if (!entity)
58201         return chapter.restart();
58202       var oldPreset = _mainPresetIndex.match(entity, context.graph());
58203       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
58204       context.enter(modeBrowse(context));
58205       var msec = transitionTime(entity.loc, context.map().center());
58206       if (msec) {
58207         reveal(null, null, { duration: 0 });
58208       }
58209       context.map().centerEase(entity.loc, msec);
58210       timeout2(function() {
58211         var box = pointBox(entity.loc, context);
58212         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
58213         timeout2(function() {
58214           context.map().on("move.intro drawn.intro", function() {
58215             var entity2 = context.hasEntity(_pointID);
58216             if (!entity2)
58217               return chapter.restart();
58218             var box2 = pointBox(entity2.loc, context);
58219             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
58220           });
58221         }, 600);
58222         context.on("enter.intro", function(mode) {
58223           if (mode.id !== "select")
58224             return;
58225           continueTo(updatePoint);
58226         });
58227       }, msec + 100);
58228       function continueTo(nextStep) {
58229         context.map().on("move.intro drawn.intro", null);
58230         context.on("enter.intro", null);
58231         nextStep();
58232       }
58233     }
58234     function updatePoint() {
58235       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58236         return continueTo(reselectPoint);
58237       }
58238       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58239       context.on("exit.intro", function() {
58240         continueTo(reselectPoint);
58241       });
58242       context.history().on("change.intro", function() {
58243         continueTo(updateCloseEditor);
58244       });
58245       timeout2(function() {
58246         reveal(
58247           ".entity-editor-pane",
58248           helpHtml("intro.points.update"),
58249           { tooltipClass: "intro-points-describe" }
58250         );
58251       }, 400);
58252       function continueTo(nextStep) {
58253         context.on("exit.intro", null);
58254         context.history().on("change.intro", null);
58255         nextStep();
58256       }
58257     }
58258     function updateCloseEditor() {
58259       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58260         return continueTo(reselectPoint);
58261       }
58262       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58263       context.on("exit.intro", function() {
58264         continueTo(rightClickPoint);
58265       });
58266       timeout2(function() {
58267         reveal(
58268           ".entity-editor-pane",
58269           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
58270         );
58271       }, 500);
58272       function continueTo(nextStep) {
58273         context.on("exit.intro", null);
58274         nextStep();
58275       }
58276     }
58277     function rightClickPoint() {
58278       if (!_pointID)
58279         return chapter.restart();
58280       var entity = context.hasEntity(_pointID);
58281       if (!entity)
58282         return chapter.restart();
58283       context.enter(modeBrowse(context));
58284       var box = pointBox(entity.loc, context);
58285       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
58286       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
58287       timeout2(function() {
58288         context.map().on("move.intro", function() {
58289           var entity2 = context.hasEntity(_pointID);
58290           if (!entity2)
58291             return chapter.restart();
58292           var box2 = pointBox(entity2.loc, context);
58293           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
58294         });
58295       }, 600);
58296       context.on("enter.intro", function(mode) {
58297         if (mode.id !== "select")
58298           return;
58299         var ids = context.selectedIDs();
58300         if (ids.length !== 1 || ids[0] !== _pointID)
58301           return;
58302         timeout2(function() {
58303           var node = selectMenuItem(context, "delete").node();
58304           if (!node)
58305             return;
58306           continueTo(enterDelete);
58307         }, 50);
58308       });
58309       function continueTo(nextStep) {
58310         context.on("enter.intro", null);
58311         context.map().on("move.intro", null);
58312         nextStep();
58313       }
58314     }
58315     function enterDelete() {
58316       if (!_pointID)
58317         return chapter.restart();
58318       var entity = context.hasEntity(_pointID);
58319       if (!entity)
58320         return chapter.restart();
58321       var node = selectMenuItem(context, "delete").node();
58322       if (!node) {
58323         return continueTo(rightClickPoint);
58324       }
58325       reveal(
58326         ".edit-menu",
58327         helpHtml("intro.points.delete"),
58328         { padding: 50 }
58329       );
58330       timeout2(function() {
58331         context.map().on("move.intro", function() {
58332           reveal(
58333             ".edit-menu",
58334             helpHtml("intro.points.delete"),
58335             { duration: 0, padding: 50 }
58336           );
58337         });
58338       }, 300);
58339       context.on("exit.intro", function() {
58340         if (!_pointID)
58341           return chapter.restart();
58342         var entity2 = context.hasEntity(_pointID);
58343         if (entity2)
58344           return continueTo(rightClickPoint);
58345       });
58346       context.history().on("change.intro", function(changed) {
58347         if (changed.deleted().length) {
58348           continueTo(undo);
58349         }
58350       });
58351       function continueTo(nextStep) {
58352         context.map().on("move.intro", null);
58353         context.history().on("change.intro", null);
58354         context.on("exit.intro", null);
58355         nextStep();
58356       }
58357     }
58358     function undo() {
58359       context.history().on("change.intro", function() {
58360         continueTo(play);
58361       });
58362       reveal(
58363         ".top-toolbar button.undo-button",
58364         helpHtml("intro.points.undo")
58365       );
58366       function continueTo(nextStep) {
58367         context.history().on("change.intro", null);
58368         nextStep();
58369       }
58370     }
58371     function play() {
58372       dispatch14.call("done");
58373       reveal(
58374         ".ideditor",
58375         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
58376         {
58377           tooltipBox: ".intro-nav-wrap .chapter-area",
58378           buttonText: _t.html("intro.ok"),
58379           buttonCallback: function() {
58380             reveal(".ideditor");
58381           }
58382         }
58383       );
58384     }
58385     chapter.enter = function() {
58386       addPoint();
58387     };
58388     chapter.exit = function() {
58389       timeouts.forEach(window.clearTimeout);
58390       context.on("enter.intro exit.intro", null);
58391       context.map().on("move.intro drawn.intro", null);
58392       context.history().on("change.intro", null);
58393       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58394       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58395     };
58396     chapter.restart = function() {
58397       chapter.exit();
58398       chapter.enter();
58399     };
58400     return utilRebind(chapter, dispatch14, "on");
58401   }
58402
58403   // modules/ui/intro/area.js
58404   function uiIntroArea(context, reveal) {
58405     var dispatch14 = dispatch_default("done");
58406     var playground = [-85.63552, 41.94159];
58407     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
58408     var nameField = _mainPresetIndex.field("name");
58409     var descriptionField = _mainPresetIndex.field("description");
58410     var timeouts = [];
58411     var _areaID;
58412     var chapter = {
58413       title: "intro.areas.title"
58414     };
58415     function timeout2(f3, t2) {
58416       timeouts.push(window.setTimeout(f3, t2));
58417     }
58418     function eventCancel(d3_event) {
58419       d3_event.stopPropagation();
58420       d3_event.preventDefault();
58421     }
58422     function revealPlayground(center, text2, options2) {
58423       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
58424       var box = pad(center, padding, context);
58425       reveal(box, text2, options2);
58426     }
58427     function addArea() {
58428       context.enter(modeBrowse(context));
58429       context.history().reset("initial");
58430       _areaID = null;
58431       var msec = transitionTime(playground, context.map().center());
58432       if (msec) {
58433         reveal(null, null, { duration: 0 });
58434       }
58435       context.map().centerZoomEase(playground, 19, msec);
58436       timeout2(function() {
58437         var tooltip = reveal(
58438           "button.add-area",
58439           helpHtml("intro.areas.add_playground")
58440         );
58441         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
58442         context.on("enter.intro", function(mode) {
58443           if (mode.id !== "add-area")
58444             return;
58445           continueTo(startPlayground);
58446         });
58447       }, msec + 100);
58448       function continueTo(nextStep) {
58449         context.on("enter.intro", null);
58450         nextStep();
58451       }
58452     }
58453     function startPlayground() {
58454       if (context.mode().id !== "add-area") {
58455         return chapter.restart();
58456       }
58457       _areaID = null;
58458       context.map().zoomEase(19.5, 500);
58459       timeout2(function() {
58460         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
58461         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
58462         revealPlayground(
58463           playground,
58464           startDrawString,
58465           { duration: 250 }
58466         );
58467         timeout2(function() {
58468           context.map().on("move.intro drawn.intro", function() {
58469             revealPlayground(
58470               playground,
58471               startDrawString,
58472               { duration: 0 }
58473             );
58474           });
58475           context.on("enter.intro", function(mode) {
58476             if (mode.id !== "draw-area")
58477               return chapter.restart();
58478             continueTo(continuePlayground);
58479           });
58480         }, 250);
58481       }, 550);
58482       function continueTo(nextStep) {
58483         context.map().on("move.intro drawn.intro", null);
58484         context.on("enter.intro", null);
58485         nextStep();
58486       }
58487     }
58488     function continuePlayground() {
58489       if (context.mode().id !== "draw-area") {
58490         return chapter.restart();
58491       }
58492       _areaID = null;
58493       revealPlayground(
58494         playground,
58495         helpHtml("intro.areas.continue_playground"),
58496         { duration: 250 }
58497       );
58498       timeout2(function() {
58499         context.map().on("move.intro drawn.intro", function() {
58500           revealPlayground(
58501             playground,
58502             helpHtml("intro.areas.continue_playground"),
58503             { duration: 0 }
58504           );
58505         });
58506       }, 250);
58507       context.on("enter.intro", function(mode) {
58508         if (mode.id === "draw-area") {
58509           var entity = context.hasEntity(context.selectedIDs()[0]);
58510           if (entity && entity.nodes.length >= 6) {
58511             return continueTo(finishPlayground);
58512           } else {
58513             return;
58514           }
58515         } else if (mode.id === "select") {
58516           _areaID = context.selectedIDs()[0];
58517           return continueTo(searchPresets);
58518         } else {
58519           return chapter.restart();
58520         }
58521       });
58522       function continueTo(nextStep) {
58523         context.map().on("move.intro drawn.intro", null);
58524         context.on("enter.intro", null);
58525         nextStep();
58526       }
58527     }
58528     function finishPlayground() {
58529       if (context.mode().id !== "draw-area") {
58530         return chapter.restart();
58531       }
58532       _areaID = null;
58533       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
58534       revealPlayground(
58535         playground,
58536         finishString,
58537         { duration: 250 }
58538       );
58539       timeout2(function() {
58540         context.map().on("move.intro drawn.intro", function() {
58541           revealPlayground(
58542             playground,
58543             finishString,
58544             { duration: 0 }
58545           );
58546         });
58547       }, 250);
58548       context.on("enter.intro", function(mode) {
58549         if (mode.id === "draw-area") {
58550           return;
58551         } else if (mode.id === "select") {
58552           _areaID = context.selectedIDs()[0];
58553           return continueTo(searchPresets);
58554         } else {
58555           return chapter.restart();
58556         }
58557       });
58558       function continueTo(nextStep) {
58559         context.map().on("move.intro drawn.intro", null);
58560         context.on("enter.intro", null);
58561         nextStep();
58562       }
58563     }
58564     function searchPresets() {
58565       if (!_areaID || !context.hasEntity(_areaID)) {
58566         return addArea();
58567       }
58568       var ids = context.selectedIDs();
58569       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58570         context.enter(modeSelect(context, [_areaID]));
58571       }
58572       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58573       timeout2(function() {
58574         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58575         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58576         reveal(
58577           ".preset-search-input",
58578           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58579         );
58580       }, 400);
58581       context.on("enter.intro", function(mode) {
58582         if (!_areaID || !context.hasEntity(_areaID)) {
58583           return continueTo(addArea);
58584         }
58585         var ids2 = context.selectedIDs();
58586         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
58587           context.enter(modeSelect(context, [_areaID]));
58588           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58589           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58590           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58591           reveal(
58592             ".preset-search-input",
58593             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58594           );
58595           context.history().on("change.intro", null);
58596         }
58597       });
58598       function checkPresetSearch() {
58599         var first = context.container().select(".preset-list-item:first-child");
58600         if (first.classed("preset-leisure-playground")) {
58601           reveal(
58602             first.select(".preset-list-button").node(),
58603             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
58604             { duration: 300 }
58605           );
58606           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58607           context.history().on("change.intro", function() {
58608             continueTo(clickAddField);
58609           });
58610         }
58611       }
58612       function continueTo(nextStep) {
58613         context.container().select(".inspector-wrap").on("wheel.intro", null);
58614         context.on("enter.intro", null);
58615         context.history().on("change.intro", null);
58616         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58617         nextStep();
58618       }
58619     }
58620     function clickAddField() {
58621       if (!_areaID || !context.hasEntity(_areaID)) {
58622         return addArea();
58623       }
58624       var ids = context.selectedIDs();
58625       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58626         return searchPresets();
58627       }
58628       if (!context.container().select(".form-field-description").empty()) {
58629         return continueTo(describePlayground);
58630       }
58631       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58632       timeout2(function() {
58633         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58634         var entity = context.entity(_areaID);
58635         if (entity.tags.description) {
58636           return continueTo(play);
58637         }
58638         var box = context.container().select(".more-fields").node().getBoundingClientRect();
58639         if (box.top > 300) {
58640           var pane = context.container().select(".entity-editor-pane .inspector-body");
58641           var start2 = pane.node().scrollTop;
58642           var end = start2 + (box.top - 300);
58643           pane.transition().duration(250).tween("scroll.inspector", function() {
58644             var node = this;
58645             var i3 = number_default(start2, end);
58646             return function(t2) {
58647               node.scrollTop = i3(t2);
58648             };
58649           });
58650         }
58651         timeout2(function() {
58652           reveal(
58653             ".more-fields .combobox-input",
58654             helpHtml("intro.areas.add_field", {
58655               name: nameField.title(),
58656               description: descriptionField.title()
58657             }),
58658             { duration: 300 }
58659           );
58660           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
58661             var watcher;
58662             watcher = window.setInterval(function() {
58663               if (!context.container().select("div.combobox").empty()) {
58664                 window.clearInterval(watcher);
58665                 continueTo(chooseDescriptionField);
58666               }
58667             }, 300);
58668           });
58669         }, 300);
58670       }, 400);
58671       context.on("exit.intro", function() {
58672         return continueTo(searchPresets);
58673       });
58674       function continueTo(nextStep) {
58675         context.container().select(".inspector-wrap").on("wheel.intro", null);
58676         context.container().select(".more-fields .combobox-input").on("click.intro", null);
58677         context.on("exit.intro", null);
58678         nextStep();
58679       }
58680     }
58681     function chooseDescriptionField() {
58682       if (!_areaID || !context.hasEntity(_areaID)) {
58683         return addArea();
58684       }
58685       var ids = context.selectedIDs();
58686       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58687         return searchPresets();
58688       }
58689       if (!context.container().select(".form-field-description").empty()) {
58690         return continueTo(describePlayground);
58691       }
58692       if (context.container().select("div.combobox").empty()) {
58693         return continueTo(clickAddField);
58694       }
58695       var watcher;
58696       watcher = window.setInterval(function() {
58697         if (context.container().select("div.combobox").empty()) {
58698           window.clearInterval(watcher);
58699           timeout2(function() {
58700             if (context.container().select(".form-field-description").empty()) {
58701               continueTo(retryChooseDescription);
58702             } else {
58703               continueTo(describePlayground);
58704             }
58705           }, 300);
58706         }
58707       }, 300);
58708       reveal(
58709         "div.combobox",
58710         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
58711         { duration: 300 }
58712       );
58713       context.on("exit.intro", function() {
58714         return continueTo(searchPresets);
58715       });
58716       function continueTo(nextStep) {
58717         if (watcher)
58718           window.clearInterval(watcher);
58719         context.on("exit.intro", null);
58720         nextStep();
58721       }
58722     }
58723     function describePlayground() {
58724       if (!_areaID || !context.hasEntity(_areaID)) {
58725         return addArea();
58726       }
58727       var ids = context.selectedIDs();
58728       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58729         return searchPresets();
58730       }
58731       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58732       if (context.container().select(".form-field-description").empty()) {
58733         return continueTo(retryChooseDescription);
58734       }
58735       context.on("exit.intro", function() {
58736         continueTo(play);
58737       });
58738       reveal(
58739         ".entity-editor-pane",
58740         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
58741         { duration: 300 }
58742       );
58743       function continueTo(nextStep) {
58744         context.on("exit.intro", null);
58745         nextStep();
58746       }
58747     }
58748     function retryChooseDescription() {
58749       if (!_areaID || !context.hasEntity(_areaID)) {
58750         return addArea();
58751       }
58752       var ids = context.selectedIDs();
58753       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58754         return searchPresets();
58755       }
58756       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58757       reveal(
58758         ".entity-editor-pane",
58759         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
58760         {
58761           buttonText: _t.html("intro.ok"),
58762           buttonCallback: function() {
58763             continueTo(clickAddField);
58764           }
58765         }
58766       );
58767       context.on("exit.intro", function() {
58768         return continueTo(searchPresets);
58769       });
58770       function continueTo(nextStep) {
58771         context.on("exit.intro", null);
58772         nextStep();
58773       }
58774     }
58775     function play() {
58776       dispatch14.call("done");
58777       reveal(
58778         ".ideditor",
58779         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
58780         {
58781           tooltipBox: ".intro-nav-wrap .chapter-line",
58782           buttonText: _t.html("intro.ok"),
58783           buttonCallback: function() {
58784             reveal(".ideditor");
58785           }
58786         }
58787       );
58788     }
58789     chapter.enter = function() {
58790       addArea();
58791     };
58792     chapter.exit = function() {
58793       timeouts.forEach(window.clearTimeout);
58794       context.on("enter.intro exit.intro", null);
58795       context.map().on("move.intro drawn.intro", null);
58796       context.history().on("change.intro", null);
58797       context.container().select(".inspector-wrap").on("wheel.intro", null);
58798       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58799       context.container().select(".more-fields .combobox-input").on("click.intro", null);
58800     };
58801     chapter.restart = function() {
58802       chapter.exit();
58803       chapter.enter();
58804     };
58805     return utilRebind(chapter, dispatch14, "on");
58806   }
58807
58808   // modules/ui/intro/line.js
58809   function uiIntroLine(context, reveal) {
58810     var dispatch14 = dispatch_default("done");
58811     var timeouts = [];
58812     var _tulipRoadID = null;
58813     var flowerRoadID = "w646";
58814     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
58815     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
58816     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
58817     var roadCategory = _mainPresetIndex.item("category-road_minor");
58818     var residentialPreset = _mainPresetIndex.item("highway/residential");
58819     var woodRoadID = "w525";
58820     var woodRoadEndID = "n2862";
58821     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
58822     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
58823     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
58824     var washingtonStreetID = "w522";
58825     var twelfthAvenueID = "w1";
58826     var eleventhAvenueEndID = "n3550";
58827     var twelfthAvenueEndID = "n5";
58828     var _washingtonSegmentID = null;
58829     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
58830     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
58831     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
58832     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
58833     var chapter = {
58834       title: "intro.lines.title"
58835     };
58836     function timeout2(f3, t2) {
58837       timeouts.push(window.setTimeout(f3, t2));
58838     }
58839     function eventCancel(d3_event) {
58840       d3_event.stopPropagation();
58841       d3_event.preventDefault();
58842     }
58843     function addLine() {
58844       context.enter(modeBrowse(context));
58845       context.history().reset("initial");
58846       var msec = transitionTime(tulipRoadStart, context.map().center());
58847       if (msec) {
58848         reveal(null, null, { duration: 0 });
58849       }
58850       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
58851       timeout2(function() {
58852         var tooltip = reveal(
58853           "button.add-line",
58854           helpHtml("intro.lines.add_line")
58855         );
58856         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
58857         context.on("enter.intro", function(mode) {
58858           if (mode.id !== "add-line")
58859             return;
58860           continueTo(startLine);
58861         });
58862       }, msec + 100);
58863       function continueTo(nextStep) {
58864         context.on("enter.intro", null);
58865         nextStep();
58866       }
58867     }
58868     function startLine() {
58869       if (context.mode().id !== "add-line")
58870         return chapter.restart();
58871       _tulipRoadID = null;
58872       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
58873       var box = pad(tulipRoadStart, padding, context);
58874       box.height = box.height + 100;
58875       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
58876       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
58877       reveal(box, startLineString);
58878       context.map().on("move.intro drawn.intro", function() {
58879         padding = 70 * Math.pow(2, context.map().zoom() - 18);
58880         box = pad(tulipRoadStart, padding, context);
58881         box.height = box.height + 100;
58882         reveal(box, startLineString, { duration: 0 });
58883       });
58884       context.on("enter.intro", function(mode) {
58885         if (mode.id !== "draw-line")
58886           return chapter.restart();
58887         continueTo(drawLine);
58888       });
58889       function continueTo(nextStep) {
58890         context.map().on("move.intro drawn.intro", null);
58891         context.on("enter.intro", null);
58892         nextStep();
58893       }
58894     }
58895     function drawLine() {
58896       if (context.mode().id !== "draw-line")
58897         return chapter.restart();
58898       _tulipRoadID = context.mode().selectedIDs()[0];
58899       context.map().centerEase(tulipRoadMidpoint, 500);
58900       timeout2(function() {
58901         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58902         var box = pad(tulipRoadMidpoint, padding, context);
58903         box.height = box.height * 2;
58904         reveal(
58905           box,
58906           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
58907         );
58908         context.map().on("move.intro drawn.intro", function() {
58909           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58910           box = pad(tulipRoadMidpoint, padding, context);
58911           box.height = box.height * 2;
58912           reveal(
58913             box,
58914             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
58915             { duration: 0 }
58916           );
58917         });
58918       }, 550);
58919       context.history().on("change.intro", function() {
58920         if (isLineConnected()) {
58921           continueTo(continueLine);
58922         }
58923       });
58924       context.on("enter.intro", function(mode) {
58925         if (mode.id === "draw-line") {
58926           return;
58927         } else if (mode.id === "select") {
58928           continueTo(retryIntersect);
58929           return;
58930         } else {
58931           return chapter.restart();
58932         }
58933       });
58934       function continueTo(nextStep) {
58935         context.map().on("move.intro drawn.intro", null);
58936         context.history().on("change.intro", null);
58937         context.on("enter.intro", null);
58938         nextStep();
58939       }
58940     }
58941     function isLineConnected() {
58942       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58943       if (!entity)
58944         return false;
58945       var drawNodes = context.graph().childNodes(entity);
58946       return drawNodes.some(function(node) {
58947         return context.graph().parentWays(node).some(function(parent) {
58948           return parent.id === flowerRoadID;
58949         });
58950       });
58951     }
58952     function retryIntersect() {
58953       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
58954       var box = pad(tulipRoadIntersection, 80, context);
58955       reveal(
58956         box,
58957         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
58958       );
58959       timeout2(chapter.restart, 3e3);
58960     }
58961     function continueLine() {
58962       if (context.mode().id !== "draw-line")
58963         return chapter.restart();
58964       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58965       if (!entity)
58966         return chapter.restart();
58967       context.map().centerEase(tulipRoadIntersection, 500);
58968       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
58969       reveal(".surface", continueLineText);
58970       context.on("enter.intro", function(mode) {
58971         if (mode.id === "draw-line") {
58972           return;
58973         } else if (mode.id === "select") {
58974           return continueTo(chooseCategoryRoad);
58975         } else {
58976           return chapter.restart();
58977         }
58978       });
58979       function continueTo(nextStep) {
58980         context.on("enter.intro", null);
58981         nextStep();
58982       }
58983     }
58984     function chooseCategoryRoad() {
58985       if (context.mode().id !== "select")
58986         return chapter.restart();
58987       context.on("exit.intro", function() {
58988         return chapter.restart();
58989       });
58990       var button = context.container().select(".preset-category-road_minor .preset-list-button");
58991       if (button.empty())
58992         return chapter.restart();
58993       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58994       timeout2(function() {
58995         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58996         reveal(
58997           button.node(),
58998           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
58999         );
59000         button.on("click.intro", function() {
59001           continueTo(choosePresetResidential);
59002         });
59003       }, 400);
59004       function continueTo(nextStep) {
59005         context.container().select(".inspector-wrap").on("wheel.intro", null);
59006         context.container().select(".preset-list-button").on("click.intro", null);
59007         context.on("exit.intro", null);
59008         nextStep();
59009       }
59010     }
59011     function choosePresetResidential() {
59012       if (context.mode().id !== "select")
59013         return chapter.restart();
59014       context.on("exit.intro", function() {
59015         return chapter.restart();
59016       });
59017       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
59018       if (subgrid.empty())
59019         return chapter.restart();
59020       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
59021         continueTo(retryPresetResidential);
59022       });
59023       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
59024         continueTo(nameRoad);
59025       });
59026       timeout2(function() {
59027         reveal(
59028           subgrid.node(),
59029           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
59030           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
59031         );
59032       }, 300);
59033       function continueTo(nextStep) {
59034         context.container().select(".preset-list-button").on("click.intro", null);
59035         context.on("exit.intro", null);
59036         nextStep();
59037       }
59038     }
59039     function retryPresetResidential() {
59040       if (context.mode().id !== "select")
59041         return chapter.restart();
59042       context.on("exit.intro", function() {
59043         return chapter.restart();
59044       });
59045       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59046       timeout2(function() {
59047         var button = context.container().select(".entity-editor-pane .preset-list-button");
59048         reveal(
59049           button.node(),
59050           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
59051         );
59052         button.on("click.intro", function() {
59053           continueTo(chooseCategoryRoad);
59054         });
59055       }, 500);
59056       function continueTo(nextStep) {
59057         context.container().select(".inspector-wrap").on("wheel.intro", null);
59058         context.container().select(".preset-list-button").on("click.intro", null);
59059         context.on("exit.intro", null);
59060         nextStep();
59061       }
59062     }
59063     function nameRoad() {
59064       context.on("exit.intro", function() {
59065         continueTo(didNameRoad);
59066       });
59067       timeout2(function() {
59068         reveal(
59069           ".entity-editor-pane",
59070           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
59071           { tooltipClass: "intro-lines-name_road" }
59072         );
59073       }, 500);
59074       function continueTo(nextStep) {
59075         context.on("exit.intro", null);
59076         nextStep();
59077       }
59078     }
59079     function didNameRoad() {
59080       context.history().checkpoint("doneAddLine");
59081       timeout2(function() {
59082         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
59083           buttonText: _t.html("intro.ok"),
59084           buttonCallback: function() {
59085             continueTo(updateLine);
59086           }
59087         });
59088       }, 500);
59089       function continueTo(nextStep) {
59090         nextStep();
59091       }
59092     }
59093     function updateLine() {
59094       context.history().reset("doneAddLine");
59095       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59096         return chapter.restart();
59097       }
59098       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
59099       if (msec) {
59100         reveal(null, null, { duration: 0 });
59101       }
59102       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
59103       timeout2(function() {
59104         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
59105         var box = pad(woodRoadDragMidpoint, padding, context);
59106         var advance = function() {
59107           continueTo(addNode);
59108         };
59109         reveal(
59110           box,
59111           helpHtml("intro.lines.update_line"),
59112           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59113         );
59114         context.map().on("move.intro drawn.intro", function() {
59115           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
59116           var box2 = pad(woodRoadDragMidpoint, padding2, context);
59117           reveal(
59118             box2,
59119             helpHtml("intro.lines.update_line"),
59120             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59121           );
59122         });
59123       }, msec + 100);
59124       function continueTo(nextStep) {
59125         context.map().on("move.intro drawn.intro", null);
59126         nextStep();
59127       }
59128     }
59129     function addNode() {
59130       context.history().reset("doneAddLine");
59131       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59132         return chapter.restart();
59133       }
59134       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
59135       var box = pad(woodRoadAddNode, padding, context);
59136       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59137       reveal(box, addNodeString);
59138       context.map().on("move.intro drawn.intro", function() {
59139         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
59140         var box2 = pad(woodRoadAddNode, padding2, context);
59141         reveal(box2, addNodeString, { duration: 0 });
59142       });
59143       context.history().on("change.intro", function(changed) {
59144         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59145           return continueTo(updateLine);
59146         }
59147         if (changed.created().length === 1) {
59148           timeout2(function() {
59149             continueTo(startDragEndpoint);
59150           }, 500);
59151         }
59152       });
59153       context.on("enter.intro", function(mode) {
59154         if (mode.id !== "select") {
59155           continueTo(updateLine);
59156         }
59157       });
59158       function continueTo(nextStep) {
59159         context.map().on("move.intro drawn.intro", null);
59160         context.history().on("change.intro", null);
59161         context.on("enter.intro", null);
59162         nextStep();
59163       }
59164     }
59165     function startDragEndpoint() {
59166       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59167         return continueTo(updateLine);
59168       }
59169       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59170       var box = pad(woodRoadDragEndpoint, padding, context);
59171       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
59172       reveal(box, startDragString);
59173       context.map().on("move.intro drawn.intro", function() {
59174         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59175           return continueTo(updateLine);
59176         }
59177         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59178         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59179         reveal(box2, startDragString, { duration: 0 });
59180         var entity = context.entity(woodRoadEndID);
59181         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
59182           continueTo(finishDragEndpoint);
59183         }
59184       });
59185       function continueTo(nextStep) {
59186         context.map().on("move.intro drawn.intro", null);
59187         nextStep();
59188       }
59189     }
59190     function finishDragEndpoint() {
59191       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59192         return continueTo(updateLine);
59193       }
59194       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59195       var box = pad(woodRoadDragEndpoint, padding, context);
59196       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59197       reveal(box, finishDragString);
59198       context.map().on("move.intro drawn.intro", function() {
59199         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59200           return continueTo(updateLine);
59201         }
59202         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59203         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59204         reveal(box2, finishDragString, { duration: 0 });
59205         var entity = context.entity(woodRoadEndID);
59206         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
59207           continueTo(startDragEndpoint);
59208         }
59209       });
59210       context.on("enter.intro", function() {
59211         continueTo(startDragMidpoint);
59212       });
59213       function continueTo(nextStep) {
59214         context.map().on("move.intro drawn.intro", null);
59215         context.on("enter.intro", null);
59216         nextStep();
59217       }
59218     }
59219     function startDragMidpoint() {
59220       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59221         return continueTo(updateLine);
59222       }
59223       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
59224         context.enter(modeSelect(context, [woodRoadID]));
59225       }
59226       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
59227       var box = pad(woodRoadDragMidpoint, padding, context);
59228       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
59229       context.map().on("move.intro drawn.intro", function() {
59230         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59231           return continueTo(updateLine);
59232         }
59233         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
59234         var box2 = pad(woodRoadDragMidpoint, padding2, context);
59235         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
59236       });
59237       context.history().on("change.intro", function(changed) {
59238         if (changed.created().length === 1) {
59239           continueTo(continueDragMidpoint);
59240         }
59241       });
59242       context.on("enter.intro", function(mode) {
59243         if (mode.id !== "select") {
59244           context.enter(modeSelect(context, [woodRoadID]));
59245         }
59246       });
59247       function continueTo(nextStep) {
59248         context.map().on("move.intro drawn.intro", null);
59249         context.history().on("change.intro", null);
59250         context.on("enter.intro", null);
59251         nextStep();
59252       }
59253     }
59254     function continueDragMidpoint() {
59255       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59256         return continueTo(updateLine);
59257       }
59258       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59259       var box = pad(woodRoadDragEndpoint, padding, context);
59260       box.height += 400;
59261       var advance = function() {
59262         context.history().checkpoint("doneUpdateLine");
59263         continueTo(deleteLines);
59264       };
59265       reveal(
59266         box,
59267         helpHtml("intro.lines.continue_drag_midpoint"),
59268         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59269       );
59270       context.map().on("move.intro drawn.intro", function() {
59271         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59272           return continueTo(updateLine);
59273         }
59274         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59275         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59276         box2.height += 400;
59277         reveal(
59278           box2,
59279           helpHtml("intro.lines.continue_drag_midpoint"),
59280           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59281         );
59282       });
59283       function continueTo(nextStep) {
59284         context.map().on("move.intro drawn.intro", null);
59285         nextStep();
59286       }
59287     }
59288     function deleteLines() {
59289       context.history().reset("doneUpdateLine");
59290       context.enter(modeBrowse(context));
59291       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59292         return chapter.restart();
59293       }
59294       var msec = transitionTime(deleteLinesLoc, context.map().center());
59295       if (msec) {
59296         reveal(null, null, { duration: 0 });
59297       }
59298       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
59299       timeout2(function() {
59300         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59301         var box = pad(deleteLinesLoc, padding, context);
59302         box.top -= 200;
59303         box.height += 400;
59304         var advance = function() {
59305           continueTo(rightClickIntersection);
59306         };
59307         reveal(
59308           box,
59309           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59310           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59311         );
59312         context.map().on("move.intro drawn.intro", function() {
59313           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59314           var box2 = pad(deleteLinesLoc, padding2, context);
59315           box2.top -= 200;
59316           box2.height += 400;
59317           reveal(
59318             box2,
59319             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59320             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59321           );
59322         });
59323         context.history().on("change.intro", function() {
59324           timeout2(function() {
59325             continueTo(deleteLines);
59326           }, 500);
59327         });
59328       }, msec + 100);
59329       function continueTo(nextStep) {
59330         context.map().on("move.intro drawn.intro", null);
59331         context.history().on("change.intro", null);
59332         nextStep();
59333       }
59334     }
59335     function rightClickIntersection() {
59336       context.history().reset("doneUpdateLine");
59337       context.enter(modeBrowse(context));
59338       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59339       var rightClickString = helpHtml("intro.lines.split_street", {
59340         street1: _t("intro.graph.name.11th-avenue"),
59341         street2: _t("intro.graph.name.washington-street")
59342       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
59343       timeout2(function() {
59344         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59345         var box = pad(eleventhAvenueEnd, padding, context);
59346         reveal(box, rightClickString);
59347         context.map().on("move.intro drawn.intro", function() {
59348           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59349           var box2 = pad(eleventhAvenueEnd, padding2, context);
59350           reveal(
59351             box2,
59352             rightClickString,
59353             { duration: 0 }
59354           );
59355         });
59356         context.on("enter.intro", function(mode) {
59357           if (mode.id !== "select")
59358             return;
59359           var ids = context.selectedIDs();
59360           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
59361             return;
59362           timeout2(function() {
59363             var node = selectMenuItem(context, "split").node();
59364             if (!node)
59365               return;
59366             continueTo(splitIntersection);
59367           }, 50);
59368         });
59369         context.history().on("change.intro", function() {
59370           timeout2(function() {
59371             continueTo(deleteLines);
59372           }, 300);
59373         });
59374       }, 600);
59375       function continueTo(nextStep) {
59376         context.map().on("move.intro drawn.intro", null);
59377         context.on("enter.intro", null);
59378         context.history().on("change.intro", null);
59379         nextStep();
59380       }
59381     }
59382     function splitIntersection() {
59383       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59384         return continueTo(deleteLines);
59385       }
59386       var node = selectMenuItem(context, "split").node();
59387       if (!node) {
59388         return continueTo(rightClickIntersection);
59389       }
59390       var wasChanged = false;
59391       _washingtonSegmentID = null;
59392       reveal(
59393         ".edit-menu",
59394         helpHtml(
59395           "intro.lines.split_intersection",
59396           { street: _t("intro.graph.name.washington-street") }
59397         ),
59398         { padding: 50 }
59399       );
59400       context.map().on("move.intro drawn.intro", function() {
59401         var node2 = selectMenuItem(context, "split").node();
59402         if (!wasChanged && !node2) {
59403           return continueTo(rightClickIntersection);
59404         }
59405         reveal(
59406           ".edit-menu",
59407           helpHtml(
59408             "intro.lines.split_intersection",
59409             { street: _t("intro.graph.name.washington-street") }
59410           ),
59411           { duration: 0, padding: 50 }
59412         );
59413       });
59414       context.history().on("change.intro", function(changed) {
59415         wasChanged = true;
59416         timeout2(function() {
59417           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
59418             _washingtonSegmentID = changed.created()[0].id;
59419             continueTo(didSplit);
59420           } else {
59421             _washingtonSegmentID = null;
59422             continueTo(retrySplit);
59423           }
59424         }, 300);
59425       });
59426       function continueTo(nextStep) {
59427         context.map().on("move.intro drawn.intro", null);
59428         context.history().on("change.intro", null);
59429         nextStep();
59430       }
59431     }
59432     function retrySplit() {
59433       context.enter(modeBrowse(context));
59434       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59435       var advance = function() {
59436         continueTo(rightClickIntersection);
59437       };
59438       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59439       var box = pad(eleventhAvenueEnd, padding, context);
59440       reveal(
59441         box,
59442         helpHtml("intro.lines.retry_split"),
59443         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59444       );
59445       context.map().on("move.intro drawn.intro", function() {
59446         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59447         var box2 = pad(eleventhAvenueEnd, padding2, context);
59448         reveal(
59449           box2,
59450           helpHtml("intro.lines.retry_split"),
59451           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59452         );
59453       });
59454       function continueTo(nextStep) {
59455         context.map().on("move.intro drawn.intro", null);
59456         nextStep();
59457       }
59458     }
59459     function didSplit() {
59460       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59461         return continueTo(rightClickIntersection);
59462       }
59463       var ids = context.selectedIDs();
59464       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
59465       var street = _t("intro.graph.name.washington-street");
59466       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59467       var box = pad(twelfthAvenue, padding, context);
59468       box.width = box.width / 2;
59469       reveal(
59470         box,
59471         helpHtml(string, { street1: street, street2: street }),
59472         { duration: 500 }
59473       );
59474       timeout2(function() {
59475         context.map().centerZoomEase(twelfthAvenue, 18, 500);
59476         context.map().on("move.intro drawn.intro", function() {
59477           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59478           var box2 = pad(twelfthAvenue, padding2, context);
59479           box2.width = box2.width / 2;
59480           reveal(
59481             box2,
59482             helpHtml(string, { street1: street, street2: street }),
59483             { duration: 0 }
59484           );
59485         });
59486       }, 600);
59487       context.on("enter.intro", function() {
59488         var ids2 = context.selectedIDs();
59489         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
59490           continueTo(multiSelect);
59491         }
59492       });
59493       context.history().on("change.intro", function() {
59494         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59495           return continueTo(rightClickIntersection);
59496         }
59497       });
59498       function continueTo(nextStep) {
59499         context.map().on("move.intro drawn.intro", null);
59500         context.on("enter.intro", null);
59501         context.history().on("change.intro", null);
59502         nextStep();
59503       }
59504     }
59505     function multiSelect() {
59506       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59507         return continueTo(rightClickIntersection);
59508       }
59509       var ids = context.selectedIDs();
59510       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
59511       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
59512       if (hasWashington && hasTwelfth) {
59513         return continueTo(multiRightClick);
59514       } else if (!hasWashington && !hasTwelfth) {
59515         return continueTo(didSplit);
59516       }
59517       context.map().centerZoomEase(twelfthAvenue, 18, 500);
59518       timeout2(function() {
59519         var selected, other, padding, box;
59520         if (hasWashington) {
59521           selected = _t("intro.graph.name.washington-street");
59522           other = _t("intro.graph.name.12th-avenue");
59523           padding = 60 * Math.pow(2, context.map().zoom() - 18);
59524           box = pad(twelfthAvenueEnd, padding, context);
59525           box.width *= 3;
59526         } else {
59527           selected = _t("intro.graph.name.12th-avenue");
59528           other = _t("intro.graph.name.washington-street");
59529           padding = 200 * Math.pow(2, context.map().zoom() - 18);
59530           box = pad(twelfthAvenue, padding, context);
59531           box.width /= 2;
59532         }
59533         reveal(
59534           box,
59535           helpHtml(
59536             "intro.lines.multi_select",
59537             { selected, other1: other }
59538           ) + " " + helpHtml(
59539             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59540             { selected, other2: other }
59541           )
59542         );
59543         context.map().on("move.intro drawn.intro", function() {
59544           if (hasWashington) {
59545             selected = _t("intro.graph.name.washington-street");
59546             other = _t("intro.graph.name.12th-avenue");
59547             padding = 60 * Math.pow(2, context.map().zoom() - 18);
59548             box = pad(twelfthAvenueEnd, padding, context);
59549             box.width *= 3;
59550           } else {
59551             selected = _t("intro.graph.name.12th-avenue");
59552             other = _t("intro.graph.name.washington-street");
59553             padding = 200 * Math.pow(2, context.map().zoom() - 18);
59554             box = pad(twelfthAvenue, padding, context);
59555             box.width /= 2;
59556           }
59557           reveal(
59558             box,
59559             helpHtml(
59560               "intro.lines.multi_select",
59561               { selected, other1: other }
59562             ) + " " + helpHtml(
59563               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59564               { selected, other2: other }
59565             ),
59566             { duration: 0 }
59567           );
59568         });
59569         context.on("enter.intro", function() {
59570           continueTo(multiSelect);
59571         });
59572         context.history().on("change.intro", function() {
59573           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59574             return continueTo(rightClickIntersection);
59575           }
59576         });
59577       }, 600);
59578       function continueTo(nextStep) {
59579         context.map().on("move.intro drawn.intro", null);
59580         context.on("enter.intro", null);
59581         context.history().on("change.intro", null);
59582         nextStep();
59583       }
59584     }
59585     function multiRightClick() {
59586       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59587         return continueTo(rightClickIntersection);
59588       }
59589       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59590       var box = pad(twelfthAvenue, padding, context);
59591       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
59592       reveal(box, rightClickString);
59593       context.map().on("move.intro drawn.intro", function() {
59594         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59595         var box2 = pad(twelfthAvenue, padding2, context);
59596         reveal(box2, rightClickString, { duration: 0 });
59597       });
59598       context.ui().editMenu().on("toggled.intro", function(open) {
59599         if (!open)
59600           return;
59601         timeout2(function() {
59602           var ids = context.selectedIDs();
59603           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59604             var node = selectMenuItem(context, "delete").node();
59605             if (!node)
59606               return;
59607             continueTo(multiDelete);
59608           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59609             return continueTo(multiSelect);
59610           } else {
59611             return continueTo(didSplit);
59612           }
59613         }, 300);
59614       });
59615       context.history().on("change.intro", function() {
59616         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59617           return continueTo(rightClickIntersection);
59618         }
59619       });
59620       function continueTo(nextStep) {
59621         context.map().on("move.intro drawn.intro", null);
59622         context.ui().editMenu().on("toggled.intro", null);
59623         context.history().on("change.intro", null);
59624         nextStep();
59625       }
59626     }
59627     function multiDelete() {
59628       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59629         return continueTo(rightClickIntersection);
59630       }
59631       var node = selectMenuItem(context, "delete").node();
59632       if (!node)
59633         return continueTo(multiRightClick);
59634       reveal(
59635         ".edit-menu",
59636         helpHtml("intro.lines.multi_delete"),
59637         { padding: 50 }
59638       );
59639       context.map().on("move.intro drawn.intro", function() {
59640         reveal(
59641           ".edit-menu",
59642           helpHtml("intro.lines.multi_delete"),
59643           { duration: 0, padding: 50 }
59644         );
59645       });
59646       context.on("exit.intro", function() {
59647         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59648           return continueTo(multiSelect);
59649         }
59650       });
59651       context.history().on("change.intro", function() {
59652         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59653           continueTo(retryDelete);
59654         } else {
59655           continueTo(play);
59656         }
59657       });
59658       function continueTo(nextStep) {
59659         context.map().on("move.intro drawn.intro", null);
59660         context.on("exit.intro", null);
59661         context.history().on("change.intro", null);
59662         nextStep();
59663       }
59664     }
59665     function retryDelete() {
59666       context.enter(modeBrowse(context));
59667       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59668       var box = pad(twelfthAvenue, padding, context);
59669       reveal(box, helpHtml("intro.lines.retry_delete"), {
59670         buttonText: _t.html("intro.ok"),
59671         buttonCallback: function() {
59672           continueTo(multiSelect);
59673         }
59674       });
59675       function continueTo(nextStep) {
59676         nextStep();
59677       }
59678     }
59679     function play() {
59680       dispatch14.call("done");
59681       reveal(
59682         ".ideditor",
59683         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
59684         {
59685           tooltipBox: ".intro-nav-wrap .chapter-building",
59686           buttonText: _t.html("intro.ok"),
59687           buttonCallback: function() {
59688             reveal(".ideditor");
59689           }
59690         }
59691       );
59692     }
59693     chapter.enter = function() {
59694       addLine();
59695     };
59696     chapter.exit = function() {
59697       timeouts.forEach(window.clearTimeout);
59698       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
59699       context.on("enter.intro exit.intro", null);
59700       context.map().on("move.intro drawn.intro", null);
59701       context.history().on("change.intro", null);
59702       context.container().select(".inspector-wrap").on("wheel.intro", null);
59703       context.container().select(".preset-list-button").on("click.intro", null);
59704     };
59705     chapter.restart = function() {
59706       chapter.exit();
59707       chapter.enter();
59708     };
59709     return utilRebind(chapter, dispatch14, "on");
59710   }
59711
59712   // modules/ui/intro/building.js
59713   function uiIntroBuilding(context, reveal) {
59714     var dispatch14 = dispatch_default("done");
59715     var house = [-85.62815, 41.95638];
59716     var tank = [-85.62732, 41.95347];
59717     var buildingCatetory = _mainPresetIndex.item("category-building");
59718     var housePreset = _mainPresetIndex.item("building/house");
59719     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
59720     var timeouts = [];
59721     var _houseID = null;
59722     var _tankID = null;
59723     var chapter = {
59724       title: "intro.buildings.title"
59725     };
59726     function timeout2(f3, t2) {
59727       timeouts.push(window.setTimeout(f3, t2));
59728     }
59729     function eventCancel(d3_event) {
59730       d3_event.stopPropagation();
59731       d3_event.preventDefault();
59732     }
59733     function revealHouse(center, text2, options2) {
59734       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
59735       var box = pad(center, padding, context);
59736       reveal(box, text2, options2);
59737     }
59738     function revealTank(center, text2, options2) {
59739       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
59740       var box = pad(center, padding, context);
59741       reveal(box, text2, options2);
59742     }
59743     function addHouse() {
59744       context.enter(modeBrowse(context));
59745       context.history().reset("initial");
59746       _houseID = null;
59747       var msec = transitionTime(house, context.map().center());
59748       if (msec) {
59749         reveal(null, null, { duration: 0 });
59750       }
59751       context.map().centerZoomEase(house, 19, msec);
59752       timeout2(function() {
59753         var tooltip = reveal(
59754           "button.add-area",
59755           helpHtml("intro.buildings.add_building")
59756         );
59757         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
59758         context.on("enter.intro", function(mode) {
59759           if (mode.id !== "add-area")
59760             return;
59761           continueTo(startHouse);
59762         });
59763       }, msec + 100);
59764       function continueTo(nextStep) {
59765         context.on("enter.intro", null);
59766         nextStep();
59767       }
59768     }
59769     function startHouse() {
59770       if (context.mode().id !== "add-area") {
59771         return continueTo(addHouse);
59772       }
59773       _houseID = null;
59774       context.map().zoomEase(20, 500);
59775       timeout2(function() {
59776         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
59777         revealHouse(house, startString);
59778         context.map().on("move.intro drawn.intro", function() {
59779           revealHouse(house, startString, { duration: 0 });
59780         });
59781         context.on("enter.intro", function(mode) {
59782           if (mode.id !== "draw-area")
59783             return chapter.restart();
59784           continueTo(continueHouse);
59785         });
59786       }, 550);
59787       function continueTo(nextStep) {
59788         context.map().on("move.intro drawn.intro", null);
59789         context.on("enter.intro", null);
59790         nextStep();
59791       }
59792     }
59793     function continueHouse() {
59794       if (context.mode().id !== "draw-area") {
59795         return continueTo(addHouse);
59796       }
59797       _houseID = null;
59798       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
59799       revealHouse(house, continueString);
59800       context.map().on("move.intro drawn.intro", function() {
59801         revealHouse(house, continueString, { duration: 0 });
59802       });
59803       context.on("enter.intro", function(mode) {
59804         if (mode.id === "draw-area") {
59805           return;
59806         } else if (mode.id === "select") {
59807           var graph = context.graph();
59808           var way = context.entity(context.selectedIDs()[0]);
59809           var nodes = graph.childNodes(way);
59810           var points = utilArrayUniq(nodes).map(function(n3) {
59811             return context.projection(n3.loc);
59812           });
59813           if (isMostlySquare(points)) {
59814             _houseID = way.id;
59815             return continueTo(chooseCategoryBuilding);
59816           } else {
59817             return continueTo(retryHouse);
59818           }
59819         } else {
59820           return chapter.restart();
59821         }
59822       });
59823       function continueTo(nextStep) {
59824         context.map().on("move.intro drawn.intro", null);
59825         context.on("enter.intro", null);
59826         nextStep();
59827       }
59828     }
59829     function retryHouse() {
59830       var onClick = function() {
59831         continueTo(addHouse);
59832       };
59833       revealHouse(
59834         house,
59835         helpHtml("intro.buildings.retry_building"),
59836         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59837       );
59838       context.map().on("move.intro drawn.intro", function() {
59839         revealHouse(
59840           house,
59841           helpHtml("intro.buildings.retry_building"),
59842           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59843         );
59844       });
59845       function continueTo(nextStep) {
59846         context.map().on("move.intro drawn.intro", null);
59847         nextStep();
59848       }
59849     }
59850     function chooseCategoryBuilding() {
59851       if (!_houseID || !context.hasEntity(_houseID)) {
59852         return addHouse();
59853       }
59854       var ids = context.selectedIDs();
59855       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59856         context.enter(modeSelect(context, [_houseID]));
59857       }
59858       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59859       timeout2(function() {
59860         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59861         var button = context.container().select(".preset-category-building .preset-list-button");
59862         reveal(
59863           button.node(),
59864           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
59865         );
59866         button.on("click.intro", function() {
59867           button.on("click.intro", null);
59868           continueTo(choosePresetHouse);
59869         });
59870       }, 400);
59871       context.on("enter.intro", function(mode) {
59872         if (!_houseID || !context.hasEntity(_houseID)) {
59873           return continueTo(addHouse);
59874         }
59875         var ids2 = context.selectedIDs();
59876         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59877           return continueTo(chooseCategoryBuilding);
59878         }
59879       });
59880       function continueTo(nextStep) {
59881         context.container().select(".inspector-wrap").on("wheel.intro", null);
59882         context.container().select(".preset-list-button").on("click.intro", null);
59883         context.on("enter.intro", null);
59884         nextStep();
59885       }
59886     }
59887     function choosePresetHouse() {
59888       if (!_houseID || !context.hasEntity(_houseID)) {
59889         return addHouse();
59890       }
59891       var ids = context.selectedIDs();
59892       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59893         context.enter(modeSelect(context, [_houseID]));
59894       }
59895       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59896       timeout2(function() {
59897         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59898         var button = context.container().select(".preset-building-house .preset-list-button");
59899         reveal(
59900           button.node(),
59901           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
59902           { duration: 300 }
59903         );
59904         button.on("click.intro", function() {
59905           button.on("click.intro", null);
59906           continueTo(closeEditorHouse);
59907         });
59908       }, 400);
59909       context.on("enter.intro", function(mode) {
59910         if (!_houseID || !context.hasEntity(_houseID)) {
59911           return continueTo(addHouse);
59912         }
59913         var ids2 = context.selectedIDs();
59914         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59915           return continueTo(chooseCategoryBuilding);
59916         }
59917       });
59918       function continueTo(nextStep) {
59919         context.container().select(".inspector-wrap").on("wheel.intro", null);
59920         context.container().select(".preset-list-button").on("click.intro", null);
59921         context.on("enter.intro", null);
59922         nextStep();
59923       }
59924     }
59925     function closeEditorHouse() {
59926       if (!_houseID || !context.hasEntity(_houseID)) {
59927         return addHouse();
59928       }
59929       var ids = context.selectedIDs();
59930       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59931         context.enter(modeSelect(context, [_houseID]));
59932       }
59933       context.history().checkpoint("hasHouse");
59934       context.on("exit.intro", function() {
59935         continueTo(rightClickHouse);
59936       });
59937       timeout2(function() {
59938         reveal(
59939           ".entity-editor-pane",
59940           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
59941         );
59942       }, 500);
59943       function continueTo(nextStep) {
59944         context.on("exit.intro", null);
59945         nextStep();
59946       }
59947     }
59948     function rightClickHouse() {
59949       if (!_houseID)
59950         return chapter.restart();
59951       context.enter(modeBrowse(context));
59952       context.history().reset("hasHouse");
59953       var zoom = context.map().zoom();
59954       if (zoom < 20) {
59955         zoom = 20;
59956       }
59957       context.map().centerZoomEase(house, zoom, 500);
59958       context.on("enter.intro", function(mode) {
59959         if (mode.id !== "select")
59960           return;
59961         var ids = context.selectedIDs();
59962         if (ids.length !== 1 || ids[0] !== _houseID)
59963           return;
59964         timeout2(function() {
59965           var node = selectMenuItem(context, "orthogonalize").node();
59966           if (!node)
59967             return;
59968           continueTo(clickSquare);
59969         }, 50);
59970       });
59971       context.map().on("move.intro drawn.intro", function() {
59972         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
59973         revealHouse(house, rightclickString, { duration: 0 });
59974       });
59975       context.history().on("change.intro", function() {
59976         continueTo(rightClickHouse);
59977       });
59978       function continueTo(nextStep) {
59979         context.on("enter.intro", null);
59980         context.map().on("move.intro drawn.intro", null);
59981         context.history().on("change.intro", null);
59982         nextStep();
59983       }
59984     }
59985     function clickSquare() {
59986       if (!_houseID)
59987         return chapter.restart();
59988       var entity = context.hasEntity(_houseID);
59989       if (!entity)
59990         return continueTo(rightClickHouse);
59991       var node = selectMenuItem(context, "orthogonalize").node();
59992       if (!node) {
59993         return continueTo(rightClickHouse);
59994       }
59995       var wasChanged = false;
59996       reveal(
59997         ".edit-menu",
59998         helpHtml("intro.buildings.square_building"),
59999         { padding: 50 }
60000       );
60001       context.on("enter.intro", function(mode) {
60002         if (mode.id === "browse") {
60003           continueTo(rightClickHouse);
60004         } else if (mode.id === "move" || mode.id === "rotate") {
60005           continueTo(retryClickSquare);
60006         }
60007       });
60008       context.map().on("move.intro", function() {
60009         var node2 = selectMenuItem(context, "orthogonalize").node();
60010         if (!wasChanged && !node2) {
60011           return continueTo(rightClickHouse);
60012         }
60013         reveal(
60014           ".edit-menu",
60015           helpHtml("intro.buildings.square_building"),
60016           { duration: 0, padding: 50 }
60017         );
60018       });
60019       context.history().on("change.intro", function() {
60020         wasChanged = true;
60021         context.history().on("change.intro", null);
60022         timeout2(function() {
60023           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
60024             continueTo(doneSquare);
60025           } else {
60026             continueTo(retryClickSquare);
60027           }
60028         }, 500);
60029       });
60030       function continueTo(nextStep) {
60031         context.on("enter.intro", null);
60032         context.map().on("move.intro", null);
60033         context.history().on("change.intro", null);
60034         nextStep();
60035       }
60036     }
60037     function retryClickSquare() {
60038       context.enter(modeBrowse(context));
60039       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
60040         buttonText: _t.html("intro.ok"),
60041         buttonCallback: function() {
60042           continueTo(rightClickHouse);
60043         }
60044       });
60045       function continueTo(nextStep) {
60046         nextStep();
60047       }
60048     }
60049     function doneSquare() {
60050       context.history().checkpoint("doneSquare");
60051       revealHouse(house, helpHtml("intro.buildings.done_square"), {
60052         buttonText: _t.html("intro.ok"),
60053         buttonCallback: function() {
60054           continueTo(addTank);
60055         }
60056       });
60057       function continueTo(nextStep) {
60058         nextStep();
60059       }
60060     }
60061     function addTank() {
60062       context.enter(modeBrowse(context));
60063       context.history().reset("doneSquare");
60064       _tankID = null;
60065       var msec = transitionTime(tank, context.map().center());
60066       if (msec) {
60067         reveal(null, null, { duration: 0 });
60068       }
60069       context.map().centerZoomEase(tank, 19.5, msec);
60070       timeout2(function() {
60071         reveal(
60072           "button.add-area",
60073           helpHtml("intro.buildings.add_tank")
60074         );
60075         context.on("enter.intro", function(mode) {
60076           if (mode.id !== "add-area")
60077             return;
60078           continueTo(startTank);
60079         });
60080       }, msec + 100);
60081       function continueTo(nextStep) {
60082         context.on("enter.intro", null);
60083         nextStep();
60084       }
60085     }
60086     function startTank() {
60087       if (context.mode().id !== "add-area") {
60088         return continueTo(addTank);
60089       }
60090       _tankID = null;
60091       timeout2(function() {
60092         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
60093         revealTank(tank, startString);
60094         context.map().on("move.intro drawn.intro", function() {
60095           revealTank(tank, startString, { duration: 0 });
60096         });
60097         context.on("enter.intro", function(mode) {
60098           if (mode.id !== "draw-area")
60099             return chapter.restart();
60100           continueTo(continueTank);
60101         });
60102       }, 550);
60103       function continueTo(nextStep) {
60104         context.map().on("move.intro drawn.intro", null);
60105         context.on("enter.intro", null);
60106         nextStep();
60107       }
60108     }
60109     function continueTank() {
60110       if (context.mode().id !== "draw-area") {
60111         return continueTo(addTank);
60112       }
60113       _tankID = null;
60114       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
60115       revealTank(tank, continueString);
60116       context.map().on("move.intro drawn.intro", function() {
60117         revealTank(tank, continueString, { duration: 0 });
60118       });
60119       context.on("enter.intro", function(mode) {
60120         if (mode.id === "draw-area") {
60121           return;
60122         } else if (mode.id === "select") {
60123           _tankID = context.selectedIDs()[0];
60124           return continueTo(searchPresetTank);
60125         } else {
60126           return continueTo(addTank);
60127         }
60128       });
60129       function continueTo(nextStep) {
60130         context.map().on("move.intro drawn.intro", null);
60131         context.on("enter.intro", null);
60132         nextStep();
60133       }
60134     }
60135     function searchPresetTank() {
60136       if (!_tankID || !context.hasEntity(_tankID)) {
60137         return addTank();
60138       }
60139       var ids = context.selectedIDs();
60140       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60141         context.enter(modeSelect(context, [_tankID]));
60142       }
60143       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60144       timeout2(function() {
60145         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60146         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60147         reveal(
60148           ".preset-search-input",
60149           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60150         );
60151       }, 400);
60152       context.on("enter.intro", function(mode) {
60153         if (!_tankID || !context.hasEntity(_tankID)) {
60154           return continueTo(addTank);
60155         }
60156         var ids2 = context.selectedIDs();
60157         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
60158           context.enter(modeSelect(context, [_tankID]));
60159           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60160           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60161           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60162           reveal(
60163             ".preset-search-input",
60164             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60165           );
60166           context.history().on("change.intro", null);
60167         }
60168       });
60169       function checkPresetSearch() {
60170         var first = context.container().select(".preset-list-item:first-child");
60171         if (first.classed("preset-man_made-storage_tank")) {
60172           reveal(
60173             first.select(".preset-list-button").node(),
60174             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
60175             { duration: 300 }
60176           );
60177           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60178           context.history().on("change.intro", function() {
60179             continueTo(closeEditorTank);
60180           });
60181         }
60182       }
60183       function continueTo(nextStep) {
60184         context.container().select(".inspector-wrap").on("wheel.intro", null);
60185         context.on("enter.intro", null);
60186         context.history().on("change.intro", null);
60187         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60188         nextStep();
60189       }
60190     }
60191     function closeEditorTank() {
60192       if (!_tankID || !context.hasEntity(_tankID)) {
60193         return addTank();
60194       }
60195       var ids = context.selectedIDs();
60196       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60197         context.enter(modeSelect(context, [_tankID]));
60198       }
60199       context.history().checkpoint("hasTank");
60200       context.on("exit.intro", function() {
60201         continueTo(rightClickTank);
60202       });
60203       timeout2(function() {
60204         reveal(
60205           ".entity-editor-pane",
60206           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
60207         );
60208       }, 500);
60209       function continueTo(nextStep) {
60210         context.on("exit.intro", null);
60211         nextStep();
60212       }
60213     }
60214     function rightClickTank() {
60215       if (!_tankID)
60216         return continueTo(addTank);
60217       context.enter(modeBrowse(context));
60218       context.history().reset("hasTank");
60219       context.map().centerEase(tank, 500);
60220       timeout2(function() {
60221         context.on("enter.intro", function(mode) {
60222           if (mode.id !== "select")
60223             return;
60224           var ids = context.selectedIDs();
60225           if (ids.length !== 1 || ids[0] !== _tankID)
60226             return;
60227           timeout2(function() {
60228             var node = selectMenuItem(context, "circularize").node();
60229             if (!node)
60230               return;
60231             continueTo(clickCircle);
60232           }, 50);
60233         });
60234         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
60235         revealTank(tank, rightclickString);
60236         context.map().on("move.intro drawn.intro", function() {
60237           revealTank(tank, rightclickString, { duration: 0 });
60238         });
60239         context.history().on("change.intro", function() {
60240           continueTo(rightClickTank);
60241         });
60242       }, 600);
60243       function continueTo(nextStep) {
60244         context.on("enter.intro", null);
60245         context.map().on("move.intro drawn.intro", null);
60246         context.history().on("change.intro", null);
60247         nextStep();
60248       }
60249     }
60250     function clickCircle() {
60251       if (!_tankID)
60252         return chapter.restart();
60253       var entity = context.hasEntity(_tankID);
60254       if (!entity)
60255         return continueTo(rightClickTank);
60256       var node = selectMenuItem(context, "circularize").node();
60257       if (!node) {
60258         return continueTo(rightClickTank);
60259       }
60260       var wasChanged = false;
60261       reveal(
60262         ".edit-menu",
60263         helpHtml("intro.buildings.circle_tank"),
60264         { padding: 50 }
60265       );
60266       context.on("enter.intro", function(mode) {
60267         if (mode.id === "browse") {
60268           continueTo(rightClickTank);
60269         } else if (mode.id === "move" || mode.id === "rotate") {
60270           continueTo(retryClickCircle);
60271         }
60272       });
60273       context.map().on("move.intro", function() {
60274         var node2 = selectMenuItem(context, "circularize").node();
60275         if (!wasChanged && !node2) {
60276           return continueTo(rightClickTank);
60277         }
60278         reveal(
60279           ".edit-menu",
60280           helpHtml("intro.buildings.circle_tank"),
60281           { duration: 0, padding: 50 }
60282         );
60283       });
60284       context.history().on("change.intro", function() {
60285         wasChanged = true;
60286         context.history().on("change.intro", null);
60287         timeout2(function() {
60288           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
60289             continueTo(play);
60290           } else {
60291             continueTo(retryClickCircle);
60292           }
60293         }, 500);
60294       });
60295       function continueTo(nextStep) {
60296         context.on("enter.intro", null);
60297         context.map().on("move.intro", null);
60298         context.history().on("change.intro", null);
60299         nextStep();
60300       }
60301     }
60302     function retryClickCircle() {
60303       context.enter(modeBrowse(context));
60304       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
60305         buttonText: _t.html("intro.ok"),
60306         buttonCallback: function() {
60307           continueTo(rightClickTank);
60308         }
60309       });
60310       function continueTo(nextStep) {
60311         nextStep();
60312       }
60313     }
60314     function play() {
60315       dispatch14.call("done");
60316       reveal(
60317         ".ideditor",
60318         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
60319         {
60320           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
60321           buttonText: _t.html("intro.ok"),
60322           buttonCallback: function() {
60323             reveal(".ideditor");
60324           }
60325         }
60326       );
60327     }
60328     chapter.enter = function() {
60329       addHouse();
60330     };
60331     chapter.exit = function() {
60332       timeouts.forEach(window.clearTimeout);
60333       context.on("enter.intro exit.intro", null);
60334       context.map().on("move.intro drawn.intro", null);
60335       context.history().on("change.intro", null);
60336       context.container().select(".inspector-wrap").on("wheel.intro", null);
60337       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60338       context.container().select(".more-fields .combobox-input").on("click.intro", null);
60339     };
60340     chapter.restart = function() {
60341       chapter.exit();
60342       chapter.enter();
60343     };
60344     return utilRebind(chapter, dispatch14, "on");
60345   }
60346
60347   // modules/ui/intro/start_editing.js
60348   function uiIntroStartEditing(context, reveal) {
60349     var dispatch14 = dispatch_default("done", "startEditing");
60350     var modalSelection = select_default2(null);
60351     var chapter = {
60352       title: "intro.startediting.title"
60353     };
60354     function showHelp() {
60355       reveal(
60356         ".map-control.help-control",
60357         helpHtml("intro.startediting.help"),
60358         {
60359           buttonText: _t.html("intro.ok"),
60360           buttonCallback: function() {
60361             shortcuts();
60362           }
60363         }
60364       );
60365     }
60366     function shortcuts() {
60367       reveal(
60368         ".map-control.help-control",
60369         helpHtml("intro.startediting.shortcuts"),
60370         {
60371           buttonText: _t.html("intro.ok"),
60372           buttonCallback: function() {
60373             showSave();
60374           }
60375         }
60376       );
60377     }
60378     function showSave() {
60379       context.container().selectAll(".shaded").remove();
60380       reveal(
60381         ".top-toolbar button.save",
60382         helpHtml("intro.startediting.save"),
60383         {
60384           buttonText: _t.html("intro.ok"),
60385           buttonCallback: function() {
60386             showStart();
60387           }
60388         }
60389       );
60390     }
60391     function showStart() {
60392       context.container().selectAll(".shaded").remove();
60393       modalSelection = uiModal(context.container());
60394       modalSelection.select(".modal").attr("class", "modal-splash modal");
60395       modalSelection.selectAll(".close").remove();
60396       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
60397         modalSelection.remove();
60398       });
60399       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60400       startbutton.append("h2").call(_t.append("intro.startediting.start"));
60401       dispatch14.call("startEditing");
60402     }
60403     chapter.enter = function() {
60404       showHelp();
60405     };
60406     chapter.exit = function() {
60407       modalSelection.remove();
60408       context.container().selectAll(".shaded").remove();
60409     };
60410     return utilRebind(chapter, dispatch14, "on");
60411   }
60412
60413   // modules/ui/intro/intro.js
60414   var chapterUi = {
60415     welcome: uiIntroWelcome,
60416     navigation: uiIntroNavigation,
60417     point: uiIntroPoint,
60418     area: uiIntroArea,
60419     line: uiIntroLine,
60420     building: uiIntroBuilding,
60421     startEditing: uiIntroStartEditing
60422   };
60423   var chapterFlow = [
60424     "welcome",
60425     "navigation",
60426     "point",
60427     "area",
60428     "line",
60429     "building",
60430     "startEditing"
60431   ];
60432   function uiIntro(context) {
60433     const INTRO_IMAGERY = "EsriWorldImageryClarity";
60434     let _introGraph = {};
60435     let _currChapter;
60436     function intro(selection2) {
60437       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
60438         for (let id2 in dataIntroGraph) {
60439           if (!_introGraph[id2]) {
60440             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
60441           }
60442         }
60443         selection2.call(startIntro);
60444       }).catch(function() {
60445       });
60446     }
60447     function startIntro(selection2) {
60448       context.enter(modeBrowse(context));
60449       let osm = context.connection();
60450       let history = context.history().toJSON();
60451       let hash = window.location.hash;
60452       let center = context.map().center();
60453       let zoom = context.map().zoom();
60454       let background = context.background().baseLayerSource();
60455       let overlays = context.background().overlayLayerSources();
60456       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
60457       let caches = osm && osm.caches();
60458       let baseEntities = context.history().graph().base().entities;
60459       context.ui().sidebar.expand();
60460       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
60461       context.inIntro(true);
60462       if (osm) {
60463         osm.toggle(false).reset();
60464       }
60465       context.history().reset();
60466       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
60467       context.history().checkpoint("initial");
60468       let imagery = context.background().findSource(INTRO_IMAGERY);
60469       if (imagery) {
60470         context.background().baseLayerSource(imagery);
60471       } else {
60472         context.background().bing();
60473       }
60474       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60475       let layers = context.layers();
60476       layers.all().forEach((item) => {
60477         if (typeof item.layer.enabled === "function") {
60478           item.layer.enabled(item.id === "osm");
60479         }
60480       });
60481       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
60482       let curtain = uiCurtain(context.container().node());
60483       selection2.call(curtain);
60484       corePreferences("walkthrough_started", "yes");
60485       let storedProgress = corePreferences("walkthrough_progress") || "";
60486       let progress = storedProgress.split(";").filter(Boolean);
60487       let chapters = chapterFlow.map((chapter, i3) => {
60488         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
60489           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
60490           if (i3 < chapterFlow.length - 1) {
60491             const next = chapterFlow[i3 + 1];
60492             context.container().select(`button.chapter-${next}`).classed("next", true);
60493           }
60494           progress.push(chapter);
60495           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60496         });
60497         return s2;
60498       });
60499       chapters[chapters.length - 1].on("startEditing", () => {
60500         progress.push("startEditing");
60501         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60502         let incomplete = utilArrayDifference(chapterFlow, progress);
60503         if (!incomplete.length) {
60504           corePreferences("walkthrough_completed", "yes");
60505         }
60506         curtain.remove();
60507         navwrap.remove();
60508         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
60509         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
60510         if (osm) {
60511           osm.toggle(true).reset().caches(caches);
60512         }
60513         context.history().reset().merge(Object.values(baseEntities));
60514         context.background().baseLayerSource(background);
60515         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60516         if (history) {
60517           context.history().fromJSON(history, false);
60518         }
60519         context.map().centerZoom(center, zoom);
60520         window.location.replace(hash);
60521         context.inIntro(false);
60522       });
60523       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
60524       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60525       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
60526       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => `chapter chapter-${chapterFlow[i3]}`).on("click", enterChapter);
60527       buttons.append("span").html((d2) => _t.html(d2.title));
60528       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
60529       enterChapter(null, chapters[0]);
60530       function enterChapter(d3_event, newChapter) {
60531         if (_currChapter) {
60532           _currChapter.exit();
60533         }
60534         context.enter(modeBrowse(context));
60535         _currChapter = newChapter;
60536         _currChapter.enter();
60537         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
60538       }
60539     }
60540     return intro;
60541   }
60542
60543   // modules/ui/issues_info.js
60544   function uiIssuesInfo(context) {
60545     var warningsItem = {
60546       id: "warnings",
60547       count: 0,
60548       iconID: "iD-icon-alert",
60549       descriptionID: "issues.warnings_and_errors"
60550     };
60551     var resolvedItem = {
60552       id: "resolved",
60553       count: 0,
60554       iconID: "iD-icon-apply",
60555       descriptionID: "issues.user_resolved_issues"
60556     };
60557     function update(selection2) {
60558       var shownItems = [];
60559       var liveIssues = context.validator().getIssues({
60560         what: corePreferences("validate-what") || "edited",
60561         where: corePreferences("validate-where") || "all"
60562       });
60563       if (liveIssues.length) {
60564         warningsItem.count = liveIssues.length;
60565         shownItems.push(warningsItem);
60566       }
60567       if (corePreferences("validate-what") === "all") {
60568         var resolvedIssues = context.validator().getResolvedIssues();
60569         if (resolvedIssues.length) {
60570           resolvedItem.count = resolvedIssues.length;
60571           shownItems.push(resolvedItem);
60572         }
60573       }
60574       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
60575         return d2.id;
60576       });
60577       chips.exit().remove();
60578       var enter = chips.enter().append("a").attr("class", function(d2) {
60579         return "chip " + d2.id + "-count";
60580       }).attr("href", "#").each(function(d2) {
60581         var chipSelection = select_default2(this);
60582         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
60583         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
60584           d3_event.preventDefault();
60585           tooltipBehavior.hide(select_default2(this));
60586           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
60587         });
60588         chipSelection.call(svgIcon("#" + d2.iconID));
60589       });
60590       enter.append("span").attr("class", "count");
60591       enter.merge(chips).selectAll("span.count").text(function(d2) {
60592         return d2.count.toString();
60593       });
60594     }
60595     return function(selection2) {
60596       update(selection2);
60597       context.validator().on("validated.infobox", function() {
60598         update(selection2);
60599       });
60600     };
60601   }
60602
60603   // modules/ui/map_in_map.js
60604   function uiMapInMap(context) {
60605     function mapInMap(selection2) {
60606       var backgroundLayer = rendererTileLayer(context);
60607       var overlayLayers = {};
60608       var projection2 = geoRawMercator();
60609       var dataLayer = svgData(projection2, context).showLabels(false);
60610       var debugLayer = svgDebug(projection2, context);
60611       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
60612       var wrap2 = select_default2(null);
60613       var tiles = select_default2(null);
60614       var viewport = select_default2(null);
60615       var _isTransformed = false;
60616       var _isHidden = true;
60617       var _skipEvents = false;
60618       var _gesture = null;
60619       var _zDiff = 6;
60620       var _dMini;
60621       var _cMini;
60622       var _tStart;
60623       var _tCurr;
60624       var _timeoutID;
60625       function zoomStarted() {
60626         if (_skipEvents)
60627           return;
60628         _tStart = _tCurr = projection2.transform();
60629         _gesture = null;
60630       }
60631       function zoomed(d3_event) {
60632         if (_skipEvents)
60633           return;
60634         var x2 = d3_event.transform.x;
60635         var y2 = d3_event.transform.y;
60636         var k2 = d3_event.transform.k;
60637         var isZooming = k2 !== _tStart.k;
60638         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
60639         if (!isZooming && !isPanning) {
60640           return;
60641         }
60642         if (!_gesture) {
60643           _gesture = isZooming ? "zoom" : "pan";
60644         }
60645         var tMini = projection2.transform();
60646         var tX, tY, scale;
60647         if (_gesture === "zoom") {
60648           scale = k2 / tMini.k;
60649           tX = (_cMini[0] / scale - _cMini[0]) * scale;
60650           tY = (_cMini[1] / scale - _cMini[1]) * scale;
60651         } else {
60652           k2 = tMini.k;
60653           scale = 1;
60654           tX = x2 - tMini.x;
60655           tY = y2 - tMini.y;
60656         }
60657         utilSetTransform(tiles, tX, tY, scale);
60658         utilSetTransform(viewport, 0, 0, scale);
60659         _isTransformed = true;
60660         _tCurr = identity2.translate(x2, y2).scale(k2);
60661         var zMain = geoScaleToZoom(context.projection.scale());
60662         var zMini = geoScaleToZoom(k2);
60663         _zDiff = zMain - zMini;
60664         queueRedraw();
60665       }
60666       function zoomEnded() {
60667         if (_skipEvents)
60668           return;
60669         if (_gesture !== "pan")
60670           return;
60671         updateProjection();
60672         _gesture = null;
60673         context.map().center(projection2.invert(_cMini));
60674       }
60675       function updateProjection() {
60676         var loc = context.map().center();
60677         var tMain = context.projection.transform();
60678         var zMain = geoScaleToZoom(tMain.k);
60679         var zMini = Math.max(zMain - _zDiff, 0.5);
60680         var kMini = geoZoomToScale(zMini);
60681         projection2.translate([tMain.x, tMain.y]).scale(kMini);
60682         var point2 = projection2(loc);
60683         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
60684         var xMini = _cMini[0] - point2[0] + tMain.x + mouse[0];
60685         var yMini = _cMini[1] - point2[1] + tMain.y + mouse[1];
60686         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
60687         _tCurr = projection2.transform();
60688         if (_isTransformed) {
60689           utilSetTransform(tiles, 0, 0);
60690           utilSetTransform(viewport, 0, 0);
60691           _isTransformed = false;
60692         }
60693         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
60694         _skipEvents = true;
60695         wrap2.call(zoom.transform, _tCurr);
60696         _skipEvents = false;
60697       }
60698       function redraw() {
60699         clearTimeout(_timeoutID);
60700         if (_isHidden)
60701           return;
60702         updateProjection();
60703         var zMini = geoScaleToZoom(projection2.scale());
60704         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
60705         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
60706         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
60707         var background = tiles.selectAll(".map-in-map-background").data([0]);
60708         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
60709         var overlaySources = context.background().overlayLayerSources();
60710         var activeOverlayLayers = [];
60711         for (var i3 = 0; i3 < overlaySources.length; i3++) {
60712           if (overlaySources[i3].validZoom(zMini)) {
60713             if (!overlayLayers[i3])
60714               overlayLayers[i3] = rendererTileLayer(context);
60715             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
60716           }
60717         }
60718         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
60719         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
60720         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
60721           return d2.source().name();
60722         });
60723         overlays.exit().remove();
60724         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
60725           select_default2(this).call(layer);
60726         });
60727         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
60728         dataLayers.exit().remove();
60729         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
60730         if (_gesture !== "pan") {
60731           var getPath = path_default(projection2);
60732           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
60733           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
60734           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
60735           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
60736           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
60737             return getPath.area(d2) < 30;
60738           });
60739         }
60740       }
60741       function queueRedraw() {
60742         clearTimeout(_timeoutID);
60743         _timeoutID = setTimeout(function() {
60744           redraw();
60745         }, 750);
60746       }
60747       function toggle(d3_event) {
60748         if (d3_event)
60749           d3_event.preventDefault();
60750         _isHidden = !_isHidden;
60751         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
60752         if (_isHidden) {
60753           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
60754             selection2.selectAll(".map-in-map").style("display", "none");
60755           });
60756         } else {
60757           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
60758             redraw();
60759           });
60760         }
60761       }
60762       uiMapInMap.toggle = toggle;
60763       wrap2 = selection2.selectAll(".map-in-map").data([0]);
60764       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
60765       _dMini = [200, 150];
60766       _cMini = geoVecScale(_dMini, 0.5);
60767       context.map().on("drawn.map-in-map", function(drawn) {
60768         if (drawn.full === true) {
60769           redraw();
60770         }
60771       });
60772       redraw();
60773       context.keybinding().on(_t("background.minimap.key"), toggle);
60774     }
60775     return mapInMap;
60776   }
60777
60778   // modules/ui/notice.js
60779   function uiNotice(context) {
60780     return function(selection2) {
60781       var div = selection2.append("div").attr("class", "notice");
60782       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
60783         context.map().zoomEase(context.minEditableZoom());
60784       }).on("wheel", function(d3_event) {
60785         var e22 = new WheelEvent(d3_event.type, d3_event);
60786         context.surface().node().dispatchEvent(e22);
60787       });
60788       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
60789       function disableTooHigh() {
60790         var canEdit = context.map().zoom() >= context.minEditableZoom();
60791         div.style("display", canEdit ? "none" : "block");
60792       }
60793       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
60794       disableTooHigh();
60795     };
60796   }
60797
60798   // modules/ui/photoviewer.js
60799   function uiPhotoviewer(context) {
60800     var dispatch14 = dispatch_default("resize");
60801     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
60802     function photoviewer(selection2) {
60803       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
60804         if (services.streetside) {
60805           services.streetside.hideViewer(context);
60806         }
60807         if (services.mapillary) {
60808           services.mapillary.hideViewer(context);
60809         }
60810         if (services.kartaview) {
60811           services.kartaview.hideViewer(context);
60812         }
60813         if (services.mapilio) {
60814           services.mapilio.hideViewer(context);
60815         }
60816         if (services.vegbilder) {
60817           services.vegbilder.hideViewer(context);
60818         }
60819       }).append("div").call(svgIcon("#iD-icon-close"));
60820       function preventDefault(d3_event) {
60821         d3_event.preventDefault();
60822       }
60823       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
60824         _pointerPrefix + "down",
60825         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
60826       );
60827       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
60828         _pointerPrefix + "down",
60829         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
60830       );
60831       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
60832         _pointerPrefix + "down",
60833         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
60834       );
60835       function buildResizeListener(target, eventName, dispatch15, options2) {
60836         var resizeOnX = !!options2.resizeOnX;
60837         var resizeOnY = !!options2.resizeOnY;
60838         var minHeight = options2.minHeight || 240;
60839         var minWidth = options2.minWidth || 320;
60840         var pointerId;
60841         var startX;
60842         var startY;
60843         var startWidth;
60844         var startHeight;
60845         function startResize(d3_event) {
60846           if (pointerId !== (d3_event.pointerId || "mouse"))
60847             return;
60848           d3_event.preventDefault();
60849           d3_event.stopPropagation();
60850           var mapSize = context.map().dimensions();
60851           if (resizeOnX) {
60852             var maxWidth = mapSize[0];
60853             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
60854             target.style("width", newWidth + "px");
60855           }
60856           if (resizeOnY) {
60857             var maxHeight = mapSize[1] - 90;
60858             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
60859             target.style("height", newHeight + "px");
60860           }
60861           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
60862         }
60863         function clamp3(num, min3, max3) {
60864           return Math.max(min3, Math.min(num, max3));
60865         }
60866         function stopResize(d3_event) {
60867           if (pointerId !== (d3_event.pointerId || "mouse"))
60868             return;
60869           d3_event.preventDefault();
60870           d3_event.stopPropagation();
60871           select_default2(window).on("." + eventName, null);
60872         }
60873         return function initResize(d3_event) {
60874           d3_event.preventDefault();
60875           d3_event.stopPropagation();
60876           pointerId = d3_event.pointerId || "mouse";
60877           startX = d3_event.clientX;
60878           startY = d3_event.clientY;
60879           var targetRect = target.node().getBoundingClientRect();
60880           startWidth = targetRect.width;
60881           startHeight = targetRect.height;
60882           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
60883           if (_pointerPrefix === "pointer") {
60884             select_default2(window).on("pointercancel." + eventName, stopResize, false);
60885           }
60886         };
60887       }
60888     }
60889     photoviewer.onMapResize = function() {
60890       var photoviewer2 = context.container().select(".photoviewer");
60891       var content = context.container().select(".main-content");
60892       var mapDimensions = utilGetDimensions(content, true);
60893       var photoDimensions = utilGetDimensions(photoviewer2, true);
60894       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
60895         var setPhotoDimensions = [
60896           Math.min(photoDimensions[0], mapDimensions[0]),
60897           Math.min(photoDimensions[1], mapDimensions[1] - 90)
60898         ];
60899         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
60900         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
60901       }
60902     };
60903     function subtractPadding(dimensions, selection2) {
60904       return [
60905         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
60906         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
60907       ];
60908     }
60909     return utilRebind(photoviewer, dispatch14, "on");
60910   }
60911
60912   // modules/ui/restore.js
60913   function uiRestore(context) {
60914     return function(selection2) {
60915       if (!context.history().hasRestorableChanges())
60916         return;
60917       let modalSelection = uiModal(selection2, true);
60918       modalSelection.select(".modal").attr("class", "modal fillL");
60919       let introModal = modalSelection.select(".content");
60920       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
60921       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
60922       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
60923       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
60924         context.history().restore();
60925         modalSelection.remove();
60926       });
60927       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
60928       restore.append("div").call(_t.append("restore.restore"));
60929       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
60930         context.history().clearSaved();
60931         modalSelection.remove();
60932       });
60933       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
60934       reset.append("div").call(_t.append("restore.reset"));
60935       restore.node().focus();
60936     };
60937   }
60938
60939   // modules/ui/scale.js
60940   function uiScale(context) {
60941     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
60942     function scaleDefs(loc1, loc2) {
60943       var lat = (loc2[1] + loc1[1]) / 2, conversion = isImperial ? 3.28084 : 1, dist = geoLonToMeters(loc2[0] - loc1[0], lat) * conversion, scale = { dist: 0, px: 0, text: "" }, buckets, i3, val, dLon;
60944       if (isImperial) {
60945         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
60946       } else {
60947         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
60948       }
60949       for (i3 = 0; i3 < buckets.length; i3++) {
60950         val = buckets[i3];
60951         if (dist >= val) {
60952           scale.dist = Math.floor(dist / val) * val;
60953           break;
60954         } else {
60955           scale.dist = +dist.toFixed(2);
60956         }
60957       }
60958       dLon = geoMetersToLon(scale.dist / conversion, lat);
60959       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
60960       scale.text = displayLength(scale.dist / conversion, isImperial);
60961       return scale;
60962     }
60963     function update(selection2) {
60964       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
60965       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
60966       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
60967     }
60968     return function(selection2) {
60969       function switchUnits() {
60970         isImperial = !isImperial;
60971         selection2.call(update);
60972       }
60973       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
60974       scalegroup.append("path").attr("class", "scale-path");
60975       selection2.append("div").attr("class", "scale-text");
60976       selection2.call(update);
60977       context.map().on("move.scale", function() {
60978         update(selection2);
60979       });
60980     };
60981   }
60982
60983   // modules/ui/shortcuts.js
60984   function uiShortcuts(context) {
60985     var detected = utilDetect();
60986     var _activeTab = 0;
60987     var _modalSelection;
60988     var _selection = select_default2(null);
60989     var _dataShortcuts;
60990     function shortcutsModal(_modalSelection2) {
60991       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
60992       var content = _modalSelection2.select(".content");
60993       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
60994       _mainFileFetcher.get("shortcuts").then(function(data) {
60995         _dataShortcuts = data;
60996         content.call(render);
60997       }).catch(function() {
60998       });
60999     }
61000     function render(selection2) {
61001       if (!_dataShortcuts)
61002         return;
61003       var wrapper = selection2.selectAll(".wrapper").data([0]);
61004       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
61005       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
61006       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
61007       wrapper = wrapper.merge(wrapperEnter);
61008       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
61009       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
61010         d3_event.preventDefault();
61011         var i3 = _dataShortcuts.indexOf(d2);
61012         _activeTab = i3;
61013         render(selection2);
61014       });
61015       tabsEnter.append("span").html(function(d2) {
61016         return _t.html(d2.text);
61017       });
61018       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
61019         return i3 === _activeTab;
61020       });
61021       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
61022       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
61023         return "shortcut-tab shortcut-tab-" + d2.tab;
61024       });
61025       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
61026         return d2.columns;
61027       }).enter().append("table").attr("class", "shortcut-column");
61028       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
61029         return d2.rows;
61030       }).enter().append("tr").attr("class", "shortcut-row");
61031       var sectionRows = rowsEnter.filter(function(d2) {
61032         return !d2.shortcuts;
61033       });
61034       sectionRows.append("td");
61035       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
61036         return _t.html(d2.text);
61037       });
61038       var shortcutRows = rowsEnter.filter(function(d2) {
61039         return d2.shortcuts;
61040       });
61041       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
61042       var modifierKeys = shortcutKeys.filter(function(d2) {
61043         return d2.modifiers;
61044       });
61045       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
61046         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
61047           return ["\u2318"];
61048         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
61049           return [];
61050         } else {
61051           return d2.modifiers;
61052         }
61053       }).enter().each(function() {
61054         var selection3 = select_default2(this);
61055         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
61056           return uiCmd.display(d2);
61057         });
61058         selection3.append("span").text("+");
61059       });
61060       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
61061         var arr = d2.shortcuts;
61062         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
61063           arr = ["Y"];
61064         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
61065           arr = ["F11"];
61066         }
61067         arr = arr.map(function(s2) {
61068           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
61069         });
61070         return utilArrayUniq(arr).map(function(s2) {
61071           return {
61072             shortcut: s2,
61073             separator: d2.separator,
61074             suffix: d2.suffix
61075           };
61076         });
61077       }).enter().each(function(d2, i3, nodes) {
61078         var selection3 = select_default2(this);
61079         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
61080         if (click && click[1]) {
61081           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
61082         } else if (d2.shortcut.toLowerCase() === "long-press") {
61083           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
61084         } else if (d2.shortcut.toLowerCase() === "tap") {
61085           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
61086         } else {
61087           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
61088             return d4.shortcut;
61089           });
61090         }
61091         if (i3 < nodes.length - 1) {
61092           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
61093         } else if (i3 === nodes.length - 1 && d2.suffix) {
61094           selection3.append("span").text(d2.suffix);
61095         }
61096       });
61097       shortcutKeys.filter(function(d2) {
61098         return d2.gesture;
61099       }).each(function() {
61100         var selection3 = select_default2(this);
61101         selection3.append("span").text("+");
61102         selection3.append("span").attr("class", "gesture").html(function(d2) {
61103           return _t.html(d2.gesture);
61104         });
61105       });
61106       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
61107         return d2.text ? _t.html(d2.text) : "\xA0";
61108       });
61109       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
61110         return i3 === _activeTab ? "flex" : "none";
61111       });
61112     }
61113     return function(selection2, show) {
61114       _selection = selection2;
61115       if (show) {
61116         _modalSelection = uiModal(selection2);
61117         _modalSelection.call(shortcutsModal);
61118       } else {
61119         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
61120           if (context.container().selectAll(".modal-shortcuts").size()) {
61121             if (_modalSelection) {
61122               _modalSelection.close();
61123               _modalSelection = null;
61124             }
61125           } else {
61126             _modalSelection = uiModal(_selection);
61127             _modalSelection.call(shortcutsModal);
61128           }
61129         });
61130       }
61131     };
61132   }
61133
61134   // modules/ui/data_header.js
61135   function uiDataHeader() {
61136     var _datum;
61137     function dataHeader(selection2) {
61138       var header = selection2.selectAll(".data-header").data(
61139         _datum ? [_datum] : [],
61140         function(d2) {
61141           return d2.__featurehash__;
61142         }
61143       );
61144       header.exit().remove();
61145       var headerEnter = header.enter().append("div").attr("class", "data-header");
61146       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
61147       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
61148       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
61149     }
61150     dataHeader.datum = function(val) {
61151       if (!arguments.length)
61152         return _datum;
61153       _datum = val;
61154       return this;
61155     };
61156     return dataHeader;
61157   }
61158
61159   // modules/ui/combobox.js
61160   var _comboHideTimerID;
61161   function uiCombobox(context, klass) {
61162     var dispatch14 = dispatch_default("accept", "cancel", "update");
61163     var container = context.container();
61164     var _suggestions = [];
61165     var _data = [];
61166     var _fetched = {};
61167     var _selected = null;
61168     var _canAutocomplete = true;
61169     var _caseSensitive = false;
61170     var _cancelFetch = false;
61171     var _minItems = 2;
61172     var _tDown = 0;
61173     var _mouseEnterHandler, _mouseLeaveHandler;
61174     var _fetcher = function(val, cb) {
61175       cb(_data.filter(function(d2) {
61176         var terms = d2.terms || [];
61177         terms.push(d2.value);
61178         if (d2.key) {
61179           terms.push(d2.key);
61180         }
61181         return terms.some(function(term) {
61182           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
61183         });
61184       }));
61185     };
61186     var combobox = function(input, attachTo) {
61187       if (!input || input.empty())
61188         return;
61189       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() {
61190         var parent = this.parentNode;
61191         var sibling = this.nextSibling;
61192         select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
61193           return d2 === input.node();
61194         }).data([input.node()]).enter().insert("div", function() {
61195           return sibling;
61196         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
61197           d3_event.preventDefault();
61198           input.node().focus();
61199           mousedown(d3_event);
61200         }).on("mouseup.combo-caret", function(d3_event) {
61201           d3_event.preventDefault();
61202           mouseup(d3_event);
61203         });
61204       });
61205       function mousedown(d3_event) {
61206         if (d3_event.button !== 0)
61207           return;
61208         if (input.classed("disabled"))
61209           return;
61210         _tDown = +/* @__PURE__ */ new Date();
61211         var start2 = input.property("selectionStart");
61212         var end = input.property("selectionEnd");
61213         if (start2 !== end) {
61214           var val = utilGetSetValue(input);
61215           input.node().setSelectionRange(val.length, val.length);
61216           return;
61217         }
61218         input.on("mouseup.combo-input", mouseup);
61219       }
61220       function mouseup(d3_event) {
61221         input.on("mouseup.combo-input", null);
61222         if (d3_event.button !== 0)
61223           return;
61224         if (input.classed("disabled"))
61225           return;
61226         if (input.node() !== document.activeElement)
61227           return;
61228         var start2 = input.property("selectionStart");
61229         var end = input.property("selectionEnd");
61230         if (start2 !== end)
61231           return;
61232         var combo = container.selectAll(".combobox");
61233         if (combo.empty() || combo.datum() !== input.node()) {
61234           var tOrig = _tDown;
61235           window.setTimeout(function() {
61236             if (tOrig !== _tDown)
61237               return;
61238             fetchComboData("", function() {
61239               show();
61240               render();
61241             });
61242           }, 250);
61243         } else {
61244           hide();
61245         }
61246       }
61247       function focus() {
61248         fetchComboData("");
61249       }
61250       function blur() {
61251         _comboHideTimerID = window.setTimeout(hide, 75);
61252       }
61253       function show() {
61254         hide();
61255         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) {
61256           d3_event.preventDefault();
61257         });
61258         container.on("scroll.combo-scroll", render, true);
61259       }
61260       function hide() {
61261         if (_comboHideTimerID) {
61262           window.clearTimeout(_comboHideTimerID);
61263           _comboHideTimerID = void 0;
61264         }
61265         container.selectAll(".combobox").remove();
61266         container.on("scroll.combo-scroll", null);
61267       }
61268       function keydown(d3_event) {
61269         var shown = !container.selectAll(".combobox").empty();
61270         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
61271         switch (d3_event.keyCode) {
61272           case 8:
61273           case 46:
61274             d3_event.stopPropagation();
61275             _selected = null;
61276             render();
61277             input.on("input.combo-input", function() {
61278               var start2 = input.property("selectionStart");
61279               input.node().setSelectionRange(start2, start2);
61280               input.on("input.combo-input", change);
61281               change(false);
61282             });
61283             break;
61284           case 9:
61285             accept(d3_event);
61286             break;
61287           case 13:
61288             d3_event.preventDefault();
61289             d3_event.stopPropagation();
61290             accept(d3_event);
61291             break;
61292           case 38:
61293             if (tagName === "textarea" && !shown)
61294               return;
61295             d3_event.preventDefault();
61296             if (tagName === "input" && !shown) {
61297               show();
61298             }
61299             nav(-1);
61300             break;
61301           case 40:
61302             if (tagName === "textarea" && !shown)
61303               return;
61304             d3_event.preventDefault();
61305             if (tagName === "input" && !shown) {
61306               show();
61307             }
61308             nav(1);
61309             break;
61310         }
61311       }
61312       function keyup(d3_event) {
61313         switch (d3_event.keyCode) {
61314           case 27:
61315             cancel();
61316             break;
61317         }
61318       }
61319       function change(doAutoComplete) {
61320         if (doAutoComplete === void 0)
61321           doAutoComplete = true;
61322         fetchComboData(value(), function() {
61323           _selected = null;
61324           var val = input.property("value");
61325           if (_suggestions.length) {
61326             if (doAutoComplete && input.property("selectionEnd") === val.length) {
61327               _selected = tryAutocomplete();
61328             }
61329             if (!_selected) {
61330               _selected = val;
61331             }
61332           }
61333           if (val.length) {
61334             var combo = container.selectAll(".combobox");
61335             if (combo.empty()) {
61336               show();
61337             }
61338           } else {
61339             hide();
61340           }
61341           render();
61342         });
61343       }
61344       function nav(dir) {
61345         if (_suggestions.length) {
61346           var index = -1;
61347           for (var i3 = 0; i3 < _suggestions.length; i3++) {
61348             if (_selected && _suggestions[i3].value === _selected) {
61349               index = i3;
61350               break;
61351             }
61352           }
61353           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
61354           _selected = _suggestions[index].value;
61355           utilGetSetValue(input, _selected);
61356           dispatch14.call("update");
61357         }
61358         render();
61359         ensureVisible();
61360       }
61361       function ensureVisible() {
61362         var combo = container.selectAll(".combobox");
61363         if (combo.empty())
61364           return;
61365         var containerRect = container.node().getBoundingClientRect();
61366         var comboRect = combo.node().getBoundingClientRect();
61367         if (comboRect.bottom > containerRect.bottom) {
61368           var node = attachTo ? attachTo.node() : input.node();
61369           node.scrollIntoView({ behavior: "instant", block: "center" });
61370           render();
61371         }
61372         var selected = combo.selectAll(".combobox-option.selected").node();
61373         if (selected) {
61374           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
61375         }
61376       }
61377       function value() {
61378         var value2 = input.property("value");
61379         var start2 = input.property("selectionStart");
61380         var end = input.property("selectionEnd");
61381         if (start2 && end) {
61382           value2 = value2.substring(0, start2);
61383         }
61384         return value2;
61385       }
61386       function fetchComboData(v2, cb) {
61387         _cancelFetch = false;
61388         _fetcher.call(input, v2, function(results) {
61389           if (_cancelFetch)
61390             return;
61391           _suggestions = results;
61392           results.forEach(function(d2) {
61393             _fetched[d2.value] = d2;
61394           });
61395           if (cb) {
61396             cb();
61397           }
61398         });
61399       }
61400       function tryAutocomplete() {
61401         if (!_canAutocomplete)
61402           return;
61403         var val = _caseSensitive ? value() : value().toLowerCase();
61404         if (!val)
61405           return;
61406         if (isFinite(val))
61407           return;
61408         const suggestionValues = [];
61409         _suggestions.forEach((s2) => {
61410           suggestionValues.push(s2.value);
61411           if (s2.key && s2.key !== s2.value) {
61412             suggestionValues.push(s2.key);
61413           }
61414         });
61415         var bestIndex = -1;
61416         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
61417           var suggestion = suggestionValues[i3];
61418           var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
61419           if (compare === val) {
61420             bestIndex = i3;
61421             break;
61422           } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
61423             bestIndex = i3;
61424           }
61425         }
61426         if (bestIndex !== -1) {
61427           var bestVal = suggestionValues[bestIndex];
61428           input.property("value", bestVal);
61429           input.node().setSelectionRange(val.length, bestVal.length);
61430           dispatch14.call("update");
61431           return bestVal;
61432         }
61433       }
61434       function render() {
61435         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
61436           hide();
61437           return;
61438         }
61439         var shown = !container.selectAll(".combobox").empty();
61440         if (!shown)
61441           return;
61442         var combo = container.selectAll(".combobox");
61443         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
61444           return d2.value;
61445         });
61446         options2.exit().remove();
61447         options2.enter().append("a").attr("class", function(d2) {
61448           return "combobox-option " + (d2.klass || "");
61449         }).attr("title", function(d2) {
61450           return d2.title;
61451         }).each(function(d2) {
61452           if (d2.display) {
61453             d2.display(select_default2(this));
61454           } else {
61455             select_default2(this).text(d2.value);
61456           }
61457         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
61458           return d2.value === _selected || d2.key === _selected;
61459         }).on("click.combo-option", accept).order();
61460         var node = attachTo ? attachTo.node() : input.node();
61461         var containerRect = container.node().getBoundingClientRect();
61462         var rect = node.getBoundingClientRect();
61463         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
61464       }
61465       function accept(d3_event, d2) {
61466         _cancelFetch = true;
61467         var thiz = input.node();
61468         if (d2) {
61469           utilGetSetValue(input, d2.value);
61470           utilTriggerEvent(input, "change");
61471         }
61472         var val = utilGetSetValue(input);
61473         thiz.setSelectionRange(val.length, val.length);
61474         d2 = _fetched[val];
61475         dispatch14.call("accept", thiz, d2, val);
61476         hide();
61477       }
61478       function cancel() {
61479         _cancelFetch = true;
61480         var thiz = input.node();
61481         var val = utilGetSetValue(input);
61482         var start2 = input.property("selectionStart");
61483         var end = input.property("selectionEnd");
61484         val = val.slice(0, start2) + val.slice(end);
61485         utilGetSetValue(input, val);
61486         thiz.setSelectionRange(val.length, val.length);
61487         dispatch14.call("cancel", thiz);
61488         hide();
61489       }
61490     };
61491     combobox.canAutocomplete = function(val) {
61492       if (!arguments.length)
61493         return _canAutocomplete;
61494       _canAutocomplete = val;
61495       return combobox;
61496     };
61497     combobox.caseSensitive = function(val) {
61498       if (!arguments.length)
61499         return _caseSensitive;
61500       _caseSensitive = val;
61501       return combobox;
61502     };
61503     combobox.data = function(val) {
61504       if (!arguments.length)
61505         return _data;
61506       _data = val;
61507       return combobox;
61508     };
61509     combobox.fetcher = function(val) {
61510       if (!arguments.length)
61511         return _fetcher;
61512       _fetcher = val;
61513       return combobox;
61514     };
61515     combobox.minItems = function(val) {
61516       if (!arguments.length)
61517         return _minItems;
61518       _minItems = val;
61519       return combobox;
61520     };
61521     combobox.itemsMouseEnter = function(val) {
61522       if (!arguments.length)
61523         return _mouseEnterHandler;
61524       _mouseEnterHandler = val;
61525       return combobox;
61526     };
61527     combobox.itemsMouseLeave = function(val) {
61528       if (!arguments.length)
61529         return _mouseLeaveHandler;
61530       _mouseLeaveHandler = val;
61531       return combobox;
61532     };
61533     return utilRebind(combobox, dispatch14, "on");
61534   }
61535   uiCombobox.off = function(input, context) {
61536     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);
61537     context.container().on("scroll.combo-scroll", null);
61538   };
61539
61540   // modules/ui/disclosure.js
61541   function uiDisclosure(context, key, expandedDefault) {
61542     var dispatch14 = dispatch_default("toggled");
61543     var _expanded;
61544     var _label = utilFunctor("");
61545     var _updatePreference = true;
61546     var _content = function() {
61547     };
61548     var disclosure = function(selection2) {
61549       if (_expanded === void 0 || _expanded === null) {
61550         var preference = corePreferences("disclosure." + key + ".expanded");
61551         _expanded = preference === null ? !!expandedDefault : preference === "true";
61552       }
61553       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
61554       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"));
61555       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
61556       hideToggle = hideToggleEnter.merge(hideToggle);
61557       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
61558       const label = _label();
61559       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
61560       if (typeof label !== "function") {
61561         labelSelection.text(_label());
61562       } else {
61563         labelSelection.text("").call(label);
61564       }
61565       hideToggle.selectAll(".hide-toggle-icon").attr(
61566         "xlink:href",
61567         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
61568       );
61569       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
61570       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
61571       if (_expanded) {
61572         wrap2.call(_content);
61573       }
61574       function toggle(d3_event) {
61575         d3_event.preventDefault();
61576         _expanded = !_expanded;
61577         if (_updatePreference) {
61578           corePreferences("disclosure." + key + ".expanded", _expanded);
61579         }
61580         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
61581         hideToggle.selectAll(".hide-toggle-icon").attr(
61582           "xlink:href",
61583           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
61584         );
61585         wrap2.call(uiToggle(_expanded));
61586         if (_expanded) {
61587           wrap2.call(_content);
61588         }
61589         dispatch14.call("toggled", this, _expanded);
61590       }
61591     };
61592     disclosure.label = function(val) {
61593       if (!arguments.length)
61594         return _label;
61595       _label = utilFunctor(val);
61596       return disclosure;
61597     };
61598     disclosure.expanded = function(val) {
61599       if (!arguments.length)
61600         return _expanded;
61601       _expanded = val;
61602       return disclosure;
61603     };
61604     disclosure.updatePreference = function(val) {
61605       if (!arguments.length)
61606         return _updatePreference;
61607       _updatePreference = val;
61608       return disclosure;
61609     };
61610     disclosure.content = function(val) {
61611       if (!arguments.length)
61612         return _content;
61613       _content = val;
61614       return disclosure;
61615     };
61616     return utilRebind(disclosure, dispatch14, "on");
61617   }
61618
61619   // modules/ui/section.js
61620   function uiSection(id2, context) {
61621     var _classes = utilFunctor("");
61622     var _shouldDisplay;
61623     var _content;
61624     var _disclosure;
61625     var _label;
61626     var _expandedByDefault = utilFunctor(true);
61627     var _disclosureContent;
61628     var _disclosureExpanded;
61629     var _containerSelection = select_default2(null);
61630     var section = {
61631       id: id2
61632     };
61633     section.classes = function(val) {
61634       if (!arguments.length)
61635         return _classes;
61636       _classes = utilFunctor(val);
61637       return section;
61638     };
61639     section.label = function(val) {
61640       if (!arguments.length)
61641         return _label;
61642       _label = utilFunctor(val);
61643       return section;
61644     };
61645     section.expandedByDefault = function(val) {
61646       if (!arguments.length)
61647         return _expandedByDefault;
61648       _expandedByDefault = utilFunctor(val);
61649       return section;
61650     };
61651     section.shouldDisplay = function(val) {
61652       if (!arguments.length)
61653         return _shouldDisplay;
61654       _shouldDisplay = utilFunctor(val);
61655       return section;
61656     };
61657     section.content = function(val) {
61658       if (!arguments.length)
61659         return _content;
61660       _content = val;
61661       return section;
61662     };
61663     section.disclosureContent = function(val) {
61664       if (!arguments.length)
61665         return _disclosureContent;
61666       _disclosureContent = val;
61667       return section;
61668     };
61669     section.disclosureExpanded = function(val) {
61670       if (!arguments.length)
61671         return _disclosureExpanded;
61672       _disclosureExpanded = val;
61673       return section;
61674     };
61675     section.render = function(selection2) {
61676       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
61677       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
61678       _containerSelection = sectionEnter.merge(_containerSelection);
61679       _containerSelection.call(renderContent);
61680     };
61681     section.reRender = function() {
61682       _containerSelection.call(renderContent);
61683     };
61684     section.selection = function() {
61685       return _containerSelection;
61686     };
61687     section.disclosure = function() {
61688       return _disclosure;
61689     };
61690     function renderContent(selection2) {
61691       if (_shouldDisplay) {
61692         var shouldDisplay = _shouldDisplay();
61693         selection2.classed("hide", !shouldDisplay);
61694         if (!shouldDisplay) {
61695           selection2.html("");
61696           return;
61697         }
61698       }
61699       if (_disclosureContent) {
61700         if (!_disclosure) {
61701           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
61702         }
61703         if (_disclosureExpanded !== void 0) {
61704           _disclosure.expanded(_disclosureExpanded);
61705           _disclosureExpanded = void 0;
61706         }
61707         selection2.call(_disclosure);
61708         return;
61709       }
61710       if (_content) {
61711         selection2.call(_content);
61712       }
61713     }
61714     return section;
61715   }
61716
61717   // modules/ui/tag_reference.js
61718   function uiTagReference(what) {
61719     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
61720     var tagReference = {};
61721     var _button = select_default2(null);
61722     var _body = select_default2(null);
61723     var _loaded;
61724     var _showing;
61725     function load() {
61726       if (!wikibase)
61727         return;
61728       _button.classed("tag-reference-loading", true);
61729       wikibase.getDocs(what, gotDocs);
61730     }
61731     function gotDocs(err, docs) {
61732       _body.html("");
61733       if (!docs || !docs.title) {
61734         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
61735         done();
61736         return;
61737       }
61738       if (docs.imageURL) {
61739         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
61740           done();
61741         }).on("error", function() {
61742           select_default2(this).remove();
61743           done();
61744         });
61745       } else {
61746         done();
61747       }
61748       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
61749       if (docs.description) {
61750         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
61751       } else {
61752         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
61753       }
61754       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"));
61755       if (docs.wiki) {
61756         _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));
61757       }
61758       if (what.key === "comment") {
61759         _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"));
61760       }
61761     }
61762     function done() {
61763       _loaded = true;
61764       _button.classed("tag-reference-loading", false);
61765       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
61766       _showing = true;
61767       _button.selectAll("svg.icon use").each(function() {
61768         var iconUse = select_default2(this);
61769         if (iconUse.attr("href") === "#iD-icon-info") {
61770           iconUse.attr("href", "#iD-icon-info-filled");
61771         }
61772       });
61773     }
61774     function hide() {
61775       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
61776         _body.classed("expanded", false);
61777       });
61778       _showing = false;
61779       _button.selectAll("svg.icon use").each(function() {
61780         var iconUse = select_default2(this);
61781         if (iconUse.attr("href") === "#iD-icon-info-filled") {
61782           iconUse.attr("href", "#iD-icon-info");
61783         }
61784       });
61785     }
61786     tagReference.button = function(selection2, klass, iconName) {
61787       _button = selection2.selectAll(".tag-reference-button").data([0]);
61788       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
61789       _button.on("click", function(d3_event) {
61790         d3_event.stopPropagation();
61791         d3_event.preventDefault();
61792         this.blur();
61793         if (_showing) {
61794           hide();
61795         } else if (_loaded) {
61796           done();
61797         } else {
61798           load();
61799         }
61800       });
61801     };
61802     tagReference.body = function(selection2) {
61803       var itemID = what.qid || what.key + "-" + (what.value || "");
61804       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
61805         return d2;
61806       });
61807       _body.exit().remove();
61808       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
61809       if (_showing === false) {
61810         hide();
61811       }
61812     };
61813     tagReference.showing = function(val) {
61814       if (!arguments.length)
61815         return _showing;
61816       _showing = val;
61817       return tagReference;
61818     };
61819     return tagReference;
61820   }
61821
61822   // modules/ui/field_help.js
61823   function uiFieldHelp(context, fieldName) {
61824     var fieldHelp = {};
61825     var _inspector = select_default2(null);
61826     var _wrap = select_default2(null);
61827     var _body = select_default2(null);
61828     var fieldHelpKeys = {
61829       restrictions: [
61830         ["about", [
61831           "about",
61832           "from_via_to",
61833           "maxdist",
61834           "maxvia"
61835         ]],
61836         ["inspecting", [
61837           "about",
61838           "from_shadow",
61839           "allow_shadow",
61840           "restrict_shadow",
61841           "only_shadow",
61842           "restricted",
61843           "only"
61844         ]],
61845         ["modifying", [
61846           "about",
61847           "indicators",
61848           "allow_turn",
61849           "restrict_turn",
61850           "only_turn"
61851         ]],
61852         ["tips", [
61853           "simple",
61854           "simple_example",
61855           "indirect",
61856           "indirect_example",
61857           "indirect_noedit"
61858         ]]
61859       ]
61860     };
61861     var fieldHelpHeadings = {};
61862     var replacements = {
61863       distField: { html: _t.html("restriction.controls.distance") },
61864       viaField: { html: _t.html("restriction.controls.via") },
61865       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
61866       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
61867       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
61868       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
61869       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
61870       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
61871       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
61872     };
61873     var docs = fieldHelpKeys[fieldName].map(function(key) {
61874       var helpkey = "help.field." + fieldName + "." + key[0];
61875       var text2 = key[1].reduce(function(all, part) {
61876         var subkey = helpkey + "." + part;
61877         var depth = fieldHelpHeadings[subkey];
61878         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
61879         return all + hhh + _t.html(subkey, replacements) + "\n\n";
61880       }, "");
61881       return {
61882         key: helpkey,
61883         title: _t.html(helpkey + ".title"),
61884         html: marked(text2.trim())
61885       };
61886     });
61887     function show() {
61888       updatePosition();
61889       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
61890     }
61891     function hide() {
61892       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
61893         _body.classed("hide", true);
61894       });
61895     }
61896     function clickHelp(index) {
61897       var d2 = docs[index];
61898       var tkeys = fieldHelpKeys[fieldName][index][1];
61899       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
61900         return i3 === index;
61901       });
61902       var content = _body.selectAll(".field-help-content").html(d2.html);
61903       content.selectAll("p").attr("class", function(d4, i3) {
61904         return tkeys[i3];
61905       });
61906       if (d2.key === "help.field.restrictions.inspecting") {
61907         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
61908       } else if (d2.key === "help.field.restrictions.modifying") {
61909         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
61910       }
61911     }
61912     fieldHelp.button = function(selection2) {
61913       if (_body.empty())
61914         return;
61915       var button = selection2.selectAll(".field-help-button").data([0]);
61916       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
61917         d3_event.stopPropagation();
61918         d3_event.preventDefault();
61919         if (_body.classed("hide")) {
61920           show();
61921         } else {
61922           hide();
61923         }
61924       });
61925     };
61926     function updatePosition() {
61927       var wrap2 = _wrap.node();
61928       var inspector = _inspector.node();
61929       var wRect = wrap2.getBoundingClientRect();
61930       var iRect = inspector.getBoundingClientRect();
61931       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
61932     }
61933     fieldHelp.body = function(selection2) {
61934       _wrap = selection2.selectAll(".form-field-input-wrap");
61935       if (_wrap.empty())
61936         return;
61937       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
61938       if (_inspector.empty())
61939         return;
61940       _body = _inspector.selectAll(".field-help-body").data([0]);
61941       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
61942       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
61943       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
61944       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
61945         d3_event.stopPropagation();
61946         d3_event.preventDefault();
61947         hide();
61948       }).call(svgIcon("#iD-icon-close"));
61949       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
61950       var titles = docs.map(function(d2) {
61951         return d2.title;
61952       });
61953       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
61954         return d2;
61955       }).on("click", function(d3_event, d2) {
61956         d3_event.stopPropagation();
61957         d3_event.preventDefault();
61958         clickHelp(titles.indexOf(d2));
61959       });
61960       enter.append("div").attr("class", "field-help-content");
61961       _body = _body.merge(enter);
61962       clickHelp(0);
61963     };
61964     return fieldHelp;
61965   }
61966
61967   // modules/ui/fields/check.js
61968   function uiFieldCheck(field, context) {
61969     var dispatch14 = dispatch_default("change");
61970     var options2 = field.options;
61971     var values = [];
61972     var texts = [];
61973     var _tags;
61974     var input = select_default2(null);
61975     var text2 = select_default2(null);
61976     var label = select_default2(null);
61977     var reverser = select_default2(null);
61978     var _impliedYes;
61979     var _entityIDs = [];
61980     var _value;
61981     var stringsField = field.resolveReference("stringsCrossReference");
61982     if (!options2 && stringsField.options) {
61983       options2 = stringsField.options;
61984     }
61985     if (options2) {
61986       for (var i3 in options2) {
61987         var v2 = options2[i3];
61988         values.push(v2 === "undefined" ? void 0 : v2);
61989         texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
61990       }
61991     } else {
61992       values = [void 0, "yes"];
61993       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
61994       if (field.type !== "defaultCheck") {
61995         values.push("no");
61996         texts.push(_t.html("inspector.check.no"));
61997       }
61998     }
61999     function checkImpliedYes() {
62000       _impliedYes = field.id === "oneway_yes";
62001       if (field.id === "oneway") {
62002         var entity = context.entity(_entityIDs[0]);
62003         for (var key in entity.tags) {
62004           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
62005             _impliedYes = true;
62006             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
62007             break;
62008           }
62009         }
62010       }
62011     }
62012     function reverserHidden() {
62013       if (!context.container().select("div.inspector-hover").empty())
62014         return true;
62015       return !(_value === "yes" || _impliedYes && !_value);
62016     }
62017     function reverserSetText(selection2) {
62018       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
62019       if (reverserHidden() || !entity)
62020         return selection2;
62021       var first = entity.first();
62022       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
62023       var pseudoDirection = first < last;
62024       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
62025       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
62026       return selection2;
62027     }
62028     var check = function(selection2) {
62029       checkImpliedYes();
62030       label = selection2.selectAll(".form-field-input-wrap").data([0]);
62031       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
62032       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
62033       enter.append("span").html(texts[0]).attr("class", "value");
62034       if (field.type === "onewayCheck") {
62035         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
62036       }
62037       label = label.merge(enter);
62038       input = label.selectAll("input");
62039       text2 = label.selectAll("span.value");
62040       input.on("click", function(d3_event) {
62041         d3_event.stopPropagation();
62042         var t2 = {};
62043         if (Array.isArray(_tags[field.key])) {
62044           if (values.indexOf("yes") !== -1) {
62045             t2[field.key] = "yes";
62046           } else {
62047             t2[field.key] = values[0];
62048           }
62049         } else {
62050           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
62051         }
62052         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
62053           t2[field.key] = values[0];
62054         }
62055         dispatch14.call("change", this, t2);
62056       });
62057       if (field.type === "onewayCheck") {
62058         reverser = label.selectAll(".reverser");
62059         reverser.call(reverserSetText).on("click", function(d3_event) {
62060           d3_event.preventDefault();
62061           d3_event.stopPropagation();
62062           context.perform(
62063             function(graph) {
62064               for (var i4 in _entityIDs) {
62065                 graph = actionReverse(_entityIDs[i4])(graph);
62066               }
62067               return graph;
62068             },
62069             _t("operations.reverse.annotation.line", { n: 1 })
62070           );
62071           context.validator().validate();
62072           select_default2(this).call(reverserSetText);
62073         });
62074       }
62075     };
62076     check.entityIDs = function(val) {
62077       if (!arguments.length)
62078         return _entityIDs;
62079       _entityIDs = val;
62080       return check;
62081     };
62082     check.tags = function(tags) {
62083       _tags = tags;
62084       function isChecked(val) {
62085         return val !== "no" && val !== "" && val !== void 0 && val !== null;
62086       }
62087       function textFor(val) {
62088         if (val === "")
62089           val = void 0;
62090         var index = values.indexOf(val);
62091         return index !== -1 ? texts[index] : '"' + val + '"';
62092       }
62093       checkImpliedYes();
62094       var isMixed = Array.isArray(tags[field.key]);
62095       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
62096       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
62097         _value = "yes";
62098       }
62099       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
62100       text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
62101       label.classed("set", !!_value);
62102       if (field.type === "onewayCheck") {
62103         reverser.classed("hide", reverserHidden()).call(reverserSetText);
62104       }
62105     };
62106     check.focus = function() {
62107       input.node().focus();
62108     };
62109     return utilRebind(check, dispatch14, "on");
62110   }
62111
62112   // modules/ui/length_indicator.js
62113   function uiLengthIndicator(maxChars) {
62114     var _wrap = select_default2(null);
62115     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
62116       selection2.text("");
62117       selection2.call(svgIcon("#iD-icon-alert", "inline"));
62118       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
62119     });
62120     var _silent = false;
62121     var lengthIndicator = function(selection2) {
62122       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
62123       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
62124       selection2.call(_tooltip);
62125     };
62126     lengthIndicator.update = function(val) {
62127       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
62128       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
62129       indicator.enter().append("span").merge(indicator).classed("length-indicator", true).classed("limit-reached", (d2) => d2 > maxChars).style("border-right-width", (d2) => `${Math.abs(maxChars - d2) * 2}px`).style("margin-right", (d2) => d2 > maxChars ? `${(maxChars - d2) * 2}px` : 0).style("opacity", (d2) => d2 > maxChars * 0.8 ? Math.min(1, (d2 / maxChars - 0.8) / (1 - 0.8)) : 0).style("pointer-events", (d2) => d2 > maxChars * 0.8 ? null : "none");
62130       if (_silent)
62131         return;
62132       if (strLen > maxChars) {
62133         _tooltip.show();
62134       } else {
62135         _tooltip.hide();
62136       }
62137     };
62138     lengthIndicator.silent = function(val) {
62139       if (!arguments.length)
62140         return _silent;
62141       _silent = val;
62142       return lengthIndicator;
62143     };
62144     return lengthIndicator;
62145   }
62146
62147   // modules/ui/fields/combo.js
62148   function uiFieldCombo(field, context) {
62149     var dispatch14 = dispatch_default("change");
62150     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
62151     var _isNetwork = field.type === "networkCombo";
62152     var _isSemi = field.type === "semiCombo";
62153     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
62154     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
62155     var _snake_case = field.snake_case || field.snake_case === void 0;
62156     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
62157     var _container = select_default2(null);
62158     var _inputWrap = select_default2(null);
62159     var _input = select_default2(null);
62160     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
62161     var _comboData = [];
62162     var _multiData = [];
62163     var _entityIDs = [];
62164     var _tags;
62165     var _countryCode;
62166     var _staticPlaceholder;
62167     var _dataDeprecated = [];
62168     _mainFileFetcher.get("deprecated").then(function(d2) {
62169       _dataDeprecated = d2;
62170     }).catch(function() {
62171     });
62172     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
62173       field.key += ":";
62174     }
62175     function snake(s2) {
62176       return s2.replace(/\s+/g, "_");
62177     }
62178     function clean2(s2) {
62179       return s2.split(";").map(function(s3) {
62180         return s3.trim();
62181       }).join(";");
62182     }
62183     function tagValue(dval) {
62184       dval = clean2(dval || "");
62185       var found = getOptions(true).find(function(o2) {
62186         return o2.key && clean2(o2.value) === dval;
62187       });
62188       if (found)
62189         return found.key;
62190       if (field.type === "typeCombo" && !dval) {
62191         return "yes";
62192       }
62193       return restrictTagValueSpelling(dval) || void 0;
62194     }
62195     function restrictTagValueSpelling(dval) {
62196       if (_snake_case) {
62197         dval = snake(dval);
62198       }
62199       if (!field.caseSensitive) {
62200         dval = dval.toLowerCase();
62201       }
62202       return dval;
62203     }
62204     function getLabelId(field2, v2) {
62205       return field2.hasTextForStringId(`options.${v2}.title`) ? `options.${v2}.title` : `options.${v2}`;
62206     }
62207     function displayValue(tval) {
62208       tval = tval || "";
62209       var stringsField = field.resolveReference("stringsCrossReference");
62210       const labelId = getLabelId(stringsField, tval);
62211       if (stringsField.hasTextForStringId(labelId)) {
62212         return stringsField.t(labelId, { default: tval });
62213       }
62214       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
62215         return "";
62216       }
62217       return tval;
62218     }
62219     function renderValue(tval) {
62220       tval = tval || "";
62221       var stringsField = field.resolveReference("stringsCrossReference");
62222       const labelId = getLabelId(stringsField, tval);
62223       if (stringsField.hasTextForStringId(labelId)) {
62224         return stringsField.t.append(labelId, { default: tval });
62225       }
62226       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
62227         tval = "";
62228       }
62229       return (selection2) => selection2.text(tval);
62230     }
62231     function objectDifference(a2, b2) {
62232       return a2.filter(function(d1) {
62233         return !b2.some(function(d2) {
62234           return d1.value === d2.value;
62235         });
62236       });
62237     }
62238     function initCombo(selection2, attachTo) {
62239       if (!_allowCustomValues) {
62240         selection2.attr("readonly", "readonly");
62241       }
62242       if (_showTagInfoSuggestions && services.taginfo) {
62243         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
62244         setTaginfoValues("", setPlaceholder);
62245       } else {
62246         selection2.call(_combobox, attachTo);
62247         setTimeout(() => setStaticValues(setPlaceholder), 0);
62248       }
62249     }
62250     function getOptions(allOptions) {
62251       var stringsField = field.resolveReference("stringsCrossReference");
62252       if (!(field.options || stringsField.options))
62253         return [];
62254       let options2;
62255       if (allOptions !== true) {
62256         options2 = field.options || stringsField.options;
62257       } else {
62258         options2 = [].concat(field.options, stringsField.options).filter(Boolean);
62259       }
62260       return options2.map(function(v2) {
62261         const labelId = getLabelId(stringsField, v2);
62262         return {
62263           key: v2,
62264           value: stringsField.t(labelId, { default: v2 }),
62265           title: stringsField.t(`options.${v2}.description`, { default: v2 }),
62266           display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
62267           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
62268         };
62269       });
62270     }
62271     function setStaticValues(callback, filter2) {
62272       _comboData = getOptions();
62273       if (filter2 !== void 0) {
62274         _comboData = _comboData.filter(filter2);
62275       }
62276       _comboData = objectDifference(_comboData, _multiData);
62277       _combobox.data(_comboData);
62278       if (callback)
62279         callback(_comboData);
62280     }
62281     function setTaginfoValues(q2, callback) {
62282       var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
62283       setStaticValues(callback, queryFilter);
62284       var stringsField = field.resolveReference("stringsCrossReference");
62285       var fn = _isMulti ? "multikeys" : "values";
62286       var query = (_isMulti ? field.key : "") + q2;
62287       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
62288       if (hasCountryPrefix) {
62289         query = _countryCode + ":";
62290       }
62291       var params = {
62292         debounce: q2 !== "",
62293         key: field.key,
62294         query
62295       };
62296       if (_entityIDs.length) {
62297         params.geometry = context.graph().geometry(_entityIDs[0]);
62298       }
62299       services.taginfo[fn](params, function(err, data) {
62300         if (err)
62301           return;
62302         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
62303         data = data.filter((d2) => {
62304           var value = d2.value;
62305           if (_isMulti) {
62306             value = value.slice(field.key.length);
62307           }
62308           return value === restrictTagValueSpelling(value);
62309         });
62310         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
62311         if (deprecatedValues) {
62312           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
62313         }
62314         if (hasCountryPrefix) {
62315           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
62316         }
62317         const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
62318         _container.classed("empty-combobox", data.length === 0);
62319         _comboData = data.concat(additionalOptions).map(function(d2) {
62320           var v2 = d2.value;
62321           if (_isMulti)
62322             v2 = v2.replace(field.key, "");
62323           const labelId = getLabelId(stringsField, v2);
62324           var isLocalizable = stringsField.hasTextForStringId(labelId);
62325           var label = stringsField.t(labelId, { default: v2 });
62326           return {
62327             key: v2,
62328             value: label,
62329             title: stringsField.t(`options.${v2}.description`, { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
62330             display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
62331             klass: isLocalizable ? "" : "raw-option"
62332           };
62333         });
62334         _comboData = _comboData.filter(queryFilter);
62335         _comboData = objectDifference(_comboData, _multiData);
62336         if (callback)
62337           callback(_comboData);
62338       });
62339     }
62340     function addComboboxIcons(disp, value) {
62341       const iconsField = field.resolveReference("iconsCrossReference");
62342       if (iconsField.icons) {
62343         return function(selection2) {
62344           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
62345           if (iconsField.icons[value]) {
62346             span.call(svgIcon(`#${iconsField.icons[value]}`));
62347           }
62348           disp.call(this, selection2);
62349         };
62350       }
62351       return disp;
62352     }
62353     function setPlaceholder(values) {
62354       if (_isMulti || _isSemi) {
62355         _staticPlaceholder = field.placeholder() || _t("inspector.add");
62356       } else {
62357         var vals = values.map(function(d2) {
62358           return d2.value;
62359         }).filter(function(s2) {
62360           return s2.length < 20;
62361         });
62362         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
62363           return d2.key;
62364         });
62365         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
62366       }
62367       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
62368         _staticPlaceholder += "\u2026";
62369       }
62370       var ph;
62371       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
62372         ph = _t("inspector.multiple_values");
62373       } else {
62374         ph = _staticPlaceholder;
62375       }
62376       _container.selectAll("input").attr("placeholder", ph);
62377       var hideAdd = !_allowCustomValues && !values.length;
62378       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
62379     }
62380     function change() {
62381       var t2 = {};
62382       var val;
62383       if (_isMulti || _isSemi) {
62384         var vals;
62385         if (_isMulti) {
62386           vals = [tagValue(utilGetSetValue(_input))];
62387         } else if (_isSemi) {
62388           val = tagValue(utilGetSetValue(_input)) || "";
62389           val = val.replace(/,/g, ";");
62390           vals = val.split(";");
62391         }
62392         vals = vals.filter(Boolean);
62393         if (!vals.length)
62394           return;
62395         _container.classed("active", false);
62396         utilGetSetValue(_input, "");
62397         if (_isMulti) {
62398           utilArrayUniq(vals).forEach(function(v2) {
62399             var key = (field.key || "") + v2;
62400             if (_tags) {
62401               var old = _tags[key];
62402               if (typeof old === "string" && old.toLowerCase() !== "no")
62403                 return;
62404             }
62405             key = context.cleanTagKey(key);
62406             field.keys.push(key);
62407             t2[key] = "yes";
62408           });
62409         } else if (_isSemi) {
62410           var arr = _multiData.map(function(d2) {
62411             return d2.key;
62412           });
62413           arr = arr.concat(vals);
62414           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
62415         }
62416         window.setTimeout(function() {
62417           _input.node().focus();
62418         }, 10);
62419       } else {
62420         var rawValue = utilGetSetValue(_input);
62421         if (!rawValue && Array.isArray(_tags[field.key]))
62422           return;
62423         val = context.cleanTagValue(tagValue(rawValue));
62424         t2[field.key] = val || void 0;
62425       }
62426       dispatch14.call("change", this, t2);
62427     }
62428     function removeMultikey(d3_event, d2) {
62429       d3_event.preventDefault();
62430       d3_event.stopPropagation();
62431       var t2 = {};
62432       if (_isMulti) {
62433         t2[d2.key] = void 0;
62434       } else if (_isSemi) {
62435         var arr = _multiData.map(function(md) {
62436           return md.key === d2.key ? null : md.key;
62437         }).filter(Boolean);
62438         arr = utilArrayUniq(arr);
62439         t2[field.key] = arr.length ? arr.join(";") : void 0;
62440         _lengthIndicator.update(t2[field.key]);
62441       }
62442       dispatch14.call("change", this, t2);
62443     }
62444     function invertMultikey(d3_event, d2) {
62445       d3_event.preventDefault();
62446       d3_event.stopPropagation();
62447       var t2 = {};
62448       if (_isMulti) {
62449         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
62450       }
62451       dispatch14.call("change", this, t2);
62452     }
62453     function combo(selection2) {
62454       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
62455       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
62456       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
62457       if (_isMulti || _isSemi) {
62458         _container = _container.selectAll(".chiplist").data([0]);
62459         var listClass = "chiplist";
62460         if (field.key === "destination" || field.key === "via") {
62461           listClass += " full-line-chips";
62462         }
62463         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
62464           window.setTimeout(function() {
62465             _input.node().focus();
62466           }, 10);
62467         }).merge(_container);
62468         _inputWrap = _container.selectAll(".input-wrap").data([0]);
62469         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
62470         var hideAdd = !_allowCustomValues && !_comboData.length;
62471         _inputWrap.style("display", hideAdd ? "none" : null);
62472         _input = _inputWrap.selectAll("input").data([0]);
62473       } else {
62474         _input = _container.selectAll("input").data([0]);
62475       }
62476       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
62477       if (_isSemi) {
62478         _inputWrap.call(_lengthIndicator);
62479       } else if (!_isMulti) {
62480         _container.call(_lengthIndicator);
62481       }
62482       if (_isNetwork) {
62483         var extent = combinedEntityExtent();
62484         var countryCode = extent && iso1A2Code(extent.center());
62485         _countryCode = countryCode && countryCode.toLowerCase();
62486       }
62487       _input.on("change", change).on("blur", change).on("input", function() {
62488         let val = utilGetSetValue(_input);
62489         updateIcon(val);
62490         if (_isSemi && _tags[field.key]) {
62491           val += ";" + _tags[field.key];
62492         }
62493         _lengthIndicator.update(val);
62494       });
62495       _input.on("keydown.field", function(d3_event) {
62496         switch (d3_event.keyCode) {
62497           case 13:
62498             _input.node().blur();
62499             d3_event.stopPropagation();
62500             break;
62501         }
62502       });
62503       if (_isMulti || _isSemi) {
62504         _combobox.on("accept", function() {
62505           _input.node().blur();
62506           _input.node().focus();
62507         });
62508         _input.on("focus", function() {
62509           _container.classed("active", true);
62510         });
62511       }
62512       _combobox.on("cancel", function() {
62513         _input.node().blur();
62514       }).on("update", function() {
62515         updateIcon(utilGetSetValue(_input));
62516       });
62517     }
62518     function updateIcon(value) {
62519       value = tagValue(value);
62520       let container = _container;
62521       if (field.type === "multiCombo" || field.type === "semiCombo") {
62522         container = _container.select(".input-wrap");
62523       }
62524       const iconsField = field.resolveReference("iconsCrossReference");
62525       if (iconsField.icons) {
62526         container.selectAll(".tag-value-icon").remove();
62527         if (iconsField.icons[value]) {
62528           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
62529         }
62530       }
62531     }
62532     combo.tags = function(tags) {
62533       _tags = tags;
62534       var stringsField = field.resolveReference("stringsCrossReference");
62535       var isMixed = Array.isArray(tags[field.key]);
62536       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
62537       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
62538       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
62539       var isReadOnly = !_allowCustomValues;
62540       if (_isMulti || _isSemi) {
62541         _multiData = [];
62542         var maxLength;
62543         if (_isMulti) {
62544           for (var k2 in tags) {
62545             if (field.key && k2.indexOf(field.key) !== 0)
62546               continue;
62547             if (!field.key && field.keys.indexOf(k2) === -1)
62548               continue;
62549             var v2 = tags[k2];
62550             var suffix = field.key ? k2.slice(field.key.length) : k2;
62551             _multiData.push({
62552               key: k2,
62553               value: displayValue(suffix),
62554               display: addComboboxIcons(renderValue(suffix), suffix),
62555               state: typeof v2 === "string" ? v2.toLowerCase() : "",
62556               isMixed: Array.isArray(v2)
62557             });
62558           }
62559           if (field.key) {
62560             field.keys = _multiData.map(function(d2) {
62561               return d2.key;
62562             });
62563             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
62564           } else {
62565             maxLength = context.maxCharsForTagKey();
62566           }
62567         } else if (_isSemi) {
62568           var allValues = [];
62569           var commonValues;
62570           if (Array.isArray(tags[field.key])) {
62571             tags[field.key].forEach(function(tagVal) {
62572               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
62573               allValues = allValues.concat(thisVals);
62574               if (!commonValues) {
62575                 commonValues = thisVals;
62576               } else {
62577                 commonValues = commonValues.filter((value) => thisVals.includes(value));
62578               }
62579             });
62580             allValues = utilArrayUniq(allValues).filter(Boolean);
62581           } else {
62582             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
62583             commonValues = allValues;
62584           }
62585           _multiData = allValues.map(function(v3) {
62586             return {
62587               key: v3,
62588               value: displayValue(v3),
62589               display: addComboboxIcons(renderValue(v3), v3),
62590               isMixed: !commonValues.includes(v3)
62591             };
62592           });
62593           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
62594           maxLength = context.maxCharsForTagValue() - currLength;
62595           if (currLength > 0) {
62596             maxLength -= 1;
62597           }
62598         }
62599         maxLength = Math.max(0, maxLength);
62600         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
62601         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
62602         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
62603         var chips = _container.selectAll(".chip").data(_multiData);
62604         chips.exit().remove();
62605         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
62606         enter.append("span");
62607         enter.append("a");
62608         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
62609           var k3 = d2.key;
62610           if (_isMulti)
62611             k3 = k3.replace(field.key, "");
62612           return !stringsField.hasTextForStringId("options." + k3);
62613         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
62614           return d2.isMixed;
62615         }).attr("title", function(d2) {
62616           if (d2.isMixed) {
62617             return _t("inspector.unshared_value_tooltip");
62618           }
62619           if (!["yes", "no"].includes(d2.state)) {
62620             return d2.state;
62621           }
62622           return null;
62623         }).classed("negated", (d2) => d2.state === "no");
62624         if (!_isSemi) {
62625           chips.selectAll("input[type=checkbox]").remove();
62626           chips.insert("input", "span").attr("type", "checkbox").property("checked", (d2) => d2.state === "yes").property("indeterminate", (d2) => d2.isMixed || !["yes", "no"].includes(d2.state)).on("click", invertMultikey);
62627         }
62628         if (allowDragAndDrop) {
62629           registerDragAndDrop(chips);
62630         }
62631         chips.select("span").each(function(d2) {
62632           const selection2 = select_default2(this);
62633           if (d2.display) {
62634             selection2.text("");
62635             d2.display(selection2);
62636           } else {
62637             selection2.text(d2.value);
62638           }
62639         });
62640         chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
62641         updateIcon("");
62642       } else {
62643         var mixedValues = isMixed && tags[field.key].map(function(val) {
62644           return displayValue(val);
62645         }).filter(Boolean);
62646         utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").data([tags[field.key]]).classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) {
62647           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
62648             d3_event.preventDefault();
62649             d3_event.stopPropagation();
62650             var t2 = {};
62651             t2[field.key] = void 0;
62652             dispatch14.call("change", this, t2);
62653           }
62654         });
62655         if (!Array.isArray(tags[field.key])) {
62656           updateIcon(tags[field.key]);
62657         }
62658         if (!isMixed) {
62659           _lengthIndicator.update(tags[field.key]);
62660         }
62661       }
62662       const refreshStyles = () => {
62663         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
62664       };
62665       _input.on("input.refreshStyles", refreshStyles);
62666       _combobox.on("update.refreshStyles", refreshStyles);
62667       refreshStyles();
62668     };
62669     function registerDragAndDrop(selection2) {
62670       var dragOrigin, targetIndex;
62671       selection2.call(
62672         drag_default().on("start", function(d3_event) {
62673           dragOrigin = {
62674             x: d3_event.x,
62675             y: d3_event.y
62676           };
62677           targetIndex = null;
62678         }).on("drag", function(d3_event) {
62679           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
62680           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
62681           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
62682             return;
62683           var index = selection2.nodes().indexOf(this);
62684           select_default2(this).classed("dragging", true);
62685           targetIndex = null;
62686           var targetIndexOffsetTop = null;
62687           var draggedTagWidth = select_default2(this).node().offsetWidth;
62688           if (field.key === "destination" || field.key === "via") {
62689             _container.selectAll(".chip").style("transform", function(d2, index2) {
62690               var node = select_default2(this).node();
62691               if (index === index2) {
62692                 return "translate(" + x2 + "px, " + y2 + "px)";
62693               } else if (index2 > index && d3_event.y > node.offsetTop) {
62694                 if (targetIndex === null || index2 > targetIndex) {
62695                   targetIndex = index2;
62696                 }
62697                 return "translateY(-100%)";
62698               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
62699                 if (targetIndex === null || index2 < targetIndex) {
62700                   targetIndex = index2;
62701                 }
62702                 return "translateY(100%)";
62703               }
62704               return null;
62705             });
62706           } else {
62707             _container.selectAll(".chip").each(function(d2, index2) {
62708               var node = select_default2(this).node();
62709               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) {
62710                 targetIndex = index2;
62711                 targetIndexOffsetTop = node.offsetTop;
62712               }
62713             }).style("transform", function(d2, index2) {
62714               var node = select_default2(this).node();
62715               if (index === index2) {
62716                 return "translate(" + x2 + "px, " + y2 + "px)";
62717               }
62718               if (node.offsetTop === targetIndexOffsetTop) {
62719                 if (index2 < index && index2 >= targetIndex) {
62720                   return "translateX(" + draggedTagWidth + "px)";
62721                 } else if (index2 > index && index2 <= targetIndex) {
62722                   return "translateX(-" + draggedTagWidth + "px)";
62723                 }
62724               }
62725               return null;
62726             });
62727           }
62728         }).on("end", function() {
62729           if (!select_default2(this).classed("dragging")) {
62730             return;
62731           }
62732           var index = selection2.nodes().indexOf(this);
62733           select_default2(this).classed("dragging", false);
62734           _container.selectAll(".chip").style("transform", null);
62735           if (typeof targetIndex === "number") {
62736             var element = _multiData[index];
62737             _multiData.splice(index, 1);
62738             _multiData.splice(targetIndex, 0, element);
62739             var t2 = {};
62740             if (_multiData.length) {
62741               t2[field.key] = _multiData.map(function(element2) {
62742                 return element2.key;
62743               }).join(";");
62744             } else {
62745               t2[field.key] = void 0;
62746             }
62747             dispatch14.call("change", this, t2);
62748           }
62749           dragOrigin = void 0;
62750           targetIndex = void 0;
62751         })
62752       );
62753     }
62754     combo.focus = function() {
62755       _input.node().focus();
62756     };
62757     combo.entityIDs = function(val) {
62758       if (!arguments.length)
62759         return _entityIDs;
62760       _entityIDs = val;
62761       return combo;
62762     };
62763     function combinedEntityExtent() {
62764       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
62765     }
62766     return utilRebind(combo, dispatch14, "on");
62767   }
62768
62769   // modules/ui/fields/input.js
62770   var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
62771   function uiFieldText(field, context) {
62772     var dispatch14 = dispatch_default("change");
62773     var input = select_default2(null);
62774     var outlinkButton = select_default2(null);
62775     var wrap2 = select_default2(null);
62776     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
62777     var _entityIDs = [];
62778     var _tags;
62779     var _phoneFormats = {};
62780     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
62781     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
62782     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
62783     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
62784     if (field.type === "tel") {
62785       _mainFileFetcher.get("phone_formats").then(function(d2) {
62786         _phoneFormats = d2;
62787         updatePhonePlaceholder();
62788       }).catch(function() {
62789       });
62790     }
62791     function calcLocked() {
62792       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
62793         var entity = context.graph().hasEntity(entityID);
62794         if (!entity)
62795           return false;
62796         if (entity.tags.wikidata)
62797           return true;
62798         var preset = _mainPresetIndex.match(entity, context.graph());
62799         var isSuggestion = preset && preset.suggestion;
62800         var which = field.id;
62801         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
62802       });
62803       field.locked(isLocked);
62804     }
62805     function i3(selection2) {
62806       calcLocked();
62807       var isLocked = field.locked();
62808       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62809       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
62810       input = wrap2.selectAll("input").data([0]);
62811       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);
62812       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
62813       wrap2.call(_lengthIndicator);
62814       if (field.type === "tel") {
62815         updatePhonePlaceholder();
62816       } else if (field.type === "number") {
62817         var rtl = _mainLocalizer.textDirection() === "rtl";
62818         input.attr("type", "text");
62819         var inc = field.increment;
62820         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
62821         buttons.enter().append("button").attr("class", function(d2) {
62822           var which = d2 > 0 ? "increment" : "decrement";
62823           return "form-field-button " + which;
62824         }).attr("title", function(d2) {
62825           var which = d2 > 0 ? "increment" : "decrement";
62826           return _t(`inspector.${which}`);
62827         }).merge(buttons).on("click", function(d3_event, d2) {
62828           d3_event.preventDefault();
62829           var isMixed = Array.isArray(_tags[field.key]);
62830           if (isMixed)
62831             return;
62832           var raw_vals = input.node().value || "0";
62833           var vals = raw_vals.split(";");
62834           vals = vals.map(function(v2) {
62835             v2 = v2.trim();
62836             const isRawNumber = likelyRawNumberFormat.test(v2);
62837             var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
62838             if (isDirectionField) {
62839               const compassDir = cardinal[v2.toLowerCase()];
62840               if (compassDir !== void 0) {
62841                 num = compassDir;
62842               }
62843             }
62844             if (!isFinite(num))
62845               return v2;
62846             num = parseFloat(num);
62847             if (!isFinite(num))
62848               return v2;
62849             num += d2;
62850             if (isDirectionField) {
62851               num = (num % 360 + 360) % 360;
62852             }
62853             return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
62854           });
62855           input.node().value = vals.join(";");
62856           change()();
62857         });
62858       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
62859         input.attr("type", "text");
62860         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
62861         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
62862           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
62863           if (domainResults.length >= 2 && domainResults[1]) {
62864             var domain2 = domainResults[1];
62865             return _t("icons.view_on", { domain: domain2 });
62866           }
62867           return "";
62868         }).on("click", function(d3_event) {
62869           d3_event.preventDefault();
62870           var value = validIdentifierValueForLink();
62871           if (value) {
62872             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
62873             window.open(url, "_blank");
62874           }
62875         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
62876       } else if (field.type === "url") {
62877         input.attr("type", "text");
62878         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
62879         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) {
62880           d3_event.preventDefault();
62881           const value = validIdentifierValueForLink();
62882           if (value)
62883             window.open(value, "_blank");
62884         }).merge(outlinkButton);
62885       } else if (field.type === "colour") {
62886         input.attr("type", "text");
62887         updateColourPreview();
62888       } else if (field.type === "date") {
62889         input.attr("type", "text");
62890         updateDateField();
62891       }
62892     }
62893     function updateColourPreview() {
62894       function isColourValid(colour2) {
62895         if (!colour2.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
62896           return false;
62897         } else if (!CSS.supports("color", colour2) || ["unset", "inherit", "initial", "revert"].includes(colour2)) {
62898           return false;
62899         }
62900         return true;
62901       }
62902       wrap2.selectAll(".colour-preview").remove();
62903       const colour = utilGetSetValue(input);
62904       if (!isColourValid(colour) && colour !== "") {
62905         wrap2.selectAll("input.colour-selector").remove();
62906         wrap2.selectAll(".form-field-button").remove();
62907         return;
62908       }
62909       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
62910       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
62911         d3_event.preventDefault();
62912         var colour2 = this.value;
62913         if (!isColourValid(colour2))
62914           return;
62915         utilGetSetValue(input, this.value);
62916         change()();
62917         updateColourPreview();
62918       }, 100));
62919       wrap2.selectAll("input.colour-selector").attr("value", colour);
62920       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
62921       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
62922       if (colour === "") {
62923         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
62924       }
62925       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
62926     }
62927     function updateDateField() {
62928       function isDateValid(date2) {
62929         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
62930       }
62931       const date = utilGetSetValue(input);
62932       const now3 = /* @__PURE__ */ new Date();
62933       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
62934       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
62935         wrap2.selectAll(".date-set-today").data([0]).enter().append("button").attr("class", "form-field-button date-set-today").call(svgIcon("#fas-rotate")).call(uiTooltip().title(() => _t.append("inspector.set_today"))).on("click", () => {
62936           utilGetSetValue(input, today);
62937           change()();
62938           updateDateField();
62939         });
62940       } else {
62941         wrap2.selectAll(".date-set-today").remove();
62942       }
62943       if (!isDateValid(date) && date !== "") {
62944         wrap2.selectAll("input.date-selector").remove();
62945         wrap2.selectAll(".date-calendar").remove();
62946         return;
62947       }
62948       if (utilDetect().browser !== "Safari") {
62949         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
62950         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
62951           d3_event.preventDefault();
62952           var date2 = this.value;
62953           if (!isDateValid(date2))
62954             return;
62955           utilGetSetValue(input, this.value);
62956           change()();
62957           updateDateField();
62958         }, 100));
62959         wrap2.selectAll("input.date-selector").attr("value", date);
62960         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
62961         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
62962         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
62963       }
62964     }
62965     function updatePhonePlaceholder() {
62966       if (input.empty() || !Object.keys(_phoneFormats).length)
62967         return;
62968       var extent = combinedEntityExtent();
62969       var countryCode = extent && iso1A2Code(extent.center());
62970       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
62971       if (format2)
62972         input.attr("placeholder", format2);
62973     }
62974     function validIdentifierValueForLink() {
62975       const value = utilGetSetValue(input).trim();
62976       if (field.type === "url" && value) {
62977         try {
62978           return new URL(value).href;
62979         } catch (e3) {
62980           return null;
62981         }
62982       }
62983       if (field.type === "identifier" && field.pattern) {
62984         return value && value.match(new RegExp(field.pattern))?.[0];
62985       }
62986       return null;
62987     }
62988     function clamped(num) {
62989       if (field.minValue !== void 0) {
62990         num = Math.max(num, field.minValue);
62991       }
62992       if (field.maxValue !== void 0) {
62993         num = Math.min(num, field.maxValue);
62994       }
62995       return num;
62996     }
62997     function getVals(tags) {
62998       if (field.keys) {
62999         const multiSelection = context.selectedIDs();
63000         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
63001         return tags.map((tags2) => new Set(field.keys.reduce((acc, key) => acc.concat(tags2[key]), []).filter(Boolean))).map((vals) => vals.size === 0 ? /* @__PURE__ */ new Set([void 0]) : vals).reduce((a2, b2) => /* @__PURE__ */ new Set([...a2, ...b2]));
63002       } else {
63003         return new Set([].concat(tags[field.key]));
63004       }
63005     }
63006     function change(onInput) {
63007       return function() {
63008         var t2 = {};
63009         var val = utilGetSetValue(input);
63010         if (!onInput)
63011           val = context.cleanTagValue(val);
63012         if (!val && getVals(_tags).size > 1)
63013           return;
63014         var displayVal = val;
63015         if (field.type === "number" && val) {
63016           var numbers2 = val.split(";");
63017           numbers2 = numbers2.map(function(v2) {
63018             if (likelyRawNumberFormat.test(v2)) {
63019               return v2;
63020             }
63021             var num = parseLocaleFloat(v2);
63022             const fractionDigits = countDecimalPlaces(v2);
63023             return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
63024           });
63025           val = numbers2.join(";");
63026         }
63027         if (!onInput)
63028           utilGetSetValue(input, displayVal);
63029         t2[field.key] = val || void 0;
63030         if (field.keys) {
63031           dispatch14.call("change", this, (tags) => {
63032             if (field.keys.some((key) => tags[key])) {
63033               field.keys.filter((key) => tags[key]).forEach((key) => {
63034                 tags[key] = val || void 0;
63035               });
63036             } else {
63037               tags[field.key] = val || void 0;
63038             }
63039             return tags;
63040           }, onInput);
63041         } else {
63042           dispatch14.call("change", this, t2, onInput);
63043         }
63044       };
63045     }
63046     i3.entityIDs = function(val) {
63047       if (!arguments.length)
63048         return _entityIDs;
63049       _entityIDs = val;
63050       return i3;
63051     };
63052     i3.tags = function(tags) {
63053       _tags = tags;
63054       const vals = getVals(tags);
63055       const isMixed = vals.size > 1;
63056       var val = vals.size === 1 ? [...vals][0] ?? "" : "";
63057       var shouldUpdate;
63058       if (field.type === "number" && val) {
63059         var numbers2 = val.split(";");
63060         var oriNumbers = utilGetSetValue(input).split(";");
63061         if (numbers2.length !== oriNumbers.length)
63062           shouldUpdate = true;
63063         numbers2 = numbers2.map(function(v2) {
63064           v2 = v2.trim();
63065           var num = Number(v2);
63066           if (!isFinite(num) || v2 === "")
63067             return v2;
63068           const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
63069           return formatFloat(num, fractionDigits);
63070         });
63071         val = numbers2.join(";");
63072         shouldUpdate = (inputValue, setValue) => {
63073           const inputNums = inputValue.split(";").map(
63074             (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
63075           );
63076           const setNums = setValue.split(";").map(parseLocaleFloat);
63077           return !isEqual_default(inputNums, setNums);
63078         };
63079       }
63080       utilGetSetValue(input, val, shouldUpdate).attr("title", isMixed ? [...vals].join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
63081       if (field.type === "number") {
63082         const buttons = wrap2.selectAll(".increment, .decrement");
63083         if (isMixed) {
63084           buttons.attr("disabled", "disabled").classed("disabled", true);
63085         } else {
63086           var raw_vals = tags[field.key] || "0";
63087           const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]);
63088           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
63089         }
63090       }
63091       if (field.type === "tel")
63092         updatePhonePlaceholder();
63093       if (field.type === "colour")
63094         updateColourPreview();
63095       if (field.type === "date")
63096         updateDateField();
63097       if (outlinkButton && !outlinkButton.empty()) {
63098         var disabled = !validIdentifierValueForLink();
63099         outlinkButton.classed("disabled", disabled);
63100       }
63101       if (!isMixed) {
63102         _lengthIndicator.update(tags[field.key]);
63103       }
63104     };
63105     i3.focus = function() {
63106       var node = input.node();
63107       if (node)
63108         node.focus();
63109     };
63110     function combinedEntityExtent() {
63111       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
63112     }
63113     return utilRebind(i3, dispatch14, "on");
63114   }
63115
63116   // modules/ui/fields/access.js
63117   function uiFieldAccess(field, context) {
63118     var dispatch14 = dispatch_default("change");
63119     var items = select_default2(null);
63120     var _tags;
63121     function access(selection2) {
63122       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63123       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63124       var list = wrap2.selectAll("ul").data([0]);
63125       list = list.enter().append("ul").attr("class", "rows").merge(list);
63126       items = list.selectAll("li").data(field.keys);
63127       var enter = items.enter().append("li").attr("class", function(d2) {
63128         return "labeled-input preset-access-" + d2;
63129       });
63130       enter.append("span").attr("class", "label preset-label-access").attr("for", function(d2) {
63131         return "preset-input-access-" + d2;
63132       }).html(function(d2) {
63133         return field.t.html("types." + d2);
63134       });
63135       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
63136         return "preset-input-access preset-input-access-" + d2;
63137       }).call(utilNoAuto).each(function(d2) {
63138         select_default2(this).call(
63139           uiCombobox(context, "access-" + d2).data(access.options(d2))
63140         );
63141       });
63142       items = items.merge(enter);
63143       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
63144     }
63145     function change(d3_event, d2) {
63146       var tag = {};
63147       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
63148       if (!value && typeof _tags[d2] !== "string")
63149         return;
63150       tag[d2] = value || void 0;
63151       dispatch14.call("change", this, tag);
63152     }
63153     access.options = function(type2) {
63154       var options2 = [
63155         "yes",
63156         "no",
63157         "designated",
63158         "permissive",
63159         "destination",
63160         "customers",
63161         "private",
63162         "permit",
63163         "unknown"
63164       ];
63165       if (type2 === "access") {
63166         options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
63167       }
63168       if (type2 === "bicycle") {
63169         options2.splice(options2.length - 4, 0, "dismount");
63170       }
63171       var stringsField = field.resolveReference("stringsCrossReference");
63172       return options2.map(function(option) {
63173         return {
63174           title: stringsField.t("options." + option + ".description"),
63175           value: option
63176         };
63177       });
63178     };
63179     const placeholdersByTag = {
63180       highway: {
63181         footway: {
63182           foot: "designated",
63183           motor_vehicle: "no"
63184         },
63185         steps: {
63186           foot: "yes",
63187           motor_vehicle: "no",
63188           bicycle: "no",
63189           horse: "no"
63190         },
63191         pedestrian: {
63192           foot: "yes",
63193           motor_vehicle: "no"
63194         },
63195         cycleway: {
63196           motor_vehicle: "no",
63197           bicycle: "designated"
63198         },
63199         bridleway: {
63200           motor_vehicle: "no",
63201           horse: "designated"
63202         },
63203         path: {
63204           foot: "yes",
63205           motor_vehicle: "no",
63206           bicycle: "yes",
63207           horse: "yes"
63208         },
63209         motorway: {
63210           foot: "no",
63211           motor_vehicle: "yes",
63212           bicycle: "no",
63213           horse: "no"
63214         },
63215         trunk: {
63216           motor_vehicle: "yes"
63217         },
63218         primary: {
63219           foot: "yes",
63220           motor_vehicle: "yes",
63221           bicycle: "yes",
63222           horse: "yes"
63223         },
63224         secondary: {
63225           foot: "yes",
63226           motor_vehicle: "yes",
63227           bicycle: "yes",
63228           horse: "yes"
63229         },
63230         tertiary: {
63231           foot: "yes",
63232           motor_vehicle: "yes",
63233           bicycle: "yes",
63234           horse: "yes"
63235         },
63236         residential: {
63237           foot: "yes",
63238           motor_vehicle: "yes",
63239           bicycle: "yes",
63240           horse: "yes"
63241         },
63242         unclassified: {
63243           foot: "yes",
63244           motor_vehicle: "yes",
63245           bicycle: "yes",
63246           horse: "yes"
63247         },
63248         service: {
63249           foot: "yes",
63250           motor_vehicle: "yes",
63251           bicycle: "yes",
63252           horse: "yes"
63253         },
63254         motorway_link: {
63255           foot: "no",
63256           motor_vehicle: "yes",
63257           bicycle: "no",
63258           horse: "no"
63259         },
63260         trunk_link: {
63261           motor_vehicle: "yes"
63262         },
63263         primary_link: {
63264           foot: "yes",
63265           motor_vehicle: "yes",
63266           bicycle: "yes",
63267           horse: "yes"
63268         },
63269         secondary_link: {
63270           foot: "yes",
63271           motor_vehicle: "yes",
63272           bicycle: "yes",
63273           horse: "yes"
63274         },
63275         tertiary_link: {
63276           foot: "yes",
63277           motor_vehicle: "yes",
63278           bicycle: "yes",
63279           horse: "yes"
63280         },
63281         construction: {
63282           access: "no"
63283         }
63284       },
63285       barrier: {
63286         bollard: {
63287           access: "no",
63288           bicycle: "yes",
63289           foot: "yes"
63290         },
63291         bus_trap: {
63292           motor_vehicle: "no",
63293           psv: "yes",
63294           foot: "yes",
63295           bicycle: "yes"
63296         },
63297         city_wall: {
63298           access: "no"
63299         },
63300         coupure: {
63301           access: "yes"
63302         },
63303         cycle_barrier: {
63304           motor_vehicle: "no"
63305         },
63306         ditch: {
63307           access: "no"
63308         },
63309         entrance: {
63310           access: "yes"
63311         },
63312         fence: {
63313           access: "no"
63314         },
63315         hedge: {
63316           access: "no"
63317         },
63318         jersey_barrier: {
63319           access: "no"
63320         },
63321         motorcycle_barrier: {
63322           motor_vehicle: "no"
63323         },
63324         rail_guard: {
63325           access: "no"
63326         }
63327       }
63328     };
63329     access.tags = function(tags) {
63330       _tags = tags;
63331       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
63332         return typeof tags[d2] === "string" ? tags[d2] : "";
63333       }).classed("mixed", function(d2) {
63334         return tags[d2] && Array.isArray(tags[d2]);
63335       }).attr("title", function(d2) {
63336         return tags[d2] && Array.isArray(tags[d2]) && tags[d2].filter(Boolean).join("\n");
63337       }).attr("placeholder", function(d2) {
63338         if (tags[d2] && Array.isArray(tags[d2])) {
63339           return _t("inspector.multiple_values");
63340         }
63341         if (d2 === "bicycle" || d2 === "motor_vehicle") {
63342           if (tags.vehicle && typeof tags.vehicle === "string") {
63343             return tags.vehicle;
63344           }
63345         }
63346         if (tags.access && typeof tags.access === "string") {
63347           return tags.access;
63348         }
63349         function getPlaceholdersByTag(key, placeholdersByKey) {
63350           if (typeof tags[key] === "string") {
63351             if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d2]) {
63352               return placeholdersByKey[tags[key]][d2];
63353             }
63354           } else {
63355             var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
63356               return placeholdersByKey[val] && placeholdersByKey[val][d2];
63357             }).filter(Boolean);
63358             if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
63359               return impliedAccesses[0];
63360             }
63361           }
63362         }
63363         for (const key in placeholdersByTag) {
63364           if (tags[key]) {
63365             const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
63366             if (impliedAccess) {
63367               return impliedAccess;
63368             }
63369           }
63370         }
63371         if (d2 === "access" && !tags.barrier) {
63372           return "yes";
63373         }
63374         return field.placeholder();
63375       });
63376     };
63377     access.focus = function() {
63378       items.selectAll(".preset-input-access").node().focus();
63379     };
63380     return utilRebind(access, dispatch14, "on");
63381   }
63382
63383   // modules/ui/fields/address.js
63384   function uiFieldAddress(field, context) {
63385     var dispatch14 = dispatch_default("change");
63386     var _selection = select_default2(null);
63387     var _wrap = select_default2(null);
63388     var addrField = _mainPresetIndex.field("address");
63389     var _entityIDs = [];
63390     var _tags;
63391     var _countryCode;
63392     var _addressFormats = [{
63393       format: [
63394         ["housenumber", "street"],
63395         ["city", "postcode"]
63396       ]
63397     }];
63398     _mainFileFetcher.get("address_formats").then(function(d2) {
63399       _addressFormats = d2;
63400       if (!_selection.empty()) {
63401         _selection.call(address);
63402       }
63403     }).catch(function() {
63404     });
63405     function getNear(isAddressable, type2, searchRadius, resultProp) {
63406       var extent = combinedEntityExtent();
63407       var l2 = extent.center();
63408       var box = geoExtent(l2).padByMeters(searchRadius);
63409       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
63410         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
63411         if (d2.geometry(context.graph()) === "line") {
63412           var loc = context.projection([
63413             (extent[0][0] + extent[1][0]) / 2,
63414             (extent[0][1] + extent[1][1]) / 2
63415           ]);
63416           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
63417           dist = geoSphericalDistance(choice.loc, l2);
63418         }
63419         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
63420         let title = value;
63421         if (type2 === "street") {
63422           title = `${addrField.t("placeholders.street")}: ${title}`;
63423         } else if (type2 === "place") {
63424           title = `${addrField.t("placeholders.place")}: ${title}`;
63425         }
63426         return {
63427           title,
63428           value,
63429           dist,
63430           type: type2,
63431           klass: `address-${type2}`
63432         };
63433       }).sort(function(a2, b2) {
63434         return a2.dist - b2.dist;
63435       });
63436       return utilArrayUniqBy(features, "value");
63437     }
63438     function getNearStreets() {
63439       function isAddressable(d2) {
63440         return d2.tags.highway && d2.tags.name && d2.type === "way";
63441       }
63442       return getNear(isAddressable, "street", 200);
63443     }
63444     function getNearPlaces() {
63445       function isAddressable(d2) {
63446         if (d2.tags.name) {
63447           if (d2.tags.place)
63448             return true;
63449           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8)
63450             return true;
63451         }
63452         return false;
63453       }
63454       return getNear(isAddressable, "place", 200);
63455     }
63456     function getNearCities() {
63457       function isAddressable(d2) {
63458         if (d2.tags.name) {
63459           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8")
63460             return true;
63461           if (d2.tags.border_type === "city")
63462             return true;
63463           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village")
63464             return true;
63465         }
63466         if (d2.tags[`${field.key}:city`])
63467           return true;
63468         return false;
63469       }
63470       return getNear(isAddressable, "city", 200, `${field.key}:city`);
63471     }
63472     function getNearPostcodes() {
63473       return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code")))];
63474     }
63475     function getNearValues(key) {
63476       const tagKey = `${field.key}:${key}`;
63477       function hasTag(d2) {
63478         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
63479       }
63480       return getNear(hasTag, key, 200, tagKey);
63481     }
63482     function updateForCountryCode() {
63483       if (!_countryCode)
63484         return;
63485       var addressFormat;
63486       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
63487         var format2 = _addressFormats[i3];
63488         if (!format2.countryCodes) {
63489           addressFormat = format2;
63490         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
63491           addressFormat = format2;
63492           break;
63493         }
63494       }
63495       var dropdowns = addressFormat.dropdowns || [
63496         "city",
63497         "county",
63498         "country",
63499         "district",
63500         "hamlet",
63501         "neighbourhood",
63502         "place",
63503         "postcode",
63504         "province",
63505         "quarter",
63506         "state",
63507         "street",
63508         "street+place",
63509         "subdistrict",
63510         "suburb"
63511       ];
63512       var widths = addressFormat.widths || {
63513         housenumber: 1 / 5,
63514         unit: 1 / 5,
63515         street: 1 / 2,
63516         place: 1 / 2,
63517         city: 2 / 3,
63518         state: 1 / 4,
63519         postcode: 1 / 3
63520       };
63521       function row(r2) {
63522         var total = r2.reduce(function(sum, key) {
63523           return sum + (widths[key] || 0.5);
63524         }, 0);
63525         return r2.map(function(key) {
63526           return {
63527             id: key,
63528             width: (widths[key] || 0.5) / total
63529           };
63530         });
63531       }
63532       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
63533         return d2.toString();
63534       });
63535       rows.exit().remove();
63536       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d2) {
63537         return "addr-" + d2.id;
63538       }).call(utilNoAuto).each(addDropdown).style("width", function(d2) {
63539         return d2.width * 100 + "%";
63540       });
63541       function addDropdown(d2) {
63542         if (dropdowns.indexOf(d2.id) === -1)
63543           return;
63544         var nearValues;
63545         switch (d2.id) {
63546           case "street":
63547             nearValues = getNearStreets;
63548             break;
63549           case "place":
63550             nearValues = getNearPlaces;
63551             break;
63552           case "street+place":
63553             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
63554             d2.isAutoStreetPlace = true;
63555             d2.id = _tags[`${field.key}:place`] ? "place" : "street";
63556             break;
63557           case "city":
63558             nearValues = getNearCities;
63559             break;
63560           case "postcode":
63561             nearValues = getNearPostcodes;
63562             break;
63563           default:
63564             nearValues = getNearValues;
63565         }
63566         select_default2(this).call(
63567           uiCombobox(context, `address-${d2.isAutoStreetPlace ? "street-place" : d2.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
63568             typedValue = typedValue.toLowerCase();
63569             callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
63570           }).on("accept", function(selected) {
63571             if (d2.isAutoStreetPlace) {
63572               d2.id = selected ? selected.type : "street";
63573             }
63574           })
63575         );
63576       }
63577       _wrap.selectAll("input").on("blur", change()).on("change", change());
63578       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
63579       if (_tags)
63580         updateTags(_tags);
63581     }
63582     function address(selection2) {
63583       _selection = selection2;
63584       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
63585       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
63586       var extent = combinedEntityExtent();
63587       if (extent) {
63588         var countryCode;
63589         if (context.inIntro()) {
63590           countryCode = _t("intro.graph.countrycode");
63591         } else {
63592           var center = extent.center();
63593           countryCode = iso1A2Code(center);
63594         }
63595         if (countryCode) {
63596           _countryCode = countryCode.toLowerCase();
63597           updateForCountryCode();
63598         }
63599       }
63600     }
63601     function change(onInput) {
63602       return function() {
63603         setTimeout(() => {
63604           var tags = {};
63605           _wrap.selectAll("input").each(function(subfield) {
63606             var key = field.key + ":" + subfield.id;
63607             var value = this.value;
63608             if (!onInput)
63609               value = context.cleanTagValue(value);
63610             if (Array.isArray(_tags[key]) && !value)
63611               return;
63612             if (subfield.isAutoStreetPlace) {
63613               if (subfield.id === "street") {
63614                 tags[`${field.key}:place`] = void 0;
63615               } else if (subfield.id === "place") {
63616                 tags[`${field.key}:street`] = void 0;
63617               }
63618             }
63619             tags[key] = value || void 0;
63620           });
63621           Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
63622           dispatch14.call("change", this, tags, onInput);
63623         }, 0);
63624       };
63625     }
63626     function updatePlaceholder(inputSelection) {
63627       return inputSelection.attr("placeholder", function(subfield) {
63628         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
63629           return _t("inspector.multiple_values");
63630         }
63631         if (subfield.isAutoStreetPlace) {
63632           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
63633         }
63634         return getLocalPlaceholder(subfield.id);
63635       });
63636     }
63637     function getLocalPlaceholder(key) {
63638       if (_countryCode) {
63639         var localkey = key + "!" + _countryCode;
63640         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
63641         return addrField.t("placeholders." + tkey);
63642       }
63643     }
63644     function updateTags(tags) {
63645       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
63646         var val;
63647         if (subfield.isAutoStreetPlace) {
63648           const streetKey = `${field.key}:street`;
63649           const placeKey = `${field.key}:place`;
63650           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
63651             val = tags[streetKey];
63652             subfield.id = "street";
63653           } else {
63654             val = tags[placeKey];
63655             subfield.id = "place";
63656           }
63657         } else {
63658           val = tags[`${field.key}:${subfield.id}`];
63659         }
63660         return typeof val === "string" ? val : "";
63661       }).attr("title", function(subfield) {
63662         var val = tags[field.key + ":" + subfield.id];
63663         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
63664       }).classed("mixed", function(subfield) {
63665         return Array.isArray(tags[field.key + ":" + subfield.id]);
63666       }).call(updatePlaceholder);
63667     }
63668     function combinedEntityExtent() {
63669       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
63670     }
63671     address.entityIDs = function(val) {
63672       if (!arguments.length)
63673         return _entityIDs;
63674       _entityIDs = val;
63675       return address;
63676     };
63677     address.tags = function(tags) {
63678       _tags = tags;
63679       updateTags(tags);
63680     };
63681     address.focus = function() {
63682       var node = _wrap.selectAll("input").node();
63683       if (node)
63684         node.focus();
63685     };
63686     return utilRebind(address, dispatch14, "on");
63687   }
63688
63689   // modules/ui/fields/directional_combo.js
63690   function uiFieldDirectionalCombo(field, context) {
63691     var dispatch14 = dispatch_default("change");
63692     var items = select_default2(null);
63693     var wrap2 = select_default2(null);
63694     var _tags;
63695     var _combos = {};
63696     if (field.type === "cycleway") {
63697       field = {
63698         ...field,
63699         key: field.keys[0],
63700         keys: field.keys.slice(1)
63701       };
63702     }
63703     function directionalCombo(selection2) {
63704       function stripcolon(s2) {
63705         return s2.replace(":", "");
63706       }
63707       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63708       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63709       var div = wrap2.selectAll("ul").data([0]);
63710       div = div.enter().append("ul").attr("class", "rows").merge(div);
63711       items = div.selectAll("li").data(field.keys);
63712       var enter = items.enter().append("li").attr("class", function(d2) {
63713         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
63714       });
63715       enter.append("span").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
63716         return "preset-input-directionalcombo-" + stripcolon(d2);
63717       }).html(function(d2) {
63718         return field.t.html("types." + d2);
63719       });
63720       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
63721         const subField = {
63722           ...field,
63723           type: "combo",
63724           key
63725         };
63726         const combo = uiFieldCombo(subField, context);
63727         combo.on("change", (t2) => change(key, t2[key]));
63728         _combos[key] = combo;
63729         select_default2(this).call(combo);
63730       });
63731       items = items.merge(enter);
63732       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
63733     }
63734     function change(key, newValue) {
63735       const commonKey = field.key;
63736       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
63737       dispatch14.call("change", this, (tags) => {
63738         const otherValue = tags[otherKey] || tags[commonKey];
63739         if (newValue === otherValue) {
63740           tags[commonKey] = newValue;
63741           delete tags[key];
63742           delete tags[otherKey];
63743         } else {
63744           tags[key] = newValue;
63745           delete tags[commonKey];
63746           tags[otherKey] = otherValue;
63747         }
63748         return tags;
63749       });
63750     }
63751     directionalCombo.tags = function(tags) {
63752       _tags = tags;
63753       const commonKey = field.key;
63754       for (let key in _combos) {
63755         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))];
63756         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
63757       }
63758     };
63759     directionalCombo.focus = function() {
63760       var node = wrap2.selectAll("input").node();
63761       if (node)
63762         node.focus();
63763     };
63764     return utilRebind(directionalCombo, dispatch14, "on");
63765   }
63766
63767   // modules/ui/fields/lanes.js
63768   function uiFieldLanes(field, context) {
63769     var dispatch14 = dispatch_default("change");
63770     var LANE_WIDTH = 40;
63771     var LANE_HEIGHT = 200;
63772     var _entityIDs = [];
63773     function lanes(selection2) {
63774       var lanesData = context.entity(_entityIDs[0]).lanes();
63775       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
63776         selection2.call(lanes.off);
63777         return;
63778       }
63779       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63780       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63781       var surface = wrap2.selectAll(".surface").data([0]);
63782       var d2 = utilGetDimensions(wrap2);
63783       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
63784       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
63785       var lanesSelection = surface.selectAll(".lanes").data([0]);
63786       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
63787       lanesSelection.attr("transform", function() {
63788         return "translate(" + freeSpace / 2 + ", 0)";
63789       });
63790       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
63791       lane.exit().remove();
63792       var enter = lane.enter().append("g").attr("class", "lane");
63793       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
63794       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
63795       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
63796       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
63797       lane = lane.merge(enter);
63798       lane.attr("transform", function(d4) {
63799         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
63800       });
63801       lane.select(".forward").style("visibility", function(d4) {
63802         return d4.direction === "forward" ? "visible" : "hidden";
63803       });
63804       lane.select(".bothways").style("visibility", function(d4) {
63805         return d4.direction === "bothways" ? "visible" : "hidden";
63806       });
63807       lane.select(".backward").style("visibility", function(d4) {
63808         return d4.direction === "backward" ? "visible" : "hidden";
63809       });
63810     }
63811     lanes.entityIDs = function(val) {
63812       _entityIDs = val;
63813     };
63814     lanes.tags = function() {
63815     };
63816     lanes.focus = function() {
63817     };
63818     lanes.off = function() {
63819     };
63820     return utilRebind(lanes, dispatch14, "on");
63821   }
63822   uiFieldLanes.supportsMultiselection = false;
63823
63824   // modules/ui/fields/localized.js
63825   var _languagesArray = [];
63826   function uiFieldLocalized(field, context) {
63827     var dispatch14 = dispatch_default("change", "input");
63828     var wikipedia = services.wikipedia;
63829     var input = select_default2(null);
63830     var localizedInputs = select_default2(null);
63831     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
63832     var _countryCode;
63833     var _tags;
63834     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
63835     });
63836     var _territoryLanguages = {};
63837     _mainFileFetcher.get("territory_languages").then(function(d2) {
63838       _territoryLanguages = d2;
63839     }).catch(function() {
63840     });
63841     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
63842     var _selection = select_default2(null);
63843     var _multilingual = [];
63844     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
63845     var _wikiTitles;
63846     var _entityIDs = [];
63847     function loadLanguagesArray(dataLanguages) {
63848       if (_languagesArray.length !== 0)
63849         return;
63850       var replacements = {
63851         sr: "sr-Cyrl",
63852         // in OSM, `sr` implies Cyrillic
63853         "sr-Cyrl": false
63854         // `sr-Cyrl` isn't used in OSM
63855       };
63856       for (var code in dataLanguages) {
63857         if (replacements[code] === false)
63858           continue;
63859         var metaCode = code;
63860         if (replacements[code])
63861           metaCode = replacements[code];
63862         _languagesArray.push({
63863           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
63864           nativeName: dataLanguages[metaCode].nativeName,
63865           code,
63866           label: _mainLocalizer.languageName(metaCode)
63867         });
63868       }
63869     }
63870     function calcLocked() {
63871       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
63872         var entity = context.graph().hasEntity(entityID);
63873         if (!entity)
63874           return false;
63875         if (entity.tags.wikidata)
63876           return true;
63877         if (entity.tags["name:etymology:wikidata"])
63878           return true;
63879         var preset = _mainPresetIndex.match(entity, context.graph());
63880         if (preset) {
63881           var isSuggestion = preset.suggestion;
63882           var fields = preset.fields(entity.extent(context.graph()).center());
63883           var showsBrandField = fields.some(function(d2) {
63884             return d2.id === "brand";
63885           });
63886           var showsOperatorField = fields.some(function(d2) {
63887             return d2.id === "operator";
63888           });
63889           var setsName = preset.addTags.name;
63890           var setsBrandWikidata = preset.addTags["brand:wikidata"];
63891           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
63892           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
63893         }
63894         return false;
63895       });
63896       field.locked(isLocked);
63897     }
63898     function calcMultilingual(tags) {
63899       var existingLangsOrdered = _multilingual.map(function(item2) {
63900         return item2.lang;
63901       });
63902       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
63903       for (var k2 in tags) {
63904         var m2 = k2.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
63905         if (m2 && m2[1] === field.key && m2[2]) {
63906           var item = { lang: m2[2], value: tags[k2] };
63907           if (existingLangs.has(item.lang)) {
63908             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
63909             existingLangs.delete(item.lang);
63910           } else {
63911             _multilingual.push(item);
63912           }
63913         }
63914       }
63915       _multilingual.forEach(function(item2) {
63916         if (item2.lang && existingLangs.has(item2.lang)) {
63917           item2.value = "";
63918         }
63919       });
63920     }
63921     function localized(selection2) {
63922       _selection = selection2;
63923       calcLocked();
63924       var isLocked = field.locked();
63925       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63926       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63927       input = wrap2.selectAll(".localized-main").data([0]);
63928       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
63929       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
63930       wrap2.call(_lengthIndicator);
63931       var translateButton = wrap2.selectAll(".localized-add").data([0]);
63932       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);
63933       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
63934       if (_tags && !_multilingual.length) {
63935         calcMultilingual(_tags);
63936       }
63937       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
63938       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
63939       localizedInputs.call(renderMultilingual);
63940       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
63941       selection2.selectAll(".combobox-caret").classed("nope", true);
63942       function addNew(d3_event) {
63943         d3_event.preventDefault();
63944         if (field.locked())
63945           return;
63946         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
63947         var langExists = _multilingual.find(function(datum2) {
63948           return datum2.lang === defaultLang;
63949         });
63950         var isLangEn = defaultLang.indexOf("en") > -1;
63951         if (isLangEn || langExists) {
63952           defaultLang = "";
63953           langExists = _multilingual.find(function(datum2) {
63954             return datum2.lang === defaultLang;
63955           });
63956         }
63957         if (!langExists) {
63958           _multilingual.unshift({ lang: defaultLang, value: "" });
63959           localizedInputs.call(renderMultilingual);
63960         }
63961       }
63962       function change(onInput) {
63963         return function(d3_event) {
63964           if (field.locked()) {
63965             d3_event.preventDefault();
63966             return;
63967           }
63968           var val = utilGetSetValue(select_default2(this));
63969           if (!onInput)
63970             val = context.cleanTagValue(val);
63971           if (!val && Array.isArray(_tags[field.key]))
63972             return;
63973           var t2 = {};
63974           t2[field.key] = val || void 0;
63975           dispatch14.call("change", this, t2, onInput);
63976         };
63977       }
63978     }
63979     function key(lang) {
63980       return field.key + ":" + lang;
63981     }
63982     function changeLang(d3_event, d2) {
63983       var tags = {};
63984       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
63985       var language = _languagesArray.find(function(d4) {
63986         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
63987       });
63988       if (language)
63989         lang = language.code;
63990       if (d2.lang && d2.lang !== lang) {
63991         tags[key(d2.lang)] = void 0;
63992       }
63993       var newKey = lang && context.cleanTagKey(key(lang));
63994       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
63995       if (newKey && value) {
63996         tags[newKey] = value;
63997       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
63998         tags[newKey] = _wikiTitles[d2.lang];
63999       }
64000       d2.lang = lang;
64001       dispatch14.call("change", this, tags);
64002     }
64003     function changeValue(d3_event, d2) {
64004       if (!d2.lang)
64005         return;
64006       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
64007       if (!value && Array.isArray(d2.value))
64008         return;
64009       var t2 = {};
64010       t2[key(d2.lang)] = value;
64011       d2.value = value;
64012       dispatch14.call("change", this, t2);
64013     }
64014     function fetchLanguages(value, cb) {
64015       var v2 = value.toLowerCase();
64016       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
64017       if (_countryCode && _territoryLanguages[_countryCode]) {
64018         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
64019       }
64020       var langItems = [];
64021       langCodes.forEach(function(code) {
64022         var langItem = _languagesArray.find(function(item) {
64023           return item.code === code;
64024         });
64025         if (langItem)
64026           langItems.push(langItem);
64027       });
64028       langItems = utilArrayUniq(langItems.concat(_languagesArray));
64029       cb(langItems.filter(function(d2) {
64030         return d2.label.toLowerCase().indexOf(v2) >= 0 || d2.localName && d2.localName.toLowerCase().indexOf(v2) >= 0 || d2.nativeName && d2.nativeName.toLowerCase().indexOf(v2) >= 0 || d2.code.toLowerCase().indexOf(v2) >= 0;
64031       }).map(function(d2) {
64032         return { value: d2.label };
64033       }));
64034     }
64035     function renderMultilingual(selection2) {
64036       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
64037         return d2.lang;
64038       });
64039       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
64040       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
64041         var wrap2 = select_default2(this);
64042         var domId = utilUniqueDomId(index);
64043         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
64044         var text2 = label.append("span").attr("class", "label-text");
64045         text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
64046         text2.append("span").attr("class", "label-textannotation");
64047         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
64048           if (field.locked())
64049             return;
64050           d3_event.preventDefault();
64051           _multilingual.splice(_multilingual.indexOf(d2), 1);
64052           var langKey = d2.lang && key(d2.lang);
64053           if (langKey && langKey in _tags) {
64054             delete _tags[langKey];
64055             var t2 = {};
64056             t2[langKey] = void 0;
64057             dispatch14.call("change", this, t2);
64058             return;
64059           }
64060           renderMultilingual(selection2);
64061         }).call(svgIcon("#iD-operation-delete"));
64062         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);
64063         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
64064       });
64065       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() {
64066         select_default2(this).style("max-height", "").style("overflow", "visible");
64067       });
64068       entries = entries.merge(entriesEnter);
64069       entries.order();
64070       entries.classed("present", true);
64071       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
64072         var langItem = _languagesArray.find(function(item) {
64073           return item.code === d2.lang;
64074         });
64075         if (langItem)
64076           return langItem.label;
64077         return d2.lang;
64078       });
64079       utilGetSetValue(entries.select(".localized-value"), function(d2) {
64080         return typeof d2.value === "string" ? d2.value : "";
64081       }).attr("title", function(d2) {
64082         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
64083       }).attr("placeholder", function(d2) {
64084         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
64085       }).classed("mixed", function(d2) {
64086         return Array.isArray(d2.value);
64087       });
64088     }
64089     localized.tags = function(tags) {
64090       _tags = tags;
64091       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
64092         _wikiTitles = {};
64093         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
64094         if (wm && wm[0] && wm[1]) {
64095           wikipedia.translations(wm[1], wm[2], function(err, d2) {
64096             if (err || !d2)
64097               return;
64098             _wikiTitles = d2;
64099           });
64100         }
64101       }
64102       var isMixed = Array.isArray(tags[field.key]);
64103       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);
64104       calcMultilingual(tags);
64105       _selection.call(localized);
64106       if (!isMixed) {
64107         _lengthIndicator.update(tags[field.key]);
64108       }
64109     };
64110     localized.focus = function() {
64111       input.node().focus();
64112     };
64113     localized.entityIDs = function(val) {
64114       if (!arguments.length)
64115         return _entityIDs;
64116       _entityIDs = val;
64117       _multilingual = [];
64118       loadCountryCode();
64119       return localized;
64120     };
64121     function loadCountryCode() {
64122       var extent = combinedEntityExtent();
64123       var countryCode = extent && iso1A2Code(extent.center());
64124       _countryCode = countryCode && countryCode.toLowerCase();
64125     }
64126     function combinedEntityExtent() {
64127       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64128     }
64129     return utilRebind(localized, dispatch14, "on");
64130   }
64131
64132   // modules/ui/fields/roadheight.js
64133   function uiFieldRoadheight(field, context) {
64134     var dispatch14 = dispatch_default("change");
64135     var primaryUnitInput = select_default2(null);
64136     var primaryInput = select_default2(null);
64137     var secondaryInput = select_default2(null);
64138     var secondaryUnitInput = select_default2(null);
64139     var _entityIDs = [];
64140     var _tags;
64141     var _isImperial;
64142     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
64143     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
64144     var primaryUnits = [
64145       {
64146         value: "m",
64147         title: _t("inspector.roadheight.meter")
64148       },
64149       {
64150         value: "ft",
64151         title: _t("inspector.roadheight.foot")
64152       }
64153     ];
64154     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
64155     function roadheight(selection2) {
64156       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64157       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64158       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
64159       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
64160       primaryInput.on("change", change).on("blur", change);
64161       var loc = combinedEntityExtent().center();
64162       _isImperial = roadHeightUnit(loc) === "ft";
64163       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
64164       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
64165       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
64166       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
64167       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
64168       secondaryInput.on("change", change).on("blur", change);
64169       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
64170       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
64171       function changeUnits() {
64172         var primaryUnit = utilGetSetValue(primaryUnitInput);
64173         if (primaryUnit === "m") {
64174           _isImperial = false;
64175         } else if (primaryUnit === "ft") {
64176           _isImperial = true;
64177         }
64178         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
64179         setUnitSuggestions();
64180         change();
64181       }
64182     }
64183     function setUnitSuggestions() {
64184       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
64185     }
64186     function change() {
64187       var tag = {};
64188       var primaryValue = utilGetSetValue(primaryInput).trim();
64189       var secondaryValue = utilGetSetValue(secondaryInput).trim();
64190       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
64191         return;
64192       if (!primaryValue && !secondaryValue) {
64193         tag[field.key] = void 0;
64194       } else {
64195         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
64196         if (isNaN(rawPrimaryValue))
64197           rawPrimaryValue = primaryValue;
64198         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
64199         if (isNaN(rawSecondaryValue))
64200           rawSecondaryValue = secondaryValue;
64201         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
64202           tag[field.key] = context.cleanTagValue(rawPrimaryValue);
64203         } else {
64204           if (rawPrimaryValue !== "") {
64205             rawPrimaryValue = rawPrimaryValue + "'";
64206           }
64207           if (rawSecondaryValue !== "") {
64208             rawSecondaryValue = rawSecondaryValue + '"';
64209           }
64210           tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
64211         }
64212       }
64213       dispatch14.call("change", this, tag);
64214     }
64215     roadheight.tags = function(tags) {
64216       _tags = tags;
64217       var primaryValue = tags[field.key];
64218       var secondaryValue;
64219       var isMixed = Array.isArray(primaryValue);
64220       if (!isMixed) {
64221         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
64222           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
64223           if (secondaryValue !== null) {
64224             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
64225           }
64226           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
64227           if (primaryValue !== null) {
64228             primaryValue = formatFloat(parseFloat(primaryValue[1]));
64229           }
64230           _isImperial = true;
64231         } else if (primaryValue) {
64232           var rawValue = primaryValue;
64233           primaryValue = parseFloat(rawValue);
64234           if (isNaN(primaryValue)) {
64235             primaryValue = rawValue;
64236           } else {
64237             primaryValue = formatFloat(primaryValue);
64238           }
64239           _isImperial = false;
64240         }
64241       }
64242       setUnitSuggestions();
64243       var inchesPlaceholder = formatFloat(0);
64244       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);
64245       utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? inchesPlaceholder : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
64246       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
64247     };
64248     roadheight.focus = function() {
64249       primaryInput.node().focus();
64250     };
64251     roadheight.entityIDs = function(val) {
64252       _entityIDs = val;
64253     };
64254     function combinedEntityExtent() {
64255       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64256     }
64257     return utilRebind(roadheight, dispatch14, "on");
64258   }
64259
64260   // modules/ui/fields/roadspeed.js
64261   function uiFieldRoadspeed(field, context) {
64262     var dispatch14 = dispatch_default("change");
64263     var unitInput = select_default2(null);
64264     var input = select_default2(null);
64265     var _entityIDs = [];
64266     var _tags;
64267     var _isImperial;
64268     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
64269     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
64270     var speedCombo = uiCombobox(context, "roadspeed");
64271     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
64272     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
64273     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
64274     function roadspeed(selection2) {
64275       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64276       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64277       input = wrap2.selectAll("input.roadspeed-number").data([0]);
64278       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
64279       input.on("change", change).on("blur", change);
64280       var loc = combinedEntityExtent().center();
64281       _isImperial = roadSpeedUnit(loc) === "mph";
64282       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
64283       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
64284       unitInput.on("blur", changeUnits).on("change", changeUnits);
64285       function changeUnits() {
64286         var unit2 = utilGetSetValue(unitInput);
64287         if (unit2 === "km/h") {
64288           _isImperial = false;
64289         } else if (unit2 === "mph") {
64290           _isImperial = true;
64291         }
64292         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
64293         setUnitSuggestions();
64294         change();
64295       }
64296     }
64297     function setUnitSuggestions() {
64298       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
64299       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
64300     }
64301     function comboValues(d2) {
64302       return {
64303         value: formatFloat(d2),
64304         title: formatFloat(d2)
64305       };
64306     }
64307     function change() {
64308       var tag = {};
64309       var value = utilGetSetValue(input).trim();
64310       if (!value && Array.isArray(_tags[field.key]))
64311         return;
64312       if (!value) {
64313         tag[field.key] = void 0;
64314       } else {
64315         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
64316         if (isNaN(rawValue))
64317           rawValue = value;
64318         if (isNaN(rawValue) || !_isImperial) {
64319           tag[field.key] = context.cleanTagValue(rawValue);
64320         } else {
64321           tag[field.key] = context.cleanTagValue(rawValue + " mph");
64322         }
64323       }
64324       dispatch14.call("change", this, tag);
64325     }
64326     roadspeed.tags = function(tags) {
64327       _tags = tags;
64328       var rawValue = tags[field.key];
64329       var value = rawValue;
64330       var isMixed = Array.isArray(value);
64331       if (!isMixed) {
64332         if (rawValue && rawValue.indexOf("mph") >= 0) {
64333           _isImperial = true;
64334         } else if (rawValue) {
64335           _isImperial = false;
64336         }
64337         value = parseInt(value, 10);
64338         if (isNaN(value)) {
64339           value = rawValue;
64340         } else {
64341           value = formatFloat(value);
64342         }
64343       }
64344       setUnitSuggestions();
64345       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);
64346     };
64347     roadspeed.focus = function() {
64348       input.node().focus();
64349     };
64350     roadspeed.entityIDs = function(val) {
64351       _entityIDs = val;
64352     };
64353     function combinedEntityExtent() {
64354       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64355     }
64356     return utilRebind(roadspeed, dispatch14, "on");
64357   }
64358
64359   // modules/ui/fields/radio.js
64360   function uiFieldRadio(field, context) {
64361     var dispatch14 = dispatch_default("change");
64362     var placeholder = select_default2(null);
64363     var wrap2 = select_default2(null);
64364     var labels = select_default2(null);
64365     var radios = select_default2(null);
64366     var radioData = (field.options || field.keys).slice();
64367     var typeField;
64368     var layerField;
64369     var _oldType = {};
64370     var _entityIDs = [];
64371     function selectedKey() {
64372       var node = wrap2.selectAll(".form-field-input-radio label.active input");
64373       return !node.empty() && node.datum();
64374     }
64375     function radio(selection2) {
64376       selection2.classed("preset-radio", true);
64377       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64378       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
64379       enter.append("span").attr("class", "placeholder");
64380       wrap2 = wrap2.merge(enter);
64381       placeholder = wrap2.selectAll(".placeholder");
64382       labels = wrap2.selectAll("label").data(radioData);
64383       enter = labels.enter().append("label");
64384       var stringsField = field.resolveReference("stringsCrossReference");
64385       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
64386         return stringsField.t("options." + d2, { "default": d2 });
64387       }).attr("checked", false);
64388       enter.append("span").each(function(d2) {
64389         stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
64390       });
64391       labels = labels.merge(enter);
64392       radios = labels.selectAll("input").on("change", changeRadio);
64393     }
64394     function structureExtras(selection2, tags) {
64395       var selected = selectedKey() || tags.layer !== void 0;
64396       var type2 = _mainPresetIndex.field(selected);
64397       var layer = _mainPresetIndex.field("layer");
64398       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
64399       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
64400       extrasWrap.exit().remove();
64401       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
64402       var list = extrasWrap.selectAll("ul").data([0]);
64403       list = list.enter().append("ul").attr("class", "rows").merge(list);
64404       if (type2) {
64405         if (!typeField || typeField.id !== selected) {
64406           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
64407         }
64408         typeField.tags(tags);
64409       } else {
64410         typeField = null;
64411       }
64412       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
64413         return d2.id;
64414       });
64415       typeItem.exit().remove();
64416       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
64417       typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
64418       typeEnter.append("div").attr("class", "structure-input-type-wrap");
64419       typeItem = typeItem.merge(typeEnter);
64420       if (typeField) {
64421         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
64422       }
64423       if (layer && showLayer) {
64424         if (!layerField) {
64425           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
64426         }
64427         layerField.tags(tags);
64428         field.keys = utilArrayUnion(field.keys, ["layer"]);
64429       } else {
64430         layerField = null;
64431         field.keys = field.keys.filter(function(k2) {
64432           return k2 !== "layer";
64433         });
64434       }
64435       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
64436       layerItem.exit().remove();
64437       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
64438       layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
64439       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
64440       layerItem = layerItem.merge(layerEnter);
64441       if (layerField) {
64442         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
64443       }
64444     }
64445     function changeType(t2, onInput) {
64446       var key = selectedKey();
64447       if (!key)
64448         return;
64449       var val = t2[key];
64450       if (val !== "no") {
64451         _oldType[key] = val;
64452       }
64453       if (field.type === "structureRadio") {
64454         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
64455           t2.layer = void 0;
64456         }
64457         if (t2.layer === void 0) {
64458           if (key === "bridge" && val !== "no") {
64459             t2.layer = "1";
64460           }
64461           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
64462             t2.layer = "-1";
64463           }
64464         }
64465       }
64466       dispatch14.call("change", this, t2, onInput);
64467     }
64468     function changeLayer(t2, onInput) {
64469       if (t2.layer === "0") {
64470         t2.layer = void 0;
64471       }
64472       dispatch14.call("change", this, t2, onInput);
64473     }
64474     function changeRadio() {
64475       var t2 = {};
64476       var activeKey;
64477       if (field.key) {
64478         t2[field.key] = void 0;
64479       }
64480       radios.each(function(d2) {
64481         var active = select_default2(this).property("checked");
64482         if (active)
64483           activeKey = d2;
64484         if (field.key) {
64485           if (active)
64486             t2[field.key] = d2;
64487         } else {
64488           var val = _oldType[activeKey] || "yes";
64489           t2[d2] = active ? val : void 0;
64490         }
64491       });
64492       if (field.type === "structureRadio") {
64493         if (activeKey === "bridge") {
64494           t2.layer = "1";
64495         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
64496           t2.layer = "-1";
64497         } else {
64498           t2.layer = void 0;
64499         }
64500       }
64501       dispatch14.call("change", this, t2);
64502     }
64503     radio.tags = function(tags) {
64504       function isOptionChecked(d2) {
64505         if (field.key) {
64506           return tags[field.key] === d2;
64507         }
64508         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
64509       }
64510       function isMixed(d2) {
64511         if (field.key) {
64512           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
64513         }
64514         return Array.isArray(tags[d2]);
64515       }
64516       radios.property("checked", function(d2) {
64517         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
64518       });
64519       labels.classed("active", function(d2) {
64520         if (field.key) {
64521           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
64522         }
64523         return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
64524       }).classed("mixed", isMixed).attr("title", function(d2) {
64525         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
64526       });
64527       var selection2 = radios.filter(function() {
64528         return this.checked;
64529       });
64530       if (selection2.empty()) {
64531         placeholder.text("");
64532         placeholder.call(_t.append("inspector.none"));
64533       } else {
64534         placeholder.text(selection2.attr("value"));
64535         _oldType[selection2.datum()] = tags[selection2.datum()];
64536       }
64537       if (field.type === "structureRadio") {
64538         if (!!tags.waterway && !_oldType.tunnel) {
64539           _oldType.tunnel = "culvert";
64540         }
64541         wrap2.call(structureExtras, tags);
64542       }
64543     };
64544     radio.focus = function() {
64545       radios.node().focus();
64546     };
64547     radio.entityIDs = function(val) {
64548       if (!arguments.length)
64549         return _entityIDs;
64550       _entityIDs = val;
64551       _oldType = {};
64552       return radio;
64553     };
64554     radio.isAllowed = function() {
64555       return _entityIDs.length === 1;
64556     };
64557     return utilRebind(radio, dispatch14, "on");
64558   }
64559
64560   // modules/ui/fields/restrictions.js
64561   function uiFieldRestrictions(field, context) {
64562     var dispatch14 = dispatch_default("change");
64563     var breathe = behaviorBreathe(context);
64564     corePreferences("turn-restriction-via-way", null);
64565     var storedViaWay = corePreferences("turn-restriction-via-way0");
64566     var storedDistance = corePreferences("turn-restriction-distance");
64567     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
64568     var _maxDistance = storedDistance ? +storedDistance : 30;
64569     var _initialized3 = false;
64570     var _parent = select_default2(null);
64571     var _container = select_default2(null);
64572     var _oldTurns;
64573     var _graph;
64574     var _vertexID;
64575     var _intersection;
64576     var _fromWayID;
64577     var _lastXPos;
64578     function restrictions(selection2) {
64579       _parent = selection2;
64580       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
64581         _graph = context.graph();
64582         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
64583       }
64584       var isOK = _intersection && _intersection.vertices.length && // has vertices
64585       _intersection.vertices.filter(function(vertex) {
64586         return vertex.id === _vertexID;
64587       }).length && _intersection.ways.length > 2 && // has more than 2 ways
64588       _intersection.ways.filter(function(way) {
64589         return way.__to;
64590       }).length > 1;
64591       select_default2(selection2.node().parentNode).classed("hide", !isOK);
64592       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
64593         selection2.call(restrictions.off);
64594         return;
64595       }
64596       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64597       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64598       var container = wrap2.selectAll(".restriction-container").data([0]);
64599       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
64600       containerEnter.append("div").attr("class", "restriction-help");
64601       _container = containerEnter.merge(container).call(renderViewer);
64602       var controls = wrap2.selectAll(".restriction-controls").data([0]);
64603       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
64604     }
64605     function renderControls(selection2) {
64606       var distControl = selection2.selectAll(".restriction-distance").data([0]);
64607       distControl.exit().remove();
64608       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
64609       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
64610       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
64611       distControlEnter.append("span").attr("class", "restriction-distance-text");
64612       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
64613         var val = select_default2(this).property("value");
64614         _maxDistance = +val;
64615         _intersection = null;
64616         _container.selectAll(".layer-osm .layer-turns *").remove();
64617         corePreferences("turn-restriction-distance", _maxDistance);
64618         _parent.call(restrictions);
64619       });
64620       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
64621       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
64622       viaControl.exit().remove();
64623       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
64624       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
64625       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
64626       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
64627       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
64628         var val = select_default2(this).property("value");
64629         _maxViaWay = +val;
64630         _container.selectAll(".layer-osm .layer-turns *").remove();
64631         corePreferences("turn-restriction-via-way0", _maxViaWay);
64632         _parent.call(restrictions);
64633       });
64634       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
64635     }
64636     function renderViewer(selection2) {
64637       if (!_intersection)
64638         return;
64639       var vgraph = _intersection.graph;
64640       var filter2 = utilFunctor(true);
64641       var projection2 = geoRawMercator();
64642       var sdims = utilGetDimensions(context.container().select(".sidebar"));
64643       var d2 = [sdims[0] - 50, 370];
64644       var c2 = geoVecScale(d2, 0.5);
64645       var z2 = 22;
64646       projection2.scale(geoZoomToScale(z2));
64647       var extent = geoExtent();
64648       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
64649         extent._extend(_intersection.vertices[i3].extent());
64650       }
64651       var padTop = 35;
64652       if (_intersection.vertices.length > 1) {
64653         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
64654         var vPadding = 160;
64655         var tl = projection2([extent[0][0], extent[1][1]]);
64656         var br = projection2([extent[1][0], extent[0][1]]);
64657         var hFactor = (br[0] - tl[0]) / (d2[0] - hPadding);
64658         var vFactor = (br[1] - tl[1]) / (d2[1] - vPadding - padTop);
64659         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
64660         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
64661         z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
64662         projection2.scale(geoZoomToScale(z2));
64663       }
64664       var extentCenter = projection2(extent.center());
64665       extentCenter[1] = extentCenter[1] - padTop / 2;
64666       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
64667       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
64668       var drawVertices = svgVertices(projection2, context);
64669       var drawLines = svgLines(projection2, context);
64670       var drawTurns = svgTurns(projection2, context);
64671       var firstTime = selection2.selectAll(".surface").empty();
64672       selection2.call(drawLayers);
64673       var surface = selection2.selectAll(".surface").classed("tr", true);
64674       if (firstTime) {
64675         _initialized3 = true;
64676         surface.call(breathe);
64677       }
64678       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
64679         _fromWayID = null;
64680         _oldTurns = null;
64681       }
64682       surface.call(utilSetDimensions, d2).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z2).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
64683       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
64684       surface.selectAll(".selected").classed("selected", false);
64685       surface.selectAll(".related").classed("related", false);
64686       var way;
64687       if (_fromWayID) {
64688         way = vgraph.entity(_fromWayID);
64689         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
64690       }
64691       document.addEventListener("resizeWindow", function() {
64692         utilSetDimensions(_container, null);
64693         redraw(1);
64694       }, false);
64695       updateHints(null);
64696       function click(d3_event) {
64697         surface.call(breathe.off).call(breathe);
64698         var datum2 = d3_event.target.__data__;
64699         var entity = datum2 && datum2.properties && datum2.properties.entity;
64700         if (entity) {
64701           datum2 = entity;
64702         }
64703         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
64704           _fromWayID = datum2.id;
64705           _oldTurns = null;
64706           redraw();
64707         } else if (datum2 instanceof osmTurn) {
64708           var actions, extraActions, turns, i4;
64709           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
64710           if (datum2.restrictionID && !datum2.direct) {
64711             return;
64712           } else if (datum2.restrictionID && !datum2.only) {
64713             var seen = {};
64714             var datumOnly = JSON.parse(JSON.stringify(datum2));
64715             datumOnly.only = true;
64716             restrictionType = restrictionType.replace(/^no/, "only");
64717             turns = _intersection.turns(_fromWayID, 2);
64718             extraActions = [];
64719             _oldTurns = [];
64720             for (i4 = 0; i4 < turns.length; i4++) {
64721               var turn = turns[i4];
64722               if (seen[turn.restrictionID])
64723                 continue;
64724               if (turn.direct && turn.path[1] === datum2.path[1]) {
64725                 seen[turns[i4].restrictionID] = true;
64726                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
64727                 _oldTurns.push(turn);
64728                 extraActions.push(actionUnrestrictTurn(turn));
64729               }
64730             }
64731             actions = _intersection.actions.concat(extraActions, [
64732               actionRestrictTurn(datumOnly, restrictionType),
64733               _t("operations.restriction.annotation.create")
64734             ]);
64735           } else if (datum2.restrictionID) {
64736             turns = _oldTurns || [];
64737             extraActions = [];
64738             for (i4 = 0; i4 < turns.length; i4++) {
64739               if (turns[i4].key !== datum2.key) {
64740                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
64741               }
64742             }
64743             _oldTurns = null;
64744             actions = _intersection.actions.concat(extraActions, [
64745               actionUnrestrictTurn(datum2),
64746               _t("operations.restriction.annotation.delete")
64747             ]);
64748           } else {
64749             actions = _intersection.actions.concat([
64750               actionRestrictTurn(datum2, restrictionType),
64751               _t("operations.restriction.annotation.create")
64752             ]);
64753           }
64754           context.perform.apply(context, actions);
64755           var s2 = surface.selectAll("." + datum2.key);
64756           datum2 = s2.empty() ? null : s2.datum();
64757           updateHints(datum2);
64758         } else {
64759           _fromWayID = null;
64760           _oldTurns = null;
64761           redraw();
64762         }
64763       }
64764       function mouseover(d3_event) {
64765         var datum2 = d3_event.target.__data__;
64766         updateHints(datum2);
64767       }
64768       _lastXPos = _lastXPos || sdims[0];
64769       function redraw(minChange) {
64770         var xPos = -1;
64771         if (minChange) {
64772           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
64773         }
64774         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
64775           if (context.hasEntity(_vertexID)) {
64776             _lastXPos = xPos;
64777             _container.call(renderViewer);
64778           }
64779         }
64780       }
64781       function highlightPathsFrom(wayID) {
64782         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
64783         surface.selectAll("." + wayID).classed("related", true);
64784         if (wayID) {
64785           var turns = _intersection.turns(wayID, _maxViaWay);
64786           for (var i4 = 0; i4 < turns.length; i4++) {
64787             var turn = turns[i4];
64788             var ids = [turn.to.way];
64789             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
64790             if (turn.only || turns.length === 1) {
64791               if (turn.via.ways) {
64792                 ids = ids.concat(turn.via.ways);
64793               }
64794             } else if (turn.to.way === wayID) {
64795               continue;
64796             }
64797             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
64798           }
64799         }
64800       }
64801       function updateHints(datum2) {
64802         var help = _container.selectAll(".restriction-help").html("");
64803         var placeholders = {};
64804         ["from", "via", "to"].forEach(function(k2) {
64805           placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
64806         });
64807         var entity = datum2 && datum2.properties && datum2.properties.entity;
64808         if (entity) {
64809           datum2 = entity;
64810         }
64811         if (_fromWayID) {
64812           way = vgraph.entity(_fromWayID);
64813           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
64814         }
64815         if (datum2 instanceof osmWay && datum2.__from) {
64816           way = datum2;
64817           highlightPathsFrom(_fromWayID ? null : way.id);
64818           surface.selectAll("." + way.id).classed("related", true);
64819           var clickSelect = !_fromWayID || _fromWayID !== way.id;
64820           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
64821             from: placeholders.from,
64822             fromName: displayName(way.id, vgraph)
64823           }));
64824         } else if (datum2 instanceof osmTurn) {
64825           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
64826           var turnType = restrictionType.replace(/^(only|no)\_/, "");
64827           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
64828           var klass, turnText, nextText;
64829           if (datum2.no) {
64830             klass = "restrict";
64831             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
64832             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
64833           } else if (datum2.only) {
64834             klass = "only";
64835             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
64836             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
64837           } else {
64838             klass = "allow";
64839             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
64840             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
64841           }
64842           help.append("div").attr("class", "qualifier " + klass).html(turnText);
64843           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
64844             from: placeholders.from,
64845             fromName: displayName(datum2.from.way, vgraph),
64846             to: placeholders.to,
64847             toName: displayName(datum2.to.way, vgraph)
64848           }));
64849           if (datum2.via.ways && datum2.via.ways.length) {
64850             var names = [];
64851             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
64852               var prev = names[names.length - 1];
64853               var curr = displayName(datum2.via.ways[i4], vgraph);
64854               if (!prev || curr !== prev) {
64855                 names.push(curr);
64856               }
64857             }
64858             help.append("div").html(_t.html("restriction.help.via_names", {
64859               via: placeholders.via,
64860               viaNames: names.join(", ")
64861             }));
64862           }
64863           if (!indirect) {
64864             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
64865           }
64866           highlightPathsFrom(null);
64867           var alongIDs = datum2.path.slice();
64868           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
64869         } else {
64870           highlightPathsFrom(null);
64871           if (_fromWayID) {
64872             help.append("div").html(_t.html("restriction.help.from_name", {
64873               from: placeholders.from,
64874               fromName: displayName(_fromWayID, vgraph)
64875             }));
64876           } else {
64877             help.append("div").html(_t.html("restriction.help.select_from", {
64878               from: placeholders.from
64879             }));
64880           }
64881         }
64882       }
64883     }
64884     function displayMaxDistance(maxDist) {
64885       return (selection2) => {
64886         var isImperial = !_mainLocalizer.usesMetric();
64887         var opts;
64888         if (isImperial) {
64889           var distToFeet = {
64890             // imprecise conversion for prettier display
64891             20: 70,
64892             25: 85,
64893             30: 100,
64894             35: 115,
64895             40: 130,
64896             45: 145,
64897             50: 160
64898           }[maxDist];
64899           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
64900         } else {
64901           opts = { distance: _t("units.meters", { quantity: maxDist }) };
64902         }
64903         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
64904       };
64905     }
64906     function displayMaxVia(maxVia) {
64907       return (selection2) => {
64908         selection2 = selection2.html("");
64909         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"));
64910       };
64911     }
64912     function displayName(entityID, graph) {
64913       var entity = graph.entity(entityID);
64914       var name = utilDisplayName(entity) || "";
64915       var matched = _mainPresetIndex.match(entity, graph);
64916       var type2 = matched && matched.name() || utilDisplayType(entity.id);
64917       return name || type2;
64918     }
64919     restrictions.entityIDs = function(val) {
64920       _intersection = null;
64921       _fromWayID = null;
64922       _oldTurns = null;
64923       _vertexID = val[0];
64924     };
64925     restrictions.tags = function() {
64926     };
64927     restrictions.focus = function() {
64928     };
64929     restrictions.off = function(selection2) {
64930       if (!_initialized3)
64931         return;
64932       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
64933       select_default2(window).on("resize.restrictions", null);
64934     };
64935     return utilRebind(restrictions, dispatch14, "on");
64936   }
64937   uiFieldRestrictions.supportsMultiselection = false;
64938
64939   // modules/ui/fields/textarea.js
64940   function uiFieldTextarea(field, context) {
64941     var dispatch14 = dispatch_default("change");
64942     var input = select_default2(null);
64943     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
64944     var _tags;
64945     function textarea(selection2) {
64946       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64947       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
64948       input = wrap2.selectAll("textarea").data([0]);
64949       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
64950       wrap2.call(_lengthIndicator);
64951       function change(onInput) {
64952         return function() {
64953           var val = utilGetSetValue(input);
64954           if (!onInput)
64955             val = context.cleanTagValue(val);
64956           if (!val && Array.isArray(_tags[field.key]))
64957             return;
64958           var t2 = {};
64959           t2[field.key] = val || void 0;
64960           dispatch14.call("change", this, t2, onInput);
64961         };
64962       }
64963     }
64964     textarea.tags = function(tags) {
64965       _tags = tags;
64966       var isMixed = Array.isArray(tags[field.key]);
64967       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);
64968       if (!isMixed) {
64969         _lengthIndicator.update(tags[field.key]);
64970       }
64971     };
64972     textarea.focus = function() {
64973       input.node().focus();
64974     };
64975     return utilRebind(textarea, dispatch14, "on");
64976   }
64977
64978   // modules/ui/fields/wikidata.js
64979   function uiFieldWikidata(field, context) {
64980     var wikidata = services.wikidata;
64981     var dispatch14 = dispatch_default("change");
64982     var _selection = select_default2(null);
64983     var _searchInput = select_default2(null);
64984     var _qid = null;
64985     var _wikidataEntity = null;
64986     var _wikiURL = "";
64987     var _entityIDs = [];
64988     var _wikipediaKey = field.keys && field.keys.find(function(key) {
64989       return key.includes("wikipedia");
64990     });
64991     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
64992     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
64993     function wiki(selection2) {
64994       _selection = selection2;
64995       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64996       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64997       var list = wrap2.selectAll("ul").data([0]);
64998       list = list.enter().append("ul").attr("class", "rows").merge(list);
64999       var searchRow = list.selectAll("li.wikidata-search").data([0]);
65000       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
65001       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
65002         var node = select_default2(this).node();
65003         node.setSelectionRange(0, node.value.length);
65004       }).on("blur", function() {
65005         setLabelForEntity();
65006       }).call(combobox.fetcher(fetchWikidataItems));
65007       combobox.on("accept", function(d2) {
65008         if (d2) {
65009           _qid = d2.id;
65010           change();
65011         }
65012       }).on("cancel", function() {
65013         setLabelForEntity();
65014       });
65015       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) {
65016         d3_event.preventDefault();
65017         if (_wikiURL)
65018           window.open(_wikiURL, "_blank");
65019       });
65020       searchRow = searchRow.merge(searchRowEnter);
65021       _searchInput = searchRow.select("input");
65022       var wikidataProperties = ["description", "identifier"];
65023       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
65024       var enter = items.enter().append("li").attr("class", function(d2) {
65025         return "labeled-input preset-wikidata-" + d2;
65026       });
65027       enter.append("span").attr("class", "label").html(function(d2) {
65028         return _t.html("wikidata." + d2);
65029       });
65030       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
65031       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
65032         d3_event.preventDefault();
65033         select_default2(this.parentNode).select("input").node().select();
65034         document.execCommand("copy");
65035       });
65036     }
65037     function fetchWikidataItems(q2, callback) {
65038       if (!q2 && _hintKey) {
65039         for (var i3 in _entityIDs) {
65040           var entity = context.hasEntity(_entityIDs[i3]);
65041           if (entity.tags[_hintKey]) {
65042             q2 = entity.tags[_hintKey];
65043             break;
65044           }
65045         }
65046       }
65047       wikidata.itemsForSearchQuery(q2, function(err, data) {
65048         if (err) {
65049           if (err !== "No query")
65050             console.error(err);
65051           return;
65052         }
65053         var result = data.map(function(item) {
65054           return {
65055             id: item.id,
65056             value: item.display.label.value + " (" + item.id + ")",
65057             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
65058             title: item.display.description && item.display.description.value,
65059             terms: item.aliases
65060           };
65061         });
65062         if (callback)
65063           callback(result);
65064       });
65065     }
65066     function change() {
65067       var syncTags = {};
65068       syncTags[field.key] = _qid;
65069       dispatch14.call("change", this, syncTags);
65070       var initGraph = context.graph();
65071       var initEntityIDs = _entityIDs;
65072       wikidata.entityByQID(_qid, function(err, entity) {
65073         if (err)
65074           return;
65075         if (context.graph() !== initGraph)
65076           return;
65077         if (!entity.sitelinks)
65078           return;
65079         var langs = wikidata.languagesToQuery();
65080         ["labels", "descriptions"].forEach(function(key) {
65081           if (!entity[key])
65082             return;
65083           var valueLangs = Object.keys(entity[key]);
65084           if (valueLangs.length === 0)
65085             return;
65086           var valueLang = valueLangs[0];
65087           if (langs.indexOf(valueLang) === -1) {
65088             langs.push(valueLang);
65089           }
65090         });
65091         var newWikipediaValue;
65092         if (_wikipediaKey) {
65093           var foundPreferred;
65094           for (var i3 in langs) {
65095             var lang = langs[i3];
65096             var siteID = lang.replace("-", "_") + "wiki";
65097             if (entity.sitelinks[siteID]) {
65098               foundPreferred = true;
65099               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
65100               break;
65101             }
65102           }
65103           if (!foundPreferred) {
65104             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
65105               return site.endsWith("wiki");
65106             });
65107             if (wikiSiteKeys.length === 0) {
65108               newWikipediaValue = null;
65109             } else {
65110               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
65111               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
65112               newWikipediaValue = wikiLang + ":" + wikiTitle;
65113             }
65114           }
65115         }
65116         if (newWikipediaValue) {
65117           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
65118         }
65119         if (typeof newWikipediaValue === "undefined")
65120           return;
65121         var actions = initEntityIDs.map(function(entityID) {
65122           var entity2 = context.hasEntity(entityID);
65123           if (!entity2)
65124             return null;
65125           var currTags = Object.assign({}, entity2.tags);
65126           if (newWikipediaValue === null) {
65127             if (!currTags[_wikipediaKey])
65128               return null;
65129             delete currTags[_wikipediaKey];
65130           } else {
65131             currTags[_wikipediaKey] = newWikipediaValue;
65132           }
65133           return actionChangeTags(entityID, currTags);
65134         }).filter(Boolean);
65135         if (!actions.length)
65136           return;
65137         context.overwrite(
65138           function actionUpdateWikipediaTags(graph) {
65139             actions.forEach(function(action) {
65140               graph = action(graph);
65141             });
65142             return graph;
65143           },
65144           context.history().undoAnnotation()
65145         );
65146       });
65147     }
65148     function setLabelForEntity() {
65149       var label = "";
65150       if (_wikidataEntity) {
65151         label = entityPropertyForDisplay(_wikidataEntity, "labels");
65152         if (label.length === 0) {
65153           label = _wikidataEntity.id.toString();
65154         }
65155       }
65156       utilGetSetValue(_searchInput, label);
65157     }
65158     wiki.tags = function(tags) {
65159       var isMixed = Array.isArray(tags[field.key]);
65160       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
65161       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
65162       if (!/^Q[0-9]*$/.test(_qid)) {
65163         unrecognized();
65164         return;
65165       }
65166       _wikiURL = "https://wikidata.org/wiki/" + _qid;
65167       wikidata.entityByQID(_qid, function(err, entity) {
65168         if (err) {
65169           unrecognized();
65170           return;
65171         }
65172         _wikidataEntity = entity;
65173         setLabelForEntity();
65174         var description = entityPropertyForDisplay(entity, "descriptions");
65175         _selection.select("button.wiki-link").classed("disabled", false);
65176         _selection.select(".preset-wikidata-description").style("display", function() {
65177           return description.length > 0 ? "flex" : "none";
65178         }).select("input").attr("value", description);
65179         _selection.select(".preset-wikidata-identifier").style("display", function() {
65180           return entity.id ? "flex" : "none";
65181         }).select("input").attr("value", entity.id);
65182       });
65183       function unrecognized() {
65184         _wikidataEntity = null;
65185         setLabelForEntity();
65186         _selection.select(".preset-wikidata-description").style("display", "none");
65187         _selection.select(".preset-wikidata-identifier").style("display", "none");
65188         _selection.select("button.wiki-link").classed("disabled", true);
65189         if (_qid && _qid !== "") {
65190           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
65191         } else {
65192           _wikiURL = "";
65193         }
65194       }
65195     };
65196     function entityPropertyForDisplay(wikidataEntity, propKey) {
65197       if (!wikidataEntity[propKey])
65198         return "";
65199       var propObj = wikidataEntity[propKey];
65200       var langKeys = Object.keys(propObj);
65201       if (langKeys.length === 0)
65202         return "";
65203       var langs = wikidata.languagesToQuery();
65204       for (var i3 in langs) {
65205         var lang = langs[i3];
65206         var valueObj = propObj[lang];
65207         if (valueObj && valueObj.value && valueObj.value.length > 0)
65208           return valueObj.value;
65209       }
65210       return propObj[langKeys[0]].value;
65211     }
65212     wiki.entityIDs = function(val) {
65213       if (!arguments.length)
65214         return _entityIDs;
65215       _entityIDs = val;
65216       return wiki;
65217     };
65218     wiki.focus = function() {
65219       _searchInput.node().focus();
65220     };
65221     return utilRebind(wiki, dispatch14, "on");
65222   }
65223
65224   // modules/ui/fields/wikipedia.js
65225   function uiFieldWikipedia(field, context) {
65226     const dispatch14 = dispatch_default("change");
65227     const wikipedia = services.wikipedia;
65228     const wikidata = services.wikidata;
65229     let _langInput = select_default2(null);
65230     let _titleInput = select_default2(null);
65231     let _wikiURL = "";
65232     let _entityIDs;
65233     let _tags;
65234     let _dataWikipedia = [];
65235     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
65236       _dataWikipedia = d2;
65237       if (_tags)
65238         updateForTags(_tags);
65239     }).catch(() => {
65240     });
65241     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
65242       const v2 = value.toLowerCase();
65243       callback(
65244         _dataWikipedia.filter((d2) => {
65245           return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
65246         }).map((d2) => ({ value: d2[1] }))
65247       );
65248     });
65249     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
65250       if (!value) {
65251         value = "";
65252         for (let i3 in _entityIDs) {
65253           let entity = context.hasEntity(_entityIDs[i3]);
65254           if (entity.tags.name) {
65255             value = entity.tags.name;
65256             break;
65257           }
65258         }
65259       }
65260       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
65261       searchfn(language()[2], value, (query, data) => {
65262         callback(data.map((d2) => ({ value: d2 })));
65263       });
65264     });
65265     function wiki(selection2) {
65266       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65267       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
65268       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
65269       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
65270       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
65271       _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);
65272       _langInput.on("blur", changeLang).on("change", changeLang);
65273       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
65274       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
65275       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
65276       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
65277       _titleInput.on("blur", function() {
65278         change(true);
65279       }).on("change", function() {
65280         change(false);
65281       });
65282       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
65283       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);
65284       link2.on("click", (d3_event) => {
65285         d3_event.preventDefault();
65286         if (_wikiURL)
65287           window.open(_wikiURL, "_blank");
65288       });
65289     }
65290     function defaultLanguageInfo(skipEnglishFallback) {
65291       const langCode = _mainLocalizer.languageCode().toLowerCase();
65292       for (let i3 in _dataWikipedia) {
65293         let d2 = _dataWikipedia[i3];
65294         if (d2[2] === langCode)
65295           return d2;
65296       }
65297       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
65298     }
65299     function language(skipEnglishFallback) {
65300       const value = utilGetSetValue(_langInput).toLowerCase();
65301       for (let i3 in _dataWikipedia) {
65302         let d2 = _dataWikipedia[i3];
65303         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value)
65304           return d2;
65305       }
65306       return defaultLanguageInfo(skipEnglishFallback);
65307     }
65308     function changeLang() {
65309       utilGetSetValue(_langInput, language()[1]);
65310       change(true);
65311     }
65312     function change(skipWikidata) {
65313       let value = utilGetSetValue(_titleInput);
65314       const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
65315       const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
65316       let syncTags = {};
65317       if (langInfo) {
65318         const nativeLangName = langInfo[1];
65319         value = decodeURIComponent(m2[2]).replace(/_/g, " ");
65320         if (m2[3]) {
65321           let anchor;
65322           anchor = decodeURIComponent(m2[3]);
65323           value += "#" + anchor.replace(/_/g, " ");
65324         }
65325         value = value.slice(0, 1).toUpperCase() + value.slice(1);
65326         utilGetSetValue(_langInput, nativeLangName);
65327         utilGetSetValue(_titleInput, value);
65328       }
65329       if (value) {
65330         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
65331       } else {
65332         syncTags.wikipedia = void 0;
65333       }
65334       dispatch14.call("change", this, syncTags);
65335       if (skipWikidata || !value || !language()[2])
65336         return;
65337       const initGraph = context.graph();
65338       const initEntityIDs = _entityIDs;
65339       wikidata.itemsByTitle(language()[2], value, (err, data) => {
65340         if (err || !data || !Object.keys(data).length)
65341           return;
65342         if (context.graph() !== initGraph)
65343           return;
65344         const qids = Object.keys(data);
65345         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
65346         let actions = initEntityIDs.map((entityID) => {
65347           let entity = context.entity(entityID).tags;
65348           let currTags = Object.assign({}, entity);
65349           if (currTags.wikidata !== value2) {
65350             currTags.wikidata = value2;
65351             return actionChangeTags(entityID, currTags);
65352           }
65353           return null;
65354         }).filter(Boolean);
65355         if (!actions.length)
65356           return;
65357         context.overwrite(
65358           function actionUpdateWikidataTags(graph) {
65359             actions.forEach(function(action) {
65360               graph = action(graph);
65361             });
65362             return graph;
65363           },
65364           context.history().undoAnnotation()
65365         );
65366       });
65367     }
65368     wiki.tags = (tags) => {
65369       _tags = tags;
65370       updateForTags(tags);
65371     };
65372     function updateForTags(tags) {
65373       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
65374       const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
65375       const tagLang = m2 && m2[1];
65376       const tagArticleTitle = m2 && m2[2];
65377       let anchor = m2 && m2[3];
65378       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
65379       if (tagLangInfo) {
65380         const nativeLangName = tagLangInfo[1];
65381         utilGetSetValue(_langInput, nativeLangName);
65382         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
65383         if (anchor) {
65384           try {
65385             anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
65386           } catch (e3) {
65387             anchor = anchor.replace(/ /g, "_");
65388           }
65389         }
65390         _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
65391       } else {
65392         utilGetSetValue(_titleInput, value);
65393         if (value && value !== "") {
65394           utilGetSetValue(_langInput, "");
65395           const defaultLangInfo = defaultLanguageInfo();
65396           _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
65397         } else {
65398           const shownOrDefaultLangInfo = language(
65399             true
65400             /* skipEnglishFallback */
65401           );
65402           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
65403           _wikiURL = "";
65404         }
65405       }
65406     }
65407     wiki.entityIDs = (val) => {
65408       if (!arguments.length)
65409         return _entityIDs;
65410       _entityIDs = val;
65411       return wiki;
65412     };
65413     wiki.focus = () => {
65414       _titleInput.node().focus();
65415     };
65416     return utilRebind(wiki, dispatch14, "on");
65417   }
65418   uiFieldWikipedia.supportsMultiselection = false;
65419
65420   // modules/ui/fields/index.js
65421   var uiFields = {
65422     access: uiFieldAccess,
65423     address: uiFieldAddress,
65424     check: uiFieldCheck,
65425     colour: uiFieldText,
65426     combo: uiFieldCombo,
65427     cycleway: uiFieldDirectionalCombo,
65428     date: uiFieldText,
65429     defaultCheck: uiFieldCheck,
65430     directionalCombo: uiFieldDirectionalCombo,
65431     email: uiFieldText,
65432     identifier: uiFieldText,
65433     lanes: uiFieldLanes,
65434     localized: uiFieldLocalized,
65435     roadheight: uiFieldRoadheight,
65436     roadspeed: uiFieldRoadspeed,
65437     manyCombo: uiFieldCombo,
65438     multiCombo: uiFieldCombo,
65439     networkCombo: uiFieldCombo,
65440     number: uiFieldText,
65441     onewayCheck: uiFieldCheck,
65442     radio: uiFieldRadio,
65443     restrictions: uiFieldRestrictions,
65444     semiCombo: uiFieldCombo,
65445     structureRadio: uiFieldRadio,
65446     tel: uiFieldText,
65447     text: uiFieldText,
65448     textarea: uiFieldTextarea,
65449     typeCombo: uiFieldCombo,
65450     url: uiFieldText,
65451     wikidata: uiFieldWikidata,
65452     wikipedia: uiFieldWikipedia
65453   };
65454
65455   // modules/ui/field.js
65456   function uiField(context, presetField2, entityIDs, options2) {
65457     options2 = Object.assign({
65458       show: true,
65459       wrap: true,
65460       remove: true,
65461       revert: true,
65462       info: true
65463     }, options2);
65464     var dispatch14 = dispatch_default("change", "revert");
65465     var field = Object.assign({}, presetField2);
65466     field.domId = utilUniqueDomId("form-field-" + field.safeid);
65467     var _show = options2.show;
65468     var _state = "";
65469     var _tags = {};
65470     var _entityExtent;
65471     if (entityIDs && entityIDs.length) {
65472       _entityExtent = entityIDs.reduce(function(extent, entityID) {
65473         var entity = context.graph().entity(entityID);
65474         return extent.extend(entity.extent(context.graph()));
65475       }, geoExtent());
65476     }
65477     var _locked = false;
65478     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
65479     if (_show && !field.impl) {
65480       createField();
65481     }
65482     function createField() {
65483       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
65484         dispatch14.call("change", field, t2, onInput);
65485       });
65486       if (entityIDs) {
65487         field.entityIDs = entityIDs;
65488         if (field.impl.entityIDs) {
65489           field.impl.entityIDs(entityIDs);
65490         }
65491       }
65492     }
65493     function allKeys() {
65494       let keys2 = field.keys || [field.key];
65495       if (field.type === "directionalCombo" && field.key) {
65496         keys2 = keys2.concat(field.key);
65497       }
65498       return keys2;
65499     }
65500     function isModified() {
65501       if (!entityIDs || !entityIDs.length)
65502         return false;
65503       return entityIDs.some(function(entityID) {
65504         var original = context.graph().base().entities[entityID];
65505         var latest = context.graph().entity(entityID);
65506         return allKeys().some(function(key) {
65507           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
65508         });
65509       });
65510     }
65511     function tagsContainFieldKey() {
65512       return allKeys().some(function(key) {
65513         if (field.type === "multiCombo") {
65514           for (var tagKey in _tags) {
65515             if (tagKey.indexOf(key) === 0) {
65516               return true;
65517             }
65518           }
65519           return false;
65520         }
65521         return _tags[key] !== void 0;
65522       });
65523     }
65524     function revert(d3_event, d2) {
65525       d3_event.stopPropagation();
65526       d3_event.preventDefault();
65527       if (!entityIDs || _locked)
65528         return;
65529       dispatch14.call("revert", d2, allKeys());
65530     }
65531     function remove2(d3_event, d2) {
65532       d3_event.stopPropagation();
65533       d3_event.preventDefault();
65534       if (_locked)
65535         return;
65536       var t2 = {};
65537       allKeys().forEach(function(key) {
65538         t2[key] = void 0;
65539       });
65540       dispatch14.call("change", d2, t2);
65541     }
65542     field.render = function(selection2) {
65543       var container = selection2.selectAll(".form-field").data([field]);
65544       var enter = container.enter().append("div").attr("class", function(d2) {
65545         return "form-field form-field-" + d2.safeid;
65546       }).classed("nowrap", !options2.wrap);
65547       if (options2.wrap) {
65548         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
65549           return d2.domId;
65550         });
65551         var textEnter = labelEnter.append("span").attr("class", "label-text");
65552         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
65553           d2.label()(select_default2(this));
65554         });
65555         textEnter.append("span").attr("class", "label-textannotation");
65556         if (options2.remove) {
65557           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
65558         }
65559         if (options2.revert) {
65560           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
65561         }
65562       }
65563       container = container.merge(enter);
65564       container.select(".field-label > .remove-icon").on("click", remove2);
65565       container.select(".field-label > .modified-icon").on("click", revert);
65566       container.each(function(d2) {
65567         var selection3 = select_default2(this);
65568         if (!d2.impl) {
65569           createField();
65570         }
65571         var reference, help;
65572         if (options2.wrap && field.type === "restrictions") {
65573           help = uiFieldHelp(context, "restrictions");
65574         }
65575         if (options2.wrap && options2.info) {
65576           var referenceKey = d2.key || "";
65577           if (d2.type === "multiCombo") {
65578             referenceKey = referenceKey.replace(/:$/, "");
65579           }
65580           var referenceOptions = d2.reference || {
65581             key: referenceKey,
65582             value: _tags[referenceKey]
65583           };
65584           reference = uiTagReference(referenceOptions, context);
65585           if (_state === "hover") {
65586             reference.showing(false);
65587           }
65588         }
65589         selection3.call(d2.impl);
65590         if (help) {
65591           selection3.call(help.body).select(".field-label").call(help.button);
65592         }
65593         if (reference) {
65594           selection3.call(reference.body).select(".field-label").call(reference.button);
65595         }
65596         d2.impl.tags(_tags);
65597       });
65598       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
65599       var annotation = container.selectAll(".field-label .label-textannotation");
65600       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
65601       icon2.exit().remove();
65602       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
65603       container.call(_locked ? _lockedTip : _lockedTip.destroy);
65604     };
65605     field.state = function(val) {
65606       if (!arguments.length)
65607         return _state;
65608       _state = val;
65609       return field;
65610     };
65611     field.tags = function(val) {
65612       if (!arguments.length)
65613         return _tags;
65614       _tags = val;
65615       if (tagsContainFieldKey() && !_show) {
65616         _show = true;
65617         if (!field.impl) {
65618           createField();
65619         }
65620       }
65621       return field;
65622     };
65623     field.locked = function(val) {
65624       if (!arguments.length)
65625         return _locked;
65626       _locked = val;
65627       return field;
65628     };
65629     field.show = function() {
65630       _show = true;
65631       if (!field.impl) {
65632         createField();
65633       }
65634       if (field.default && field.key && _tags[field.key] !== field.default) {
65635         var t2 = {};
65636         t2[field.key] = field.default;
65637         dispatch14.call("change", this, t2);
65638       }
65639     };
65640     field.isShown = function() {
65641       return _show;
65642     };
65643     field.isAllowed = function() {
65644       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
65645         return false;
65646       if (field.geometry && !entityIDs.every(function(entityID) {
65647         return field.matchGeometry(context.graph().geometry(entityID));
65648       }))
65649         return false;
65650       if (entityIDs && _entityExtent && field.locationSetID) {
65651         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
65652         if (!validHere[field.locationSetID])
65653           return false;
65654       }
65655       var prerequisiteTag = field.prerequisiteTag;
65656       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
65657       prerequisiteTag) {
65658         if (!entityIDs.every(function(entityID) {
65659           var entity = context.graph().entity(entityID);
65660           if (prerequisiteTag.key) {
65661             var value = entity.tags[prerequisiteTag.key];
65662             if (!value)
65663               return false;
65664             if (prerequisiteTag.valueNot) {
65665               return prerequisiteTag.valueNot !== value;
65666             }
65667             if (prerequisiteTag.value) {
65668               return prerequisiteTag.value === value;
65669             }
65670           } else if (prerequisiteTag.keyNot) {
65671             if (entity.tags[prerequisiteTag.keyNot])
65672               return false;
65673           }
65674           return true;
65675         }))
65676           return false;
65677       }
65678       return true;
65679     };
65680     field.focus = function() {
65681       if (field.impl) {
65682         field.impl.focus();
65683       }
65684     };
65685     return utilRebind(field, dispatch14, "on");
65686   }
65687
65688   // modules/ui/form_fields.js
65689   function uiFormFields(context) {
65690     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
65691     var _fieldsArr = [];
65692     var _lastPlaceholder = "";
65693     var _state = "";
65694     var _klass = "";
65695     function formFields(selection2) {
65696       var allowedFields = _fieldsArr.filter(function(field) {
65697         return field.isAllowed();
65698       });
65699       var shown = allowedFields.filter(function(field) {
65700         return field.isShown();
65701       });
65702       var notShown = allowedFields.filter(function(field) {
65703         return !field.isShown();
65704       });
65705       var container = selection2.selectAll(".form-fields-container").data([0]);
65706       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
65707       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
65708         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
65709       });
65710       fields.exit().remove();
65711       var enter = fields.enter().append("div").attr("class", function(d2) {
65712         return "wrap-form-field wrap-form-field-" + d2.safeid;
65713       });
65714       fields = fields.merge(enter);
65715       fields.order().each(function(d2) {
65716         select_default2(this).call(d2.render);
65717       });
65718       var titles = [];
65719       var moreFields = notShown.map(function(field) {
65720         var title = field.title();
65721         titles.push(title);
65722         var terms = field.terms();
65723         if (field.key)
65724           terms.push(field.key);
65725         if (field.keys)
65726           terms = terms.concat(field.keys);
65727         return {
65728           display: field.label(),
65729           value: title,
65730           title,
65731           field,
65732           terms
65733         };
65734       });
65735       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
65736       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
65737       more.exit().remove();
65738       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
65739       moreEnter.append("span").call(_t.append("inspector.add_fields"));
65740       more = moreEnter.merge(more);
65741       var input = more.selectAll(".value").data([0]);
65742       input.exit().remove();
65743       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
65744       input.call(utilGetSetValue, "").call(
65745         moreCombo.data(moreFields).on("accept", function(d2) {
65746           if (!d2)
65747             return;
65748           var field = d2.field;
65749           field.show();
65750           selection2.call(formFields);
65751           field.focus();
65752         })
65753       );
65754       if (_lastPlaceholder !== placeholder) {
65755         input.attr("placeholder", placeholder);
65756         _lastPlaceholder = placeholder;
65757       }
65758     }
65759     formFields.fieldsArr = function(val) {
65760       if (!arguments.length)
65761         return _fieldsArr;
65762       _fieldsArr = val || [];
65763       return formFields;
65764     };
65765     formFields.state = function(val) {
65766       if (!arguments.length)
65767         return _state;
65768       _state = val;
65769       return formFields;
65770     };
65771     formFields.klass = function(val) {
65772       if (!arguments.length)
65773         return _klass;
65774       _klass = val;
65775       return formFields;
65776     };
65777     return formFields;
65778   }
65779
65780   // modules/ui/changeset_editor.js
65781   function uiChangesetEditor(context) {
65782     var dispatch14 = dispatch_default("change");
65783     var formFields = uiFormFields(context);
65784     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
65785     var _fieldsArr;
65786     var _tags;
65787     var _changesetID;
65788     function changesetEditor(selection2) {
65789       render(selection2);
65790     }
65791     function render(selection2) {
65792       var initial = false;
65793       if (!_fieldsArr) {
65794         initial = true;
65795         var presets = _mainPresetIndex;
65796         _fieldsArr = [
65797           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
65798           uiField(context, presets.field("source"), null, { show: false, revert: false }),
65799           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
65800         ];
65801         _fieldsArr.forEach(function(field) {
65802           field.on("change", function(t2, onInput) {
65803             dispatch14.call("change", field, void 0, t2, onInput);
65804           });
65805         });
65806       }
65807       _fieldsArr.forEach(function(field) {
65808         field.tags(_tags);
65809       });
65810       selection2.call(formFields.fieldsArr(_fieldsArr));
65811       if (initial) {
65812         var commentField = selection2.select(".form-field-comment textarea");
65813         var commentNode = commentField.node();
65814         if (commentNode) {
65815           commentNode.focus();
65816           commentNode.select();
65817         }
65818         utilTriggerEvent(commentField, "blur");
65819         var osm = context.connection();
65820         if (osm) {
65821           osm.userChangesets(function(err, changesets) {
65822             if (err)
65823               return;
65824             var comments = changesets.map(function(changeset) {
65825               var comment = changeset.tags.comment;
65826               return comment ? { title: comment, value: comment } : null;
65827             }).filter(Boolean);
65828             commentField.call(
65829               commentCombo.data(utilArrayUniqBy(comments, "title"))
65830             );
65831           });
65832         }
65833       }
65834       const warnings = [];
65835       if (_tags.comment.match(/google/i)) {
65836         warnings.push({
65837           id: 'contains "google"',
65838           msg: _t.append("commit.google_warning"),
65839           link: _t("commit.google_warning_link")
65840         });
65841       }
65842       const maxChars = context.maxCharsForTagValue();
65843       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
65844       if (strLen > maxChars || false) {
65845         warnings.push({
65846           id: "message too long",
65847           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
65848         });
65849       }
65850       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
65851       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
65852       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
65853       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
65854       commentEnter.transition().duration(200).style("opacity", 1);
65855       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
65856         let selection3 = select_default2(this);
65857         if (d2.link) {
65858           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
65859         }
65860         selection3.call(d2.msg);
65861       });
65862     }
65863     changesetEditor.tags = function(_2) {
65864       if (!arguments.length)
65865         return _tags;
65866       _tags = _2;
65867       return changesetEditor;
65868     };
65869     changesetEditor.changesetID = function(_2) {
65870       if (!arguments.length)
65871         return _changesetID;
65872       if (_changesetID === _2)
65873         return changesetEditor;
65874       _changesetID = _2;
65875       _fieldsArr = null;
65876       return changesetEditor;
65877     };
65878     return utilRebind(changesetEditor, dispatch14, "on");
65879   }
65880
65881   // modules/ui/commit.js
65882   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
65883
65884   // modules/util/jxon.js
65885   var JXON = new function() {
65886     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
65887     function parseText(sValue) {
65888       if (rIsNull.test(sValue)) {
65889         return null;
65890       }
65891       if (rIsBool.test(sValue)) {
65892         return sValue.toLowerCase() === "true";
65893       }
65894       if (isFinite(sValue)) {
65895         return parseFloat(sValue);
65896       }
65897       if (isFinite(Date.parse(sValue))) {
65898         return new Date(sValue);
65899       }
65900       return sValue;
65901     }
65902     function EmptyTree() {
65903     }
65904     EmptyTree.prototype.toString = function() {
65905       return "null";
65906     };
65907     EmptyTree.prototype.valueOf = function() {
65908       return null;
65909     };
65910     function objectify(vValue) {
65911       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
65912     }
65913     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
65914       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
65915       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
65916         /* put here the default value for empty nodes: */
65917         true
65918       );
65919       if (bChildren) {
65920         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
65921           oNode = oParentNode.childNodes.item(nItem);
65922           if (oNode.nodeType === 4) {
65923             sCollectedTxt += oNode.nodeValue;
65924           } else if (oNode.nodeType === 3) {
65925             sCollectedTxt += oNode.nodeValue.trim();
65926           } else if (oNode.nodeType === 1 && !oNode.prefix) {
65927             aCache.push(oNode);
65928           }
65929         }
65930       }
65931       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
65932       if (!bHighVerb && (bChildren || bAttributes)) {
65933         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
65934       }
65935       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
65936         sProp = aCache[nElId].nodeName.toLowerCase();
65937         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
65938         if (vResult.hasOwnProperty(sProp)) {
65939           if (vResult[sProp].constructor !== Array) {
65940             vResult[sProp] = [vResult[sProp]];
65941           }
65942           vResult[sProp].push(vContent);
65943         } else {
65944           vResult[sProp] = vContent;
65945           nLength++;
65946         }
65947       }
65948       if (bAttributes) {
65949         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
65950         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
65951           oAttrib = oParentNode.attributes.item(nAttrib);
65952           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
65953         }
65954         if (bNesteAttr) {
65955           if (bFreeze) {
65956             Object.freeze(oAttrParent);
65957           }
65958           vResult[sAttributesProp] = oAttrParent;
65959           nLength -= nAttrLen - 1;
65960         }
65961       }
65962       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
65963         vResult[sValueProp] = vBuiltVal;
65964       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
65965         vResult = vBuiltVal;
65966       }
65967       if (bFreeze && (bHighVerb || nLength > 0)) {
65968         Object.freeze(vResult);
65969       }
65970       aCache.length = nLevelStart;
65971       return vResult;
65972     }
65973     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
65974       var vValue, oChild;
65975       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
65976         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
65977       } else if (oParentObj.constructor === Date) {
65978         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
65979       }
65980       for (var sName in oParentObj) {
65981         vValue = oParentObj[sName];
65982         if (isFinite(sName) || vValue instanceof Function) {
65983           continue;
65984         }
65985         if (sName === sValueProp) {
65986           if (vValue !== null && vValue !== true) {
65987             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
65988           }
65989         } else if (sName === sAttributesProp) {
65990           for (var sAttrib in vValue) {
65991             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
65992           }
65993         } else if (sName.charAt(0) === sAttrPref) {
65994           oParentEl.setAttribute(sName.slice(1), vValue);
65995         } else if (vValue.constructor === Array) {
65996           for (var nItem = 0; nItem < vValue.length; nItem++) {
65997             oChild = oXMLDoc.createElement(sName);
65998             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
65999             oParentEl.appendChild(oChild);
66000           }
66001         } else {
66002           oChild = oXMLDoc.createElement(sName);
66003           if (vValue instanceof Object) {
66004             loadObjTree(oXMLDoc, oChild, vValue);
66005           } else if (vValue !== null && vValue !== true) {
66006             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
66007           }
66008           oParentEl.appendChild(oChild);
66009         }
66010       }
66011     }
66012     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
66013       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
66014         /* put here the default verbosity level: */
66015         1
66016       );
66017       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
66018     };
66019     this.unbuild = function(oObjTree) {
66020       var oNewDoc = document.implementation.createDocument("", "", null);
66021       loadObjTree(oNewDoc, oNewDoc, oObjTree);
66022       return oNewDoc;
66023     };
66024     this.stringify = function(oObjTree) {
66025       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
66026     };
66027   }();
66028
66029   // modules/ui/sections/changes.js
66030   function uiSectionChanges(context) {
66031     var _discardTags = {};
66032     _mainFileFetcher.get("discarded").then(function(d2) {
66033       _discardTags = d2;
66034     }).catch(function() {
66035     });
66036     var section = uiSection("changes-list", context).label(function() {
66037       var history = context.history();
66038       var summary = history.difference().summary();
66039       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
66040     }).disclosureContent(renderDisclosureContent);
66041     function renderDisclosureContent(selection2) {
66042       var history = context.history();
66043       var summary = history.difference().summary();
66044       var container = selection2.selectAll(".commit-section").data([0]);
66045       var containerEnter = container.enter().append("div").attr("class", "commit-section");
66046       containerEnter.append("ul").attr("class", "changeset-list");
66047       container = containerEnter.merge(container);
66048       var items = container.select("ul").selectAll("li").data(summary);
66049       var itemsEnter = items.enter().append("li").attr("class", "change-item");
66050       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
66051       buttons.each(function(d2) {
66052         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
66053       });
66054       buttons.append("span").attr("class", "change-type").html(function(d2) {
66055         return _t.html("commit." + d2.changeType) + " ";
66056       });
66057       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
66058         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
66059         return matched && matched.name() || utilDisplayType(d2.entity.id);
66060       });
66061       buttons.append("span").attr("class", "entity-name").text(function(d2) {
66062         var name = utilDisplayName(d2.entity) || "", string = "";
66063         if (name !== "") {
66064           string += ":";
66065         }
66066         return string += " " + name;
66067       });
66068       items = itemsEnter.merge(items);
66069       var changeset = new osmChangeset().update({ id: void 0 });
66070       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
66071       delete changeset.id;
66072       var data = JXON.stringify(changeset.osmChangeJXON(changes));
66073       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
66074       var fileName = "changes.osc";
66075       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
66076       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
66077       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
66078       function mouseover(d2) {
66079         if (d2.entity) {
66080           context.surface().selectAll(
66081             utilEntityOrMemberSelector([d2.entity.id], context.graph())
66082           ).classed("hover", true);
66083         }
66084       }
66085       function mouseout() {
66086         context.surface().selectAll(".hover").classed("hover", false);
66087       }
66088       function click(d3_event, change) {
66089         if (change.changeType !== "deleted") {
66090           var entity = change.entity;
66091           context.map().zoomToEase(entity);
66092           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
66093         }
66094       }
66095     }
66096     return section;
66097   }
66098
66099   // modules/ui/commit_warnings.js
66100   function uiCommitWarnings(context) {
66101     function commitWarnings(selection2) {
66102       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
66103       for (var severity in issuesBySeverity) {
66104         var issues = issuesBySeverity[severity];
66105         if (severity !== "error") {
66106           issues = issues.filter(function(issue) {
66107             return issue.type !== "help_request";
66108           });
66109         }
66110         var section = severity + "-section";
66111         var issueItem = severity + "-item";
66112         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
66113         container.exit().remove();
66114         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
66115         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
66116         containerEnter.append("ul").attr("class", "changeset-list");
66117         container = containerEnter.merge(container);
66118         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
66119           return d2.key;
66120         });
66121         items.exit().remove();
66122         var itemsEnter = items.enter().append("li").attr("class", issueItem);
66123         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
66124           if (d2.entityIds) {
66125             context.surface().selectAll(
66126               utilEntityOrMemberSelector(
66127                 d2.entityIds,
66128                 context.graph()
66129               )
66130             ).classed("hover", true);
66131           }
66132         }).on("mouseout", function() {
66133           context.surface().selectAll(".hover").classed("hover", false);
66134         }).on("click", function(d3_event, d2) {
66135           context.validator().focusIssue(d2);
66136         });
66137         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
66138         buttons.append("strong").attr("class", "issue-message");
66139         buttons.filter(function(d2) {
66140           return d2.tooltip;
66141         }).call(
66142           uiTooltip().title(function(d2) {
66143             return d2.tooltip;
66144           }).placement("top")
66145         );
66146         items = itemsEnter.merge(items);
66147         items.selectAll(".issue-message").text("").each(function(d2) {
66148           return d2.message(context)(select_default2(this));
66149         });
66150       }
66151     }
66152     return commitWarnings;
66153   }
66154
66155   // modules/ui/commit.js
66156   var readOnlyTags = [
66157     /^changesets_count$/,
66158     /^created_by$/,
66159     /^ideditor:/,
66160     /^imagery_used$/,
66161     /^host$/,
66162     /^locale$/,
66163     /^warnings:/,
66164     /^resolved:/,
66165     /^closed:note$/,
66166     /^closed:keepright$/,
66167     /^closed:improveosm:/,
66168     /^closed:osmose:/
66169   ];
66170   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
66171   function uiCommit(context) {
66172     var dispatch14 = dispatch_default("cancel");
66173     var _userDetails2;
66174     var _selection;
66175     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
66176     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
66177     var commitChanges = uiSectionChanges(context);
66178     var commitWarnings = uiCommitWarnings(context);
66179     function commit(selection2) {
66180       _selection = selection2;
66181       if (!context.changeset)
66182         initChangeset();
66183       loadDerivedChangesetTags();
66184       selection2.call(render);
66185     }
66186     function initChangeset() {
66187       var commentDate = +corePreferences("commentDate") || 0;
66188       var currDate = Date.now();
66189       var cutoff = 2 * 86400 * 1e3;
66190       if (commentDate > currDate || currDate - commentDate > cutoff) {
66191         corePreferences("comment", null);
66192         corePreferences("hashtags", null);
66193         corePreferences("source", null);
66194       }
66195       if (context.defaultChangesetComment()) {
66196         corePreferences("comment", context.defaultChangesetComment());
66197         corePreferences("commentDate", Date.now());
66198       }
66199       if (context.defaultChangesetSource()) {
66200         corePreferences("source", context.defaultChangesetSource());
66201         corePreferences("commentDate", Date.now());
66202       }
66203       if (context.defaultChangesetHashtags()) {
66204         corePreferences("hashtags", context.defaultChangesetHashtags());
66205         corePreferences("commentDate", Date.now());
66206       }
66207       var detected = utilDetect();
66208       var tags = {
66209         comment: corePreferences("comment") || "",
66210         created_by: context.cleanTagValue("iD " + context.version),
66211         host: context.cleanTagValue(detected.host),
66212         locale: context.cleanTagValue(_mainLocalizer.localeCode())
66213       };
66214       findHashtags(tags, true);
66215       var hashtags = corePreferences("hashtags");
66216       if (hashtags) {
66217         tags.hashtags = hashtags;
66218       }
66219       var source = corePreferences("source");
66220       if (source) {
66221         tags.source = source;
66222       }
66223       var photoOverlaysUsed = context.history().photoOverlaysUsed();
66224       if (photoOverlaysUsed.length) {
66225         var sources = (tags.source || "").split(";");
66226         if (sources.indexOf("streetlevel imagery") === -1) {
66227           sources.push("streetlevel imagery");
66228         }
66229         photoOverlaysUsed.forEach(function(photoOverlay) {
66230           if (sources.indexOf(photoOverlay) === -1) {
66231             sources.push(photoOverlay);
66232           }
66233         });
66234         tags.source = context.cleanTagValue(sources.join(";"));
66235       }
66236       context.changeset = new osmChangeset({ tags });
66237     }
66238     function loadDerivedChangesetTags() {
66239       var osm = context.connection();
66240       if (!osm)
66241         return;
66242       var tags = Object.assign({}, context.changeset.tags);
66243       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
66244       tags.imagery_used = imageryUsed || "None";
66245       var osmClosed = osm.getClosedIDs();
66246       var itemType;
66247       if (osmClosed.length) {
66248         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
66249       }
66250       if (services.keepRight) {
66251         var krClosed = services.keepRight.getClosedIDs();
66252         if (krClosed.length) {
66253           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
66254         }
66255       }
66256       if (services.improveOSM) {
66257         var iOsmClosed = services.improveOSM.getClosedCounts();
66258         for (itemType in iOsmClosed) {
66259           tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
66260         }
66261       }
66262       if (services.osmose) {
66263         var osmoseClosed = services.osmose.getClosedCounts();
66264         for (itemType in osmoseClosed) {
66265           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
66266         }
66267       }
66268       for (var key in tags) {
66269         if (key.match(/(^warnings:)|(^resolved:)/)) {
66270           delete tags[key];
66271         }
66272       }
66273       function addIssueCounts(issues, prefix) {
66274         var issuesByType = utilArrayGroupBy(issues, "type");
66275         for (var issueType in issuesByType) {
66276           var issuesOfType = issuesByType[issueType];
66277           if (issuesOfType[0].subtype) {
66278             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
66279             for (var issueSubtype in issuesBySubtype) {
66280               var issuesOfSubtype = issuesBySubtype[issueSubtype];
66281               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
66282             }
66283           } else {
66284             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
66285           }
66286         }
66287       }
66288       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
66289         return issue.type !== "help_request";
66290       });
66291       addIssueCounts(warnings, "warnings");
66292       var resolvedIssues = context.validator().getResolvedIssues();
66293       addIssueCounts(resolvedIssues, "resolved");
66294       context.changeset = context.changeset.update({ tags });
66295     }
66296     function render(selection2) {
66297       var osm = context.connection();
66298       if (!osm)
66299         return;
66300       var header = selection2.selectAll(".header").data([0]);
66301       var headerTitle = header.enter().append("div").attr("class", "header fillL");
66302       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
66303       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
66304         dispatch14.call("cancel", this);
66305       }).call(svgIcon("#iD-icon-close"));
66306       var body = selection2.selectAll(".body").data([0]);
66307       body = body.enter().append("div").attr("class", "body").merge(body);
66308       var changesetSection = body.selectAll(".changeset-editor").data([0]);
66309       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
66310       changesetSection.call(
66311         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
66312       );
66313       body.call(commitWarnings);
66314       var saveSection = body.selectAll(".save-section").data([0]);
66315       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
66316       var prose = saveSection.selectAll(".commit-info").data([0]);
66317       if (prose.enter().size()) {
66318         _userDetails2 = null;
66319       }
66320       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
66321       osm.userDetails(function(err, user) {
66322         if (err)
66323           return;
66324         if (_userDetails2 === user)
66325           return;
66326         _userDetails2 = user;
66327         var userLink = select_default2(document.createElement("div"));
66328         if (user.image_url) {
66329           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
66330         }
66331         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
66332         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
66333       });
66334       var requestReview = saveSection.selectAll(".request-review").data([0]);
66335       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
66336       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
66337       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
66338       if (!labelEnter.empty()) {
66339         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
66340       }
66341       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
66342       labelEnter.append("span").call(_t.append("commit.request_review"));
66343       requestReview = requestReview.merge(requestReviewEnter);
66344       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
66345       var buttonSection = saveSection.selectAll(".buttons").data([0]);
66346       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
66347       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
66348       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
66349       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
66350       var uploadBlockerTooltipText = getUploadBlockerMessage();
66351       buttonSection = buttonSection.merge(buttonEnter);
66352       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
66353         dispatch14.call("cancel", this);
66354       });
66355       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
66356         if (!select_default2(this).classed("disabled")) {
66357           this.blur();
66358           for (var key in context.changeset.tags) {
66359             if (!key)
66360               delete context.changeset.tags[key];
66361           }
66362           context.uploader().save(context.changeset);
66363         }
66364       });
66365       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
66366       if (uploadBlockerTooltipText) {
66367         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
66368       }
66369       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
66370       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
66371       tagSection.call(
66372         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
66373       );
66374       var changesSection = body.selectAll(".commit-changes-section").data([0]);
66375       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
66376       changesSection.call(commitChanges.render);
66377       function toggleRequestReview() {
66378         var rr = requestReviewInput.property("checked");
66379         updateChangeset({ review_requested: rr ? "yes" : void 0 });
66380         tagSection.call(
66381           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
66382         );
66383       }
66384     }
66385     function getUploadBlockerMessage() {
66386       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
66387       if (errors.length) {
66388         return _t.append("commit.outstanding_errors_message", { count: errors.length });
66389       } else {
66390         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
66391         if (!hasChangesetComment) {
66392           return _t.append("commit.comment_needed_message");
66393         }
66394       }
66395       return null;
66396     }
66397     function changeTags(_2, changed, onInput) {
66398       if (changed.hasOwnProperty("comment")) {
66399         if (changed.comment === void 0) {
66400           changed.comment = "";
66401         }
66402         if (!onInput) {
66403           corePreferences("comment", changed.comment);
66404           corePreferences("commentDate", Date.now());
66405         }
66406       }
66407       if (changed.hasOwnProperty("source")) {
66408         if (changed.source === void 0) {
66409           corePreferences("source", null);
66410         } else if (!onInput) {
66411           corePreferences("source", changed.source);
66412           corePreferences("commentDate", Date.now());
66413         }
66414       }
66415       updateChangeset(changed, onInput);
66416       if (_selection) {
66417         _selection.call(render);
66418       }
66419     }
66420     function findHashtags(tags, commentOnly) {
66421       var detectedHashtags = commentHashtags();
66422       if (detectedHashtags.length) {
66423         corePreferences("hashtags", null);
66424       }
66425       if (!detectedHashtags.length || !commentOnly) {
66426         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
66427       }
66428       var allLowerCase = /* @__PURE__ */ new Set();
66429       return detectedHashtags.filter(function(hashtag) {
66430         var lowerCase = hashtag.toLowerCase();
66431         if (!allLowerCase.has(lowerCase)) {
66432           allLowerCase.add(lowerCase);
66433           return true;
66434         }
66435         return false;
66436       });
66437       function commentHashtags() {
66438         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
66439         return matches || [];
66440       }
66441       function hashtagHashtags() {
66442         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
66443           if (s2[0] !== "#") {
66444             s2 = "#" + s2;
66445           }
66446           var matched = s2.match(hashtagRegex);
66447           return matched && matched[0];
66448         }).filter(Boolean);
66449         return matches || [];
66450       }
66451     }
66452     function isReviewRequested(tags) {
66453       var rr = tags.review_requested;
66454       if (rr === void 0)
66455         return false;
66456       rr = rr.trim().toLowerCase();
66457       return !(rr === "" || rr === "no");
66458     }
66459     function updateChangeset(changed, onInput) {
66460       var tags = Object.assign({}, context.changeset.tags);
66461       Object.keys(changed).forEach(function(k2) {
66462         var v2 = changed[k2];
66463         k2 = context.cleanTagKey(k2);
66464         if (readOnlyTags.indexOf(k2) !== -1)
66465           return;
66466         if (v2 === void 0) {
66467           delete tags[k2];
66468         } else if (onInput) {
66469           tags[k2] = v2;
66470         } else {
66471           tags[k2] = context.cleanTagValue(v2);
66472         }
66473       });
66474       if (!onInput) {
66475         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
66476         var arr = findHashtags(tags, commentOnly);
66477         if (arr.length) {
66478           tags.hashtags = context.cleanTagValue(arr.join(";"));
66479           corePreferences("hashtags", tags.hashtags);
66480         } else {
66481           delete tags.hashtags;
66482           corePreferences("hashtags", null);
66483         }
66484       }
66485       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
66486         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
66487         tags.changesets_count = String(changesetsCount);
66488         if (changesetsCount <= 100) {
66489           var s2;
66490           s2 = corePreferences("walkthrough_completed");
66491           if (s2) {
66492             tags["ideditor:walkthrough_completed"] = s2;
66493           }
66494           s2 = corePreferences("walkthrough_progress");
66495           if (s2) {
66496             tags["ideditor:walkthrough_progress"] = s2;
66497           }
66498           s2 = corePreferences("walkthrough_started");
66499           if (s2) {
66500             tags["ideditor:walkthrough_started"] = s2;
66501           }
66502         }
66503       } else {
66504         delete tags.changesets_count;
66505       }
66506       if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
66507         context.changeset = context.changeset.update({ tags });
66508       }
66509     }
66510     commit.reset = function() {
66511       context.changeset = null;
66512     };
66513     return utilRebind(commit, dispatch14, "on");
66514   }
66515
66516   // modules/ui/confirm.js
66517   function uiConfirm(selection2) {
66518     var modalSelection = uiModal(selection2);
66519     modalSelection.select(".modal").classed("modal-alert", true);
66520     var section = modalSelection.select(".content");
66521     section.append("div").attr("class", "modal-section header");
66522     section.append("div").attr("class", "modal-section message-text");
66523     var buttons = section.append("div").attr("class", "modal-section buttons cf");
66524     modalSelection.okButton = function() {
66525       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
66526         modalSelection.remove();
66527       }).call(_t.append("confirm.okay")).node().focus();
66528       return modalSelection;
66529     };
66530     return modalSelection;
66531   }
66532
66533   // modules/ui/conflicts.js
66534   function uiConflicts(context) {
66535     var dispatch14 = dispatch_default("cancel", "save");
66536     var keybinding = utilKeybinding("conflicts");
66537     var _origChanges;
66538     var _conflictList;
66539     var _shownConflictIndex;
66540     function keybindingOn() {
66541       select_default2(document).call(keybinding.on("\u238B", cancel, true));
66542     }
66543     function keybindingOff() {
66544       select_default2(document).call(keybinding.unbind);
66545     }
66546     function tryAgain() {
66547       keybindingOff();
66548       dispatch14.call("save");
66549     }
66550     function cancel() {
66551       keybindingOff();
66552       dispatch14.call("cancel");
66553     }
66554     function conflicts(selection2) {
66555       keybindingOn();
66556       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
66557       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
66558       headerEnter.append("h2").call(_t.append("save.conflict.header"));
66559       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
66560       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
66561       var changeset = new osmChangeset();
66562       delete changeset.id;
66563       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
66564       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
66565       var fileName = "changes.osc";
66566       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
66567       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
66568       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
66569       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
66570       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
66571       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
66572       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
66573       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
66574     }
66575     function showConflict(selection2, index) {
66576       index = utilWrap(index, _conflictList.length);
66577       _shownConflictIndex = index;
66578       var parent = select_default2(selection2.node().parentNode);
66579       if (index === _conflictList.length - 1) {
66580         window.setTimeout(function() {
66581           parent.select(".conflicts-button").attr("disabled", null);
66582           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
66583         }, 250);
66584       }
66585       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
66586       conflict.exit().remove();
66587       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
66588       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
66589       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
66590         return d2.name;
66591       }).on("click", function(d3_event, d2) {
66592         d3_event.preventDefault();
66593         zoomToEntity(d2.id);
66594       });
66595       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
66596       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
66597         return d2.details || [];
66598       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
66599         return d2;
66600       });
66601       details.append("div").attr("class", "conflict-choices").call(addChoices);
66602       details.append("div").attr("class", "conflict-nav-buttons joined cf").selectAll("button").data(["previous", "next"]).enter().append("button").attr("class", "conflict-nav-button action col6").attr("disabled", function(d2, i3) {
66603         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
66604       }).on("click", function(d3_event, d2) {
66605         d3_event.preventDefault();
66606         var container = parent.selectAll(".conflict-container");
66607         var sign2 = d2 === "previous" ? -1 : 1;
66608         container.selectAll(".conflict").remove();
66609         container.call(showConflict, index + sign2);
66610       }).each(function(d2) {
66611         _t.append("save.conflict." + d2)(select_default2(this));
66612       });
66613     }
66614     function addChoices(selection2) {
66615       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
66616         return d2.choices || [];
66617       });
66618       var choicesEnter = choices.enter().append("li").attr("class", "layer");
66619       var labelEnter = choicesEnter.append("label");
66620       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
66621         return d2.id;
66622       }).on("change", function(d3_event, d2) {
66623         var ul = this.parentNode.parentNode.parentNode;
66624         ul.__data__.chosen = d2.id;
66625         choose(d3_event, ul, d2);
66626       });
66627       labelEnter.append("span").text(function(d2) {
66628         return d2.text;
66629       });
66630       choicesEnter.merge(choices).each(function(d2) {
66631         var ul = this.parentNode;
66632         if (ul.__data__.chosen === d2.id) {
66633           choose(null, ul, d2);
66634         }
66635       });
66636     }
66637     function choose(d3_event, ul, datum2) {
66638       if (d3_event)
66639         d3_event.preventDefault();
66640       select_default2(ul).selectAll("li").classed("active", function(d2) {
66641         return d2 === datum2;
66642       }).selectAll("input").property("checked", function(d2) {
66643         return d2 === datum2;
66644       });
66645       var extent = geoExtent();
66646       var entity;
66647       entity = context.graph().hasEntity(datum2.id);
66648       if (entity)
66649         extent._extend(entity.extent(context.graph()));
66650       datum2.action();
66651       entity = context.graph().hasEntity(datum2.id);
66652       if (entity)
66653         extent._extend(entity.extent(context.graph()));
66654       zoomToEntity(datum2.id, extent);
66655     }
66656     function zoomToEntity(id2, extent) {
66657       context.surface().selectAll(".hover").classed("hover", false);
66658       var entity = context.graph().hasEntity(id2);
66659       if (entity) {
66660         if (extent) {
66661           context.map().trimmedExtent(extent);
66662         } else {
66663           context.map().zoomToEase(entity);
66664         }
66665         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
66666       }
66667     }
66668     conflicts.conflictList = function(_2) {
66669       if (!arguments.length)
66670         return _conflictList;
66671       _conflictList = _2;
66672       return conflicts;
66673     };
66674     conflicts.origChanges = function(_2) {
66675       if (!arguments.length)
66676         return _origChanges;
66677       _origChanges = _2;
66678       return conflicts;
66679     };
66680     conflicts.shownEntityIds = function() {
66681       if (_conflictList && typeof _shownConflictIndex === "number") {
66682         return [_conflictList[_shownConflictIndex].id];
66683       }
66684       return [];
66685     };
66686     return utilRebind(conflicts, dispatch14, "on");
66687   }
66688
66689   // modules/ui/entity_editor.js
66690   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
66691
66692   // modules/ui/sections/entity_issues.js
66693   function uiSectionEntityIssues(context) {
66694     var preference = corePreferences("entity-issues.reference.expanded");
66695     var _expanded = preference === null ? true : preference === "true";
66696     var _entityIDs = [];
66697     var _issues = [];
66698     var _activeIssueID;
66699     var section = uiSection("entity-issues", context).shouldDisplay(function() {
66700       return _issues.length > 0;
66701     }).label(function() {
66702       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
66703     }).disclosureContent(renderDisclosureContent);
66704     context.validator().on("validated.entity_issues", function() {
66705       reloadIssues();
66706       section.reRender();
66707     }).on("focusedIssue.entity_issues", function(issue) {
66708       makeActiveIssue(issue.id);
66709     });
66710     function reloadIssues() {
66711       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
66712     }
66713     function makeActiveIssue(issueID) {
66714       _activeIssueID = issueID;
66715       section.selection().selectAll(".issue-container").classed("active", function(d2) {
66716         return d2.id === _activeIssueID;
66717       });
66718     }
66719     function renderDisclosureContent(selection2) {
66720       selection2.classed("grouped-items-area", true);
66721       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
66722       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
66723         return d2.key;
66724       });
66725       containers.exit().remove();
66726       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
66727       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
66728         return "issue severity-" + d2.severity;
66729       }).on("mouseover.highlight", function(d3_event, d2) {
66730         var ids = d2.entityIds.filter(function(e3) {
66731           return _entityIDs.indexOf(e3) === -1;
66732         });
66733         utilHighlightEntities(ids, true, context);
66734       }).on("mouseout.highlight", function(d3_event, d2) {
66735         var ids = d2.entityIds.filter(function(e3) {
66736           return _entityIDs.indexOf(e3) === -1;
66737         });
66738         utilHighlightEntities(ids, false, context);
66739       });
66740       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
66741       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
66742         makeActiveIssue(d2.id);
66743         var extent = d2.extent(context.graph());
66744         if (extent) {
66745           var setZoom = Math.max(context.map().zoom(), 19);
66746           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
66747         }
66748       });
66749       textEnter.each(function(d2) {
66750         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
66751         select_default2(this).call(svgIcon(iconName, "issue-icon"));
66752       });
66753       textEnter.append("span").attr("class", "issue-message");
66754       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
66755       infoButton.on("click", function(d3_event) {
66756         d3_event.stopPropagation();
66757         d3_event.preventDefault();
66758         this.blur();
66759         var container = select_default2(this.parentNode.parentNode.parentNode);
66760         var info = container.selectAll(".issue-info");
66761         var isExpanded = info.classed("expanded");
66762         _expanded = !isExpanded;
66763         corePreferences("entity-issues.reference.expanded", _expanded);
66764         if (isExpanded) {
66765           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
66766             info.classed("expanded", false);
66767           });
66768         } else {
66769           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
66770             info.style("max-height", null);
66771           });
66772         }
66773       });
66774       itemsEnter.append("ul").attr("class", "issue-fix-list");
66775       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
66776         if (typeof d2.reference === "function") {
66777           select_default2(this).call(d2.reference);
66778         } else {
66779           select_default2(this).call(_t.append("inspector.no_documentation_key"));
66780         }
66781       });
66782       containers = containers.merge(containersEnter).classed("active", function(d2) {
66783         return d2.id === _activeIssueID;
66784       });
66785       containers.selectAll(".issue-message").text("").each(function(d2) {
66786         return d2.message(context)(select_default2(this));
66787       });
66788       var fixLists = containers.selectAll(".issue-fix-list");
66789       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
66790         return d2.fixes ? d2.fixes(context) : [];
66791       }, function(fix) {
66792         return fix.id;
66793       });
66794       fixes.exit().remove();
66795       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
66796       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
66797         if (select_default2(this).attr("disabled") || !d2.onClick)
66798           return;
66799         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3)
66800           return;
66801         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
66802         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
66803         new Promise(function(resolve, reject) {
66804           d2.onClick(context, resolve, reject);
66805           if (d2.onClick.length <= 1) {
66806             resolve();
66807           }
66808         }).then(function() {
66809           context.validator().validate();
66810         });
66811       }).on("mouseover.highlight", function(d3_event, d2) {
66812         utilHighlightEntities(d2.entityIds, true, context);
66813       }).on("mouseout.highlight", function(d3_event, d2) {
66814         utilHighlightEntities(d2.entityIds, false, context);
66815       });
66816       buttons.each(function(d2) {
66817         var iconName = d2.icon || "iD-icon-wrench";
66818         if (iconName.startsWith("maki")) {
66819           iconName += "-15";
66820         }
66821         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
66822       });
66823       buttons.append("span").attr("class", "fix-message").each(function(d2) {
66824         return d2.title(select_default2(this));
66825       });
66826       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
66827         return d2.onClick;
66828       }).attr("disabled", function(d2) {
66829         return d2.onClick ? null : "true";
66830       }).attr("title", function(d2) {
66831         if (d2.disabledReason) {
66832           return d2.disabledReason;
66833         }
66834         return null;
66835       });
66836     }
66837     section.entityIDs = function(val) {
66838       if (!arguments.length)
66839         return _entityIDs;
66840       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
66841         _entityIDs = val;
66842         _activeIssueID = null;
66843         reloadIssues();
66844       }
66845       return section;
66846     };
66847     return section;
66848   }
66849
66850   // modules/ui/preset_icon.js
66851   function uiPresetIcon() {
66852     let _preset;
66853     let _geometry;
66854     function presetIcon(selection2) {
66855       selection2.each(render);
66856     }
66857     function getIcon(p2, geom) {
66858       if (p2.isFallback && p2.isFallback())
66859         return geom === "vertex" ? "" : "iD-icon-" + p2.id;
66860       if (p2.icon)
66861         return p2.icon;
66862       if (geom === "line")
66863         return "iD-other-line";
66864       if (geom === "vertex")
66865         return "temaki-vertex";
66866       return "maki-marker-stroked";
66867     }
66868     function renderPointBorder(container, drawPoint) {
66869       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
66870       pointBorder.exit().remove();
66871       let pointBorderEnter = pointBorder.enter();
66872       const w2 = 40;
66873       const h2 = 40;
66874       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`).append("path").attr("transform", "translate(11.5, 8)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
66875       pointBorder = pointBorderEnter.merge(pointBorder);
66876     }
66877     function renderCategoryBorder(container, category) {
66878       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
66879       categoryBorder.exit().remove();
66880       let categoryBorderEnter = categoryBorder.enter();
66881       const d2 = 60;
66882       let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d2).attr("height", d2).attr("viewBox", `0 0 ${d2} ${d2}`);
66883       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");
66884       categoryBorder = categoryBorderEnter.merge(categoryBorder);
66885       if (category) {
66886         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
66887       }
66888     }
66889     function renderCircleFill(container, drawVertex) {
66890       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
66891       vertexFill.exit().remove();
66892       let vertexFillEnter = vertexFill.enter();
66893       const w2 = 60;
66894       const h2 = 60;
66895       const d2 = 40;
66896       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`).append("circle").attr("cx", w2 / 2).attr("cy", h2 / 2).attr("r", d2 / 2);
66897       vertexFill = vertexFillEnter.merge(vertexFill);
66898     }
66899     function renderSquareFill(container, drawArea, tagClasses) {
66900       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
66901       fill.exit().remove();
66902       let fillEnter = fill.enter();
66903       const d2 = 60;
66904       const w2 = d2;
66905       const h2 = d2;
66906       const l2 = d2 * 2 / 3;
66907       const c1 = (w2 - l2) / 2;
66908       const c2 = c1 + l2;
66909       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
66910       ["fill", "stroke"].forEach((klass) => {
66911         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
66912       });
66913       const rVertex = 2.5;
66914       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point2) => {
66915         fillEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rVertex);
66916       });
66917       const rMidpoint = 1.25;
66918       [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point2) => {
66919         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rMidpoint);
66920       });
66921       fill = fillEnter.merge(fill);
66922       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
66923       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
66924     }
66925     function renderLine(container, drawLine, tagClasses) {
66926       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
66927       line.exit().remove();
66928       let lineEnter = line.enter();
66929       const d2 = 60;
66930       const w2 = d2;
66931       const h2 = d2;
66932       const y2 = Math.round(d2 * 0.72);
66933       const l2 = Math.round(d2 * 0.6);
66934       const r2 = 2.5;
66935       const x12 = (w2 - l2) / 2;
66936       const x2 = x12 + l2;
66937       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
66938       ["casing", "stroke"].forEach((klass) => {
66939         lineEnter.append("path").attr("d", `M${x12} ${y2} L${x2} ${y2}`).attr("class", `line ${klass}`);
66940       });
66941       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point2) => {
66942         lineEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
66943       });
66944       line = lineEnter.merge(line);
66945       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
66946       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
66947     }
66948     function renderRoute(container, drawRoute, p2) {
66949       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
66950       route.exit().remove();
66951       let routeEnter = route.enter();
66952       const d2 = 60;
66953       const w2 = d2;
66954       const h2 = d2;
66955       const y12 = Math.round(d2 * 0.8);
66956       const y2 = Math.round(d2 * 0.68);
66957       const l2 = Math.round(d2 * 0.6);
66958       const r2 = 2;
66959       const x12 = (w2 - l2) / 2;
66960       const x2 = x12 + l2 / 3;
66961       const x3 = x2 + l2 / 3;
66962       const x4 = x3 + l2 / 3;
66963       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
66964       ["casing", "stroke"].forEach((klass) => {
66965         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
66966         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
66967         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
66968       });
66969       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point2) => {
66970         routeEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
66971       });
66972       route = routeEnter.merge(route);
66973       if (drawRoute) {
66974         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
66975         const segmentPresetIDs = routeSegments[routeType];
66976         for (let i3 in segmentPresetIDs) {
66977           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
66978           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
66979           route.selectAll(`path.stroke.segment${i3}`).attr("class", `segment${i3} line stroke ${segmentTagClasses}`);
66980           route.selectAll(`path.casing.segment${i3}`).attr("class", `segment${i3} line casing ${segmentTagClasses}`);
66981         }
66982       }
66983     }
66984     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
66985       const isMaki = picon && /^maki-/.test(picon);
66986       const isTemaki = picon && /^temaki-/.test(picon);
66987       const isFa = picon && /^fa[srb]-/.test(picon);
66988       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
66989       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
66990       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
66991       icon2.exit().remove();
66992       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
66993       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
66994       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
66995       icon2.selectAll("use").attr("href", "#" + picon);
66996     }
66997     function renderImageIcon(container, imageURL) {
66998       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
66999       imageIcon.exit().remove();
67000       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);
67001       imageIcon.attr("src", imageURL);
67002     }
67003     const routeSegments = {
67004       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
67005       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
67006       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
67007       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
67008       ferry: ["route/ferry", "route/ferry", "route/ferry"],
67009       foot: ["highway/footway", "highway/footway", "highway/footway"],
67010       hiking: ["highway/path", "highway/path", "highway/path"],
67011       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
67012       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
67013       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
67014       mtb: ["highway/path", "highway/track", "highway/bridleway"],
67015       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
67016       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
67017       power: ["power/line", "power/line", "power/line"],
67018       road: ["highway/secondary", "highway/primary", "highway/trunk"],
67019       subway: ["railway/subway", "railway/subway", "railway/subway"],
67020       train: ["railway/rail", "railway/rail", "railway/rail"],
67021       tram: ["railway/tram", "railway/tram", "railway/tram"],
67022       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
67023     };
67024     function render() {
67025       let p2 = _preset.apply(this, arguments);
67026       let geom = _geometry ? _geometry.apply(this, arguments) : null;
67027       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
67028         geom = "route";
67029       }
67030       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
67031       const isFallback = p2.isFallback && p2.isFallback();
67032       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
67033       const picon = getIcon(p2, geom);
67034       const isCategory = !p2.setTags;
67035       const drawPoint = false;
67036       const drawVertex = picon !== null && geom === "vertex";
67037       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
67038       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
67039       const drawRoute = picon && geom === "route";
67040       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
67041       let tags = !isCategory ? p2.setTags({}, geom) : {};
67042       for (let k2 in tags) {
67043         if (tags[k2] === "*") {
67044           tags[k2] = "yes";
67045         }
67046       }
67047       let tagClasses = svgTagClasses().getClassesString(tags, "");
67048       let selection2 = select_default2(this);
67049       let container = selection2.selectAll(".preset-icon-container").data([0]);
67050       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
67051       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
67052       renderCategoryBorder(container, isCategory && p2);
67053       renderPointBorder(container, drawPoint);
67054       renderCircleFill(container, drawVertex);
67055       renderSquareFill(container, drawArea, tagClasses);
67056       renderLine(container, drawLine, tagClasses);
67057       renderRoute(container, drawRoute, p2);
67058       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
67059       renderImageIcon(container, imageURL);
67060     }
67061     presetIcon.preset = function(val) {
67062       if (!arguments.length)
67063         return _preset;
67064       _preset = utilFunctor(val);
67065       return presetIcon;
67066     };
67067     presetIcon.geometry = function(val) {
67068       if (!arguments.length)
67069         return _geometry;
67070       _geometry = utilFunctor(val);
67071       return presetIcon;
67072     };
67073     return presetIcon;
67074   }
67075
67076   // modules/ui/sections/feature_type.js
67077   function uiSectionFeatureType(context) {
67078     var dispatch14 = dispatch_default("choose");
67079     var _entityIDs = [];
67080     var _presets = [];
67081     var _tagReference;
67082     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
67083     function renderDisclosureContent(selection2) {
67084       selection2.classed("preset-list-item", true);
67085       selection2.classed("mixed-types", _presets.length > 1);
67086       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
67087       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
67088         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
67089       );
67090       presetButton.append("div").attr("class", "preset-icon-container");
67091       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
67092       presetButtonWrap.append("div").attr("class", "accessory-buttons");
67093       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
67094       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
67095       if (_tagReference) {
67096         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
67097         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
67098       }
67099       selection2.selectAll(".preset-reset").on("click", function() {
67100         dispatch14.call("choose", this, _presets);
67101       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
67102         d3_event.preventDefault();
67103         d3_event.stopPropagation();
67104       });
67105       var geometries = entityGeometries();
67106       selection2.select(".preset-list-item button").call(
67107         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
67108       );
67109       var names = _presets.length === 1 ? [
67110         _presets[0].nameLabel(),
67111         _presets[0].subtitleLabel()
67112       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
67113       var label = selection2.select(".label-inner");
67114       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
67115       nameparts.exit().remove();
67116       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
67117         d2(select_default2(this));
67118       });
67119     }
67120     section.entityIDs = function(val) {
67121       if (!arguments.length)
67122         return _entityIDs;
67123       _entityIDs = val;
67124       return section;
67125     };
67126     section.presets = function(val) {
67127       if (!arguments.length)
67128         return _presets;
67129       if (!utilArrayIdentical(val, _presets)) {
67130         _presets = val;
67131         if (_presets.length === 1) {
67132           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
67133         }
67134       }
67135       return section;
67136     };
67137     function entityGeometries() {
67138       var counts = {};
67139       for (var i3 in _entityIDs) {
67140         var geometry = context.graph().geometry(_entityIDs[i3]);
67141         if (!counts[geometry])
67142           counts[geometry] = 0;
67143         counts[geometry] += 1;
67144       }
67145       return Object.keys(counts).sort(function(geom1, geom2) {
67146         return counts[geom2] - counts[geom1];
67147       });
67148     }
67149     return utilRebind(section, dispatch14, "on");
67150   }
67151
67152   // modules/ui/sections/preset_fields.js
67153   function uiSectionPresetFields(context) {
67154     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
67155     var dispatch14 = dispatch_default("change", "revert");
67156     var formFields = uiFormFields(context);
67157     var _state;
67158     var _fieldsArr;
67159     var _presets = [];
67160     var _tags;
67161     var _entityIDs;
67162     function renderDisclosureContent(selection2) {
67163       if (!_fieldsArr) {
67164         var graph = context.graph();
67165         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
67166           geoms[graph.entity(entityID).geometry(graph)] = true;
67167           return geoms;
67168         }, {}));
67169         const loc = _entityIDs.reduce(function(extent, entityID) {
67170           var entity = context.graph().entity(entityID);
67171           return extent.extend(entity.extent(context.graph()));
67172         }, geoExtent()).center();
67173         var presetsManager = _mainPresetIndex;
67174         var allFields = [];
67175         var allMoreFields = [];
67176         var sharedTotalFields;
67177         _presets.forEach(function(preset) {
67178           var fields = preset.fields(loc);
67179           var moreFields = preset.moreFields(loc);
67180           allFields = utilArrayUnion(allFields, fields);
67181           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
67182           if (!sharedTotalFields) {
67183             sharedTotalFields = utilArrayUnion(fields, moreFields);
67184           } else {
67185             sharedTotalFields = sharedTotalFields.filter(function(field) {
67186               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
67187             });
67188           }
67189         });
67190         var sharedFields = allFields.filter(function(field) {
67191           return sharedTotalFields.indexOf(field) !== -1;
67192         });
67193         var sharedMoreFields = allMoreFields.filter(function(field) {
67194           return sharedTotalFields.indexOf(field) !== -1;
67195         });
67196         _fieldsArr = [];
67197         sharedFields.forEach(function(field) {
67198           if (field.matchAllGeometry(geometries)) {
67199             _fieldsArr.push(
67200               uiField(context, field, _entityIDs)
67201             );
67202           }
67203         });
67204         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
67205         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
67206           _fieldsArr.push(
67207             uiField(context, presetsManager.field("restrictions"), _entityIDs)
67208           );
67209         }
67210         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
67211         additionalFields.sort(function(field1, field2) {
67212           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
67213         });
67214         additionalFields.forEach(function(field) {
67215           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
67216             _fieldsArr.push(
67217               uiField(context, field, _entityIDs, { show: false })
67218             );
67219           }
67220         });
67221         _fieldsArr.forEach(function(field) {
67222           field.on("change", function(t2, onInput) {
67223             dispatch14.call("change", field, _entityIDs, t2, onInput);
67224           }).on("revert", function(keys2) {
67225             dispatch14.call("revert", field, keys2);
67226           });
67227         });
67228       }
67229       _fieldsArr.forEach(function(field) {
67230         field.state(_state).tags(_tags);
67231       });
67232       selection2.call(
67233         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
67234       );
67235     }
67236     section.presets = function(val) {
67237       if (!arguments.length)
67238         return _presets;
67239       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
67240         _presets = val;
67241         _fieldsArr = null;
67242       }
67243       return section;
67244     };
67245     section.state = function(val) {
67246       if (!arguments.length)
67247         return _state;
67248       _state = val;
67249       return section;
67250     };
67251     section.tags = function(val) {
67252       if (!arguments.length)
67253         return _tags;
67254       _tags = val;
67255       return section;
67256     };
67257     section.entityIDs = function(val) {
67258       if (!arguments.length)
67259         return _entityIDs;
67260       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
67261         _entityIDs = val;
67262         _fieldsArr = null;
67263       }
67264       return section;
67265     };
67266     return utilRebind(section, dispatch14, "on");
67267   }
67268
67269   // modules/ui/sections/raw_member_editor.js
67270   function uiSectionRawMemberEditor(context) {
67271     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
67272       if (!_entityIDs || _entityIDs.length !== 1)
67273         return false;
67274       var entity = context.hasEntity(_entityIDs[0]);
67275       return entity && entity.type === "relation";
67276     }).label(function() {
67277       var entity = context.hasEntity(_entityIDs[0]);
67278       if (!entity)
67279         return "";
67280       var gt2 = entity.members.length > _maxMembers ? ">" : "";
67281       var count = gt2 + entity.members.slice(0, _maxMembers).length;
67282       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
67283     }).disclosureContent(renderDisclosureContent);
67284     var taginfo = services.taginfo;
67285     var _entityIDs;
67286     var _maxMembers = 1e3;
67287     function downloadMember(d3_event, d2) {
67288       d3_event.preventDefault();
67289       select_default2(this.parentNode).classed("tag-reference-loading", true);
67290       context.loadEntity(d2.id, function() {
67291         section.reRender();
67292       });
67293     }
67294     function zoomToMember(d3_event, d2) {
67295       d3_event.preventDefault();
67296       var entity = context.entity(d2.id);
67297       context.map().zoomToEase(entity);
67298       utilHighlightEntities([d2.id], true, context);
67299     }
67300     function selectMember(d3_event, d2) {
67301       d3_event.preventDefault();
67302       utilHighlightEntities([d2.id], false, context);
67303       var entity = context.entity(d2.id);
67304       var mapExtent = context.map().extent();
67305       if (!entity.intersects(mapExtent, context.graph())) {
67306         context.map().zoomToEase(entity);
67307       }
67308       context.enter(modeSelect(context, [d2.id]));
67309     }
67310     function changeRole(d3_event, d2) {
67311       var oldRole = d2.role;
67312       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
67313       if (oldRole !== newRole) {
67314         var member = { id: d2.id, type: d2.type, role: newRole };
67315         context.perform(
67316           actionChangeMember(d2.relation.id, member, d2.index),
67317           _t("operations.change_role.annotation", {
67318             n: 1
67319           })
67320         );
67321         context.validator().validate();
67322       }
67323     }
67324     function deleteMember(d3_event, d2) {
67325       utilHighlightEntities([d2.id], false, context);
67326       context.perform(
67327         actionDeleteMember(d2.relation.id, d2.index),
67328         _t("operations.delete_member.annotation", {
67329           n: 1
67330         })
67331       );
67332       if (!context.hasEntity(d2.relation.id)) {
67333         context.enter(modeBrowse(context));
67334       } else {
67335         context.validator().validate();
67336       }
67337     }
67338     function renderDisclosureContent(selection2) {
67339       var entityID = _entityIDs[0];
67340       var memberships = [];
67341       var entity = context.entity(entityID);
67342       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
67343         memberships.push({
67344           index,
67345           id: member.id,
67346           type: member.type,
67347           role: member.role,
67348           relation: entity,
67349           member: context.hasEntity(member.id),
67350           domId: utilUniqueDomId(entityID + "-member-" + index)
67351         });
67352       });
67353       var list = selection2.selectAll(".member-list").data([0]);
67354       list = list.enter().append("ul").attr("class", "member-list").merge(list);
67355       var items = list.selectAll("li").data(memberships, function(d2) {
67356         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
67357       });
67358       items.exit().each(unbind).remove();
67359       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
67360         return !d2.member;
67361       });
67362       itemsEnter.each(function(d2) {
67363         var item = select_default2(this);
67364         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
67365         if (d2.member) {
67366           item.on("mouseover", function() {
67367             utilHighlightEntities([d2.id], true, context);
67368           }).on("mouseout", function() {
67369             utilHighlightEntities([d2.id], false, context);
67370           });
67371           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
67372           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
67373             var matched = _mainPresetIndex.match(d4.member, context.graph());
67374             return matched && matched.name() || utilDisplayType(d4.member.id);
67375           });
67376           labelLink.append("span").attr("class", "member-entity-name").text(function(d4) {
67377             return utilDisplayName(d4.member);
67378           });
67379           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
67380           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
67381         } else {
67382           var labelText = label.append("span").attr("class", "label-text");
67383           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
67384           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
67385           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
67386         }
67387       });
67388       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67389       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
67390         return d2.domId;
67391       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
67392       if (taginfo) {
67393         wrapEnter.each(bindTypeahead);
67394       }
67395       items = items.merge(itemsEnter).order();
67396       items.select("input.member-role").property("value", function(d2) {
67397         return d2.role;
67398       }).on("blur", changeRole).on("change", changeRole);
67399       items.select("button.member-delete").on("click", deleteMember);
67400       var dragOrigin, targetIndex;
67401       items.call(
67402         drag_default().on("start", function(d3_event) {
67403           dragOrigin = {
67404             x: d3_event.x,
67405             y: d3_event.y
67406           };
67407           targetIndex = null;
67408         }).on("drag", function(d3_event) {
67409           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
67410           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
67411           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
67412             return;
67413           var index = items.nodes().indexOf(this);
67414           select_default2(this).classed("dragging", true);
67415           targetIndex = null;
67416           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
67417             var node = select_default2(this).node();
67418             if (index === index2) {
67419               return "translate(" + x2 + "px, " + y2 + "px)";
67420             } else if (index2 > index && d3_event.y > node.offsetTop) {
67421               if (targetIndex === null || index2 > targetIndex) {
67422                 targetIndex = index2;
67423               }
67424               return "translateY(-100%)";
67425             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
67426               if (targetIndex === null || index2 < targetIndex) {
67427                 targetIndex = index2;
67428               }
67429               return "translateY(100%)";
67430             }
67431             return null;
67432           });
67433         }).on("end", function(d3_event, d2) {
67434           if (!select_default2(this).classed("dragging"))
67435             return;
67436           var index = items.nodes().indexOf(this);
67437           select_default2(this).classed("dragging", false);
67438           selection2.selectAll("li.member-row").style("transform", null);
67439           if (targetIndex !== null) {
67440             context.perform(
67441               actionMoveMember(d2.relation.id, index, targetIndex),
67442               _t("operations.reorder_members.annotation")
67443             );
67444             context.validator().validate();
67445           }
67446         })
67447       );
67448       function bindTypeahead(d2) {
67449         var row = select_default2(this);
67450         var role = row.selectAll("input.member-role");
67451         var origValue = role.property("value");
67452         function sort(value, data) {
67453           var sameletter = [];
67454           var other = [];
67455           for (var i3 = 0; i3 < data.length; i3++) {
67456             if (data[i3].value.substring(0, value.length) === value) {
67457               sameletter.push(data[i3]);
67458             } else {
67459               other.push(data[i3]);
67460             }
67461           }
67462           return sameletter.concat(other);
67463         }
67464         role.call(
67465           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
67466             var geometry;
67467             if (d2.member) {
67468               geometry = context.graph().geometry(d2.member.id);
67469             } else if (d2.type === "relation") {
67470               geometry = "relation";
67471             } else if (d2.type === "way") {
67472               geometry = "line";
67473             } else {
67474               geometry = "point";
67475             }
67476             var rtype = entity.tags.type;
67477             taginfo.roles({
67478               debounce: true,
67479               rtype: rtype || "",
67480               geometry,
67481               query: role2
67482             }, function(err, data) {
67483               if (!err)
67484                 callback(sort(role2, data));
67485             });
67486           }).on("cancel", function() {
67487             role.property("value", origValue);
67488           })
67489         );
67490       }
67491       function unbind() {
67492         var row = select_default2(this);
67493         row.selectAll("input.member-role").call(uiCombobox.off, context);
67494       }
67495     }
67496     section.entityIDs = function(val) {
67497       if (!arguments.length)
67498         return _entityIDs;
67499       _entityIDs = val;
67500       return section;
67501     };
67502     return section;
67503   }
67504
67505   // modules/actions/delete_members.js
67506   function actionDeleteMembers(relationId, memberIndexes) {
67507     return function(graph) {
67508       memberIndexes.sort((a2, b2) => b2 - a2);
67509       for (var i3 in memberIndexes) {
67510         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
67511       }
67512       return graph;
67513     };
67514   }
67515
67516   // modules/ui/sections/raw_membership_editor.js
67517   function uiSectionRawMembershipEditor(context) {
67518     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
67519       return _entityIDs && _entityIDs.length;
67520     }).label(function() {
67521       var parents = getSharedParentRelations();
67522       var gt2 = parents.length > _maxMemberships ? ">" : "";
67523       var count = gt2 + parents.slice(0, _maxMemberships).length;
67524       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
67525     }).disclosureContent(renderDisclosureContent);
67526     var taginfo = services.taginfo;
67527     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
67528       if (d2.relation)
67529         utilHighlightEntities([d2.relation.id], true, context);
67530     }).itemsMouseLeave(function(d3_event, d2) {
67531       if (d2.relation)
67532         utilHighlightEntities([d2.relation.id], false, context);
67533     });
67534     var _inChange = false;
67535     var _entityIDs = [];
67536     var _showBlank;
67537     var _maxMemberships = 1e3;
67538     function getSharedParentRelations() {
67539       var parents = [];
67540       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
67541         var entity = context.graph().hasEntity(_entityIDs[i3]);
67542         if (!entity)
67543           continue;
67544         if (i3 === 0) {
67545           parents = context.graph().parentRelations(entity);
67546         } else {
67547           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
67548         }
67549         if (!parents.length)
67550           break;
67551       }
67552       return parents;
67553     }
67554     function getMemberships() {
67555       var memberships = [];
67556       var relations = getSharedParentRelations().slice(0, _maxMemberships);
67557       var isMultiselect = _entityIDs.length > 1;
67558       var i3, relation, membership, index, member, indexedMember;
67559       for (i3 = 0; i3 < relations.length; i3++) {
67560         relation = relations[i3];
67561         membership = {
67562           relation,
67563           members: [],
67564           hash: osmEntity.key(relation)
67565         };
67566         for (index = 0; index < relation.members.length; index++) {
67567           member = relation.members[index];
67568           if (_entityIDs.indexOf(member.id) !== -1) {
67569             indexedMember = Object.assign({}, member, { index });
67570             membership.members.push(indexedMember);
67571             membership.hash += "," + index.toString();
67572             if (!isMultiselect) {
67573               memberships.push(membership);
67574               membership = {
67575                 relation,
67576                 members: [],
67577                 hash: osmEntity.key(relation)
67578               };
67579             }
67580           }
67581         }
67582         if (membership.members.length)
67583           memberships.push(membership);
67584       }
67585       memberships.forEach(function(membership2) {
67586         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
67587         var roles = [];
67588         membership2.members.forEach(function(member2) {
67589           if (roles.indexOf(member2.role) === -1)
67590             roles.push(member2.role);
67591         });
67592         membership2.role = roles.length === 1 ? roles[0] : roles;
67593       });
67594       return memberships;
67595     }
67596     function selectRelation(d3_event, d2) {
67597       d3_event.preventDefault();
67598       utilHighlightEntities([d2.relation.id], false, context);
67599       context.enter(modeSelect(context, [d2.relation.id]));
67600     }
67601     function zoomToRelation(d3_event, d2) {
67602       d3_event.preventDefault();
67603       var entity = context.entity(d2.relation.id);
67604       context.map().zoomToEase(entity);
67605       utilHighlightEntities([d2.relation.id], true, context);
67606     }
67607     function changeRole(d3_event, d2) {
67608       if (d2 === 0)
67609         return;
67610       if (_inChange)
67611         return;
67612       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
67613       if (!newRole.trim() && typeof d2.role !== "string")
67614         return;
67615       var membersToUpdate = d2.members.filter(function(member) {
67616         return member.role !== newRole;
67617       });
67618       if (membersToUpdate.length) {
67619         _inChange = true;
67620         context.perform(
67621           function actionChangeMemberRoles(graph) {
67622             membersToUpdate.forEach(function(member) {
67623               var newMember = Object.assign({}, member, { role: newRole });
67624               delete newMember.index;
67625               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
67626             });
67627             return graph;
67628           },
67629           _t("operations.change_role.annotation", {
67630             n: membersToUpdate.length
67631           })
67632         );
67633         context.validator().validate();
67634       }
67635       _inChange = false;
67636     }
67637     function addMembership(d2, role) {
67638       this.blur();
67639       _showBlank = false;
67640       function actionAddMembers(relationId, ids, role2) {
67641         return function(graph) {
67642           for (var i3 in ids) {
67643             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
67644             graph = actionAddMember(relationId, member)(graph);
67645           }
67646           return graph;
67647         };
67648       }
67649       if (d2.relation) {
67650         context.perform(
67651           actionAddMembers(d2.relation.id, _entityIDs, role),
67652           _t("operations.add_member.annotation", {
67653             n: _entityIDs.length
67654           })
67655         );
67656         context.validator().validate();
67657       } else {
67658         var relation = osmRelation();
67659         context.perform(
67660           actionAddEntity(relation),
67661           actionAddMembers(relation.id, _entityIDs, role),
67662           _t("operations.add.annotation.relation")
67663         );
67664         context.enter(modeSelect(context, [relation.id]).newFeature(true));
67665       }
67666     }
67667     function deleteMembership(d3_event, d2) {
67668       this.blur();
67669       if (d2 === 0)
67670         return;
67671       utilHighlightEntities([d2.relation.id], false, context);
67672       var indexes = d2.members.map(function(member) {
67673         return member.index;
67674       });
67675       context.perform(
67676         actionDeleteMembers(d2.relation.id, indexes),
67677         _t("operations.delete_member.annotation", {
67678           n: _entityIDs.length
67679         })
67680       );
67681       context.validator().validate();
67682     }
67683     function fetchNearbyRelations(q2, callback) {
67684       var newRelation = {
67685         relation: null,
67686         value: _t("inspector.new_relation"),
67687         display: _t.append("inspector.new_relation")
67688       };
67689       var entityID = _entityIDs[0];
67690       var result = [];
67691       var graph = context.graph();
67692       function baseDisplayLabel(entity) {
67693         var matched = _mainPresetIndex.match(entity, graph);
67694         var presetName = matched && matched.name() || _t("inspector.relation");
67695         var entityName = utilDisplayName(entity) || "";
67696         return presetName + " " + entityName;
67697       }
67698       var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
67699       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
67700         result.push({
67701           relation: explicitRelation,
67702           value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
67703         });
67704       } else {
67705         context.history().intersects(context.map().extent()).forEach(function(entity) {
67706           if (entity.type !== "relation" || entity.id === entityID)
67707             return;
67708           var value = baseDisplayLabel(entity);
67709           if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1)
67710             return;
67711           result.push({ relation: entity, value });
67712         });
67713         result.sort(function(a2, b2) {
67714           return osmRelation.creationOrder(a2.relation, b2.relation);
67715         });
67716         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v2) {
67717           return v2.length > 1;
67718         });
67719         dupeGroups.forEach(function(group) {
67720           group.forEach(function(obj) {
67721             obj.value += " " + obj.relation.id;
67722           });
67723         });
67724       }
67725       result.forEach(function(obj) {
67726         obj.title = obj.value;
67727       });
67728       result.unshift(newRelation);
67729       callback(result);
67730     }
67731     function renderDisclosureContent(selection2) {
67732       var memberships = getMemberships();
67733       var list = selection2.selectAll(".member-list").data([0]);
67734       list = list.enter().append("ul").attr("class", "member-list").merge(list);
67735       var items = list.selectAll("li.member-row-normal").data(memberships, function(d2) {
67736         return d2.hash;
67737       });
67738       items.exit().each(unbind).remove();
67739       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
67740       itemsEnter.on("mouseover", function(d3_event, d2) {
67741         utilHighlightEntities([d2.relation.id], true, context);
67742       }).on("mouseout", function(d3_event, d2) {
67743         utilHighlightEntities([d2.relation.id], false, context);
67744       });
67745       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
67746         return d2.domId;
67747       });
67748       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
67749       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
67750         var matched = _mainPresetIndex.match(d2.relation, context.graph());
67751         return matched && matched.name() || _t.html("inspector.relation");
67752       });
67753       labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
67754         return utilDisplayName(d2.relation);
67755       });
67756       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
67757       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
67758       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67759       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
67760         return d2.domId;
67761       }).property("type", "text").property("value", function(d2) {
67762         return typeof d2.role === "string" ? d2.role : "";
67763       }).attr("title", function(d2) {
67764         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
67765       }).attr("placeholder", function(d2) {
67766         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
67767       }).classed("mixed", function(d2) {
67768         return Array.isArray(d2.role);
67769       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
67770       if (taginfo) {
67771         wrapEnter.each(bindTypeahead);
67772       }
67773       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
67774       newMembership.exit().remove();
67775       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
67776       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
67777       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
67778       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
67779         list.selectAll(".member-row-new").remove();
67780       });
67781       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67782       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
67783       newMembership = newMembership.merge(newMembershipEnter);
67784       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
67785         nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
67786       );
67787       var addRow = selection2.selectAll(".add-row").data([0]);
67788       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
67789       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
67790       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
67791       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
67792       addRowEnter.append("div").attr("class", "space-value");
67793       addRowEnter.append("div").attr("class", "space-buttons");
67794       addRow = addRow.merge(addRowEnter);
67795       addRow.select(".add-relation").on("click", function() {
67796         _showBlank = true;
67797         section.reRender();
67798         list.selectAll(".member-entity-input").node().focus();
67799       });
67800       function acceptEntity(d2) {
67801         if (!d2) {
67802           cancelEntity();
67803           return;
67804         }
67805         if (d2.relation)
67806           utilHighlightEntities([d2.relation.id], false, context);
67807         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
67808         addMembership(d2, role);
67809       }
67810       function cancelEntity() {
67811         var input = newMembership.selectAll(".member-entity-input");
67812         input.property("value", "");
67813         context.surface().selectAll(".highlighted").classed("highlighted", false);
67814       }
67815       function bindTypeahead(d2) {
67816         var row = select_default2(this);
67817         var role = row.selectAll("input.member-role");
67818         var origValue = role.property("value");
67819         function sort(value, data) {
67820           var sameletter = [];
67821           var other = [];
67822           for (var i3 = 0; i3 < data.length; i3++) {
67823             if (data[i3].value.substring(0, value.length) === value) {
67824               sameletter.push(data[i3]);
67825             } else {
67826               other.push(data[i3]);
67827             }
67828           }
67829           return sameletter.concat(other);
67830         }
67831         role.call(
67832           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
67833             var rtype = d2.relation.tags.type;
67834             taginfo.roles({
67835               debounce: true,
67836               rtype: rtype || "",
67837               geometry: context.graph().geometry(_entityIDs[0]),
67838               query: role2
67839             }, function(err, data) {
67840               if (!err)
67841                 callback(sort(role2, data));
67842             });
67843           }).on("cancel", function() {
67844             role.property("value", origValue);
67845           })
67846         );
67847       }
67848       function unbind() {
67849         var row = select_default2(this);
67850         row.selectAll("input.member-role").call(uiCombobox.off, context);
67851       }
67852     }
67853     section.entityIDs = function(val) {
67854       if (!arguments.length)
67855         return _entityIDs;
67856       _entityIDs = val;
67857       _showBlank = false;
67858       return section;
67859     };
67860     return section;
67861   }
67862
67863   // modules/ui/sections/selection_list.js
67864   function uiSectionSelectionList(context) {
67865     var _selectedIDs = [];
67866     var section = uiSection("selected-features", context).shouldDisplay(function() {
67867       return _selectedIDs.length > 1;
67868     }).label(function() {
67869       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
67870     }).disclosureContent(renderDisclosureContent);
67871     context.history().on("change.selectionList", function(difference) {
67872       if (difference) {
67873         section.reRender();
67874       }
67875     });
67876     section.entityIDs = function(val) {
67877       if (!arguments.length)
67878         return _selectedIDs;
67879       _selectedIDs = val;
67880       return section;
67881     };
67882     function selectEntity(d3_event, entity) {
67883       context.enter(modeSelect(context, [entity.id]));
67884     }
67885     function deselectEntity(d3_event, entity) {
67886       var selectedIDs = _selectedIDs.slice();
67887       var index = selectedIDs.indexOf(entity.id);
67888       if (index > -1) {
67889         selectedIDs.splice(index, 1);
67890         context.enter(modeSelect(context, selectedIDs));
67891       }
67892     }
67893     function renderDisclosureContent(selection2) {
67894       var list = selection2.selectAll(".feature-list").data([0]);
67895       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
67896       var entities = _selectedIDs.map(function(id2) {
67897         return context.hasEntity(id2);
67898       }).filter(Boolean);
67899       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
67900       items.exit().remove();
67901       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
67902         select_default2(this).on("mouseover", function() {
67903           utilHighlightEntities([d2.id], true, context);
67904         }).on("mouseout", function() {
67905           utilHighlightEntities([d2.id], false, context);
67906         });
67907       });
67908       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
67909       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
67910       label.append("span").attr("class", "entity-type");
67911       label.append("span").attr("class", "entity-name");
67912       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
67913       items = items.merge(enter);
67914       items.selectAll(".entity-geom-icon use").attr("href", function() {
67915         var entity = this.parentNode.parentNode.__data__;
67916         return "#iD-icon-" + entity.geometry(context.graph());
67917       });
67918       items.selectAll(".entity-type").text(function(entity) {
67919         return _mainPresetIndex.match(entity, context.graph()).name();
67920       });
67921       items.selectAll(".entity-name").text(function(d2) {
67922         var entity = context.entity(d2.id);
67923         return utilDisplayName(entity);
67924       });
67925     }
67926     return section;
67927   }
67928
67929   // modules/ui/entity_editor.js
67930   function uiEntityEditor(context) {
67931     var dispatch14 = dispatch_default("choose");
67932     var _state = "select";
67933     var _coalesceChanges = false;
67934     var _modified = false;
67935     var _base;
67936     var _entityIDs;
67937     var _activePresets = [];
67938     var _newFeature;
67939     var _sections;
67940     function entityEditor(selection2) {
67941       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
67942       var header = selection2.selectAll(".header").data([0]);
67943       var headerEnter = header.enter().append("div").attr("class", "header fillL");
67944       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
67945       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
67946       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
67947         context.enter(modeBrowse(context));
67948       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
67949       headerEnter.append("h2");
67950       header = header.merge(headerEnter);
67951       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
67952       header.selectAll(".preset-reset").on("click", function() {
67953         dispatch14.call("choose", this, _activePresets);
67954       });
67955       var body = selection2.selectAll(".inspector-body").data([0]);
67956       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
67957       body = body.merge(bodyEnter);
67958       if (!_sections) {
67959         _sections = [
67960           uiSectionSelectionList(context),
67961           uiSectionFeatureType(context).on("choose", function(presets) {
67962             dispatch14.call("choose", this, presets);
67963           }),
67964           uiSectionEntityIssues(context),
67965           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
67966           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
67967           uiSectionRawMemberEditor(context),
67968           uiSectionRawMembershipEditor(context)
67969         ];
67970       }
67971       _sections.forEach(function(section) {
67972         if (section.entityIDs) {
67973           section.entityIDs(_entityIDs);
67974         }
67975         if (section.presets) {
67976           section.presets(_activePresets);
67977         }
67978         if (section.tags) {
67979           section.tags(combinedTags);
67980         }
67981         if (section.state) {
67982           section.state(_state);
67983         }
67984         body.call(section.render);
67985       });
67986       context.history().on("change.entity-editor", historyChanged);
67987       function historyChanged(difference) {
67988         if (selection2.selectAll(".entity-editor").empty())
67989           return;
67990         if (_state === "hide")
67991           return;
67992         var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
67993         if (!significant)
67994           return;
67995         _entityIDs = _entityIDs.filter(context.hasEntity);
67996         if (!_entityIDs.length)
67997           return;
67998         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
67999         loadActivePresets();
68000         var graph = context.graph();
68001         entityEditor.modified(_base !== graph);
68002         entityEditor(selection2);
68003         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
68004           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
68005         }
68006       }
68007     }
68008     function changeTags(entityIDs, changed, onInput) {
68009       var actions = [];
68010       for (var i3 in entityIDs) {
68011         var entityID = entityIDs[i3];
68012         var entity = context.entity(entityID);
68013         var tags = Object.assign({}, entity.tags);
68014         if (typeof changed === "function") {
68015           tags = changed(tags);
68016         } else {
68017           for (var k2 in changed) {
68018             if (!k2)
68019               continue;
68020             var v2 = changed[k2];
68021             if (typeof v2 === "object") {
68022               tags[k2] = tags[v2.oldKey];
68023             } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
68024               tags[k2] = v2;
68025             }
68026           }
68027         }
68028         if (!onInput) {
68029           tags = utilCleanTags(tags);
68030         }
68031         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
68032           actions.push(actionChangeTags(entityID, tags));
68033         }
68034       }
68035       if (actions.length) {
68036         var combinedAction = function(graph) {
68037           actions.forEach(function(action) {
68038             graph = action(graph);
68039           });
68040           return graph;
68041         };
68042         var annotation = _t("operations.change_tags.annotation");
68043         if (_coalesceChanges) {
68044           context.overwrite(combinedAction, annotation);
68045         } else {
68046           context.perform(combinedAction, annotation);
68047           _coalesceChanges = !!onInput;
68048         }
68049       }
68050       if (!onInput) {
68051         context.validator().validate();
68052       }
68053     }
68054     function revertTags(keys2) {
68055       var actions = [];
68056       for (var i3 in _entityIDs) {
68057         var entityID = _entityIDs[i3];
68058         var original = context.graph().base().entities[entityID];
68059         var changed = {};
68060         for (var j3 in keys2) {
68061           var key = keys2[j3];
68062           changed[key] = original ? original.tags[key] : void 0;
68063         }
68064         var entity = context.entity(entityID);
68065         var tags = Object.assign({}, entity.tags);
68066         for (var k2 in changed) {
68067           if (!k2)
68068             continue;
68069           var v2 = changed[k2];
68070           if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
68071             tags[k2] = v2;
68072           }
68073         }
68074         tags = utilCleanTags(tags);
68075         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
68076           actions.push(actionChangeTags(entityID, tags));
68077         }
68078       }
68079       if (actions.length) {
68080         var combinedAction = function(graph) {
68081           actions.forEach(function(action) {
68082             graph = action(graph);
68083           });
68084           return graph;
68085         };
68086         var annotation = _t("operations.change_tags.annotation");
68087         if (_coalesceChanges) {
68088           context.overwrite(combinedAction, annotation);
68089         } else {
68090           context.perform(combinedAction, annotation);
68091           _coalesceChanges = false;
68092         }
68093       }
68094       context.validator().validate();
68095     }
68096     entityEditor.modified = function(val) {
68097       if (!arguments.length)
68098         return _modified;
68099       _modified = val;
68100       return entityEditor;
68101     };
68102     entityEditor.state = function(val) {
68103       if (!arguments.length)
68104         return _state;
68105       _state = val;
68106       return entityEditor;
68107     };
68108     entityEditor.entityIDs = function(val) {
68109       if (!arguments.length)
68110         return _entityIDs;
68111       _base = context.graph();
68112       _coalesceChanges = false;
68113       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
68114         return entityEditor;
68115       _entityIDs = val;
68116       loadActivePresets(true);
68117       return entityEditor.modified(false);
68118     };
68119     entityEditor.newFeature = function(val) {
68120       if (!arguments.length)
68121         return _newFeature;
68122       _newFeature = val;
68123       return entityEditor;
68124     };
68125     function loadActivePresets(isForNewSelection) {
68126       var graph = context.graph();
68127       var counts = {};
68128       for (var i3 in _entityIDs) {
68129         var entity = graph.hasEntity(_entityIDs[i3]);
68130         if (!entity)
68131           return;
68132         var match = _mainPresetIndex.match(entity, graph);
68133         if (!counts[match.id])
68134           counts[match.id] = 0;
68135         counts[match.id] += 1;
68136       }
68137       var matches = Object.keys(counts).sort(function(p1, p2) {
68138         return counts[p2] - counts[p1];
68139       }).map(function(pID) {
68140         return _mainPresetIndex.item(pID);
68141       });
68142       if (!isForNewSelection) {
68143         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
68144         if (weakPreset && matches.length === 1 && matches[0].isFallback())
68145           return;
68146       }
68147       entityEditor.presets(matches);
68148     }
68149     entityEditor.presets = function(val) {
68150       if (!arguments.length)
68151         return _activePresets;
68152       if (!utilArrayIdentical(val, _activePresets)) {
68153         _activePresets = val;
68154       }
68155       return entityEditor;
68156     };
68157     return utilRebind(entityEditor, dispatch14, "on");
68158   }
68159
68160   // modules/ui/feature_list.js
68161   var sexagesimal = __toESM(require_sexagesimal());
68162   function uiFeatureList(context) {
68163     var _geocodeResults;
68164     function featureList(selection2) {
68165       var header = selection2.append("div").attr("class", "header fillL");
68166       header.append("h2").call(_t.append("inspector.feature_list"));
68167       var searchWrap = selection2.append("div").attr("class", "search-header");
68168       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68169       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
68170       var listWrap = selection2.append("div").attr("class", "inspector-body");
68171       var list = listWrap.append("div").attr("class", "feature-list");
68172       context.on("exit.feature-list", clearSearch);
68173       context.map().on("drawn.feature-list", mapDrawn);
68174       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
68175       function focusSearch(d3_event) {
68176         var mode = context.mode() && context.mode().id;
68177         if (mode !== "browse")
68178           return;
68179         d3_event.preventDefault();
68180         search.node().focus();
68181       }
68182       function keydown(d3_event) {
68183         if (d3_event.keyCode === 27) {
68184           search.node().blur();
68185         }
68186       }
68187       function keypress(d3_event) {
68188         var q2 = search.property("value"), items = list.selectAll(".feature-list-item");
68189         if (d3_event.keyCode === 13 && // ↩ Return
68190         q2.length && items.size()) {
68191           click(d3_event, items.datum());
68192         }
68193       }
68194       function inputevent() {
68195         _geocodeResults = void 0;
68196         drawList();
68197       }
68198       function clearSearch() {
68199         search.property("value", "");
68200         drawList();
68201       }
68202       function mapDrawn(e3) {
68203         if (e3.full) {
68204           drawList();
68205         }
68206       }
68207       function features() {
68208         var result = [];
68209         var graph = context.graph();
68210         var visibleCenter = context.map().extent().center();
68211         var q2 = search.property("value").toLowerCase();
68212         if (!q2)
68213           return result;
68214         var locationMatch = sexagesimal.pair(q2.toUpperCase()) || q2.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
68215         if (locationMatch) {
68216           var loc = [Number(locationMatch[0]), Number(locationMatch[1])];
68217           result.push({
68218             id: -1,
68219             geometry: "point",
68220             type: _t("inspector.location"),
68221             name: dmsCoordinatePair([loc[1], loc[0]]),
68222             location: loc
68223           });
68224         }
68225         var idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
68226         if (idMatch) {
68227           var elemType = idMatch[1].charAt(0);
68228           var elemId = idMatch[2];
68229           result.push({
68230             id: elemType + elemId,
68231             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
68232             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
68233             name: elemId
68234           });
68235         }
68236         var allEntities = graph.entities;
68237         var localResults = [];
68238         for (var id2 in allEntities) {
68239           var entity = allEntities[id2];
68240           if (!entity)
68241             continue;
68242           var name = utilDisplayName(entity) || "";
68243           if (name.toLowerCase().indexOf(q2) < 0)
68244             continue;
68245           var matched = _mainPresetIndex.match(entity, graph);
68246           var type2 = matched && matched.name() || utilDisplayType(entity.id);
68247           var extent = entity.extent(graph);
68248           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
68249           localResults.push({
68250             id: entity.id,
68251             entity,
68252             geometry: entity.geometry(graph),
68253             type: type2,
68254             name,
68255             distance
68256           });
68257           if (localResults.length > 100)
68258             break;
68259         }
68260         localResults = localResults.sort(function byDistance(a2, b2) {
68261           return a2.distance - b2.distance;
68262         });
68263         result = result.concat(localResults);
68264         (_geocodeResults || []).forEach(function(d2) {
68265           if (d2.osm_type && d2.osm_id) {
68266             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
68267             var tags = {};
68268             tags[d2.class] = d2.type;
68269             var attrs = { id: id3, type: d2.osm_type, tags };
68270             if (d2.osm_type === "way") {
68271               attrs.nodes = ["a", "a"];
68272             }
68273             var tempEntity = osmEntity(attrs);
68274             var tempGraph = coreGraph([tempEntity]);
68275             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
68276             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
68277             result.push({
68278               id: tempEntity.id,
68279               geometry: tempEntity.geometry(tempGraph),
68280               type: type3,
68281               name: d2.display_name,
68282               extent: new geoExtent(
68283                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
68284                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
68285               )
68286             });
68287           }
68288         });
68289         if (q2.match(/^[0-9]+$/)) {
68290           result.push({
68291             id: "n" + q2,
68292             geometry: "point",
68293             type: _t("inspector.node"),
68294             name: q2
68295           });
68296           result.push({
68297             id: "w" + q2,
68298             geometry: "line",
68299             type: _t("inspector.way"),
68300             name: q2
68301           });
68302           result.push({
68303             id: "r" + q2,
68304             geometry: "relation",
68305             type: _t("inspector.relation"),
68306             name: q2
68307           });
68308         }
68309         return result;
68310       }
68311       function drawList() {
68312         var value = search.property("value");
68313         var results = features();
68314         list.classed("filtered", value.length);
68315         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"));
68316         resultsIndicator.append("span").attr("class", "entity-name");
68317         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
68318         if (services.geocoder) {
68319           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"));
68320         }
68321         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
68322         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
68323         list.selectAll(".feature-list-item").data([-1]).remove();
68324         var items = list.selectAll(".feature-list-item").data(results, function(d2) {
68325           return d2.id;
68326         });
68327         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
68328         var label = enter.append("div").attr("class", "label");
68329         label.each(function(d2) {
68330           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
68331         });
68332         label.append("span").attr("class", "entity-type").text(function(d2) {
68333           return d2.type;
68334         });
68335         label.append("span").attr("class", "entity-name").text(function(d2) {
68336           return d2.name;
68337         });
68338         enter.style("opacity", 0).transition().style("opacity", 1);
68339         items.order();
68340         items.exit().remove();
68341       }
68342       function mouseover(d3_event, d2) {
68343         if (d2.id === -1)
68344           return;
68345         utilHighlightEntities([d2.id], true, context);
68346       }
68347       function mouseout(d3_event, d2) {
68348         if (d2.id === -1)
68349           return;
68350         utilHighlightEntities([d2.id], false, context);
68351       }
68352       function click(d3_event, d2) {
68353         d3_event.preventDefault();
68354         if (d2.location) {
68355           context.map().centerZoomEase([d2.location[1], d2.location[0]], 19);
68356         } else if (d2.entity) {
68357           utilHighlightEntities([d2.id], false, context);
68358           context.enter(modeSelect(context, [d2.entity.id]));
68359           context.map().zoomToEase(d2.entity);
68360         } else {
68361           context.zoomToEntity(d2.id);
68362         }
68363       }
68364       function geocoderSearch() {
68365         services.geocoder.search(search.property("value"), function(err, resp) {
68366           _geocodeResults = resp || [];
68367           drawList();
68368         });
68369       }
68370     }
68371     return featureList;
68372   }
68373
68374   // modules/ui/improveOSM_comments.js
68375   function uiImproveOsmComments() {
68376     let _qaItem;
68377     function issueComments(selection2) {
68378       let comments = selection2.selectAll(".comments-container").data([0]);
68379       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
68380       services.improveOSM.getComments(_qaItem).then((d2) => {
68381         if (!d2.comments)
68382           return;
68383         const commentEnter = comments.selectAll(".comment").data(d2.comments).enter().append("div").attr("class", "comment");
68384         commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
68385         const mainEnter = commentEnter.append("div").attr("class", "comment-main");
68386         const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
68387         metadataEnter.append("div").attr("class", "comment-author").each(function(d4) {
68388           const osm = services.osm;
68389           let selection3 = select_default2(this);
68390           if (osm && d4.username) {
68391             selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d4.username)).attr("target", "_blank");
68392           }
68393           selection3.text((d5) => d5.username);
68394         });
68395         metadataEnter.append("div").attr("class", "comment-date").html((d4) => _t.html("note.status.commented", { when: localeDateString2(d4.timestamp) }));
68396         mainEnter.append("div").attr("class", "comment-text").append("p").text((d4) => d4.text);
68397       }).catch((err) => {
68398         console.log(err);
68399       });
68400     }
68401     function localeDateString2(s2) {
68402       if (!s2)
68403         return null;
68404       const options2 = { day: "numeric", month: "short", year: "numeric" };
68405       const d2 = new Date(s2 * 1e3);
68406       if (isNaN(d2.getTime()))
68407         return null;
68408       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
68409     }
68410     issueComments.issue = function(val) {
68411       if (!arguments.length)
68412         return _qaItem;
68413       _qaItem = val;
68414       return issueComments;
68415     };
68416     return issueComments;
68417   }
68418
68419   // modules/ui/improveOSM_details.js
68420   function uiImproveOsmDetails(context) {
68421     let _qaItem;
68422     function issueDetail(d2) {
68423       if (d2.desc)
68424         return d2.desc;
68425       const issueKey = d2.issueKey;
68426       d2.replacements = d2.replacements || {};
68427       d2.replacements.default = { html: _t.html("inspector.unknown") };
68428       return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d2.replacements);
68429     }
68430     function improveOsmDetails(selection2) {
68431       const details = selection2.selectAll(".error-details").data(
68432         _qaItem ? [_qaItem] : [],
68433         (d2) => `${d2.id}-${d2.status || 0}`
68434       );
68435       details.exit().remove();
68436       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
68437       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
68438       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
68439       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
68440       let relatedEntities = [];
68441       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
68442         const link2 = select_default2(this);
68443         const isObjectLink = link2.classed("error_object_link");
68444         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
68445         const entity = context.hasEntity(entityID);
68446         relatedEntities.push(entityID);
68447         link2.on("mouseenter", () => {
68448           utilHighlightEntities([entityID], true, context);
68449         }).on("mouseleave", () => {
68450           utilHighlightEntities([entityID], false, context);
68451         }).on("click", (d3_event) => {
68452           d3_event.preventDefault();
68453           utilHighlightEntities([entityID], false, context);
68454           const osmlayer = context.layers().layer("osm");
68455           if (!osmlayer.enabled()) {
68456             osmlayer.enabled(true);
68457           }
68458           context.map().centerZoom(_qaItem.loc, 20);
68459           if (entity) {
68460             context.enter(modeSelect(context, [entityID]));
68461           } else {
68462             context.loadEntity(entityID, (err, result) => {
68463               if (err)
68464                 return;
68465               const entity2 = result.data.find((e3) => e3.id === entityID);
68466               if (entity2)
68467                 context.enter(modeSelect(context, [entityID]));
68468             });
68469           }
68470         });
68471         if (entity) {
68472           let name = utilDisplayName(entity);
68473           if (!name && !isObjectLink) {
68474             const preset = _mainPresetIndex.match(entity, context.graph());
68475             name = preset && !preset.isFallback() && preset.name();
68476           }
68477           if (name) {
68478             this.innerText = name;
68479           }
68480         }
68481       });
68482       context.features().forceVisible(relatedEntities);
68483       context.map().pan([0, 0]);
68484     }
68485     improveOsmDetails.issue = function(val) {
68486       if (!arguments.length)
68487         return _qaItem;
68488       _qaItem = val;
68489       return improveOsmDetails;
68490     };
68491     return improveOsmDetails;
68492   }
68493
68494   // modules/ui/improveOSM_header.js
68495   function uiImproveOsmHeader() {
68496     let _qaItem;
68497     function issueTitle(d2) {
68498       const issueKey = d2.issueKey;
68499       d2.replacements = d2.replacements || {};
68500       d2.replacements.default = { html: _t.html("inspector.unknown") };
68501       return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d2.replacements);
68502     }
68503     function improveOsmHeader(selection2) {
68504       const header = selection2.selectAll(".qa-header").data(
68505         _qaItem ? [_qaItem] : [],
68506         (d2) => `${d2.id}-${d2.status || 0}`
68507       );
68508       header.exit().remove();
68509       const headerEnter = header.enter().append("div").attr("class", "qa-header");
68510       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d2) => `preset-icon-28 qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
68511       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");
68512       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
68513       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
68514     }
68515     improveOsmHeader.issue = function(val) {
68516       if (!arguments.length)
68517         return _qaItem;
68518       _qaItem = val;
68519       return improveOsmHeader;
68520     };
68521     return improveOsmHeader;
68522   }
68523
68524   // modules/ui/improveOSM_editor.js
68525   function uiImproveOsmEditor(context) {
68526     const dispatch14 = dispatch_default("change");
68527     const qaDetails = uiImproveOsmDetails(context);
68528     const qaComments = uiImproveOsmComments(context);
68529     const qaHeader = uiImproveOsmHeader(context);
68530     let _qaItem;
68531     function improveOsmEditor(selection2) {
68532       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
68533       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
68534       headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
68535       let body = selection2.selectAll(".body").data([0]);
68536       body = body.enter().append("div").attr("class", "body").merge(body);
68537       const editor = body.selectAll(".qa-editor").data([0]);
68538       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);
68539     }
68540     function improveOsmSaveSection(selection2) {
68541       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68542       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
68543       let saveSection = selection2.selectAll(".qa-save").data(
68544         isShown ? [_qaItem] : [],
68545         (d2) => `${d2.id}-${d2.status || 0}`
68546       );
68547       saveSection.exit().remove();
68548       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
68549       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
68550       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d2) => d2.newComment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
68551       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
68552       function changeInput() {
68553         const input = select_default2(this);
68554         let val = input.property("value").trim();
68555         if (val === "") {
68556           val = void 0;
68557         }
68558         _qaItem = _qaItem.update({ newComment: val });
68559         const qaService = services.improveOSM;
68560         if (qaService) {
68561           qaService.replaceItem(_qaItem);
68562         }
68563         saveSection.call(qaSaveButtons);
68564       }
68565     }
68566     function qaSaveButtons(selection2) {
68567       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68568       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
68569       buttonSection.exit().remove();
68570       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
68571       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
68572       buttonEnter.append("button").attr("class", "button close-button action");
68573       buttonEnter.append("button").attr("class", "button ignore-button action");
68574       buttonSection = buttonSection.merge(buttonEnter);
68575       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
68576         this.blur();
68577         const qaService = services.improveOSM;
68578         if (qaService) {
68579           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68580         }
68581       });
68582       buttonSection.select(".close-button").html((d2) => {
68583         const andComment = d2.newComment ? "_comment" : "";
68584         return _t.html(`QA.keepRight.close${andComment}`);
68585       }).on("click.close", function(d3_event, d2) {
68586         this.blur();
68587         const qaService = services.improveOSM;
68588         if (qaService) {
68589           d2.newStatus = "SOLVED";
68590           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68591         }
68592       });
68593       buttonSection.select(".ignore-button").html((d2) => {
68594         const andComment = d2.newComment ? "_comment" : "";
68595         return _t.html(`QA.keepRight.ignore${andComment}`);
68596       }).on("click.ignore", function(d3_event, d2) {
68597         this.blur();
68598         const qaService = services.improveOSM;
68599         if (qaService) {
68600           d2.newStatus = "INVALID";
68601           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68602         }
68603       });
68604     }
68605     improveOsmEditor.error = function(val) {
68606       if (!arguments.length)
68607         return _qaItem;
68608       _qaItem = val;
68609       return improveOsmEditor;
68610     };
68611     return utilRebind(improveOsmEditor, dispatch14, "on");
68612   }
68613
68614   // modules/ui/preset_list.js
68615   function uiPresetList(context) {
68616     var dispatch14 = dispatch_default("cancel", "choose");
68617     var _entityIDs;
68618     var _currLoc;
68619     var _currentPresets;
68620     var _autofocus = false;
68621     function presetList(selection2) {
68622       if (!_entityIDs)
68623         return;
68624       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
68625       selection2.html("");
68626       var messagewrap = selection2.append("div").attr("class", "header fillL");
68627       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
68628       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
68629       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
68630         dispatch14.call("cancel", this);
68631       }).call(svgIcon(`#iD-icon-${direction}`));
68632       function initialKeydown(d3_event) {
68633         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
68634           d3_event.preventDefault();
68635           d3_event.stopPropagation();
68636           operationDelete(context, _entityIDs)();
68637         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
68638           d3_event.preventDefault();
68639           d3_event.stopPropagation();
68640           context.undo();
68641         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
68642           select_default2(this).on("keydown", keydown);
68643           keydown.call(this, d3_event);
68644         }
68645       }
68646       function keydown(d3_event) {
68647         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
68648         search.node().selectionStart === search.property("value").length) {
68649           d3_event.preventDefault();
68650           d3_event.stopPropagation();
68651           var buttons = list.selectAll(".preset-list-button");
68652           if (!buttons.empty())
68653             buttons.nodes()[0].focus();
68654         }
68655       }
68656       function keypress(d3_event) {
68657         var value = search.property("value");
68658         if (d3_event.keyCode === 13 && // ↩ Return
68659         value.length) {
68660           list.selectAll(".preset-list-item:first-child").each(function(d2) {
68661             d2.choose.call(this);
68662           });
68663         }
68664       }
68665       function inputevent() {
68666         var value = search.property("value");
68667         list.classed("filtered", value.length);
68668         var results, messageText;
68669         if (value.length) {
68670           results = presets.search(value, entityGeometries()[0], _currLoc);
68671           messageText = _t.html("inspector.results", {
68672             n: results.collection.length,
68673             search: value
68674           });
68675         } else {
68676           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
68677           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
68678           messageText = _t.html("inspector.choose");
68679         }
68680         list.call(drawList, results);
68681         message.html(messageText);
68682       }
68683       var searchWrap = selection2.append("div").attr("class", "search-header");
68684       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68685       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));
68686       if (_autofocus) {
68687         search.node().focus();
68688         setTimeout(function() {
68689           search.node().focus();
68690         }, 0);
68691       }
68692       var listWrap = selection2.append("div").attr("class", "inspector-body");
68693       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
68694       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
68695       context.features().on("change.preset-list", updateForFeatureHiddenState);
68696     }
68697     function drawList(list, presets) {
68698       presets = presets.matchAllGeometry(entityGeometries());
68699       var collection = presets.collection.reduce(function(collection2, preset) {
68700         if (!preset)
68701           return collection2;
68702         if (preset.members) {
68703           if (preset.members.collection.filter(function(preset2) {
68704             return preset2.addable();
68705           }).length > 1) {
68706             collection2.push(CategoryItem(preset));
68707           }
68708         } else if (preset.addable()) {
68709           collection2.push(PresetItem(preset));
68710         }
68711         return collection2;
68712       }, []);
68713       var items = list.selectAll(".preset-list-item").data(collection, function(d2) {
68714         return d2.preset.id;
68715       });
68716       items.order();
68717       items.exit().remove();
68718       items.enter().append("div").attr("class", function(item) {
68719         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
68720       }).classed("current", function(item) {
68721         return _currentPresets.indexOf(item.preset) !== -1;
68722       }).each(function(item) {
68723         select_default2(this).call(item);
68724       }).style("opacity", 0).transition().style("opacity", 1);
68725       updateForFeatureHiddenState();
68726     }
68727     function itemKeydown(d3_event) {
68728       var item = select_default2(this.closest(".preset-list-item"));
68729       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
68730       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
68731         d3_event.preventDefault();
68732         d3_event.stopPropagation();
68733         var nextItem = select_default2(item.node().nextElementSibling);
68734         if (nextItem.empty()) {
68735           if (!parentItem.empty()) {
68736             nextItem = select_default2(parentItem.node().nextElementSibling);
68737           }
68738         } else if (select_default2(this).classed("expanded")) {
68739           nextItem = item.select(".subgrid .preset-list-item:first-child");
68740         }
68741         if (!nextItem.empty()) {
68742           nextItem.select(".preset-list-button").node().focus();
68743         }
68744       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
68745         d3_event.preventDefault();
68746         d3_event.stopPropagation();
68747         var previousItem = select_default2(item.node().previousElementSibling);
68748         if (previousItem.empty()) {
68749           if (!parentItem.empty()) {
68750             previousItem = parentItem;
68751           }
68752         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
68753           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
68754         }
68755         if (!previousItem.empty()) {
68756           previousItem.select(".preset-list-button").node().focus();
68757         } else {
68758           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
68759           search.node().focus();
68760         }
68761       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
68762         d3_event.preventDefault();
68763         d3_event.stopPropagation();
68764         if (!parentItem.empty()) {
68765           parentItem.select(".preset-list-button").node().focus();
68766         }
68767       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
68768         d3_event.preventDefault();
68769         d3_event.stopPropagation();
68770         item.datum().choose.call(select_default2(this).node());
68771       }
68772     }
68773     function CategoryItem(preset) {
68774       var box, sublist, shown = false;
68775       function item(selection2) {
68776         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
68777         function click() {
68778           var isExpanded = select_default2(this).classed("expanded");
68779           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
68780           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
68781           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
68782           item.choose();
68783         }
68784         var geometries = entityGeometries();
68785         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) {
68786           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
68787             d3_event.preventDefault();
68788             d3_event.stopPropagation();
68789             if (!select_default2(this).classed("expanded")) {
68790               click.call(this, d3_event);
68791             }
68792           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
68793             d3_event.preventDefault();
68794             d3_event.stopPropagation();
68795             if (select_default2(this).classed("expanded")) {
68796               click.call(this, d3_event);
68797             }
68798           } else {
68799             itemKeydown.call(this, d3_event);
68800           }
68801         });
68802         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
68803         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");
68804         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
68805         box.append("div").attr("class", "arrow");
68806         sublist = box.append("div").attr("class", "preset-list fillL3");
68807       }
68808       item.choose = function() {
68809         if (!box || !sublist)
68810           return;
68811         if (shown) {
68812           shown = false;
68813           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
68814         } else {
68815           shown = true;
68816           var members = preset.members.matchAllGeometry(entityGeometries());
68817           sublist.call(drawList, members);
68818           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
68819         }
68820       };
68821       item.preset = preset;
68822       return item;
68823     }
68824     function PresetItem(preset) {
68825       function item(selection2) {
68826         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
68827         var geometries = entityGeometries();
68828         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);
68829         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
68830         var nameparts = [
68831           preset.nameLabel(),
68832           preset.subtitleLabel()
68833         ].filter(Boolean);
68834         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
68835           d2(select_default2(this));
68836         });
68837         wrap2.call(item.reference.button);
68838         selection2.call(item.reference.body);
68839       }
68840       item.choose = function() {
68841         if (select_default2(this).classed("disabled"))
68842           return;
68843         if (!context.inIntro()) {
68844           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
68845         }
68846         context.perform(
68847           function(graph) {
68848             for (var i3 in _entityIDs) {
68849               var entityID = _entityIDs[i3];
68850               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
68851               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
68852             }
68853             return graph;
68854           },
68855           _t("operations.change_tags.annotation")
68856         );
68857         context.validator().validate();
68858         dispatch14.call("choose", this, preset);
68859       };
68860       item.help = function(d3_event) {
68861         d3_event.stopPropagation();
68862         item.reference.toggle();
68863       };
68864       item.preset = preset;
68865       item.reference = uiTagReference(preset.reference(), context);
68866       return item;
68867     }
68868     function updateForFeatureHiddenState() {
68869       if (!_entityIDs.every(context.hasEntity))
68870         return;
68871       var geometries = entityGeometries();
68872       var button = context.container().selectAll(".preset-list .preset-list-button");
68873       button.call(uiTooltip().destroyAny);
68874       button.each(function(item, index) {
68875         var hiddenPresetFeaturesId;
68876         for (var i3 in geometries) {
68877           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
68878           if (hiddenPresetFeaturesId)
68879             break;
68880         }
68881         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
68882         select_default2(this).classed("disabled", isHiddenPreset);
68883         if (isHiddenPreset) {
68884           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
68885           select_default2(this).call(
68886             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
68887               features: _t("feature." + hiddenPresetFeaturesId + ".description")
68888             })).placement(index < 2 ? "bottom" : "top")
68889           );
68890         }
68891       });
68892     }
68893     presetList.autofocus = function(val) {
68894       if (!arguments.length)
68895         return _autofocus;
68896       _autofocus = val;
68897       return presetList;
68898     };
68899     presetList.entityIDs = function(val) {
68900       if (!arguments.length)
68901         return _entityIDs;
68902       _entityIDs = val;
68903       _currLoc = null;
68904       if (_entityIDs && _entityIDs.length) {
68905         const extent = _entityIDs.reduce(function(extent2, entityID) {
68906           var entity = context.graph().entity(entityID);
68907           return extent2.extend(entity.extent(context.graph()));
68908         }, geoExtent());
68909         _currLoc = extent.center();
68910         var presets = _entityIDs.map(function(entityID) {
68911           return _mainPresetIndex.match(context.entity(entityID), context.graph());
68912         });
68913         presetList.presets(presets);
68914       }
68915       return presetList;
68916     };
68917     presetList.presets = function(val) {
68918       if (!arguments.length)
68919         return _currentPresets;
68920       _currentPresets = val;
68921       return presetList;
68922     };
68923     function entityGeometries() {
68924       var counts = {};
68925       for (var i3 in _entityIDs) {
68926         var entityID = _entityIDs[i3];
68927         var entity = context.entity(entityID);
68928         var geometry = entity.geometry(context.graph());
68929         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
68930           geometry = "point";
68931         }
68932         if (!counts[geometry])
68933           counts[geometry] = 0;
68934         counts[geometry] += 1;
68935       }
68936       return Object.keys(counts).sort(function(geom1, geom2) {
68937         return counts[geom2] - counts[geom1];
68938       });
68939     }
68940     return utilRebind(presetList, dispatch14, "on");
68941   }
68942
68943   // modules/ui/view_on_osm.js
68944   function uiViewOnOSM(context) {
68945     var _what;
68946     function viewOnOSM(selection2) {
68947       var url;
68948       if (_what instanceof osmEntity) {
68949         url = context.connection().entityURL(_what);
68950       } else if (_what instanceof osmNote) {
68951         url = context.connection().noteURL(_what);
68952       }
68953       var data = !_what || _what.isNew() ? [] : [_what];
68954       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
68955         return d2.id;
68956       });
68957       link2.exit().remove();
68958       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
68959       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
68960     }
68961     viewOnOSM.what = function(_2) {
68962       if (!arguments.length)
68963         return _what;
68964       _what = _2;
68965       return viewOnOSM;
68966     };
68967     return viewOnOSM;
68968   }
68969
68970   // modules/ui/inspector.js
68971   function uiInspector(context) {
68972     var presetList = uiPresetList(context);
68973     var entityEditor = uiEntityEditor(context);
68974     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
68975     var _state = "select";
68976     var _entityIDs;
68977     var _newFeature = false;
68978     function inspector(selection2) {
68979       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
68980         inspector.setPreset();
68981       });
68982       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
68983       wrap2 = selection2.selectAll(".panewrap").data([0]);
68984       var enter = wrap2.enter().append("div").attr("class", "panewrap");
68985       enter.append("div").attr("class", "preset-list-pane pane");
68986       enter.append("div").attr("class", "entity-editor-pane pane");
68987       wrap2 = wrap2.merge(enter);
68988       presetPane = wrap2.selectAll(".preset-list-pane");
68989       editorPane = wrap2.selectAll(".entity-editor-pane");
68990       function shouldDefaultToPresetList() {
68991         if (_state !== "select")
68992           return false;
68993         if (_entityIDs.length !== 1)
68994           return false;
68995         var entityID = _entityIDs[0];
68996         var entity = context.hasEntity(entityID);
68997         if (!entity)
68998           return false;
68999         if (entity.hasNonGeometryTags())
69000           return false;
69001         if (_newFeature)
69002           return true;
69003         if (entity.geometry(context.graph()) !== "vertex")
69004           return false;
69005         if (context.graph().parentRelations(entity).length)
69006           return false;
69007         if (context.validator().getEntityIssues(entityID).length)
69008           return false;
69009         if (entity.isHighwayIntersection(context.graph()))
69010           return false;
69011         return true;
69012       }
69013       if (shouldDefaultToPresetList()) {
69014         wrap2.style("right", "-100%");
69015         editorPane.classed("hide", true);
69016         presetPane.classed("hide", false).call(presetList);
69017       } else {
69018         wrap2.style("right", "0%");
69019         presetPane.classed("hide", true);
69020         editorPane.classed("hide", false).call(entityEditor);
69021       }
69022       var footer = selection2.selectAll(".footer").data([0]);
69023       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
69024       footer.call(
69025         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
69026       );
69027     }
69028     inspector.showList = function(presets) {
69029       presetPane.classed("hide", false);
69030       wrap2.transition().styleTween("right", function() {
69031         return value_default("0%", "-100%");
69032       }).on("end", function() {
69033         editorPane.classed("hide", true);
69034       });
69035       if (presets) {
69036         presetList.presets(presets);
69037       }
69038       presetPane.call(presetList.autofocus(true));
69039     };
69040     inspector.setPreset = function(preset) {
69041       if (preset && preset.id === "type/multipolygon") {
69042         presetPane.call(presetList.autofocus(true));
69043       } else {
69044         editorPane.classed("hide", false);
69045         wrap2.transition().styleTween("right", function() {
69046           return value_default("-100%", "0%");
69047         }).on("end", function() {
69048           presetPane.classed("hide", true);
69049         });
69050         if (preset) {
69051           entityEditor.presets([preset]);
69052         }
69053         editorPane.call(entityEditor);
69054       }
69055     };
69056     inspector.state = function(val) {
69057       if (!arguments.length)
69058         return _state;
69059       _state = val;
69060       entityEditor.state(_state);
69061       context.container().selectAll(".field-help-body").remove();
69062       return inspector;
69063     };
69064     inspector.entityIDs = function(val) {
69065       if (!arguments.length)
69066         return _entityIDs;
69067       _entityIDs = val;
69068       return inspector;
69069     };
69070     inspector.newFeature = function(val) {
69071       if (!arguments.length)
69072         return _newFeature;
69073       _newFeature = val;
69074       return inspector;
69075     };
69076     return inspector;
69077   }
69078
69079   // modules/ui/keepRight_details.js
69080   function uiKeepRightDetails(context) {
69081     let _qaItem;
69082     function issueDetail(d2) {
69083       const { itemType, parentIssueType } = d2;
69084       const unknown = { html: _t.html("inspector.unknown") };
69085       let replacements = d2.replacements || {};
69086       replacements.default = unknown;
69087       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
69088         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
69089       } else {
69090         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
69091       }
69092     }
69093     function keepRightDetails(selection2) {
69094       const details = selection2.selectAll(".error-details").data(
69095         _qaItem ? [_qaItem] : [],
69096         (d2) => `${d2.id}-${d2.status || 0}`
69097       );
69098       details.exit().remove();
69099       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
69100       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
69101       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
69102       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
69103       let relatedEntities = [];
69104       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
69105         const link2 = select_default2(this);
69106         const isObjectLink = link2.classed("error_object_link");
69107         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
69108         const entity = context.hasEntity(entityID);
69109         relatedEntities.push(entityID);
69110         link2.on("mouseenter", () => {
69111           utilHighlightEntities([entityID], true, context);
69112         }).on("mouseleave", () => {
69113           utilHighlightEntities([entityID], false, context);
69114         }).on("click", (d3_event) => {
69115           d3_event.preventDefault();
69116           utilHighlightEntities([entityID], false, context);
69117           const osmlayer = context.layers().layer("osm");
69118           if (!osmlayer.enabled()) {
69119             osmlayer.enabled(true);
69120           }
69121           context.map().centerZoomEase(_qaItem.loc, 20);
69122           if (entity) {
69123             context.enter(modeSelect(context, [entityID]));
69124           } else {
69125             context.loadEntity(entityID, (err, result) => {
69126               if (err)
69127                 return;
69128               const entity2 = result.data.find((e3) => e3.id === entityID);
69129               if (entity2)
69130                 context.enter(modeSelect(context, [entityID]));
69131             });
69132           }
69133         });
69134         if (entity) {
69135           let name = utilDisplayName(entity);
69136           if (!name && !isObjectLink) {
69137             const preset = _mainPresetIndex.match(entity, context.graph());
69138             name = preset && !preset.isFallback() && preset.name();
69139           }
69140           if (name) {
69141             this.innerText = name;
69142           }
69143         }
69144       });
69145       context.features().forceVisible(relatedEntities);
69146       context.map().pan([0, 0]);
69147     }
69148     keepRightDetails.issue = function(val) {
69149       if (!arguments.length)
69150         return _qaItem;
69151       _qaItem = val;
69152       return keepRightDetails;
69153     };
69154     return keepRightDetails;
69155   }
69156
69157   // modules/ui/keepRight_header.js
69158   function uiKeepRightHeader() {
69159     let _qaItem;
69160     function issueTitle(d2) {
69161       const { itemType, parentIssueType } = d2;
69162       const unknown = _t.html("inspector.unknown");
69163       let replacements = d2.replacements || {};
69164       replacements.default = { html: unknown };
69165       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
69166         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
69167       } else {
69168         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
69169       }
69170     }
69171     function keepRightHeader(selection2) {
69172       const header = selection2.selectAll(".qa-header").data(
69173         _qaItem ? [_qaItem] : [],
69174         (d2) => `${d2.id}-${d2.status || 0}`
69175       );
69176       header.exit().remove();
69177       const headerEnter = header.enter().append("div").attr("class", "qa-header");
69178       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
69179       iconEnter.append("div").attr("class", (d2) => `preset-icon-28 qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
69180       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
69181     }
69182     keepRightHeader.issue = function(val) {
69183       if (!arguments.length)
69184         return _qaItem;
69185       _qaItem = val;
69186       return keepRightHeader;
69187     };
69188     return keepRightHeader;
69189   }
69190
69191   // modules/ui/view_on_keepRight.js
69192   function uiViewOnKeepRight() {
69193     let _qaItem;
69194     function viewOnKeepRight(selection2) {
69195       let url;
69196       if (services.keepRight && _qaItem instanceof QAItem) {
69197         url = services.keepRight.issueURL(_qaItem);
69198       }
69199       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
69200       link2.exit().remove();
69201       const linkEnter = link2.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
69202       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
69203     }
69204     viewOnKeepRight.what = function(val) {
69205       if (!arguments.length)
69206         return _qaItem;
69207       _qaItem = val;
69208       return viewOnKeepRight;
69209     };
69210     return viewOnKeepRight;
69211   }
69212
69213   // modules/ui/keepRight_editor.js
69214   function uiKeepRightEditor(context) {
69215     const dispatch14 = dispatch_default("change");
69216     const qaDetails = uiKeepRightDetails(context);
69217     const qaHeader = uiKeepRightHeader(context);
69218     let _qaItem;
69219     function keepRightEditor(selection2) {
69220       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
69221       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
69222       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
69223       let body = selection2.selectAll(".body").data([0]);
69224       body = body.enter().append("div").attr("class", "body").merge(body);
69225       const editor = body.selectAll(".qa-editor").data([0]);
69226       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
69227       const footer = selection2.selectAll(".footer").data([0]);
69228       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
69229     }
69230     function keepRightSaveSection(selection2) {
69231       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
69232       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
69233       let saveSection = selection2.selectAll(".qa-save").data(
69234         isShown ? [_qaItem] : [],
69235         (d2) => `${d2.id}-${d2.status || 0}`
69236       );
69237       saveSection.exit().remove();
69238       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
69239       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
69240       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d2) => d2.newComment || d2.comment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
69241       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
69242       function changeInput() {
69243         const input = select_default2(this);
69244         let val = input.property("value").trim();
69245         if (val === _qaItem.comment) {
69246           val = void 0;
69247         }
69248         _qaItem = _qaItem.update({ newComment: val });
69249         const qaService = services.keepRight;
69250         if (qaService) {
69251           qaService.replaceItem(_qaItem);
69252         }
69253         saveSection.call(qaSaveButtons);
69254       }
69255     }
69256     function qaSaveButtons(selection2) {
69257       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
69258       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
69259       buttonSection.exit().remove();
69260       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
69261       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
69262       buttonEnter.append("button").attr("class", "button close-button action");
69263       buttonEnter.append("button").attr("class", "button ignore-button action");
69264       buttonSection = buttonSection.merge(buttonEnter);
69265       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
69266         this.blur();
69267         const qaService = services.keepRight;
69268         if (qaService) {
69269           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69270         }
69271       });
69272       buttonSection.select(".close-button").html((d2) => {
69273         const andComment = d2.newComment ? "_comment" : "";
69274         return _t.html(`QA.keepRight.close${andComment}`);
69275       }).on("click.close", function(d3_event, d2) {
69276         this.blur();
69277         const qaService = services.keepRight;
69278         if (qaService) {
69279           d2.newStatus = "ignore_t";
69280           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69281         }
69282       });
69283       buttonSection.select(".ignore-button").html((d2) => {
69284         const andComment = d2.newComment ? "_comment" : "";
69285         return _t.html(`QA.keepRight.ignore${andComment}`);
69286       }).on("click.ignore", function(d3_event, d2) {
69287         this.blur();
69288         const qaService = services.keepRight;
69289         if (qaService) {
69290           d2.newStatus = "ignore";
69291           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69292         }
69293       });
69294     }
69295     keepRightEditor.error = function(val) {
69296       if (!arguments.length)
69297         return _qaItem;
69298       _qaItem = val;
69299       return keepRightEditor;
69300     };
69301     return utilRebind(keepRightEditor, dispatch14, "on");
69302   }
69303
69304   // modules/ui/lasso.js
69305   function uiLasso(context) {
69306     var group, polygon2;
69307     lasso.coordinates = [];
69308     function lasso(selection2) {
69309       context.container().classed("lasso", true);
69310       group = selection2.append("g").attr("class", "lasso hide");
69311       polygon2 = group.append("path").attr("class", "lasso-path");
69312       group.call(uiToggle(true));
69313     }
69314     function draw() {
69315       if (polygon2) {
69316         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
69317           return "M" + d2.join(" L") + " Z";
69318         });
69319       }
69320     }
69321     lasso.extent = function() {
69322       return lasso.coordinates.reduce(function(extent, point2) {
69323         return extent.extend(geoExtent(point2));
69324       }, geoExtent());
69325     };
69326     lasso.p = function(_2) {
69327       if (!arguments.length)
69328         return lasso;
69329       lasso.coordinates.push(_2);
69330       draw();
69331       return lasso;
69332     };
69333     lasso.close = function() {
69334       if (group) {
69335         group.call(uiToggle(false, function() {
69336           select_default2(this).remove();
69337         }));
69338       }
69339       context.container().classed("lasso", false);
69340     };
69341     return lasso;
69342   }
69343
69344   // modules/ui/note_comments.js
69345   function uiNoteComments() {
69346     var _note;
69347     function noteComments(selection2) {
69348       if (_note.isNew())
69349         return;
69350       var comments = selection2.selectAll(".comments-container").data([0]);
69351       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
69352       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
69353       commentEnter.append("div").attr("class", function(d2) {
69354         return "comment-avatar user-" + d2.uid;
69355       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
69356       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
69357       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
69358       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
69359         var selection3 = select_default2(this);
69360         var osm = services.osm;
69361         if (osm && d2.user) {
69362           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
69363         }
69364         if (d2.user) {
69365           selection3.text(d2.user);
69366         } else {
69367           selection3.call(_t.append("note.anonymous"));
69368         }
69369       });
69370       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
69371         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
69372       });
69373       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
69374         return d2.html;
69375       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
69376       comments.call(replaceAvatars);
69377     }
69378     function replaceAvatars(selection2) {
69379       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
69380       var osm = services.osm;
69381       if (showThirdPartyIcons !== "true" || !osm)
69382         return;
69383       var uids = {};
69384       _note.comments.forEach(function(d2) {
69385         if (d2.uid)
69386           uids[d2.uid] = true;
69387       });
69388       Object.keys(uids).forEach(function(uid) {
69389         osm.loadUser(uid, function(err, user) {
69390           if (!user || !user.image_url)
69391             return;
69392           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);
69393         });
69394       });
69395     }
69396     function localeDateString2(s2) {
69397       if (!s2)
69398         return null;
69399       var options2 = { day: "numeric", month: "short", year: "numeric" };
69400       s2 = s2.replace(/-/g, "/");
69401       var d2 = new Date(s2);
69402       if (isNaN(d2.getTime()))
69403         return null;
69404       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
69405     }
69406     noteComments.note = function(val) {
69407       if (!arguments.length)
69408         return _note;
69409       _note = val;
69410       return noteComments;
69411     };
69412     return noteComments;
69413   }
69414
69415   // modules/ui/note_header.js
69416   function uiNoteHeader() {
69417     var _note;
69418     function noteHeader(selection2) {
69419       var header = selection2.selectAll(".note-header").data(
69420         _note ? [_note] : [],
69421         function(d2) {
69422           return d2.status + d2.id;
69423         }
69424       );
69425       header.exit().remove();
69426       var headerEnter = header.enter().append("div").attr("class", "note-header");
69427       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
69428         return "note-header-icon " + d2.status;
69429       }).classed("new", function(d2) {
69430         return d2.id < 0;
69431       });
69432       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
69433       iconEnter.each(function(d2) {
69434         var statusIcon;
69435         if (d2.id < 0) {
69436           statusIcon = "#iD-icon-plus";
69437         } else if (d2.status === "open") {
69438           statusIcon = "#iD-icon-close";
69439         } else {
69440           statusIcon = "#iD-icon-apply";
69441         }
69442         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
69443       });
69444       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
69445         if (_note.isNew()) {
69446           return _t.html("note.new");
69447         }
69448         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
69449       });
69450     }
69451     noteHeader.note = function(val) {
69452       if (!arguments.length)
69453         return _note;
69454       _note = val;
69455       return noteHeader;
69456     };
69457     return noteHeader;
69458   }
69459
69460   // modules/ui/note_report.js
69461   function uiNoteReport() {
69462     var _note;
69463     function noteReport(selection2) {
69464       var url;
69465       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
69466         url = services.osm.noteReportURL(_note);
69467       }
69468       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
69469       link2.exit().remove();
69470       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
69471         return d2;
69472       }).call(svgIcon("#iD-icon-out-link", "inline"));
69473       linkEnter.append("span").call(_t.append("note.report"));
69474     }
69475     noteReport.note = function(val) {
69476       if (!arguments.length)
69477         return _note;
69478       _note = val;
69479       return noteReport;
69480     };
69481     return noteReport;
69482   }
69483
69484   // modules/ui/note_editor.js
69485   function uiNoteEditor(context) {
69486     var dispatch14 = dispatch_default("change");
69487     var noteComments = uiNoteComments(context);
69488     var noteHeader = uiNoteHeader();
69489     var _note;
69490     var _newNote;
69491     function noteEditor(selection2) {
69492       var header = selection2.selectAll(".header").data([0]);
69493       var headerEnter = header.enter().append("div").attr("class", "header fillL");
69494       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
69495         context.enter(modeBrowse(context));
69496       }).call(svgIcon("#iD-icon-close"));
69497       headerEnter.append("h2").call(_t.append("note.title"));
69498       var body = selection2.selectAll(".body").data([0]);
69499       body = body.enter().append("div").attr("class", "body").merge(body);
69500       var editor = body.selectAll(".note-editor").data([0]);
69501       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
69502       var footer = selection2.selectAll(".footer").data([0]);
69503       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
69504       var osm = services.osm;
69505       if (osm) {
69506         osm.on("change.note-save", function() {
69507           selection2.call(noteEditor);
69508         });
69509       }
69510     }
69511     function noteSaveSection(selection2) {
69512       var isSelected = _note && _note.id === context.selectedNoteID();
69513       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
69514         return d2.status + d2.id;
69515       });
69516       noteSave.exit().remove();
69517       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
69518       noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
69519         return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
69520       });
69521       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
69522         return d2.newComment;
69523       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
69524       if (!commentTextarea.empty() && _newNote) {
69525         commentTextarea.node().focus();
69526       }
69527       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
69528       function keydown(d3_event) {
69529         if (!(d3_event.keyCode === 13 && // ↩ Return
69530         d3_event.metaKey))
69531           return;
69532         var osm = services.osm;
69533         if (!osm)
69534           return;
69535         var hasAuth = osm.authenticated();
69536         if (!hasAuth)
69537           return;
69538         if (!_note.newComment)
69539           return;
69540         d3_event.preventDefault();
69541         select_default2(this).on("keydown.note-input", null);
69542         window.setTimeout(function() {
69543           if (_note.isNew()) {
69544             noteSave.selectAll(".save-button").node().focus();
69545             clickSave(_note);
69546           } else {
69547             noteSave.selectAll(".comment-button").node().focus();
69548             clickComment(_note);
69549           }
69550         }, 10);
69551       }
69552       function changeInput() {
69553         var input = select_default2(this);
69554         var val = input.property("value").trim() || void 0;
69555         _note = _note.update({ newComment: val });
69556         var osm = services.osm;
69557         if (osm) {
69558           osm.replaceNote(_note);
69559         }
69560         noteSave.call(noteSaveButtons);
69561       }
69562     }
69563     function userDetails(selection2) {
69564       var detailSection = selection2.selectAll(".detail-section").data([0]);
69565       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
69566       var osm = services.osm;
69567       if (!osm)
69568         return;
69569       var hasAuth = osm.authenticated();
69570       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
69571       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
69572       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
69573       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
69574       authEnter.append("span").call(_t.append("note.login"));
69575       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) {
69576         d3_event.preventDefault();
69577         osm.authenticate();
69578       });
69579       authEnter.transition().duration(200).style("opacity", 1);
69580       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
69581       prose.exit().remove();
69582       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
69583       osm.userDetails(function(err, user) {
69584         if (err)
69585           return;
69586         var userLink = select_default2(document.createElement("div"));
69587         if (user.image_url) {
69588           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
69589         }
69590         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
69591         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
69592       });
69593     }
69594     function noteSaveButtons(selection2) {
69595       var osm = services.osm;
69596       var hasAuth = osm && osm.authenticated();
69597       var isSelected = _note && _note.id === context.selectedNoteID();
69598       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
69599         return d2.status + d2.id;
69600       });
69601       buttonSection.exit().remove();
69602       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
69603       if (_note.isNew()) {
69604         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
69605         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
69606       } else {
69607         buttonEnter.append("button").attr("class", "button status-button action");
69608         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
69609       }
69610       buttonSection = buttonSection.merge(buttonEnter);
69611       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
69612       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
69613       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d2) {
69614         var action = d2.status === "open" ? "close" : "open";
69615         var andComment = d2.newComment ? "_comment" : "";
69616         return _t.html("note." + action + andComment);
69617       }).on("click.status", clickStatus);
69618       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
69619       function isSaveDisabled(d2) {
69620         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
69621       }
69622     }
69623     function clickCancel(d3_event, d2) {
69624       this.blur();
69625       var osm = services.osm;
69626       if (osm) {
69627         osm.removeNote(d2);
69628       }
69629       context.enter(modeBrowse(context));
69630       dispatch14.call("change");
69631     }
69632     function clickSave(d3_event, d2) {
69633       this.blur();
69634       var osm = services.osm;
69635       if (osm) {
69636         osm.postNoteCreate(d2, function(err, note) {
69637           dispatch14.call("change", note);
69638         });
69639       }
69640     }
69641     function clickStatus(d3_event, d2) {
69642       this.blur();
69643       var osm = services.osm;
69644       if (osm) {
69645         var setStatus = d2.status === "open" ? "closed" : "open";
69646         osm.postNoteUpdate(d2, setStatus, function(err, note) {
69647           dispatch14.call("change", note);
69648         });
69649       }
69650     }
69651     function clickComment(d3_event, d2) {
69652       this.blur();
69653       var osm = services.osm;
69654       if (osm) {
69655         osm.postNoteUpdate(d2, d2.status, function(err, note) {
69656           dispatch14.call("change", note);
69657         });
69658       }
69659     }
69660     noteEditor.note = function(val) {
69661       if (!arguments.length)
69662         return _note;
69663       _note = val;
69664       return noteEditor;
69665     };
69666     noteEditor.newNote = function(val) {
69667       if (!arguments.length)
69668         return _newNote;
69669       _newNote = val;
69670       return noteEditor;
69671     };
69672     return utilRebind(noteEditor, dispatch14, "on");
69673   }
69674
69675   // modules/ui/source_switch.js
69676   function uiSourceSwitch(context) {
69677     var keys2;
69678     function click(d3_event) {
69679       d3_event.preventDefault();
69680       var osm = context.connection();
69681       if (!osm)
69682         return;
69683       if (context.inIntro())
69684         return;
69685       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
69686         return;
69687       var isLive = select_default2(this).classed("live");
69688       isLive = !isLive;
69689       context.enter(modeBrowse(context));
69690       context.history().clearSaved();
69691       context.flush();
69692       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
69693       osm.switch(isLive ? keys2[0] : keys2[1]);
69694     }
69695     var sourceSwitch = function(selection2) {
69696       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
69697     };
69698     sourceSwitch.keys = function(_2) {
69699       if (!arguments.length)
69700         return keys2;
69701       keys2 = _2;
69702       return sourceSwitch;
69703     };
69704     return sourceSwitch;
69705   }
69706
69707   // modules/ui/spinner.js
69708   function uiSpinner(context) {
69709     var osm = context.connection();
69710     return function(selection2) {
69711       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
69712       if (osm) {
69713         osm.on("loading.spinner", function() {
69714           img.transition().style("opacity", 1);
69715         }).on("loaded.spinner", function() {
69716           img.transition().style("opacity", 0);
69717         });
69718       }
69719     };
69720   }
69721
69722   // modules/ui/sections/privacy.js
69723   function uiSectionPrivacy(context) {
69724     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
69725     function renderDisclosureContent(selection2) {
69726       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
69727       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(
69728         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
69729       );
69730       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
69731         d3_event.preventDefault();
69732         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
69733       });
69734       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
69735       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
69736       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"));
69737     }
69738     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
69739     return section;
69740   }
69741
69742   // modules/ui/splash.js
69743   function uiSplash(context) {
69744     return (selection2) => {
69745       if (context.history().hasRestorableChanges())
69746         return;
69747       let updateMessage = "";
69748       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
69749       let showSplash = !corePreferences("sawSplash");
69750       if (sawPrivacyVersion !== context.privacyVersion) {
69751         updateMessage = _t("splash.privacy_update");
69752         showSplash = true;
69753       }
69754       if (!showSplash)
69755         return;
69756       corePreferences("sawSplash", true);
69757       corePreferences("sawPrivacyVersion", context.privacyVersion);
69758       _mainFileFetcher.get("intro_graph");
69759       let modalSelection = uiModal(selection2);
69760       modalSelection.select(".modal").attr("class", "modal-splash modal");
69761       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
69762       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
69763       let modalSection = introModal.append("div").attr("class", "modal-section");
69764       modalSection.append("p").html(_t.html("splash.text", {
69765         version: context.version,
69766         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
69767         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
69768       }));
69769       modalSection.append("p").html(_t.html("splash.privacy", {
69770         updateMessage,
69771         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
69772       }));
69773       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
69774       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
69775       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
69776         context.container().call(uiIntro(context));
69777         modalSelection.close();
69778       });
69779       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
69780       walkthrough.append("div").call(_t.append("splash.walkthrough"));
69781       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
69782       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
69783       startEditing.append("div").call(_t.append("splash.start"));
69784       modalSelection.select("button.close").attr("class", "hide");
69785     };
69786   }
69787
69788   // modules/ui/status.js
69789   function uiStatus(context) {
69790     var osm = context.connection();
69791     return function(selection2) {
69792       if (!osm)
69793         return;
69794       function update(err, apiStatus) {
69795         selection2.html("");
69796         if (err) {
69797           if (apiStatus === "connectionSwitched") {
69798             return;
69799           } else if (apiStatus === "rateLimited") {
69800             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) {
69801               d3_event.preventDefault();
69802               osm.authenticate();
69803             });
69804           } else {
69805             var throttledRetry = throttle_default(function() {
69806               context.loadTiles(context.projection);
69807               osm.reloadApiStatus();
69808             }, 2e3);
69809             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) {
69810               d3_event.preventDefault();
69811               throttledRetry();
69812             });
69813           }
69814         } else if (apiStatus === "readonly") {
69815           selection2.call(_t.append("osm_api_status.message.readonly"));
69816         } else if (apiStatus === "offline") {
69817           selection2.call(_t.append("osm_api_status.message.offline"));
69818         }
69819         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
69820       }
69821       osm.on("apiStatusChange.uiStatus", update);
69822       context.history().on("storage_error", () => {
69823         selection2.selectAll("span.local-storage-full").remove();
69824         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
69825         selection2.classed("error", true);
69826       });
69827       window.setInterval(function() {
69828         osm.reloadApiStatus();
69829       }, 9e4);
69830       osm.reloadApiStatus();
69831     };
69832   }
69833
69834   // node_modules/osm-community-index/lib/simplify.js
69835   var import_diacritics2 = __toESM(require_diacritics(), 1);
69836   function simplify(str2) {
69837     if (typeof str2 !== "string")
69838       return "";
69839     return import_diacritics2.default.remove(
69840       str2.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
69841     );
69842   }
69843
69844   // node_modules/osm-community-index/lib/resolve_strings.js
69845   function resolveStrings(item, defaults, localizerFn) {
69846     let itemStrings = Object.assign({}, item.strings);
69847     let defaultStrings = Object.assign({}, defaults[item.type]);
69848     const anyToken = new RegExp(/(\{\w+\})/, "gi");
69849     if (localizerFn) {
69850       if (itemStrings.community) {
69851         const communityID = simplify(itemStrings.community);
69852         itemStrings.community = localizerFn(`_communities.${communityID}`);
69853       }
69854       ["name", "description", "extendedDescription"].forEach((prop) => {
69855         if (defaultStrings[prop])
69856           defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
69857         if (itemStrings[prop])
69858           itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
69859       });
69860     }
69861     let replacements = {
69862       account: item.account,
69863       community: itemStrings.community,
69864       signupUrl: itemStrings.signupUrl,
69865       url: itemStrings.url
69866     };
69867     if (!replacements.signupUrl) {
69868       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
69869     }
69870     if (!replacements.url) {
69871       replacements.url = resolve(itemStrings.url || defaultStrings.url);
69872     }
69873     let resolved = {
69874       name: resolve(itemStrings.name || defaultStrings.name),
69875       url: resolve(itemStrings.url || defaultStrings.url),
69876       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
69877       description: resolve(itemStrings.description || defaultStrings.description),
69878       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
69879     };
69880     resolved.nameHTML = linkify(resolved.url, resolved.name);
69881     resolved.urlHTML = linkify(resolved.url);
69882     resolved.signupUrlHTML = linkify(resolved.signupUrl);
69883     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
69884     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
69885     return resolved;
69886     function resolve(s2, addLinks) {
69887       if (!s2)
69888         return void 0;
69889       let result = s2;
69890       for (let key in replacements) {
69891         const token = `{${key}}`;
69892         const regex = new RegExp(token, "g");
69893         if (regex.test(result)) {
69894           let replacement = replacements[key];
69895           if (!replacement) {
69896             throw new Error(`Cannot resolve token: ${token}`);
69897           } else {
69898             if (addLinks && (key === "signupUrl" || key === "url")) {
69899               replacement = linkify(replacement);
69900             }
69901             result = result.replace(regex, replacement);
69902           }
69903         }
69904       }
69905       const leftovers = result.match(anyToken);
69906       if (leftovers) {
69907         throw new Error(`Cannot resolve tokens: ${leftovers}`);
69908       }
69909       if (addLinks && item.type === "reddit") {
69910         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
69911       }
69912       return result;
69913     }
69914     function linkify(url, text2) {
69915       if (!url)
69916         return void 0;
69917       text2 = text2 || url;
69918       return `<a target="_blank" href="${url}">${text2}</a>`;
69919     }
69920   }
69921
69922   // modules/ui/success.js
69923   var _oci = null;
69924   function uiSuccess(context) {
69925     const MAXEVENTS = 2;
69926     const dispatch14 = dispatch_default("cancel");
69927     let _changeset2;
69928     let _location;
69929     ensureOSMCommunityIndex();
69930     function ensureOSMCommunityIndex() {
69931       const data = _mainFileFetcher;
69932       return Promise.all([
69933         data.get("oci_features"),
69934         data.get("oci_resources"),
69935         data.get("oci_defaults")
69936       ]).then((vals) => {
69937         if (_oci)
69938           return _oci;
69939         if (vals[0] && Array.isArray(vals[0].features)) {
69940           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
69941         }
69942         let ociResources = Object.values(vals[1].resources);
69943         if (ociResources.length) {
69944           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
69945             _oci = {
69946               resources: ociResources,
69947               defaults: vals[2].defaults
69948             };
69949             return _oci;
69950           });
69951         } else {
69952           _oci = {
69953             resources: [],
69954             // no resources?
69955             defaults: vals[2].defaults
69956           };
69957           return _oci;
69958         }
69959       });
69960     }
69961     function parseEventDate(when) {
69962       if (!when)
69963         return;
69964       let raw = when.trim();
69965       if (!raw)
69966         return;
69967       if (!/Z$/.test(raw)) {
69968         raw += "Z";
69969       }
69970       const parsed = new Date(raw);
69971       return new Date(parsed.toUTCString().slice(0, 25));
69972     }
69973     function success(selection2) {
69974       let header = selection2.append("div").attr("class", "header fillL");
69975       header.append("h2").call(_t.append("success.just_edited"));
69976       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
69977       let body = selection2.append("div").attr("class", "body save-success fillL");
69978       let summary = body.append("div").attr("class", "save-summary");
69979       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
69980       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"));
69981       let osm = context.connection();
69982       if (!osm)
69983         return;
69984       let changesetURL = osm.changesetURL(_changeset2.id);
69985       let table = summary.append("table").attr("class", "summary-table");
69986       let row = table.append("tr").attr("class", "summary-row");
69987       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");
69988       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
69989       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
69990       summaryDetail.append("div").html(_t.html("success.changeset_id", {
69991         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
69992       }));
69993       ensureOSMCommunityIndex().then((oci) => {
69994         const loc = context.map().center();
69995         const validHere = _sharedLocationManager.locationSetsAt(loc);
69996         let communities = [];
69997         oci.resources.forEach((resource) => {
69998           let area = validHere[resource.locationSetID];
69999           if (!area)
70000             return;
70001           const localizer = (stringID) => _t.html(`community.${stringID}`);
70002           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
70003           communities.push({
70004             area,
70005             order: resource.order || 0,
70006             resource
70007           });
70008         });
70009         communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
70010         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
70011       });
70012     }
70013     function showCommunityLinks(selection2, resources) {
70014       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
70015       communityLinks.append("h3").call(_t.append("success.like_osm"));
70016       let table = communityLinks.append("table").attr("class", "community-table");
70017       let row = table.selectAll(".community-row").data(resources);
70018       let rowEnter = row.enter().append("tr").attr("class", "community-row");
70019       rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d2) => d2.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d2) => `#community-${d2.type}`);
70020       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
70021       communityDetail.each(showCommunityDetails);
70022       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"));
70023     }
70024     function showCommunityDetails(d2) {
70025       let selection2 = select_default2(this);
70026       let communityID = d2.id;
70027       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
70028       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
70029       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
70030         selection2.append("div").call(
70031           uiDisclosure(context, `community-more-${d2.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
70032         );
70033       }
70034       let nextEvents = (d2.events || []).map((event) => {
70035         event.date = parseEventDate(event.when);
70036         return event;
70037       }).filter((event) => {
70038         const t2 = event.date.getTime();
70039         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
70040         return !isNaN(t2) && t2 >= now3;
70041       }).sort((a2, b2) => {
70042         return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
70043       }).slice(0, MAXEVENTS);
70044       if (nextEvents.length) {
70045         selection2.append("div").call(
70046           uiDisclosure(context, `community-events-${d2.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
70047         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
70048       }
70049       function showMore(selection3) {
70050         let more = selection3.selectAll(".community-more").data([0]);
70051         let moreEnter = more.enter().append("div").attr("class", "community-more");
70052         if (d2.resolved.extendedDescriptionHTML) {
70053           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
70054         }
70055         if (d2.languageCodes && d2.languageCodes.length) {
70056           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
70057           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
70058         }
70059       }
70060       function showNextEvents(selection3) {
70061         let events = selection3.append("div").attr("class", "community-events");
70062         let item = events.selectAll(".community-event").data(nextEvents);
70063         let itemEnter = item.enter().append("div").attr("class", "community-event");
70064         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
70065           let name = d4.name;
70066           if (d4.i18n && d4.id) {
70067             name = _t(`community.${communityID}.events.${d4.id}.name`, { default: name });
70068           }
70069           return name;
70070         });
70071         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
70072           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
70073           if (d4.date.getHours() || d4.date.getMinutes()) {
70074             options2.hour = "numeric";
70075             options2.minute = "numeric";
70076           }
70077           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
70078         });
70079         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
70080           let where = d4.where;
70081           if (d4.i18n && d4.id) {
70082             where = _t(`community.${communityID}.events.${d4.id}.where`, { default: where });
70083           }
70084           return where;
70085         });
70086         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
70087           let description = d4.description;
70088           if (d4.i18n && d4.id) {
70089             description = _t(`community.${communityID}.events.${d4.id}.description`, { default: description });
70090           }
70091           return description;
70092         });
70093       }
70094     }
70095     success.changeset = function(val) {
70096       if (!arguments.length)
70097         return _changeset2;
70098       _changeset2 = val;
70099       return success;
70100     };
70101     success.location = function(val) {
70102       if (!arguments.length)
70103         return _location;
70104       _location = val;
70105       return success;
70106     };
70107     return utilRebind(success, dispatch14, "on");
70108   }
70109
70110   // modules/ui/version.js
70111   var sawVersion = null;
70112   var isNewVersion = false;
70113   var isNewUser = false;
70114   function uiVersion(context) {
70115     var currVersion = context.version;
70116     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
70117     if (sawVersion === null && matchedVersion !== null) {
70118       if (corePreferences("sawVersion")) {
70119         isNewUser = false;
70120         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
70121       } else {
70122         isNewUser = true;
70123         isNewVersion = true;
70124       }
70125       corePreferences("sawVersion", currVersion);
70126       sawVersion = currVersion;
70127     }
70128     return function(selection2) {
70129       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
70130       if (isNewVersion && !isNewUser) {
70131         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(
70132           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
70133         );
70134       }
70135     };
70136   }
70137
70138   // modules/ui/zoom.js
70139   function uiZoom(context) {
70140     var zooms = [{
70141       id: "zoom-in",
70142       icon: "iD-icon-plus",
70143       title: _t.append("zoom.in"),
70144       action: zoomIn,
70145       disabled: function() {
70146         return !context.map().canZoomIn();
70147       },
70148       disabledTitle: _t.append("zoom.disabled.in"),
70149       key: "+"
70150     }, {
70151       id: "zoom-out",
70152       icon: "iD-icon-minus",
70153       title: _t.append("zoom.out"),
70154       action: zoomOut,
70155       disabled: function() {
70156         return !context.map().canZoomOut();
70157       },
70158       disabledTitle: _t.append("zoom.disabled.out"),
70159       key: "-"
70160     }];
70161     function zoomIn(d3_event) {
70162       if (d3_event.shiftKey)
70163         return;
70164       d3_event.preventDefault();
70165       context.map().zoomIn();
70166     }
70167     function zoomOut(d3_event) {
70168       if (d3_event.shiftKey)
70169         return;
70170       d3_event.preventDefault();
70171       context.map().zoomOut();
70172     }
70173     function zoomInFurther(d3_event) {
70174       if (d3_event.shiftKey)
70175         return;
70176       d3_event.preventDefault();
70177       context.map().zoomInFurther();
70178     }
70179     function zoomOutFurther(d3_event) {
70180       if (d3_event.shiftKey)
70181         return;
70182       d3_event.preventDefault();
70183       context.map().zoomOutFurther();
70184     }
70185     return function(selection2) {
70186       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
70187         if (d2.disabled()) {
70188           return d2.disabledTitle;
70189         }
70190         return d2.title;
70191       }).keys(function(d2) {
70192         return [d2.key];
70193       });
70194       var lastPointerUpType;
70195       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
70196         return d2.id;
70197       }).on("pointerup.editor", function(d3_event) {
70198         lastPointerUpType = d3_event.pointerType;
70199       }).on("click.editor", function(d3_event, d2) {
70200         if (!d2.disabled()) {
70201           d2.action(d3_event);
70202         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
70203           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
70204         }
70205         lastPointerUpType = null;
70206       }).call(tooltipBehavior);
70207       buttons.each(function(d2) {
70208         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
70209       });
70210       utilKeybinding.plusKeys.forEach(function(key) {
70211         context.keybinding().on([key], zoomIn);
70212         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
70213       });
70214       utilKeybinding.minusKeys.forEach(function(key) {
70215         context.keybinding().on([key], zoomOut);
70216         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
70217       });
70218       function updateButtonStates() {
70219         buttons.classed("disabled", function(d2) {
70220           return d2.disabled();
70221         }).each(function() {
70222           var selection3 = select_default2(this);
70223           if (!selection3.select(".tooltip.in").empty()) {
70224             selection3.call(tooltipBehavior.updateContent);
70225           }
70226         });
70227       }
70228       updateButtonStates();
70229       context.map().on("move.uiZoom", updateButtonStates);
70230     };
70231   }
70232
70233   // modules/ui/sections/raw_tag_editor.js
70234   function uiSectionRawTagEditor(id2, context) {
70235     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
70236       var count = Object.keys(_tags).filter(function(d2) {
70237         return d2;
70238       }).length;
70239       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
70240     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
70241     var taginfo = services.taginfo;
70242     var dispatch14 = dispatch_default("change");
70243     var availableViews = [
70244       { id: "list", icon: "#fas-th-list" },
70245       { id: "text", icon: "#fas-i-cursor" }
70246     ];
70247     let _discardTags = {};
70248     _mainFileFetcher.get("discarded").then((d2) => {
70249       _discardTags = d2;
70250     }).catch(() => {
70251     });
70252     var _tagView = corePreferences("raw-tag-editor-view") || "list";
70253     var _readOnlyTags = [];
70254     var _orderedKeys = [];
70255     var _showBlank = false;
70256     var _pendingChange = null;
70257     var _state;
70258     var _presets;
70259     var _tags;
70260     var _entityIDs;
70261     var _didInteract = false;
70262     function interacted() {
70263       _didInteract = true;
70264     }
70265     function renderDisclosureContent(wrap2) {
70266       _orderedKeys = _orderedKeys.filter(function(key) {
70267         return _tags[key] !== void 0;
70268       });
70269       var all = Object.keys(_tags).sort();
70270       var missingKeys = utilArrayDifference(all, _orderedKeys);
70271       for (var i3 in missingKeys) {
70272         _orderedKeys.push(missingKeys[i3]);
70273       }
70274       var rowData = _orderedKeys.map(function(key, i4) {
70275         return { index: i4, key, value: _tags[key] };
70276       });
70277       if (!rowData.length || _showBlank) {
70278         _showBlank = false;
70279         rowData.push({ index: rowData.length, key: "", value: "" });
70280       }
70281       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
70282       options2.exit().remove();
70283       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
70284       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
70285         return d2.id;
70286       }).enter();
70287       optionEnter.append("button").attr("class", function(d2) {
70288         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
70289       }).attr("aria-selected", function(d2) {
70290         return _tagView === d2.id;
70291       }).attr("role", "tab").attr("title", function(d2) {
70292         return _t("icons." + d2.id);
70293       }).on("click", function(d3_event, d2) {
70294         _tagView = d2.id;
70295         corePreferences("raw-tag-editor-view", d2.id);
70296         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
70297           return datum2 === d2;
70298         }).attr("aria-selected", function(datum2) {
70299           return datum2 === d2;
70300         });
70301         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
70302         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
70303       }).each(function(d2) {
70304         select_default2(this).call(svgIcon(d2.icon));
70305       });
70306       var textData = rowsToText(rowData);
70307       var textarea = wrap2.selectAll(".tag-text").data([0]);
70308       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);
70309       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
70310       var list = wrap2.selectAll(".tag-list").data([0]);
70311       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
70312       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
70313       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);
70314       addRowEnter.append("div").attr("class", "space-value");
70315       addRowEnter.append("div").attr("class", "space-buttons");
70316       var items = list.selectAll(".tag-row").data(rowData, function(d2) {
70317         return d2.key;
70318       });
70319       items.exit().each(unbind).remove();
70320       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
70321       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
70322       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);
70323       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);
70324       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
70325       items = items.merge(itemsEnter).sort(function(a2, b2) {
70326         return a2.index - b2.index;
70327       });
70328       items.each(function(d2) {
70329         var row = select_default2(this);
70330         var key = row.select("input.key");
70331         var value = row.select("input.value");
70332         if (_entityIDs && taginfo && _state !== "hover") {
70333           bindTypeahead(key, value);
70334         }
70335         var referenceOptions = { key: d2.key };
70336         if (typeof d2.value === "string") {
70337           referenceOptions.value = d2.value;
70338         }
70339         var reference = uiTagReference(referenceOptions, context);
70340         if (_state === "hover") {
70341           reference.showing(false);
70342         }
70343         row.select(".inner-wrap").call(reference.button);
70344         row.call(reference.body);
70345         row.select("button.remove");
70346       });
70347       items.selectAll("input.key").attr("title", function(d2) {
70348         return d2.key;
70349       }).call(utilGetSetValue, function(d2) {
70350         return d2.key;
70351       }).attr("readonly", function(d2) {
70352         return isReadOnly(d2) || null;
70353       });
70354       items.selectAll("input.value").attr("title", function(d2) {
70355         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
70356       }).classed("mixed", function(d2) {
70357         return Array.isArray(d2.value);
70358       }).attr("placeholder", function(d2) {
70359         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
70360       }).call(utilGetSetValue, function(d2) {
70361         return typeof d2.value === "string" ? d2.value : "";
70362       }).attr("readonly", function(d2) {
70363         return isReadOnly(d2) || null;
70364       });
70365       items.selectAll("button.remove").on(
70366         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
70367         // 'click' fires too late - #5878
70368         (d3_event, d2) => {
70369           if (d3_event.button !== 0)
70370             return;
70371           removeTag(d3_event, d2);
70372         }
70373       );
70374     }
70375     function isReadOnly(d2) {
70376       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
70377         if (d2.key.match(_readOnlyTags[i3]) !== null) {
70378           return true;
70379         }
70380       }
70381       return false;
70382     }
70383     function setTextareaHeight() {
70384       if (_tagView !== "text")
70385         return;
70386       var selection2 = select_default2(this);
70387       var matches = selection2.node().value.match(/\n/g);
70388       var lineCount = 2 + Number(matches && matches.length);
70389       var lineHeight = 20;
70390       selection2.style("height", lineCount * lineHeight + "px");
70391     }
70392     function stringify3(s2) {
70393       return JSON.stringify(s2).slice(1, -1);
70394     }
70395     function unstringify(s2) {
70396       var leading = "";
70397       var trailing = "";
70398       if (s2.length < 1 || s2.charAt(0) !== '"') {
70399         leading = '"';
70400       }
70401       if (s2.length < 2 || s2.charAt(s2.length - 1) !== '"' || s2.charAt(s2.length - 1) === '"' && s2.charAt(s2.length - 2) === "\\") {
70402         trailing = '"';
70403       }
70404       return JSON.parse(leading + s2 + trailing);
70405     }
70406     function rowsToText(rows) {
70407       var str2 = rows.filter(function(row) {
70408         return row.key && row.key.trim() !== "";
70409       }).map(function(row) {
70410         var rawVal = row.value;
70411         if (typeof rawVal !== "string")
70412           rawVal = "*";
70413         var val = rawVal ? stringify3(rawVal) : "";
70414         return stringify3(row.key) + "=" + val;
70415       }).join("\n");
70416       if (_state !== "hover" && str2.length) {
70417         return str2 + "\n";
70418       }
70419       return str2;
70420     }
70421     function textChanged() {
70422       var newText = this.value.trim();
70423       var newTags = {};
70424       newText.split("\n").forEach(function(row) {
70425         var m2 = row.match(/^\s*([^=]+)=(.*)$/);
70426         if (m2 !== null) {
70427           var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
70428           var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
70429           newTags[k2] = v2;
70430         }
70431       });
70432       var tagDiff = utilTagDiff(_tags, newTags);
70433       if (!tagDiff.length)
70434         return;
70435       _pendingChange = _pendingChange || {};
70436       tagDiff.forEach(function(change) {
70437         if (isReadOnly({ key: change.key }))
70438           return;
70439         if (change.newVal === "*" && typeof change.oldVal !== "string")
70440           return;
70441         if (change.type === "-") {
70442           _pendingChange[change.key] = void 0;
70443         } else if (change.type === "+") {
70444           _pendingChange[change.key] = change.newVal || "";
70445         }
70446       });
70447       if (Object.keys(_pendingChange).length === 0) {
70448         _pendingChange = null;
70449         return;
70450       }
70451       scheduleChange();
70452     }
70453     function pushMore(d3_event) {
70454       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
70455         addTag();
70456       }
70457     }
70458     function bindTypeahead(key, value) {
70459       if (isReadOnly(key.datum()))
70460         return;
70461       if (Array.isArray(value.datum().value)) {
70462         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
70463           var keyString = utilGetSetValue(key);
70464           if (!_tags[keyString])
70465             return;
70466           var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
70467             return {
70468               value: tagValue,
70469               title: tagValue
70470             };
70471           });
70472           callback(data);
70473         }));
70474         return;
70475       }
70476       var geometry = context.graph().geometry(_entityIDs[0]);
70477       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
70478         taginfo.keys({
70479           debounce: true,
70480           geometry,
70481           query: value2
70482         }, function(err, data) {
70483           if (!err) {
70484             const filtered = data.filter((d2) => _tags[d2.value] === void 0).filter((d2) => !(d2.value in _discardTags)).filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
70485             callback(sort(value2, filtered));
70486           }
70487         });
70488       }));
70489       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
70490         taginfo.values({
70491           debounce: true,
70492           key: utilGetSetValue(key),
70493           geometry,
70494           query: value2
70495         }, function(err, data) {
70496           if (!err) {
70497             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
70498             callback(sort(value2, filtered));
70499           }
70500         });
70501       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
70502       function sort(value2, data) {
70503         var sameletter = [];
70504         var other = [];
70505         for (var i3 = 0; i3 < data.length; i3++) {
70506           if (data[i3].value.substring(0, value2.length) === value2) {
70507             sameletter.push(data[i3]);
70508           } else {
70509             other.push(data[i3]);
70510           }
70511         }
70512         return sameletter.concat(other);
70513       }
70514     }
70515     function unbind() {
70516       var row = select_default2(this);
70517       row.selectAll("input.key").call(uiCombobox.off, context);
70518       row.selectAll("input.value").call(uiCombobox.off, context);
70519     }
70520     function keyChange(d3_event, d2) {
70521       if (select_default2(this).attr("readonly"))
70522         return;
70523       var kOld = d2.key;
70524       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
70525         return;
70526       var kNew = context.cleanTagKey(this.value.trim());
70527       if (isReadOnly({ key: kNew })) {
70528         this.value = kOld;
70529         return;
70530       }
70531       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
70532         this.value = kOld;
70533         section.selection().selectAll(".tag-list input.value").each(function(d4) {
70534           if (d4.key === kNew) {
70535             var input = select_default2(this).node();
70536             input.focus();
70537             input.select();
70538           }
70539         });
70540         return;
70541       }
70542       _pendingChange = _pendingChange || {};
70543       if (kOld) {
70544         if (kOld === kNew)
70545           return;
70546         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
70547         _pendingChange[kOld] = void 0;
70548       } else {
70549         let row = this.parentNode.parentNode;
70550         let inputVal = select_default2(row).selectAll("input.value");
70551         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
70552         _pendingChange[kNew] = vNew;
70553         utilGetSetValue(inputVal, vNew);
70554       }
70555       var existingKeyIndex = _orderedKeys.indexOf(kOld);
70556       if (existingKeyIndex !== -1)
70557         _orderedKeys[existingKeyIndex] = kNew;
70558       d2.key = kNew;
70559       this.value = kNew;
70560       scheduleChange();
70561     }
70562     function valueChange(d3_event, d2) {
70563       if (isReadOnly(d2))
70564         return;
70565       if (typeof d2.value !== "string" && !this.value)
70566         return;
70567       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0)
70568         return;
70569       _pendingChange = _pendingChange || {};
70570       _pendingChange[d2.key] = context.cleanTagValue(this.value);
70571       scheduleChange();
70572     }
70573     function removeTag(d3_event, d2) {
70574       if (isReadOnly(d2))
70575         return;
70576       if (d2.key === "") {
70577         _showBlank = false;
70578         section.reRender();
70579       } else {
70580         _orderedKeys = _orderedKeys.filter(function(key) {
70581           return key !== d2.key;
70582         });
70583         _pendingChange = _pendingChange || {};
70584         _pendingChange[d2.key] = void 0;
70585         scheduleChange();
70586       }
70587     }
70588     function addTag() {
70589       window.setTimeout(function() {
70590         _showBlank = true;
70591         section.reRender();
70592         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
70593       }, 20);
70594     }
70595     function scheduleChange() {
70596       var entityIDs = _entityIDs;
70597       window.setTimeout(function() {
70598         if (!_pendingChange)
70599           return;
70600         dispatch14.call("change", this, entityIDs, _pendingChange);
70601         _pendingChange = null;
70602       }, 10);
70603     }
70604     section.state = function(val) {
70605       if (!arguments.length)
70606         return _state;
70607       if (_state !== val) {
70608         _orderedKeys = [];
70609         _state = val;
70610       }
70611       return section;
70612     };
70613     section.presets = function(val) {
70614       if (!arguments.length)
70615         return _presets;
70616       _presets = val;
70617       if (_presets && _presets.length && _presets[0].isFallback()) {
70618         section.disclosureExpanded(true);
70619       } else if (!_didInteract) {
70620         section.disclosureExpanded(null);
70621       }
70622       return section;
70623     };
70624     section.tags = function(val) {
70625       if (!arguments.length)
70626         return _tags;
70627       _tags = val;
70628       return section;
70629     };
70630     section.entityIDs = function(val) {
70631       if (!arguments.length)
70632         return _entityIDs;
70633       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
70634         _entityIDs = val;
70635         _orderedKeys = [];
70636       }
70637       return section;
70638     };
70639     section.readOnlyTags = function(val) {
70640       if (!arguments.length)
70641         return _readOnlyTags;
70642       _readOnlyTags = val;
70643       return section;
70644     };
70645     return utilRebind(section, dispatch14, "on");
70646   }
70647
70648   // modules/ui/data_editor.js
70649   function uiDataEditor(context) {
70650     var dataHeader = uiDataHeader();
70651     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
70652     var _datum;
70653     function dataEditor(selection2) {
70654       var header = selection2.selectAll(".header").data([0]);
70655       var headerEnter = header.enter().append("div").attr("class", "header fillL");
70656       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
70657         context.enter(modeBrowse(context));
70658       }).call(svgIcon("#iD-icon-close"));
70659       headerEnter.append("h2").call(_t.append("map_data.title"));
70660       var body = selection2.selectAll(".body").data([0]);
70661       body = body.enter().append("div").attr("class", "body").merge(body);
70662       var editor = body.selectAll(".data-editor").data([0]);
70663       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
70664       var rte = body.selectAll(".raw-tag-editor").data([0]);
70665       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
70666         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
70667       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
70668     }
70669     dataEditor.datum = function(val) {
70670       if (!arguments.length)
70671         return _datum;
70672       _datum = val;
70673       return this;
70674     };
70675     return dataEditor;
70676   }
70677
70678   // modules/ui/osmose_details.js
70679   function uiOsmoseDetails(context) {
70680     let _qaItem;
70681     function issueString(d2, type2) {
70682       if (!d2)
70683         return "";
70684       const s2 = services.osmose.getStrings(d2.itemType);
70685       return type2 in s2 ? s2[type2] : "";
70686     }
70687     function osmoseDetails(selection2) {
70688       const details = selection2.selectAll(".error-details").data(
70689         _qaItem ? [_qaItem] : [],
70690         (d2) => `${d2.id}-${d2.status || 0}`
70691       );
70692       details.exit().remove();
70693       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
70694       if (issueString(_qaItem, "detail")) {
70695         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70696         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
70697         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70698       }
70699       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
70700       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
70701       if (issueString(_qaItem, "fix")) {
70702         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70703         div.append("h4").call(_t.append("QA.osmose.fix_title"));
70704         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70705       }
70706       if (issueString(_qaItem, "trap")) {
70707         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70708         div.append("h4").call(_t.append("QA.osmose.trap_title"));
70709         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70710       }
70711       const thisItem = _qaItem;
70712       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
70713         if (!d2.elems || d2.elems.length === 0)
70714           return;
70715         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
70716           return;
70717         if (d2.detail) {
70718           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
70719           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70720         }
70721         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
70722         elemsDiv.append("ul").selectAll("li").data(d2.elems).enter().append("li").append("a").attr("href", "#").attr("class", "error_entity_link").text((d4) => d4).each(function() {
70723           const link2 = select_default2(this);
70724           const entityID = this.textContent;
70725           const entity = context.hasEntity(entityID);
70726           link2.on("mouseenter", () => {
70727             utilHighlightEntities([entityID], true, context);
70728           }).on("mouseleave", () => {
70729             utilHighlightEntities([entityID], false, context);
70730           }).on("click", (d3_event) => {
70731             d3_event.preventDefault();
70732             utilHighlightEntities([entityID], false, context);
70733             const osmlayer = context.layers().layer("osm");
70734             if (!osmlayer.enabled()) {
70735               osmlayer.enabled(true);
70736             }
70737             context.map().centerZoom(d2.loc, 20);
70738             if (entity) {
70739               context.enter(modeSelect(context, [entityID]));
70740             } else {
70741               context.loadEntity(entityID, (err, result) => {
70742                 if (err)
70743                   return;
70744                 const entity2 = result.data.find((e3) => e3.id === entityID);
70745                 if (entity2)
70746                   context.enter(modeSelect(context, [entityID]));
70747               });
70748             }
70749           });
70750           if (entity) {
70751             let name = utilDisplayName(entity);
70752             if (!name) {
70753               const preset = _mainPresetIndex.match(entity, context.graph());
70754               name = preset && !preset.isFallback() && preset.name();
70755             }
70756             if (name) {
70757               this.innerText = name;
70758             }
70759           }
70760         });
70761         context.features().forceVisible(d2.elems);
70762         context.map().pan([0, 0]);
70763       }).catch((err) => {
70764         console.log(err);
70765       });
70766     }
70767     osmoseDetails.issue = function(val) {
70768       if (!arguments.length)
70769         return _qaItem;
70770       _qaItem = val;
70771       return osmoseDetails;
70772     };
70773     return osmoseDetails;
70774   }
70775
70776   // modules/ui/osmose_header.js
70777   function uiOsmoseHeader() {
70778     let _qaItem;
70779     function issueTitle(d2) {
70780       const unknown = _t("inspector.unknown");
70781       if (!d2)
70782         return unknown;
70783       const s2 = services.osmose.getStrings(d2.itemType);
70784       return "title" in s2 ? s2.title : unknown;
70785     }
70786     function osmoseHeader(selection2) {
70787       const header = selection2.selectAll(".qa-header").data(
70788         _qaItem ? [_qaItem] : [],
70789         (d2) => `${d2.id}-${d2.status || 0}`
70790       );
70791       header.exit().remove();
70792       const headerEnter = header.enter().append("div").attr("class", "qa-header");
70793       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d2) => `preset-icon-28 qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
70794       svgEnter.append("polygon").attr("fill", (d2) => services.osmose.getColor(d2.item)).attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
70795       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
70796       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
70797     }
70798     osmoseHeader.issue = function(val) {
70799       if (!arguments.length)
70800         return _qaItem;
70801       _qaItem = val;
70802       return osmoseHeader;
70803     };
70804     return osmoseHeader;
70805   }
70806
70807   // modules/ui/view_on_osmose.js
70808   function uiViewOnOsmose() {
70809     let _qaItem;
70810     function viewOnOsmose(selection2) {
70811       let url;
70812       if (services.osmose && _qaItem instanceof QAItem) {
70813         url = services.osmose.itemURL(_qaItem);
70814       }
70815       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
70816       link2.exit().remove();
70817       const linkEnter = link2.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
70818       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
70819     }
70820     viewOnOsmose.what = function(val) {
70821       if (!arguments.length)
70822         return _qaItem;
70823       _qaItem = val;
70824       return viewOnOsmose;
70825     };
70826     return viewOnOsmose;
70827   }
70828
70829   // modules/ui/osmose_editor.js
70830   function uiOsmoseEditor(context) {
70831     const dispatch14 = dispatch_default("change");
70832     const qaDetails = uiOsmoseDetails(context);
70833     const qaHeader = uiOsmoseHeader(context);
70834     let _qaItem;
70835     function osmoseEditor(selection2) {
70836       const header = selection2.selectAll(".header").data([0]);
70837       const headerEnter = header.enter().append("div").attr("class", "header fillL");
70838       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
70839       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
70840       let body = selection2.selectAll(".body").data([0]);
70841       body = body.enter().append("div").attr("class", "body").merge(body);
70842       let editor = body.selectAll(".qa-editor").data([0]);
70843       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
70844       const footer = selection2.selectAll(".footer").data([0]);
70845       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
70846     }
70847     function osmoseSaveSection(selection2) {
70848       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
70849       const isShown = _qaItem && isSelected;
70850       let saveSection = selection2.selectAll(".qa-save").data(
70851         isShown ? [_qaItem] : [],
70852         (d2) => `${d2.id}-${d2.status || 0}`
70853       );
70854       saveSection.exit().remove();
70855       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
70856       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
70857     }
70858     function qaSaveButtons(selection2) {
70859       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
70860       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
70861       buttonSection.exit().remove();
70862       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
70863       buttonEnter.append("button").attr("class", "button close-button action");
70864       buttonEnter.append("button").attr("class", "button ignore-button action");
70865       buttonSection = buttonSection.merge(buttonEnter);
70866       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
70867         this.blur();
70868         const qaService = services.osmose;
70869         if (qaService) {
70870           d2.newStatus = "done";
70871           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
70872         }
70873       });
70874       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
70875         this.blur();
70876         const qaService = services.osmose;
70877         if (qaService) {
70878           d2.newStatus = "false";
70879           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
70880         }
70881       });
70882     }
70883     osmoseEditor.error = function(val) {
70884       if (!arguments.length)
70885         return _qaItem;
70886       _qaItem = val;
70887       return osmoseEditor;
70888     };
70889     return utilRebind(osmoseEditor, dispatch14, "on");
70890   }
70891
70892   // modules/ui/sidebar.js
70893   function uiSidebar(context) {
70894     var inspector = uiInspector(context);
70895     var dataEditor = uiDataEditor(context);
70896     var noteEditor = uiNoteEditor(context);
70897     var improveOsmEditor = uiImproveOsmEditor(context);
70898     var keepRightEditor = uiKeepRightEditor(context);
70899     var osmoseEditor = uiOsmoseEditor(context);
70900     var _current;
70901     var _wasData = false;
70902     var _wasNote = false;
70903     var _wasQaItem = false;
70904     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
70905     function sidebar(selection2) {
70906       var container = context.container();
70907       var minWidth = 240;
70908       var sidebarWidth;
70909       var containerWidth;
70910       var dragOffset;
70911       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
70912       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
70913       var downPointerId, lastClientX, containerLocGetter;
70914       function pointerdown(d3_event) {
70915         if (downPointerId)
70916           return;
70917         if ("button" in d3_event && d3_event.button !== 0)
70918           return;
70919         downPointerId = d3_event.pointerId || "mouse";
70920         lastClientX = d3_event.clientX;
70921         containerLocGetter = utilFastMouse(container.node());
70922         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
70923         sidebarWidth = selection2.node().getBoundingClientRect().width;
70924         containerWidth = container.node().getBoundingClientRect().width;
70925         var widthPct = sidebarWidth / containerWidth * 100;
70926         selection2.style("width", widthPct + "%").style("max-width", "85%");
70927         resizer.classed("dragging", true);
70928         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
70929           d3_event2.preventDefault();
70930         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
70931       }
70932       function pointermove(d3_event) {
70933         if (downPointerId !== (d3_event.pointerId || "mouse"))
70934           return;
70935         d3_event.preventDefault();
70936         var dx = d3_event.clientX - lastClientX;
70937         lastClientX = d3_event.clientX;
70938         var isRTL = _mainLocalizer.textDirection() === "rtl";
70939         var scaleX = isRTL ? 0 : 1;
70940         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
70941         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
70942         sidebarWidth = isRTL ? containerWidth - x2 : x2;
70943         var isCollapsed = selection2.classed("collapsed");
70944         var shouldCollapse = sidebarWidth < minWidth;
70945         selection2.classed("collapsed", shouldCollapse);
70946         if (shouldCollapse) {
70947           if (!isCollapsed) {
70948             selection2.style(xMarginProperty, "-400px").style("width", "400px");
70949             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
70950           }
70951         } else {
70952           var widthPct = sidebarWidth / containerWidth * 100;
70953           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
70954           if (isCollapsed) {
70955             context.ui().onResize([-sidebarWidth * scaleX, 0]);
70956           } else {
70957             context.ui().onResize([-dx * scaleX, 0]);
70958           }
70959         }
70960       }
70961       function pointerup(d3_event) {
70962         if (downPointerId !== (d3_event.pointerId || "mouse"))
70963           return;
70964         downPointerId = null;
70965         resizer.classed("dragging", false);
70966         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
70967       }
70968       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
70969       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
70970       var hoverModeSelect = function(targets) {
70971         context.container().selectAll(".feature-list-item button").classed("hover", false);
70972         if (context.selectedIDs().length > 1 && targets && targets.length) {
70973           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
70974             return targets.indexOf(node) !== -1;
70975           });
70976           if (!elements.empty()) {
70977             elements.classed("hover", true);
70978           }
70979         }
70980       };
70981       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
70982       function hover(targets) {
70983         var datum2 = targets && targets.length && targets[0];
70984         if (datum2 && datum2.__featurehash__) {
70985           _wasData = true;
70986           sidebar.show(dataEditor.datum(datum2));
70987           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
70988         } else if (datum2 instanceof osmNote) {
70989           if (context.mode().id === "drag-note")
70990             return;
70991           _wasNote = true;
70992           var osm = services.osm;
70993           if (osm) {
70994             datum2 = osm.getNote(datum2.id);
70995           }
70996           sidebar.show(noteEditor.note(datum2));
70997           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
70998         } else if (datum2 instanceof QAItem) {
70999           _wasQaItem = true;
71000           var errService = services[datum2.service];
71001           if (errService) {
71002             datum2 = errService.getError(datum2.id);
71003           }
71004           var errEditor;
71005           if (datum2.service === "keepRight") {
71006             errEditor = keepRightEditor;
71007           } else if (datum2.service === "osmose") {
71008             errEditor = osmoseEditor;
71009           } else {
71010             errEditor = improveOsmEditor;
71011           }
71012           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
71013             return d2.id === datum2.id;
71014           });
71015           sidebar.show(errEditor.error(datum2));
71016           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71017         } else if (!_current && datum2 instanceof osmEntity) {
71018           featureListWrap.classed("inspector-hidden", true);
71019           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
71020           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
71021             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
71022             inspectorWrap.call(inspector);
71023           }
71024         } else if (!_current) {
71025           featureListWrap.classed("inspector-hidden", false);
71026           inspectorWrap.classed("inspector-hidden", true);
71027           inspector.state("hide");
71028         } else if (_wasData || _wasNote || _wasQaItem) {
71029           _wasNote = false;
71030           _wasData = false;
71031           _wasQaItem = false;
71032           context.container().selectAll(".note").classed("hover", false);
71033           context.container().selectAll(".qaItem").classed("hover", false);
71034           sidebar.hide();
71035         }
71036       }
71037       sidebar.hover = throttle_default(hover, 200);
71038       sidebar.intersects = function(extent) {
71039         var rect = selection2.node().getBoundingClientRect();
71040         return extent.intersects([
71041           context.projection.invert([0, rect.height]),
71042           context.projection.invert([rect.width, 0])
71043         ]);
71044       };
71045       sidebar.select = function(ids, newFeature) {
71046         sidebar.hide();
71047         if (ids && ids.length) {
71048           var entity = ids.length === 1 && context.entity(ids[0]);
71049           if (entity && newFeature && selection2.classed("collapsed")) {
71050             var extent = entity.extent(context.graph());
71051             sidebar.expand(sidebar.intersects(extent));
71052           }
71053           featureListWrap.classed("inspector-hidden", true);
71054           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
71055           inspector.state("select").entityIDs(ids).newFeature(newFeature);
71056           inspectorWrap.call(inspector);
71057         } else {
71058           inspector.state("hide");
71059         }
71060       };
71061       sidebar.showPresetList = function() {
71062         inspector.showList();
71063       };
71064       sidebar.show = function(component, element) {
71065         featureListWrap.classed("inspector-hidden", true);
71066         inspectorWrap.classed("inspector-hidden", true);
71067         if (_current)
71068           _current.remove();
71069         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
71070       };
71071       sidebar.hide = function() {
71072         featureListWrap.classed("inspector-hidden", false);
71073         inspectorWrap.classed("inspector-hidden", true);
71074         if (_current)
71075           _current.remove();
71076         _current = null;
71077       };
71078       sidebar.expand = function(moveMap) {
71079         if (selection2.classed("collapsed")) {
71080           sidebar.toggle(moveMap);
71081         }
71082       };
71083       sidebar.collapse = function(moveMap) {
71084         if (!selection2.classed("collapsed")) {
71085           sidebar.toggle(moveMap);
71086         }
71087       };
71088       sidebar.toggle = function(moveMap) {
71089         if (context.inIntro())
71090           return;
71091         var isCollapsed = selection2.classed("collapsed");
71092         var isCollapsing = !isCollapsed;
71093         var isRTL = _mainLocalizer.textDirection() === "rtl";
71094         var scaleX = isRTL ? 0 : 1;
71095         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71096         sidebarWidth = selection2.node().getBoundingClientRect().width;
71097         selection2.style("width", sidebarWidth + "px");
71098         var startMargin, endMargin, lastMargin;
71099         if (isCollapsing) {
71100           startMargin = lastMargin = 0;
71101           endMargin = -sidebarWidth;
71102         } else {
71103           startMargin = lastMargin = -sidebarWidth;
71104           endMargin = 0;
71105         }
71106         if (!isCollapsing) {
71107           selection2.classed("collapsed", isCollapsing);
71108         }
71109         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
71110           var i3 = number_default(startMargin, endMargin);
71111           return function(t2) {
71112             var dx = lastMargin - Math.round(i3(t2));
71113             lastMargin = lastMargin - dx;
71114             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
71115           };
71116         }).on("end", function() {
71117           if (isCollapsing) {
71118             selection2.classed("collapsed", isCollapsing);
71119           }
71120           if (!isCollapsing) {
71121             var containerWidth2 = container.node().getBoundingClientRect().width;
71122             var widthPct = sidebarWidth / containerWidth2 * 100;
71123             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71124           }
71125         });
71126       };
71127       resizer.on("dblclick", function(d3_event) {
71128         d3_event.preventDefault();
71129         if (d3_event.sourceEvent) {
71130           d3_event.sourceEvent.preventDefault();
71131         }
71132         sidebar.toggle();
71133       });
71134       context.map().on("crossEditableZoom.sidebar", function(within) {
71135         if (!within && !selection2.select(".inspector-hover").empty()) {
71136           hover([]);
71137         }
71138       });
71139     }
71140     sidebar.showPresetList = function() {
71141     };
71142     sidebar.hover = function() {
71143     };
71144     sidebar.hover.cancel = function() {
71145     };
71146     sidebar.intersects = function() {
71147     };
71148     sidebar.select = function() {
71149     };
71150     sidebar.show = function() {
71151     };
71152     sidebar.hide = function() {
71153     };
71154     sidebar.expand = function() {
71155     };
71156     sidebar.collapse = function() {
71157     };
71158     sidebar.toggle = function() {
71159     };
71160     return sidebar;
71161   }
71162
71163   // modules/modes/draw_area.js
71164   function modeDrawArea(context, wayID, startGraph, button) {
71165     var mode = {
71166       button,
71167       id: "draw-area"
71168     };
71169     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
71170       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
71171     });
71172     mode.wayID = wayID;
71173     mode.enter = function() {
71174       context.install(behavior);
71175     };
71176     mode.exit = function() {
71177       context.uninstall(behavior);
71178     };
71179     mode.selectedIDs = function() {
71180       return [wayID];
71181     };
71182     mode.activeID = function() {
71183       return behavior && behavior.activeID() || [];
71184     };
71185     return mode;
71186   }
71187
71188   // modules/modes/add_area.js
71189   function modeAddArea(context, mode) {
71190     mode.id = "add-area";
71191     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
71192     function defaultTags(loc) {
71193       var defaultTags2 = { area: "yes" };
71194       if (mode.preset)
71195         defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
71196       return defaultTags2;
71197     }
71198     function actionClose(wayId) {
71199       return function(graph) {
71200         return graph.replace(graph.entity(wayId).close());
71201       };
71202     }
71203     function start2(loc) {
71204       var startGraph = context.graph();
71205       var node = osmNode({ loc });
71206       var way = osmWay({ tags: defaultTags(loc) });
71207       context.perform(
71208         actionAddEntity(node),
71209         actionAddEntity(way),
71210         actionAddVertex(way.id, node.id),
71211         actionClose(way.id)
71212       );
71213       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71214     }
71215     function startFromWay(loc, edge) {
71216       var startGraph = context.graph();
71217       var node = osmNode({ loc });
71218       var way = osmWay({ tags: defaultTags(loc) });
71219       context.perform(
71220         actionAddEntity(node),
71221         actionAddEntity(way),
71222         actionAddVertex(way.id, node.id),
71223         actionClose(way.id),
71224         actionAddMidpoint({ loc, edge }, node)
71225       );
71226       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71227     }
71228     function startFromNode(node) {
71229       var startGraph = context.graph();
71230       var way = osmWay({ tags: defaultTags(node.loc) });
71231       context.perform(
71232         actionAddEntity(way),
71233         actionAddVertex(way.id, node.id),
71234         actionClose(way.id)
71235       );
71236       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71237     }
71238     mode.enter = function() {
71239       context.install(behavior);
71240     };
71241     mode.exit = function() {
71242       context.uninstall(behavior);
71243     };
71244     return mode;
71245   }
71246
71247   // modules/modes/add_line.js
71248   function modeAddLine(context, mode) {
71249     mode.id = "add-line";
71250     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
71251     function defaultTags(loc) {
71252       var defaultTags2 = {};
71253       if (mode.preset)
71254         defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
71255       return defaultTags2;
71256     }
71257     function start2(loc) {
71258       var startGraph = context.graph();
71259       var node = osmNode({ loc });
71260       var way = osmWay({ tags: defaultTags(loc) });
71261       context.perform(
71262         actionAddEntity(node),
71263         actionAddEntity(way),
71264         actionAddVertex(way.id, node.id)
71265       );
71266       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71267     }
71268     function startFromWay(loc, edge) {
71269       var startGraph = context.graph();
71270       var node = osmNode({ loc });
71271       var way = osmWay({ tags: defaultTags(loc) });
71272       context.perform(
71273         actionAddEntity(node),
71274         actionAddEntity(way),
71275         actionAddVertex(way.id, node.id),
71276         actionAddMidpoint({ loc, edge }, node)
71277       );
71278       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71279     }
71280     function startFromNode(node) {
71281       var startGraph = context.graph();
71282       var way = osmWay({ tags: defaultTags(node.loc) });
71283       context.perform(
71284         actionAddEntity(way),
71285         actionAddVertex(way.id, node.id)
71286       );
71287       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71288     }
71289     mode.enter = function() {
71290       context.install(behavior);
71291     };
71292     mode.exit = function() {
71293       context.uninstall(behavior);
71294     };
71295     return mode;
71296   }
71297
71298   // modules/modes/add_point.js
71299   function modeAddPoint(context, mode) {
71300     mode.id = "add-point";
71301     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
71302     function defaultTags(loc) {
71303       var defaultTags2 = {};
71304       if (mode.preset)
71305         defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
71306       return defaultTags2;
71307     }
71308     function add(loc) {
71309       var node = osmNode({ loc, tags: defaultTags(loc) });
71310       context.perform(
71311         actionAddEntity(node),
71312         _t("operations.add.annotation.point")
71313       );
71314       enterSelectMode(node);
71315     }
71316     function addWay(loc, edge) {
71317       var node = osmNode({ tags: defaultTags(loc) });
71318       context.perform(
71319         actionAddMidpoint({ loc, edge }, node),
71320         _t("operations.add.annotation.vertex")
71321       );
71322       enterSelectMode(node);
71323     }
71324     function enterSelectMode(node) {
71325       context.enter(
71326         modeSelect(context, [node.id]).newFeature(true)
71327       );
71328     }
71329     function addNode(node) {
71330       const _defaultTags = defaultTags(node.loc);
71331       if (Object.keys(_defaultTags).length === 0) {
71332         enterSelectMode(node);
71333         return;
71334       }
71335       var tags = Object.assign({}, node.tags);
71336       for (var key in _defaultTags) {
71337         tags[key] = _defaultTags[key];
71338       }
71339       context.perform(
71340         actionChangeTags(node.id, tags),
71341         _t("operations.add.annotation.point")
71342       );
71343       enterSelectMode(node);
71344     }
71345     function cancel() {
71346       context.enter(modeBrowse(context));
71347     }
71348     mode.enter = function() {
71349       context.install(behavior);
71350     };
71351     mode.exit = function() {
71352       context.uninstall(behavior);
71353     };
71354     return mode;
71355   }
71356
71357   // modules/modes/select_note.js
71358   function modeSelectNote(context, selectedNoteID) {
71359     var mode = {
71360       id: "select-note",
71361       button: "browse"
71362     };
71363     var _keybinding = utilKeybinding("select-note");
71364     var _noteEditor = uiNoteEditor(context).on("change", function() {
71365       context.map().pan([0, 0]);
71366       var note = checkSelectedID();
71367       if (!note)
71368         return;
71369       context.ui().sidebar.show(_noteEditor.note(note));
71370     });
71371     var _behaviors = [
71372       behaviorBreathe(context),
71373       behaviorHover(context),
71374       behaviorSelect(context),
71375       behaviorLasso(context),
71376       modeDragNode(context).behavior,
71377       modeDragNote(context).behavior
71378     ];
71379     var _newFeature = false;
71380     function checkSelectedID() {
71381       if (!services.osm)
71382         return;
71383       var note = services.osm.getNote(selectedNoteID);
71384       if (!note) {
71385         context.enter(modeBrowse(context));
71386       }
71387       return note;
71388     }
71389     function selectNote(d3_event, drawn) {
71390       if (!checkSelectedID())
71391         return;
71392       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
71393       if (selection2.empty()) {
71394         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
71395         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
71396           context.enter(modeBrowse(context));
71397         }
71398       } else {
71399         selection2.classed("selected", true);
71400         context.selectedNoteID(selectedNoteID);
71401       }
71402     }
71403     function esc() {
71404       if (context.container().select(".combobox").size())
71405         return;
71406       context.enter(modeBrowse(context));
71407     }
71408     mode.zoomToSelected = function() {
71409       if (!services.osm)
71410         return;
71411       var note = services.osm.getNote(selectedNoteID);
71412       if (note) {
71413         context.map().centerZoomEase(note.loc, 20);
71414       }
71415     };
71416     mode.newFeature = function(val) {
71417       if (!arguments.length)
71418         return _newFeature;
71419       _newFeature = val;
71420       return mode;
71421     };
71422     mode.enter = function() {
71423       var note = checkSelectedID();
71424       if (!note)
71425         return;
71426       _behaviors.forEach(context.install);
71427       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
71428       select_default2(document).call(_keybinding);
71429       selectNote();
71430       var sidebar = context.ui().sidebar;
71431       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
71432       sidebar.expand(sidebar.intersects(note.extent()));
71433       context.map().on("drawn.select", selectNote);
71434     };
71435     mode.exit = function() {
71436       _behaviors.forEach(context.uninstall);
71437       select_default2(document).call(_keybinding.unbind);
71438       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
71439       context.map().on("drawn.select", null);
71440       context.ui().sidebar.hide();
71441       context.selectedNoteID(null);
71442     };
71443     return mode;
71444   }
71445
71446   // modules/modes/add_note.js
71447   function modeAddNote(context) {
71448     var mode = {
71449       id: "add-note",
71450       button: "note",
71451       description: _t.append("modes.add_note.description"),
71452       key: _t("modes.add_note.key")
71453     };
71454     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
71455     function add(loc) {
71456       var osm = services.osm;
71457       if (!osm)
71458         return;
71459       var note = osmNote({ loc, status: "open", comments: [] });
71460       osm.replaceNote(note);
71461       context.map().pan([0, 0]);
71462       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
71463     }
71464     function cancel() {
71465       context.enter(modeBrowse(context));
71466     }
71467     mode.enter = function() {
71468       context.install(behavior);
71469     };
71470     mode.exit = function() {
71471       context.uninstall(behavior);
71472     };
71473     return mode;
71474   }
71475
71476   // modules/modes/save.js
71477   function modeSave(context) {
71478     var mode = { id: "save" };
71479     var keybinding = utilKeybinding("modeSave");
71480     var commit = uiCommit(context).on("cancel", cancel);
71481     var _conflictsUi;
71482     var _location;
71483     var _success;
71484     var uploader = context.uploader().on("saveStarted.modeSave", function() {
71485       keybindingOff();
71486     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
71487       cancel();
71488     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
71489     function cancel() {
71490       context.enter(modeBrowse(context));
71491     }
71492     function showProgress(num, total) {
71493       var modal = context.container().select(".loading-modal .modal-section");
71494       var progress = modal.selectAll(".progress").data([0]);
71495       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
71496     }
71497     function showConflicts(changeset, conflicts, origChanges) {
71498       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
71499       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71500       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
71501         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71502         selection2.remove();
71503         keybindingOn();
71504         uploader.cancelConflictResolution();
71505       }).on("save", function() {
71506         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71507         selection2.remove();
71508         uploader.processResolvedConflicts(changeset);
71509       });
71510       selection2.call(_conflictsUi);
71511     }
71512     function showErrors(errors) {
71513       keybindingOn();
71514       var selection2 = uiConfirm(context.container());
71515       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
71516       addErrors(selection2, errors);
71517       selection2.okButton();
71518     }
71519     function addErrors(selection2, data) {
71520       var message = selection2.select(".modal-section.message-text");
71521       var items = message.selectAll(".error-container").data(data);
71522       var enter = items.enter().append("div").attr("class", "error-container");
71523       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
71524         return d2.msg || _t("save.unknown_error_details");
71525       }).on("click", function(d3_event) {
71526         d3_event.preventDefault();
71527         var error = select_default2(this);
71528         var detail = select_default2(this.nextElementSibling);
71529         var exp2 = error.classed("expanded");
71530         detail.style("display", exp2 ? "none" : "block");
71531         error.classed("expanded", !exp2);
71532       });
71533       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
71534       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
71535         return d2.details || [];
71536       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
71537         return d2;
71538       });
71539       items.exit().remove();
71540     }
71541     function showSuccess(changeset) {
71542       commit.reset();
71543       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
71544         context.ui().sidebar.hide();
71545       });
71546       context.enter(modeBrowse(context).sidebar(ui));
71547     }
71548     function keybindingOn() {
71549       select_default2(document).call(keybinding.on("\u238B", cancel, true));
71550     }
71551     function keybindingOff() {
71552       select_default2(document).call(keybinding.unbind);
71553     }
71554     function prepareForSuccess() {
71555       _success = uiSuccess(context);
71556       _location = null;
71557       if (!services.geocoder)
71558         return;
71559       services.geocoder.reverse(context.map().center(), function(err, result) {
71560         if (err || !result || !result.address)
71561           return;
71562         var addr = result.address;
71563         var place = addr && (addr.town || addr.city || addr.county) || "";
71564         var region = addr && (addr.state || addr.country) || "";
71565         var separator = place && region ? _t("success.thank_you_where.separator") : "";
71566         _location = _t(
71567           "success.thank_you_where.format",
71568           { place, separator, region }
71569         );
71570       });
71571     }
71572     mode.selectedIDs = function() {
71573       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
71574     };
71575     mode.enter = function() {
71576       context.ui().sidebar.expand();
71577       function done() {
71578         context.ui().sidebar.show(commit);
71579       }
71580       keybindingOn();
71581       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71582       var osm = context.connection();
71583       if (!osm) {
71584         cancel();
71585         return;
71586       }
71587       if (osm.authenticated()) {
71588         done();
71589       } else {
71590         osm.authenticate(function(err) {
71591           if (err) {
71592             cancel();
71593           } else {
71594             done();
71595           }
71596         });
71597       }
71598     };
71599     mode.exit = function() {
71600       keybindingOff();
71601       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71602       context.ui().sidebar.hide();
71603     };
71604     return mode;
71605   }
71606
71607   // modules/modes/select_error.js
71608   function modeSelectError(context, selectedErrorID, selectedErrorService) {
71609     var mode = {
71610       id: "select-error",
71611       button: "browse"
71612     };
71613     var keybinding = utilKeybinding("select-error");
71614     var errorService = services[selectedErrorService];
71615     var errorEditor;
71616     switch (selectedErrorService) {
71617       case "improveOSM":
71618         errorEditor = uiImproveOsmEditor(context).on("change", function() {
71619           context.map().pan([0, 0]);
71620           var error = checkSelectedID();
71621           if (!error)
71622             return;
71623           context.ui().sidebar.show(errorEditor.error(error));
71624         });
71625         break;
71626       case "keepRight":
71627         errorEditor = uiKeepRightEditor(context).on("change", function() {
71628           context.map().pan([0, 0]);
71629           var error = checkSelectedID();
71630           if (!error)
71631             return;
71632           context.ui().sidebar.show(errorEditor.error(error));
71633         });
71634         break;
71635       case "osmose":
71636         errorEditor = uiOsmoseEditor(context).on("change", function() {
71637           context.map().pan([0, 0]);
71638           var error = checkSelectedID();
71639           if (!error)
71640             return;
71641           context.ui().sidebar.show(errorEditor.error(error));
71642         });
71643         break;
71644     }
71645     var behaviors = [
71646       behaviorBreathe(context),
71647       behaviorHover(context),
71648       behaviorSelect(context),
71649       behaviorLasso(context),
71650       modeDragNode(context).behavior,
71651       modeDragNote(context).behavior
71652     ];
71653     function checkSelectedID() {
71654       if (!errorService)
71655         return;
71656       var error = errorService.getError(selectedErrorID);
71657       if (!error) {
71658         context.enter(modeBrowse(context));
71659       }
71660       return error;
71661     }
71662     mode.zoomToSelected = function() {
71663       if (!errorService)
71664         return;
71665       var error = errorService.getError(selectedErrorID);
71666       if (error) {
71667         context.map().centerZoomEase(error.loc, 20);
71668       }
71669     };
71670     mode.enter = function() {
71671       var error = checkSelectedID();
71672       if (!error)
71673         return;
71674       behaviors.forEach(context.install);
71675       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
71676       select_default2(document).call(keybinding);
71677       selectError();
71678       var sidebar = context.ui().sidebar;
71679       sidebar.show(errorEditor.error(error));
71680       context.map().on("drawn.select-error", selectError);
71681       function selectError(d3_event, drawn) {
71682         if (!checkSelectedID())
71683           return;
71684         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
71685         if (selection2.empty()) {
71686           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
71687           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
71688             context.enter(modeBrowse(context));
71689           }
71690         } else {
71691           selection2.classed("selected", true);
71692           context.selectedErrorID(selectedErrorID);
71693         }
71694       }
71695       function esc() {
71696         if (context.container().select(".combobox").size())
71697           return;
71698         context.enter(modeBrowse(context));
71699       }
71700     };
71701     mode.exit = function() {
71702       behaviors.forEach(context.uninstall);
71703       select_default2(document).call(keybinding.unbind);
71704       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
71705       context.map().on("drawn.select-error", null);
71706       context.ui().sidebar.hide();
71707       context.selectedErrorID(null);
71708       context.features().forceVisible([]);
71709     };
71710     return mode;
71711   }
71712
71713   // modules/ui/tools/modes.js
71714   function uiToolDrawModes(context) {
71715     var tool = {
71716       id: "old_modes",
71717       label: _t.append("toolbar.add_feature")
71718     };
71719     var modes = [
71720       modeAddPoint(context, {
71721         title: _t.append("modes.add_point.title"),
71722         button: "point",
71723         description: _t.append("modes.add_point.description"),
71724         preset: _mainPresetIndex.item("point"),
71725         key: "1"
71726       }),
71727       modeAddLine(context, {
71728         title: _t.append("modes.add_line.title"),
71729         button: "line",
71730         description: _t.append("modes.add_line.description"),
71731         preset: _mainPresetIndex.item("line"),
71732         key: "2"
71733       }),
71734       modeAddArea(context, {
71735         title: _t.append("modes.add_area.title"),
71736         button: "area",
71737         description: _t.append("modes.add_area.description"),
71738         preset: _mainPresetIndex.item("area"),
71739         key: "3"
71740       })
71741     ];
71742     function enabled(_mode) {
71743       return osmEditable();
71744     }
71745     function osmEditable() {
71746       return context.editable();
71747     }
71748     modes.forEach(function(mode) {
71749       context.keybinding().on(mode.key, function() {
71750         if (!enabled(mode))
71751           return;
71752         if (mode.id === context.mode().id) {
71753           context.enter(modeBrowse(context));
71754         } else {
71755           context.enter(mode);
71756         }
71757       });
71758     });
71759     tool.render = function(selection2) {
71760       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
71761       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
71762       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
71763       context.on("enter.modes", update);
71764       update();
71765       function update() {
71766         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
71767           return d2.id;
71768         });
71769         buttons.exit().remove();
71770         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
71771           return d2.id + " add-button bar-button";
71772         }).on("click.mode-buttons", function(d3_event, d2) {
71773           if (!enabled(d2))
71774             return;
71775           var currMode = context.mode().id;
71776           if (/^draw/.test(currMode))
71777             return;
71778           if (d2.id === currMode) {
71779             context.enter(modeBrowse(context));
71780           } else {
71781             context.enter(d2);
71782           }
71783         }).call(
71784           uiTooltip().placement("bottom").title(function(d2) {
71785             return d2.description;
71786           }).keys(function(d2) {
71787             return [d2.key];
71788           }).scrollContainer(context.container().select(".top-toolbar"))
71789         );
71790         buttonsEnter.each(function(d2) {
71791           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
71792         });
71793         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
71794           mode.title(select_default2(this));
71795         });
71796         if (buttons.enter().size() || buttons.exit().size()) {
71797           context.ui().checkOverflow(".top-toolbar", true);
71798         }
71799         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
71800           return !enabled(d2);
71801         }).classed("disabled", function(d2) {
71802           return !enabled(d2);
71803         }).attr("aria-pressed", function(d2) {
71804           return context.mode() && context.mode().button === d2.button;
71805         }).classed("active", function(d2) {
71806           return context.mode() && context.mode().button === d2.button;
71807         });
71808       }
71809     };
71810     return tool;
71811   }
71812
71813   // modules/ui/tools/notes.js
71814   function uiToolNotes(context) {
71815     var tool = {
71816       id: "notes",
71817       label: _t.append("modes.add_note.label")
71818     };
71819     var mode = modeAddNote(context);
71820     function enabled() {
71821       return notesEnabled() && notesEditable();
71822     }
71823     function notesEnabled() {
71824       var noteLayer = context.layers().layer("notes");
71825       return noteLayer && noteLayer.enabled();
71826     }
71827     function notesEditable() {
71828       var mode2 = context.mode();
71829       return context.map().notesEditable() && mode2 && mode2.id !== "save";
71830     }
71831     context.keybinding().on(mode.key, function() {
71832       if (!enabled())
71833         return;
71834       if (mode.id === context.mode().id) {
71835         context.enter(modeBrowse(context));
71836       } else {
71837         context.enter(mode);
71838       }
71839     });
71840     tool.render = function(selection2) {
71841       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
71842       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
71843       context.on("enter.notes", update);
71844       update();
71845       function update() {
71846         var showNotes = notesEnabled();
71847         var data = showNotes ? [mode] : [];
71848         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
71849           return d2.id;
71850         });
71851         buttons.exit().remove();
71852         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
71853           return d2.id + " add-button bar-button";
71854         }).on("click.notes", function(d3_event, d2) {
71855           if (!enabled())
71856             return;
71857           var currMode = context.mode().id;
71858           if (/^draw/.test(currMode))
71859             return;
71860           if (d2.id === currMode) {
71861             context.enter(modeBrowse(context));
71862           } else {
71863             context.enter(d2);
71864           }
71865         }).call(
71866           uiTooltip().placement("bottom").title(function(d2) {
71867             return d2.description;
71868           }).keys(function(d2) {
71869             return [d2.key];
71870           }).scrollContainer(context.container().select(".top-toolbar"))
71871         );
71872         buttonsEnter.each(function(d2) {
71873           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
71874         });
71875         if (buttons.enter().size() || buttons.exit().size()) {
71876           context.ui().checkOverflow(".top-toolbar", true);
71877         }
71878         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
71879           return !enabled();
71880         }).attr("aria-disabled", function() {
71881           return !enabled();
71882         }).classed("active", function(d2) {
71883           return context.mode() && context.mode().button === d2.button;
71884         }).attr("aria-pressed", function(d2) {
71885           return context.mode() && context.mode().button === d2.button;
71886         });
71887       }
71888     };
71889     tool.uninstall = function() {
71890       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
71891       context.map().on("move.notes", null).on("drawn.notes", null);
71892     };
71893     return tool;
71894   }
71895
71896   // modules/ui/tools/save.js
71897   function uiToolSave(context) {
71898     var tool = {
71899       id: "save",
71900       label: _t.append("save.title")
71901     };
71902     var button = null;
71903     var tooltipBehavior = null;
71904     var history = context.history();
71905     var key = uiCmd("\u2318S");
71906     var _numChanges = 0;
71907     function isSaving() {
71908       var mode = context.mode();
71909       return mode && mode.id === "save";
71910     }
71911     function isDisabled() {
71912       return _numChanges === 0 || isSaving();
71913     }
71914     function save(d3_event) {
71915       d3_event.preventDefault();
71916       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
71917         context.enter(modeSave(context));
71918       }
71919     }
71920     function bgColor(numChanges) {
71921       var step;
71922       if (numChanges === 0) {
71923         return null;
71924       } else if (numChanges <= 50) {
71925         step = numChanges / 50;
71926         return rgb_default("#fff", "#ff8")(step);
71927       } else {
71928         step = Math.min((numChanges - 50) / 50, 1);
71929         return rgb_default("#ff8", "#f88")(step);
71930       }
71931     }
71932     function updateCount() {
71933       var val = history.difference().summary().length;
71934       if (val === _numChanges)
71935         return;
71936       _numChanges = val;
71937       if (tooltipBehavior) {
71938         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
71939       }
71940       if (button) {
71941         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
71942         button.select("span.count").text(_numChanges);
71943       }
71944     }
71945     tool.render = function(selection2) {
71946       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
71947       var lastPointerUpType;
71948       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
71949         lastPointerUpType = d3_event.pointerType;
71950       }).on("click", function(d3_event) {
71951         save(d3_event);
71952         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
71953           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
71954         }
71955         lastPointerUpType = null;
71956       }).call(tooltipBehavior);
71957       button.call(svgIcon("#iD-icon-save"));
71958       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
71959       updateCount();
71960       context.keybinding().on(key, save, true);
71961       context.history().on("change.save", updateCount);
71962       context.on("enter.save", function() {
71963         if (button) {
71964           button.classed("disabled", isDisabled());
71965           if (isSaving()) {
71966             button.call(tooltipBehavior.hide);
71967           }
71968         }
71969       });
71970     };
71971     tool.uninstall = function() {
71972       context.keybinding().off(key, true);
71973       context.history().on("change.save", null);
71974       context.on("enter.save", null);
71975       button = null;
71976       tooltipBehavior = null;
71977     };
71978     return tool;
71979   }
71980
71981   // modules/ui/tools/sidebar_toggle.js
71982   function uiToolSidebarToggle(context) {
71983     var tool = {
71984       id: "sidebar_toggle",
71985       label: _t.append("toolbar.inspect")
71986     };
71987     tool.render = function(selection2) {
71988       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
71989         context.ui().sidebar.toggle();
71990       }).call(
71991         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
71992       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
71993     };
71994     return tool;
71995   }
71996
71997   // modules/ui/tools/undo_redo.js
71998   function uiToolUndoRedo(context) {
71999     var tool = {
72000       id: "undo_redo",
72001       label: _t.append("toolbar.undo_redo")
72002     };
72003     var commands = [{
72004       id: "undo",
72005       cmd: uiCmd("\u2318Z"),
72006       action: function() {
72007         context.undo();
72008       },
72009       annotation: function() {
72010         return context.history().undoAnnotation();
72011       },
72012       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
72013     }, {
72014       id: "redo",
72015       cmd: uiCmd("\u2318\u21E7Z"),
72016       action: function() {
72017         context.redo();
72018       },
72019       annotation: function() {
72020         return context.history().redoAnnotation();
72021       },
72022       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
72023     }];
72024     function editable() {
72025       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
72026         true
72027         /* ignore min zoom */
72028       );
72029     }
72030     tool.render = function(selection2) {
72031       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
72032         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
72033       }).keys(function(d2) {
72034         return [d2.cmd];
72035       }).scrollContainer(context.container().select(".top-toolbar"));
72036       var lastPointerUpType;
72037       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
72038         return "disabled " + d2.id + "-button bar-button";
72039       }).on("pointerup", function(d3_event) {
72040         lastPointerUpType = d3_event.pointerType;
72041       }).on("click", function(d3_event, d2) {
72042         d3_event.preventDefault();
72043         var annotation = d2.annotation();
72044         if (editable() && annotation) {
72045           d2.action();
72046         }
72047         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72048           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
72049           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
72050         }
72051         lastPointerUpType = null;
72052       }).call(tooltipBehavior);
72053       buttons.each(function(d2) {
72054         select_default2(this).call(svgIcon("#" + d2.icon));
72055       });
72056       context.keybinding().on(commands[0].cmd, function(d3_event) {
72057         d3_event.preventDefault();
72058         if (editable())
72059           commands[0].action();
72060       }).on(commands[1].cmd, function(d3_event) {
72061         d3_event.preventDefault();
72062         if (editable())
72063           commands[1].action();
72064       });
72065       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72066       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
72067       context.history().on("change.undo_redo", function(difference) {
72068         if (difference)
72069           update();
72070       });
72071       context.on("enter.undo_redo", update);
72072       function update() {
72073         buttons.classed("disabled", function(d2) {
72074           return !editable() || !d2.annotation();
72075         }).each(function() {
72076           var selection3 = select_default2(this);
72077           if (!selection3.select(".tooltip.in").empty()) {
72078             selection3.call(tooltipBehavior.updateContent);
72079           }
72080         });
72081       }
72082     };
72083     tool.uninstall = function() {
72084       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
72085       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
72086       context.history().on("change.undo_redo", null);
72087       context.on("enter.undo_redo", null);
72088     };
72089     return tool;
72090   }
72091
72092   // modules/ui/top_toolbar.js
72093   function uiTopToolbar(context) {
72094     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
72095     function notesEnabled() {
72096       var noteLayer = context.layers().layer("notes");
72097       return noteLayer && noteLayer.enabled();
72098     }
72099     function topToolbar(bar) {
72100       bar.on("wheel.topToolbar", function(d3_event) {
72101         if (!d3_event.deltaX) {
72102           bar.node().scrollLeft += d3_event.deltaY;
72103         }
72104       });
72105       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72106       context.layers().on("change.topToolbar", debouncedUpdate);
72107       update();
72108       function update() {
72109         var tools = [
72110           sidebarToggle,
72111           "spacer",
72112           modes
72113         ];
72114         tools.push("spacer");
72115         if (notesEnabled()) {
72116           tools = tools.concat([notes, "spacer"]);
72117         }
72118         tools = tools.concat([undoRedo, save]);
72119         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
72120           return d2.id || d2;
72121         });
72122         toolbarItems.exit().each(function(d2) {
72123           if (d2.uninstall) {
72124             d2.uninstall();
72125           }
72126         }).remove();
72127         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
72128           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
72129           if (d2.klass)
72130             classes += " " + d2.klass;
72131           return classes;
72132         });
72133         var actionableItems = itemsEnter.filter(function(d2) {
72134           return d2 !== "spacer";
72135         });
72136         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
72137           select_default2(this).call(d2.render, bar);
72138         });
72139         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
72140           d2.label(select_default2(this));
72141         });
72142       }
72143     }
72144     return topToolbar;
72145   }
72146
72147   // modules/ui/zoom_to_selection.js
72148   function uiZoomToSelection(context) {
72149     function isDisabled() {
72150       var mode = context.mode();
72151       return !mode || !mode.zoomToSelected;
72152     }
72153     var _lastPointerUpType;
72154     function pointerup(d3_event) {
72155       _lastPointerUpType = d3_event.pointerType;
72156     }
72157     function click(d3_event) {
72158       d3_event.preventDefault();
72159       if (isDisabled()) {
72160         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
72161           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
72162         }
72163       } else {
72164         var mode = context.mode();
72165         if (mode && mode.zoomToSelected) {
72166           mode.zoomToSelected();
72167         }
72168       }
72169       _lastPointerUpType = null;
72170     }
72171     return function(selection2) {
72172       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
72173         if (isDisabled()) {
72174           return _t.append("inspector.zoom_to.no_selection");
72175         }
72176         return _t.append("inspector.zoom_to.title");
72177       }).keys([_t("inspector.zoom_to.key")]);
72178       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
72179       function setEnabledState() {
72180         button.classed("disabled", isDisabled());
72181         if (!button.select(".tooltip.in").empty()) {
72182           button.call(tooltipBehavior.updateContent);
72183         }
72184       }
72185       context.on("enter.uiZoomToSelection", setEnabledState);
72186       setEnabledState();
72187     };
72188   }
72189
72190   // modules/ui/pane.js
72191   function uiPane(id2, context) {
72192     var _key;
72193     var _label = "";
72194     var _description = "";
72195     var _iconName = "";
72196     var _sections;
72197     var _paneSelection = select_default2(null);
72198     var _paneTooltip;
72199     var pane = {
72200       id: id2
72201     };
72202     pane.label = function(val) {
72203       if (!arguments.length)
72204         return _label;
72205       _label = val;
72206       return pane;
72207     };
72208     pane.key = function(val) {
72209       if (!arguments.length)
72210         return _key;
72211       _key = val;
72212       return pane;
72213     };
72214     pane.description = function(val) {
72215       if (!arguments.length)
72216         return _description;
72217       _description = val;
72218       return pane;
72219     };
72220     pane.iconName = function(val) {
72221       if (!arguments.length)
72222         return _iconName;
72223       _iconName = val;
72224       return pane;
72225     };
72226     pane.sections = function(val) {
72227       if (!arguments.length)
72228         return _sections;
72229       _sections = val;
72230       return pane;
72231     };
72232     pane.selection = function() {
72233       return _paneSelection;
72234     };
72235     function hidePane() {
72236       context.ui().togglePanes();
72237     }
72238     pane.togglePane = function(d3_event) {
72239       if (d3_event)
72240         d3_event.preventDefault();
72241       _paneTooltip.hide();
72242       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
72243     };
72244     pane.renderToggleButton = function(selection2) {
72245       if (!_paneTooltip) {
72246         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
72247       }
72248       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
72249     };
72250     pane.renderContent = function(selection2) {
72251       if (_sections) {
72252         _sections.forEach(function(section) {
72253           selection2.call(section.render);
72254         });
72255       }
72256     };
72257     pane.renderPane = function(selection2) {
72258       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
72259       var heading = _paneSelection.append("div").attr("class", "pane-heading");
72260       heading.append("h2").text("").call(_label);
72261       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
72262       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
72263       if (_key) {
72264         context.keybinding().on(_key, pane.togglePane);
72265       }
72266     };
72267     return pane;
72268   }
72269
72270   // modules/ui/sections/background_display_options.js
72271   function uiSectionBackgroundDisplayOptions(context) {
72272     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
72273     var _storedOpacity = corePreferences("background-opacity");
72274     var _minVal = 0;
72275     var _maxVal = 3;
72276     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
72277     var _options = {
72278       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
72279       contrast: 1,
72280       saturation: 1,
72281       sharpness: 1
72282     };
72283     function clamp3(x2, min3, max3) {
72284       return Math.max(min3, Math.min(x2, max3));
72285     }
72286     function updateValue(d2, val) {
72287       val = clamp3(val, _minVal, _maxVal);
72288       _options[d2] = val;
72289       context.background()[d2](val);
72290       if (d2 === "brightness") {
72291         corePreferences("background-opacity", val);
72292       }
72293       section.reRender();
72294     }
72295     function renderDisclosureContent(selection2) {
72296       var container = selection2.selectAll(".display-options-container").data([0]);
72297       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
72298       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
72299         return "display-control display-control-" + d2;
72300       });
72301       slidersEnter.html(function(d2) {
72302         return _t.html("background." + d2);
72303       }).append("span").attr("class", function(d2) {
72304         return "display-option-value display-option-value-" + d2;
72305       });
72306       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
72307       sildersControlEnter.append("input").attr("class", function(d2) {
72308         return "display-option-input display-option-input-" + d2;
72309       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d2) {
72310         var val = select_default2(this).property("value");
72311         if (!val && d3_event && d3_event.target) {
72312           val = d3_event.target.value;
72313         }
72314         updateValue(d2, val);
72315       });
72316       sildersControlEnter.append("button").attr("title", function(d2) {
72317         return `${_t("background.reset")} ${_t("background." + d2)}`;
72318       }).attr("class", function(d2) {
72319         return "display-option-reset display-option-reset-" + d2;
72320       }).on("click", function(d3_event, d2) {
72321         if (d3_event.button !== 0)
72322           return;
72323         updateValue(d2, 1);
72324       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72325       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
72326         d3_event.preventDefault();
72327         for (var i3 = 0; i3 < _sliders.length; i3++) {
72328           updateValue(_sliders[i3], 1);
72329         }
72330       });
72331       container = containerEnter.merge(container);
72332       container.selectAll(".display-option-input").property("value", function(d2) {
72333         return _options[d2];
72334       });
72335       container.selectAll(".display-option-value").text(function(d2) {
72336         return Math.floor(_options[d2] * 100) + "%";
72337       });
72338       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
72339         return _options[d2] === 1;
72340       });
72341       if (containerEnter.size() && _options.brightness !== 1) {
72342         context.background().brightness(_options.brightness);
72343       }
72344     }
72345     return section;
72346   }
72347
72348   // modules/ui/settings/custom_background.js
72349   function uiSettingsCustomBackground() {
72350     var dispatch14 = dispatch_default("change");
72351     function render(selection2) {
72352       var _origSettings = {
72353         template: corePreferences("background-custom-template")
72354       };
72355       var _currSettings = {
72356         template: corePreferences("background-custom-template")
72357       };
72358       var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
72359       var modal = uiConfirm(selection2).okButton();
72360       modal.classed("settings-modal settings-custom-background", true);
72361       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
72362       var textSection = modal.select(".modal-section.message-text");
72363       var instructions = `${_t.html("settings.custom_background.instructions.info")}
72364
72365 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
72366 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
72367 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
72368 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
72369 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
72370
72371 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
72372 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
72373 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
72374 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
72375 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
72376 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
72377
72378 #### ${_t.html("settings.custom_background.instructions.example")}
72379 \`${example}\``;
72380       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
72381       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
72382       var buttonSection = modal.select(".modal-section.buttons");
72383       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
72384       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
72385       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
72386       function isSaveDisabled() {
72387         return null;
72388       }
72389       function clickCancel() {
72390         textSection.select(".field-template").property("value", _origSettings.template);
72391         corePreferences("background-custom-template", _origSettings.template);
72392         this.blur();
72393         modal.close();
72394       }
72395       function clickSave() {
72396         _currSettings.template = textSection.select(".field-template").property("value");
72397         corePreferences("background-custom-template", _currSettings.template);
72398         this.blur();
72399         modal.close();
72400         dispatch14.call("change", this, _currSettings);
72401       }
72402     }
72403     return utilRebind(render, dispatch14, "on");
72404   }
72405
72406   // modules/ui/sections/background_list.js
72407   function uiSectionBackgroundList(context) {
72408     var _backgroundList = select_default2(null);
72409     var _customSource = context.background().findSource("custom");
72410     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
72411     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
72412     function previousBackgroundID() {
72413       return corePreferences("background-last-used-toggle");
72414     }
72415     function renderDisclosureContent(selection2) {
72416       var container = selection2.selectAll(".layer-background-list").data([0]);
72417       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
72418       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
72419       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
72420         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
72421       );
72422       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72423         d3_event.preventDefault();
72424         uiMapInMap.toggle();
72425       });
72426       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
72427       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
72428         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
72429       );
72430       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72431         d3_event.preventDefault();
72432         context.ui().info.toggle("background");
72433       });
72434       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
72435       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
72436         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
72437       );
72438       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72439         d3_event.preventDefault();
72440         context.ui().info.toggle("location");
72441       });
72442       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
72443       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"));
72444       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
72445         chooseBackground(d2);
72446       }, function(d2) {
72447         return !d2.isHidden() && !d2.overlay;
72448       });
72449     }
72450     function setTooltips(selection2) {
72451       selection2.each(function(d2, i3, nodes) {
72452         var item = select_default2(this).select("label");
72453         var span = item.select("span");
72454         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
72455         var hasDescription = d2.hasDescription();
72456         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
72457         item.call(uiTooltip().destroyAny);
72458         if (d2.id === previousBackgroundID()) {
72459           item.call(
72460             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
72461           );
72462         } else if (hasDescription || isOverflowing) {
72463           item.call(
72464             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
72465           );
72466         }
72467       });
72468     }
72469     function drawListItems(layerList, type2, change, filter2) {
72470       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
72471         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
72472       });
72473       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
72474         return d2.id + "---" + i3;
72475       });
72476       layerLinks.exit().remove();
72477       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
72478         return d2.id === "custom";
72479       }).classed("best", function(d2) {
72480         return d2.best();
72481       });
72482       var label = enter.append("label");
72483       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
72484         return d2.id;
72485       }).on("change", change);
72486       label.append("span").each(function(d2) {
72487         d2.label()(select_default2(this));
72488       });
72489       enter.filter(function(d2) {
72490         return d2.id === "custom";
72491       }).append("button").attr("class", "layer-browse").call(
72492         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72493       ).on("click", function(d3_event) {
72494         d3_event.preventDefault();
72495         editCustom();
72496       }).call(svgIcon("#iD-icon-more"));
72497       enter.filter(function(d2) {
72498         return d2.best();
72499       }).append("div").attr("class", "best").call(
72500         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72501       ).append("span").text("\u2605");
72502       layerList.call(updateLayerSelections);
72503     }
72504     function updateLayerSelections(selection2) {
72505       function active(d2) {
72506         return context.background().showsLayer(d2);
72507       }
72508       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
72509         return d2.id === previousBackgroundID();
72510       }).call(setTooltips).selectAll("input").property("checked", active);
72511     }
72512     function chooseBackground(d2) {
72513       if (d2.id === "custom" && !d2.template()) {
72514         return editCustom();
72515       }
72516       var previousBackground = context.background().baseLayerSource();
72517       corePreferences("background-last-used-toggle", previousBackground.id);
72518       corePreferences("background-last-used", d2.id);
72519       context.background().baseLayerSource(d2);
72520     }
72521     function customChanged(d2) {
72522       if (d2 && d2.template) {
72523         _customSource.template(d2.template);
72524         chooseBackground(_customSource);
72525       } else {
72526         _customSource.template("");
72527         chooseBackground(context.background().findSource("none"));
72528       }
72529     }
72530     function editCustom() {
72531       context.container().call(_settingsCustomBackground);
72532     }
72533     context.background().on("change.background_list", function() {
72534       _backgroundList.call(updateLayerSelections);
72535     });
72536     context.map().on(
72537       "move.background_list",
72538       debounce_default(function() {
72539         window.requestIdleCallback(section.reRender);
72540       }, 1e3)
72541     );
72542     return section;
72543   }
72544
72545   // modules/ui/sections/background_offset.js
72546   function uiSectionBackgroundOffset(context) {
72547     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
72548     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72549     var _directions = [
72550       ["top", [0, -0.5]],
72551       ["left", [-0.5, 0]],
72552       ["right", [0.5, 0]],
72553       ["bottom", [0, 0.5]]
72554     ];
72555     function updateValue() {
72556       var meters = geoOffsetToMeters(context.background().offset());
72557       var x2 = +meters[0].toFixed(2);
72558       var y2 = +meters[1].toFixed(2);
72559       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
72560       context.container().selectAll(".nudge-reset").classed("disabled", function() {
72561         return x2 === 0 && y2 === 0;
72562       });
72563     }
72564     function resetOffset() {
72565       context.background().offset([0, 0]);
72566       updateValue();
72567     }
72568     function nudge(d2) {
72569       context.background().nudge(d2, context.map().zoom());
72570       updateValue();
72571     }
72572     function inputOffset() {
72573       var input = select_default2(this);
72574       var d2 = input.node().value;
72575       if (d2 === "")
72576         return resetOffset();
72577       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
72578         return !isNaN(n3) && n3;
72579       });
72580       if (d2.length !== 2 || !d2[0] || !d2[1]) {
72581         input.classed("error", true);
72582         return;
72583       }
72584       context.background().offset(geoMetersToOffset(d2));
72585       updateValue();
72586     }
72587     function dragOffset(d3_event) {
72588       if (d3_event.button !== 0)
72589         return;
72590       var origin = [d3_event.clientX, d3_event.clientY];
72591       var pointerId = d3_event.pointerId || "mouse";
72592       context.container().append("div").attr("class", "nudge-surface");
72593       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
72594       if (_pointerPrefix === "pointer") {
72595         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
72596       }
72597       function pointermove(d3_event2) {
72598         if (pointerId !== (d3_event2.pointerId || "mouse"))
72599           return;
72600         var latest = [d3_event2.clientX, d3_event2.clientY];
72601         var d2 = [
72602           -(origin[0] - latest[0]) / 4,
72603           -(origin[1] - latest[1]) / 4
72604         ];
72605         origin = latest;
72606         nudge(d2);
72607       }
72608       function pointerup(d3_event2) {
72609         if (pointerId !== (d3_event2.pointerId || "mouse"))
72610           return;
72611         if (d3_event2.button !== 0)
72612           return;
72613         context.container().selectAll(".nudge-surface").remove();
72614         select_default2(window).on(".drag-bg-offset", null);
72615       }
72616     }
72617     function renderDisclosureContent(selection2) {
72618       var container = selection2.selectAll(".nudge-container").data([0]);
72619       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
72620       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
72621       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
72622       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
72623       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
72624       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
72625         return _t(`background.nudge.${d2[0]}`);
72626       }).attr("class", function(d2) {
72627         return d2[0] + " nudge";
72628       }).on("click", function(d3_event, d2) {
72629         nudge(d2[1]);
72630       });
72631       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
72632         d3_event.preventDefault();
72633         resetOffset();
72634       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72635       updateValue();
72636     }
72637     context.background().on("change.backgroundOffset-update", updateValue);
72638     return section;
72639   }
72640
72641   // modules/ui/sections/overlay_list.js
72642   function uiSectionOverlayList(context) {
72643     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
72644     var _overlayList = select_default2(null);
72645     function setTooltips(selection2) {
72646       selection2.each(function(d2, i3, nodes) {
72647         var item = select_default2(this).select("label");
72648         var span = item.select("span");
72649         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
72650         var description = d2.description();
72651         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
72652         item.call(uiTooltip().destroyAny);
72653         if (description || isOverflowing) {
72654           item.call(
72655             uiTooltip().placement(placement).title(() => description || d2.name())
72656           );
72657         }
72658       });
72659     }
72660     function updateLayerSelections(selection2) {
72661       function active(d2) {
72662         return context.background().showsLayer(d2);
72663       }
72664       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
72665     }
72666     function chooseOverlay(d3_event, d2) {
72667       d3_event.preventDefault();
72668       context.background().toggleOverlayLayer(d2);
72669       _overlayList.call(updateLayerSelections);
72670       document.activeElement.blur();
72671     }
72672     function drawListItems(layerList, type2, change, filter2) {
72673       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
72674       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
72675         return d2.name();
72676       });
72677       layerLinks.exit().remove();
72678       var enter = layerLinks.enter().append("li");
72679       var label = enter.append("label");
72680       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
72681       label.append("span").each(function(d2) {
72682         d2.label()(select_default2(this));
72683       });
72684       layerList.selectAll("li").sort(sortSources);
72685       layerList.call(updateLayerSelections);
72686       function sortSources(a2, b2) {
72687         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
72688       }
72689     }
72690     function renderDisclosureContent(selection2) {
72691       var container = selection2.selectAll(".layer-overlay-list").data([0]);
72692       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
72693       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
72694         return !d2.isHidden() && d2.overlay;
72695       });
72696     }
72697     context.map().on(
72698       "move.overlay_list",
72699       debounce_default(function() {
72700         window.requestIdleCallback(section.reRender);
72701       }, 1e3)
72702     );
72703     return section;
72704   }
72705
72706   // modules/ui/panes/background.js
72707   function uiPaneBackground(context) {
72708     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
72709       uiSectionBackgroundList(context),
72710       uiSectionOverlayList(context),
72711       uiSectionBackgroundDisplayOptions(context),
72712       uiSectionBackgroundOffset(context)
72713     ]);
72714     return backgroundPane;
72715   }
72716
72717   // modules/ui/panes/help.js
72718   function uiPaneHelp(context) {
72719     var docKeys = [
72720       ["help", [
72721         "welcome",
72722         "open_data_h",
72723         "open_data",
72724         "before_start_h",
72725         "before_start",
72726         "open_source_h",
72727         "open_source",
72728         "open_source_attribution",
72729         "open_source_help"
72730       ]],
72731       ["overview", [
72732         "navigation_h",
72733         "navigation_drag",
72734         "navigation_zoom",
72735         "features_h",
72736         "features",
72737         "nodes_ways"
72738       ]],
72739       ["editing", [
72740         "select_h",
72741         "select_left_click",
72742         "select_right_click",
72743         "select_space",
72744         "multiselect_h",
72745         "multiselect",
72746         "multiselect_shift_click",
72747         "multiselect_lasso",
72748         "undo_redo_h",
72749         "undo_redo",
72750         "save_h",
72751         "save",
72752         "save_validation",
72753         "upload_h",
72754         "upload",
72755         "backups_h",
72756         "backups",
72757         "keyboard_h",
72758         "keyboard"
72759       ]],
72760       ["feature_editor", [
72761         "intro",
72762         "definitions",
72763         "type_h",
72764         "type",
72765         "type_picker",
72766         "fields_h",
72767         "fields_all_fields",
72768         "fields_example",
72769         "fields_add_field",
72770         "tags_h",
72771         "tags_all_tags",
72772         "tags_resources"
72773       ]],
72774       ["points", [
72775         "intro",
72776         "add_point_h",
72777         "add_point",
72778         "add_point_finish",
72779         "move_point_h",
72780         "move_point",
72781         "delete_point_h",
72782         "delete_point",
72783         "delete_point_command"
72784       ]],
72785       ["lines", [
72786         "intro",
72787         "add_line_h",
72788         "add_line",
72789         "add_line_draw",
72790         "add_line_continue",
72791         "add_line_finish",
72792         "modify_line_h",
72793         "modify_line_dragnode",
72794         "modify_line_addnode",
72795         "connect_line_h",
72796         "connect_line",
72797         "connect_line_display",
72798         "connect_line_drag",
72799         "connect_line_tag",
72800         "disconnect_line_h",
72801         "disconnect_line_command",
72802         "move_line_h",
72803         "move_line_command",
72804         "move_line_connected",
72805         "delete_line_h",
72806         "delete_line",
72807         "delete_line_command"
72808       ]],
72809       ["areas", [
72810         "intro",
72811         "point_or_area_h",
72812         "point_or_area",
72813         "add_area_h",
72814         "add_area_command",
72815         "add_area_draw",
72816         "add_area_continue",
72817         "add_area_finish",
72818         "square_area_h",
72819         "square_area_command",
72820         "modify_area_h",
72821         "modify_area_dragnode",
72822         "modify_area_addnode",
72823         "delete_area_h",
72824         "delete_area",
72825         "delete_area_command"
72826       ]],
72827       ["relations", [
72828         "intro",
72829         "edit_relation_h",
72830         "edit_relation",
72831         "edit_relation_add",
72832         "edit_relation_delete",
72833         "maintain_relation_h",
72834         "maintain_relation",
72835         "relation_types_h",
72836         "multipolygon_h",
72837         "multipolygon",
72838         "multipolygon_create",
72839         "multipolygon_merge",
72840         "turn_restriction_h",
72841         "turn_restriction",
72842         "turn_restriction_field",
72843         "turn_restriction_editing",
72844         "route_h",
72845         "route",
72846         "route_add",
72847         "boundary_h",
72848         "boundary",
72849         "boundary_add"
72850       ]],
72851       ["operations", [
72852         "intro",
72853         "intro_2",
72854         "straighten",
72855         "orthogonalize",
72856         "circularize",
72857         "move",
72858         "rotate",
72859         "reflect",
72860         "continue",
72861         "reverse",
72862         "disconnect",
72863         "split",
72864         "extract",
72865         "merge",
72866         "delete",
72867         "downgrade",
72868         "copy_paste"
72869       ]],
72870       ["notes", [
72871         "intro",
72872         "add_note_h",
72873         "add_note",
72874         "place_note",
72875         "move_note",
72876         "update_note_h",
72877         "update_note",
72878         "save_note_h",
72879         "save_note"
72880       ]],
72881       ["imagery", [
72882         "intro",
72883         "sources_h",
72884         "choosing",
72885         "sources",
72886         "offsets_h",
72887         "offset",
72888         "offset_change"
72889       ]],
72890       ["streetlevel", [
72891         "intro",
72892         "using_h",
72893         "using",
72894         "photos",
72895         "viewer"
72896       ]],
72897       ["gps", [
72898         "intro",
72899         "survey",
72900         "using_h",
72901         "using",
72902         "tracing",
72903         "upload"
72904       ]],
72905       ["qa", [
72906         "intro",
72907         "tools_h",
72908         "tools",
72909         "issues_h",
72910         "issues"
72911       ]]
72912     ];
72913     var headings = {
72914       "help.help.open_data_h": 3,
72915       "help.help.before_start_h": 3,
72916       "help.help.open_source_h": 3,
72917       "help.overview.navigation_h": 3,
72918       "help.overview.features_h": 3,
72919       "help.editing.select_h": 3,
72920       "help.editing.multiselect_h": 3,
72921       "help.editing.undo_redo_h": 3,
72922       "help.editing.save_h": 3,
72923       "help.editing.upload_h": 3,
72924       "help.editing.backups_h": 3,
72925       "help.editing.keyboard_h": 3,
72926       "help.feature_editor.type_h": 3,
72927       "help.feature_editor.fields_h": 3,
72928       "help.feature_editor.tags_h": 3,
72929       "help.points.add_point_h": 3,
72930       "help.points.move_point_h": 3,
72931       "help.points.delete_point_h": 3,
72932       "help.lines.add_line_h": 3,
72933       "help.lines.modify_line_h": 3,
72934       "help.lines.connect_line_h": 3,
72935       "help.lines.disconnect_line_h": 3,
72936       "help.lines.move_line_h": 3,
72937       "help.lines.delete_line_h": 3,
72938       "help.areas.point_or_area_h": 3,
72939       "help.areas.add_area_h": 3,
72940       "help.areas.square_area_h": 3,
72941       "help.areas.modify_area_h": 3,
72942       "help.areas.delete_area_h": 3,
72943       "help.relations.edit_relation_h": 3,
72944       "help.relations.maintain_relation_h": 3,
72945       "help.relations.relation_types_h": 2,
72946       "help.relations.multipolygon_h": 3,
72947       "help.relations.turn_restriction_h": 3,
72948       "help.relations.route_h": 3,
72949       "help.relations.boundary_h": 3,
72950       "help.notes.add_note_h": 3,
72951       "help.notes.update_note_h": 3,
72952       "help.notes.save_note_h": 3,
72953       "help.imagery.sources_h": 3,
72954       "help.imagery.offsets_h": 3,
72955       "help.streetlevel.using_h": 3,
72956       "help.gps.using_h": 3,
72957       "help.qa.tools_h": 3,
72958       "help.qa.issues_h": 3
72959     };
72960     var docs = docKeys.map(function(key) {
72961       var helpkey = "help." + key[0];
72962       var helpPaneReplacements = { version: context.version };
72963       var text2 = key[1].reduce(function(all, part) {
72964         var subkey = helpkey + "." + part;
72965         var depth = headings[subkey];
72966         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
72967         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
72968       }, "");
72969       return {
72970         title: _t.html(helpkey + ".title"),
72971         content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
72972       };
72973     });
72974     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
72975     helpPane.renderContent = function(content) {
72976       function clickHelp(d2, i3) {
72977         var rtl = _mainLocalizer.textDirection() === "rtl";
72978         content.property("scrollTop", 0);
72979         helpPane.selection().select(".pane-heading h2").html(d2.title);
72980         body.html(d2.content);
72981         body.selectAll("a").attr("target", "_blank");
72982         menuItems.classed("selected", function(m2) {
72983           return m2.title === d2.title;
72984         });
72985         nav.html("");
72986         if (rtl) {
72987           nav.call(drawNext).call(drawPrevious);
72988         } else {
72989           nav.call(drawPrevious).call(drawNext);
72990         }
72991         function drawNext(selection2) {
72992           if (i3 < docs.length - 1) {
72993             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
72994               d3_event.preventDefault();
72995               clickHelp(docs[i3 + 1], i3 + 1);
72996             });
72997             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
72998           }
72999         }
73000         function drawPrevious(selection2) {
73001           if (i3 > 0) {
73002             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
73003               d3_event.preventDefault();
73004               clickHelp(docs[i3 - 1], i3 - 1);
73005             });
73006             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
73007           }
73008         }
73009       }
73010       function clickWalkthrough(d3_event) {
73011         d3_event.preventDefault();
73012         if (context.inIntro())
73013           return;
73014         context.container().call(uiIntro(context));
73015         context.ui().togglePanes();
73016       }
73017       function clickShortcuts(d3_event) {
73018         d3_event.preventDefault();
73019         context.container().call(context.ui().shortcuts, true);
73020       }
73021       var toc = content.append("ul").attr("class", "toc");
73022       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
73023         return d2.title;
73024       }).on("click", function(d3_event, d2) {
73025         d3_event.preventDefault();
73026         clickHelp(d2, docs.indexOf(d2));
73027       });
73028       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
73029         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
73030       ).append("a").attr("href", "#").on("click", clickShortcuts);
73031       shortcuts.append("div").call(_t.append("shortcuts.title"));
73032       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
73033       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
73034       walkthrough.append("div").call(_t.append("splash.walkthrough"));
73035       var helpContent = content.append("div").attr("class", "left-content");
73036       var body = helpContent.append("div").attr("class", "body");
73037       var nav = helpContent.append("div").attr("class", "nav");
73038       clickHelp(docs[0], 0);
73039     };
73040     return helpPane;
73041   }
73042
73043   // modules/ui/sections/validation_issues.js
73044   function uiSectionValidationIssues(id2, severity, context) {
73045     var _issues = [];
73046     var section = uiSection(id2, context).label(function() {
73047       if (!_issues)
73048         return "";
73049       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
73050       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
73051     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
73052       return _issues && _issues.length;
73053     });
73054     function getOptions() {
73055       return {
73056         what: corePreferences("validate-what") || "edited",
73057         where: corePreferences("validate-where") || "all"
73058       };
73059     }
73060     function reloadIssues() {
73061       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
73062     }
73063     function renderDisclosureContent(selection2) {
73064       var center = context.map().center();
73065       var graph = context.graph();
73066       var issues = _issues.map(function withDistance(issue) {
73067         var extent = issue.extent(graph);
73068         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
73069         return Object.assign(issue, { dist });
73070       }).sort(function byDistance(a2, b2) {
73071         return a2.dist - b2.dist;
73072       });
73073       issues = issues.slice(0, 1e3);
73074       selection2.call(drawIssuesList, issues);
73075     }
73076     function drawIssuesList(selection2, issues) {
73077       var list = selection2.selectAll(".issues-list").data([0]);
73078       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
73079       var items = list.selectAll("li").data(issues, function(d2) {
73080         return d2.key;
73081       });
73082       items.exit().remove();
73083       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
73084         return "issue severity-" + d2.severity;
73085       });
73086       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
73087         context.validator().focusIssue(d2);
73088       }).on("mouseover", function(d3_event, d2) {
73089         utilHighlightEntities(d2.entityIds, true, context);
73090       }).on("mouseout", function(d3_event, d2) {
73091         utilHighlightEntities(d2.entityIds, false, context);
73092       });
73093       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
73094       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
73095         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73096         select_default2(this).call(svgIcon(iconName));
73097       });
73098       textEnter.append("span").attr("class", "issue-message");
73099       items = items.merge(itemsEnter).order();
73100       items.selectAll(".issue-message").text("").each(function(d2) {
73101         return d2.message(context)(select_default2(this));
73102       });
73103     }
73104     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
73105       window.requestIdleCallback(function() {
73106         reloadIssues();
73107         section.reRender();
73108       });
73109     });
73110     context.map().on(
73111       "move.uiSectionValidationIssues" + id2,
73112       debounce_default(function() {
73113         window.requestIdleCallback(function() {
73114           if (getOptions().where === "visible") {
73115             reloadIssues();
73116           }
73117           section.reRender();
73118         });
73119       }, 1e3)
73120     );
73121     return section;
73122   }
73123
73124   // modules/ui/sections/validation_options.js
73125   function uiSectionValidationOptions(context) {
73126     var section = uiSection("issues-options", context).content(renderContent);
73127     function renderContent(selection2) {
73128       var container = selection2.selectAll(".issues-options-container").data([0]);
73129       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
73130       var data = [
73131         { key: "what", values: ["edited", "all"] },
73132         { key: "where", values: ["visible", "all"] }
73133       ];
73134       var options2 = container.selectAll(".issues-option").data(data, function(d2) {
73135         return d2.key;
73136       });
73137       var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
73138         return "issues-option issues-option-" + d2.key;
73139       });
73140       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
73141         return _t.html("issues.options." + d2.key + ".title");
73142       });
73143       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
73144         return d2.values.map(function(val) {
73145           return { value: val, key: d2.key };
73146         });
73147       }).enter().append("label");
73148       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
73149         return "issues-option-" + d2.key;
73150       }).attr("value", function(d2) {
73151         return d2.value;
73152       }).property("checked", function(d2) {
73153         return getOptions()[d2.key] === d2.value;
73154       }).on("change", function(d3_event, d2) {
73155         updateOptionValue(d3_event, d2.key, d2.value);
73156       });
73157       valuesEnter.append("span").html(function(d2) {
73158         return _t.html("issues.options." + d2.key + "." + d2.value);
73159       });
73160     }
73161     function getOptions() {
73162       return {
73163         what: corePreferences("validate-what") || "edited",
73164         // 'all', 'edited'
73165         where: corePreferences("validate-where") || "all"
73166         // 'all', 'visible'
73167       };
73168     }
73169     function updateOptionValue(d3_event, d2, val) {
73170       if (!val && d3_event && d3_event.target) {
73171         val = d3_event.target.value;
73172       }
73173       corePreferences("validate-" + d2, val);
73174       context.validator().validate();
73175     }
73176     return section;
73177   }
73178
73179   // modules/ui/sections/validation_rules.js
73180   function uiSectionValidationRules(context) {
73181     var MINSQUARE = 0;
73182     var MAXSQUARE = 20;
73183     var DEFAULTSQUARE = 5;
73184     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
73185     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
73186       return key !== "maprules";
73187     }).sort(function(key1, key2) {
73188       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
73189     });
73190     function renderDisclosureContent(selection2) {
73191       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
73192       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
73193       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
73194       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
73195       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73196         d3_event.preventDefault();
73197         context.validator().disableRules(_ruleKeys);
73198       });
73199       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73200         d3_event.preventDefault();
73201         context.validator().disableRules([]);
73202       });
73203       container = container.merge(containerEnter);
73204       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
73205     }
73206     function drawListItems(selection2, data, type2, name, change, active) {
73207       var items = selection2.selectAll("li").data(data);
73208       items.exit().remove();
73209       var enter = items.enter().append("li");
73210       if (name === "rule") {
73211         enter.call(
73212           uiTooltip().title(function(d2) {
73213             return _t.append("issues." + d2 + ".tip");
73214           }).placement("top")
73215         );
73216       }
73217       var label = enter.append("label");
73218       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73219       label.append("span").html(function(d2) {
73220         var params = {};
73221         if (d2 === "unsquare_way") {
73222           params.val = { html: '<span class="square-degrees"></span>' };
73223         }
73224         return _t.html("issues." + d2 + ".title", params);
73225       });
73226       items = items.merge(enter);
73227       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73228       var degStr = corePreferences("validate-square-degrees");
73229       if (degStr === null) {
73230         degStr = DEFAULTSQUARE.toString();
73231       }
73232       var span = items.selectAll(".square-degrees");
73233       var input = span.selectAll(".square-degrees-input").data([0]);
73234       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) {
73235         d3_event.preventDefault();
73236         d3_event.stopPropagation();
73237         this.select();
73238       }).on("keyup", function(d3_event) {
73239         if (d3_event.keyCode === 13) {
73240           this.blur();
73241           this.select();
73242         }
73243       }).on("blur", changeSquare).merge(input).property("value", degStr);
73244     }
73245     function changeSquare() {
73246       var input = select_default2(this);
73247       var degStr = utilGetSetValue(input).trim();
73248       var degNum = Number(degStr);
73249       if (!isFinite(degNum)) {
73250         degNum = DEFAULTSQUARE;
73251       } else if (degNum > MAXSQUARE) {
73252         degNum = MAXSQUARE;
73253       } else if (degNum < MINSQUARE) {
73254         degNum = MINSQUARE;
73255       }
73256       degNum = Math.round(degNum * 10) / 10;
73257       degStr = degNum.toString();
73258       input.property("value", degStr);
73259       corePreferences("validate-square-degrees", degStr);
73260       context.validator().revalidateUnsquare();
73261     }
73262     function isRuleEnabled(d2) {
73263       return context.validator().isRuleEnabled(d2);
73264     }
73265     function toggleRule(d3_event, d2) {
73266       context.validator().toggleRule(d2);
73267     }
73268     context.validator().on("validated.uiSectionValidationRules", function() {
73269       window.requestIdleCallback(section.reRender);
73270     });
73271     return section;
73272   }
73273
73274   // modules/ui/sections/validation_status.js
73275   function uiSectionValidationStatus(context) {
73276     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
73277       var issues = context.validator().getIssues(getOptions());
73278       return issues.length === 0;
73279     });
73280     function getOptions() {
73281       return {
73282         what: corePreferences("validate-what") || "edited",
73283         where: corePreferences("validate-where") || "all"
73284       };
73285     }
73286     function renderContent(selection2) {
73287       var box = selection2.selectAll(".box").data([0]);
73288       var boxEnter = box.enter().append("div").attr("class", "box");
73289       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
73290       var noIssuesMessage = boxEnter.append("span");
73291       noIssuesMessage.append("strong").attr("class", "message");
73292       noIssuesMessage.append("br");
73293       noIssuesMessage.append("span").attr("class", "details");
73294       renderIgnoredIssuesReset(selection2);
73295       setNoIssuesText(selection2);
73296     }
73297     function renderIgnoredIssuesReset(selection2) {
73298       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
73299       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
73300       resetIgnored.exit().remove();
73301       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
73302       resetIgnoredEnter.append("a").attr("href", "#");
73303       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
73304       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
73305       resetIgnored.on("click", function(d3_event) {
73306         d3_event.preventDefault();
73307         context.validator().resetIgnoredIssues();
73308       });
73309     }
73310     function setNoIssuesText(selection2) {
73311       var opts = getOptions();
73312       function checkForHiddenIssues(cases) {
73313         for (var type2 in cases) {
73314           var hiddenOpts = cases[type2];
73315           var hiddenIssues = context.validator().getIssues(hiddenOpts);
73316           if (hiddenIssues.length) {
73317             selection2.select(".box .details").html("").call(_t.append(
73318               "issues.no_issues.hidden_issues." + type2,
73319               { count: hiddenIssues.length.toString() }
73320             ));
73321             return;
73322           }
73323         }
73324         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
73325       }
73326       var messageType;
73327       if (opts.what === "edited" && opts.where === "visible") {
73328         messageType = "edits_in_view";
73329         checkForHiddenIssues({
73330           elsewhere: { what: "edited", where: "all" },
73331           everything_else: { what: "all", where: "visible" },
73332           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
73333           everything_else_elsewhere: { what: "all", where: "all" },
73334           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
73335           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
73336           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
73337         });
73338       } else if (opts.what === "edited" && opts.where === "all") {
73339         messageType = "edits";
73340         checkForHiddenIssues({
73341           everything_else: { what: "all", where: "all" },
73342           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
73343           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
73344         });
73345       } else if (opts.what === "all" && opts.where === "visible") {
73346         messageType = "everything_in_view";
73347         checkForHiddenIssues({
73348           elsewhere: { what: "all", where: "all" },
73349           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
73350           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
73351           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
73352           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
73353         });
73354       } else if (opts.what === "all" && opts.where === "all") {
73355         messageType = "everything";
73356         checkForHiddenIssues({
73357           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
73358           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
73359         });
73360       }
73361       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
73362         messageType = "no_edits";
73363       }
73364       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
73365     }
73366     context.validator().on("validated.uiSectionValidationStatus", function() {
73367       window.requestIdleCallback(section.reRender);
73368     });
73369     context.map().on(
73370       "move.uiSectionValidationStatus",
73371       debounce_default(function() {
73372         window.requestIdleCallback(section.reRender);
73373       }, 1e3)
73374     );
73375     return section;
73376   }
73377
73378   // modules/ui/panes/issues.js
73379   function uiPaneIssues(context) {
73380     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
73381       uiSectionValidationOptions(context),
73382       uiSectionValidationStatus(context),
73383       uiSectionValidationIssues("issues-errors", "error", context),
73384       uiSectionValidationIssues("issues-warnings", "warning", context),
73385       uiSectionValidationRules(context)
73386     ]);
73387     return issuesPane;
73388   }
73389
73390   // modules/ui/settings/custom_data.js
73391   function uiSettingsCustomData(context) {
73392     var dispatch14 = dispatch_default("change");
73393     function render(selection2) {
73394       var dataLayer = context.layers().layer("data");
73395       var _origSettings = {
73396         fileList: dataLayer && dataLayer.fileList() || null,
73397         url: corePreferences("settings-custom-data-url")
73398       };
73399       var _currSettings = {
73400         fileList: dataLayer && dataLayer.fileList() || null
73401         // url: prefs('settings-custom-data-url')
73402       };
73403       var modal = uiConfirm(selection2).okButton();
73404       modal.classed("settings-modal settings-custom-data", true);
73405       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
73406       var textSection = modal.select(".modal-section.message-text");
73407       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
73408       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) {
73409         var files = d3_event.target.files;
73410         if (files && files.length) {
73411           _currSettings.url = "";
73412           textSection.select(".field-url").property("value", "");
73413           _currSettings.fileList = files;
73414         } else {
73415           _currSettings.fileList = null;
73416         }
73417       });
73418       textSection.append("h4").call(_t.append("settings.custom_data.or"));
73419       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
73420       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
73421       var buttonSection = modal.select(".modal-section.buttons");
73422       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
73423       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
73424       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
73425       function isSaveDisabled() {
73426         return null;
73427       }
73428       function clickCancel() {
73429         textSection.select(".field-url").property("value", _origSettings.url);
73430         corePreferences("settings-custom-data-url", _origSettings.url);
73431         this.blur();
73432         modal.close();
73433       }
73434       function clickSave() {
73435         _currSettings.url = textSection.select(".field-url").property("value").trim();
73436         if (_currSettings.url) {
73437           _currSettings.fileList = null;
73438         }
73439         if (_currSettings.fileList) {
73440           _currSettings.url = "";
73441         }
73442         corePreferences("settings-custom-data-url", _currSettings.url);
73443         this.blur();
73444         modal.close();
73445         dispatch14.call("change", this, _currSettings);
73446       }
73447     }
73448     return utilRebind(render, dispatch14, "on");
73449   }
73450
73451   // modules/ui/sections/data_layers.js
73452   function uiSectionDataLayers(context) {
73453     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
73454     var layers = context.layers();
73455     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
73456     function renderDisclosureContent(selection2) {
73457       var container = selection2.selectAll(".data-layer-container").data([0]);
73458       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
73459     }
73460     function showsLayer(which) {
73461       var layer = layers.layer(which);
73462       if (layer) {
73463         return layer.enabled();
73464       }
73465       return false;
73466     }
73467     function setLayer(which, enabled) {
73468       var mode = context.mode();
73469       if (mode && /^draw/.test(mode.id))
73470         return;
73471       var layer = layers.layer(which);
73472       if (layer) {
73473         layer.enabled(enabled);
73474         if (!enabled && (which === "osm" || which === "notes")) {
73475           context.enter(modeBrowse(context));
73476         }
73477       }
73478     }
73479     function toggleLayer(which) {
73480       setLayer(which, !showsLayer(which));
73481     }
73482     function drawOsmItems(selection2) {
73483       var osmKeys = ["osm", "notes"];
73484       var osmLayers = layers.all().filter(function(obj) {
73485         return osmKeys.indexOf(obj.id) !== -1;
73486       });
73487       var ul = selection2.selectAll(".layer-list-osm").data([0]);
73488       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
73489       var li = ul.selectAll(".list-item").data(osmLayers);
73490       li.exit().remove();
73491       var liEnter = li.enter().append("li").attr("class", function(d2) {
73492         return "list-item list-item-" + d2.id;
73493       });
73494       var labelEnter = liEnter.append("label").each(function(d2) {
73495         if (d2.id === "osm") {
73496           select_default2(this).call(
73497             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
73498           );
73499         } else {
73500           select_default2(this).call(
73501             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
73502           );
73503         }
73504       });
73505       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73506         toggleLayer(d2.id);
73507       });
73508       labelEnter.append("span").html(function(d2) {
73509         return _t.html("map_data.layers." + d2.id + ".title");
73510       });
73511       li.merge(liEnter).classed("active", function(d2) {
73512         return d2.layer.enabled();
73513       }).selectAll("input").property("checked", function(d2) {
73514         return d2.layer.enabled();
73515       });
73516     }
73517     function drawQAItems(selection2) {
73518       var qaKeys = ["keepRight", "improveOSM", "osmose"];
73519       var qaLayers = layers.all().filter(function(obj) {
73520         return qaKeys.indexOf(obj.id) !== -1;
73521       });
73522       var ul = selection2.selectAll(".layer-list-qa").data([0]);
73523       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
73524       var li = ul.selectAll(".list-item").data(qaLayers);
73525       li.exit().remove();
73526       var liEnter = li.enter().append("li").attr("class", function(d2) {
73527         return "list-item list-item-" + d2.id;
73528       });
73529       var labelEnter = liEnter.append("label").each(function(d2) {
73530         select_default2(this).call(
73531           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
73532         );
73533       });
73534       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73535         toggleLayer(d2.id);
73536       });
73537       labelEnter.append("span").each(function(d2) {
73538         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
73539       });
73540       li.merge(liEnter).classed("active", function(d2) {
73541         return d2.layer.enabled();
73542       }).selectAll("input").property("checked", function(d2) {
73543         return d2.layer.enabled();
73544       });
73545     }
73546     function drawVectorItems(selection2) {
73547       var dataLayer = layers.layer("data");
73548       var vtData = [
73549         {
73550           name: "Detroit Neighborhoods/Parks",
73551           src: "neighborhoods-parks",
73552           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
73553           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"
73554         },
73555         {
73556           name: "Detroit Composite POIs",
73557           src: "composite-poi",
73558           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
73559           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"
73560         },
73561         {
73562           name: "Detroit All-The-Places POIs",
73563           src: "alltheplaces-poi",
73564           tooltip: "Public domain business location data created by web scrapers.",
73565           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"
73566         }
73567       ];
73568       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
73569       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
73570       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
73571       container.exit().remove();
73572       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
73573       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
73574       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
73575       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");
73576       container = container.merge(containerEnter);
73577       var ul = container.selectAll(".layer-list-vectortile");
73578       var li = ul.selectAll(".list-item").data(vtData);
73579       li.exit().remove();
73580       var liEnter = li.enter().append("li").attr("class", function(d2) {
73581         return "list-item list-item-" + d2.src;
73582       });
73583       var labelEnter = liEnter.append("label").each(function(d2) {
73584         select_default2(this).call(
73585           uiTooltip().title(d2.tooltip).placement("top")
73586         );
73587       });
73588       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
73589       labelEnter.append("span").text(function(d2) {
73590         return d2.name;
73591       });
73592       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
73593       function isVTLayerSelected(d2) {
73594         return dataLayer && dataLayer.template() === d2.template;
73595       }
73596       function selectVTLayer(d3_event, d2) {
73597         corePreferences("settings-custom-data-url", d2.template);
73598         if (dataLayer) {
73599           dataLayer.template(d2.template, d2.src);
73600           dataLayer.enabled(true);
73601         }
73602       }
73603     }
73604     function drawCustomDataItems(selection2) {
73605       var dataLayer = layers.layer("data");
73606       var hasData = dataLayer && dataLayer.hasData();
73607       var showsData = hasData && dataLayer.enabled();
73608       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
73609       ul.exit().remove();
73610       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
73611       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
73612       var labelEnter = liEnter.append("label").call(
73613         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
73614       );
73615       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
73616         toggleLayer("data");
73617       });
73618       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
73619       liEnter.append("button").attr("class", "open-data-options").call(
73620         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73621       ).on("click", function(d3_event) {
73622         d3_event.preventDefault();
73623         editCustom();
73624       }).call(svgIcon("#iD-icon-more"));
73625       liEnter.append("button").attr("class", "zoom-to-data").call(
73626         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73627       ).on("click", function(d3_event) {
73628         if (select_default2(this).classed("disabled"))
73629           return;
73630         d3_event.preventDefault();
73631         d3_event.stopPropagation();
73632         dataLayer.fitZoom();
73633       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
73634       ul = ul.merge(ulEnter);
73635       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
73636       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
73637     }
73638     function editCustom() {
73639       context.container().call(settingsCustomData);
73640     }
73641     function customChanged(d2) {
73642       var dataLayer = layers.layer("data");
73643       if (d2 && d2.url) {
73644         dataLayer.url(d2.url);
73645       } else if (d2 && d2.fileList) {
73646         dataLayer.fileList(d2.fileList);
73647       }
73648     }
73649     function drawPanelItems(selection2) {
73650       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
73651       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
73652         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
73653       );
73654       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73655         d3_event.preventDefault();
73656         context.ui().info.toggle("history");
73657       });
73658       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
73659       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
73660         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
73661       );
73662       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73663         d3_event.preventDefault();
73664         context.ui().info.toggle("measurement");
73665       });
73666       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
73667     }
73668     context.layers().on("change.uiSectionDataLayers", section.reRender);
73669     context.map().on(
73670       "move.uiSectionDataLayers",
73671       debounce_default(function() {
73672         window.requestIdleCallback(section.reRender);
73673       }, 1e3)
73674     );
73675     return section;
73676   }
73677
73678   // modules/ui/sections/map_features.js
73679   function uiSectionMapFeatures(context) {
73680     var _features = context.features().keys();
73681     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73682     function renderDisclosureContent(selection2) {
73683       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
73684       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
73685       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
73686       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
73687       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73688         d3_event.preventDefault();
73689         context.features().disableAll();
73690       });
73691       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73692         d3_event.preventDefault();
73693         context.features().enableAll();
73694       });
73695       container = container.merge(containerEnter);
73696       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
73697     }
73698     function drawListItems(selection2, data, type2, name, change, active) {
73699       var items = selection2.selectAll("li").data(data);
73700       items.exit().remove();
73701       var enter = items.enter().append("li").call(
73702         uiTooltip().title(function(d2) {
73703           var tip = _t.append(name + "." + d2 + ".tooltip");
73704           if (autoHiddenFeature(d2)) {
73705             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
73706             return (selection3) => {
73707               selection3.call(tip);
73708               selection3.append("div").call(msg);
73709             };
73710           }
73711           return tip;
73712         }).placement("top")
73713       );
73714       var label = enter.append("label");
73715       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73716       label.append("span").html(function(d2) {
73717         return _t.html(name + "." + d2 + ".description");
73718       });
73719       items = items.merge(enter);
73720       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
73721     }
73722     function autoHiddenFeature(d2) {
73723       return context.features().autoHidden(d2);
73724     }
73725     function showsFeature(d2) {
73726       return context.features().enabled(d2);
73727     }
73728     function clickFeature(d3_event, d2) {
73729       context.features().toggle(d2);
73730     }
73731     function showsLayer(id2) {
73732       var layer = context.layers().layer(id2);
73733       return layer && layer.enabled();
73734     }
73735     context.features().on("change.map_features", section.reRender);
73736     return section;
73737   }
73738
73739   // modules/ui/sections/map_style_options.js
73740   function uiSectionMapStyleOptions(context) {
73741     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73742     function renderDisclosureContent(selection2) {
73743       var container = selection2.selectAll(".layer-fill-list").data([0]);
73744       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
73745       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
73746       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
73747         return context.surface().classed("highlight-edited");
73748       });
73749     }
73750     function drawListItems(selection2, data, type2, name, change, active) {
73751       var items = selection2.selectAll("li").data(data);
73752       items.exit().remove();
73753       var enter = items.enter().append("li").call(
73754         uiTooltip().title(function(d2) {
73755           return _t.append(name + "." + d2 + ".tooltip");
73756         }).keys(function(d2) {
73757           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
73758           if (d2 === "highlight_edits")
73759             key = _t("map_data.highlight_edits.key");
73760           return key ? [key] : null;
73761         }).placement("top")
73762       );
73763       var label = enter.append("label");
73764       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73765       label.append("span").html(function(d2) {
73766         return _t.html(name + "." + d2 + ".description");
73767       });
73768       items = items.merge(enter);
73769       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73770     }
73771     function isActiveFill(d2) {
73772       return context.map().activeAreaFill() === d2;
73773     }
73774     function toggleHighlightEdited(d3_event) {
73775       d3_event.preventDefault();
73776       context.map().toggleHighlightEdited();
73777     }
73778     function setFill(d3_event, d2) {
73779       context.map().activeAreaFill(d2);
73780     }
73781     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
73782     return section;
73783   }
73784
73785   // modules/ui/settings/local_photos.js
73786   function uiSettingsLocalPhotos(context) {
73787     var dispatch14 = dispatch_default("change");
73788     var photoLayer = context.layers().layer("local-photos");
73789     var modal;
73790     function render(selection2) {
73791       modal = uiConfirm(selection2).okButton();
73792       modal.classed("settings-modal settings-local-photos", true);
73793       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
73794       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
73795       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
73796       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
73797       instructionsSection.append("input").classed("field-file", true).attr("type", "file").attr("multiple", "multiple").attr("accept", ".jpg,.jpeg,.png,image/png,image/jpeg").style("visibility", "hidden").attr("id", "local-photo-files").on("change", function(d3_event) {
73798         var files = d3_event.target.files;
73799         if (files && files.length) {
73800           photoList.select("ul").append("li").classed("placeholder", true).append("div");
73801           dispatch14.call("change", this, files);
73802         }
73803         d3_event.target.value = null;
73804       });
73805       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
73806       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
73807       photoList.append("ul");
73808       updatePhotoList(photoList.select("ul"));
73809       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
73810     }
73811     function updatePhotoList(container) {
73812       function locationUnavailable(d2) {
73813         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
73814       }
73815       container.selectAll("li.placeholder").remove();
73816       let selection2 = container.selectAll("li").data(photoLayer.getPhotos() ?? [], (d2) => d2.id);
73817       selection2.exit().remove();
73818       const selectionEnter = selection2.enter().append("li");
73819       selectionEnter.append("span").classed("filename", true);
73820       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
73821       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
73822         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
73823       );
73824       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
73825       selection2 = selection2.merge(selectionEnter);
73826       selection2.classed("invalid", locationUnavailable);
73827       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
73828       selection2.select("span.filename").on("click", (d3_event, d2) => {
73829         photoLayer.openPhoto(d3_event, d2, false);
73830       });
73831       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
73832         photoLayer.openPhoto(d3_event, d2, true);
73833       });
73834       selection2.select("button.remove").on("click", (d3_event, d2) => {
73835         photoLayer.removePhoto(d2.id);
73836         updatePhotoList(container);
73837       });
73838     }
73839     return utilRebind(render, dispatch14, "on");
73840   }
73841
73842   // modules/ui/sections/photo_overlays.js
73843   function uiSectionPhotoOverlays(context) {
73844     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
73845     var layers = context.layers();
73846     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73847     function renderDisclosureContent(selection2) {
73848       var container = selection2.selectAll(".photo-overlay-container").data([0]);
73849       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter).call(drawLocalPhotos);
73850     }
73851     function drawPhotoItems(selection2) {
73852       var photoKeys = context.photos().overlayLayerIDs();
73853       var photoLayers = layers.all().filter(function(obj) {
73854         return photoKeys.indexOf(obj.id) !== -1;
73855       });
73856       var data = photoLayers.filter(function(obj) {
73857         if (!obj.layer.supported())
73858           return false;
73859         if (layerEnabled(obj))
73860           return true;
73861         if (typeof obj.layer.validHere === "function") {
73862           return obj.layer.validHere(context.map().extent(), context.map().zoom());
73863         }
73864         return true;
73865       });
73866       function layerSupported(d2) {
73867         return d2.layer && d2.layer.supported();
73868       }
73869       function layerEnabled(d2) {
73870         return layerSupported(d2) && d2.layer.enabled();
73871       }
73872       function layerRendered(d2) {
73873         return d2.layer.rendered?.(context.map().zoom()) ?? true;
73874       }
73875       var ul = selection2.selectAll(".layer-list-photos").data([0]);
73876       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
73877       var li = ul.selectAll(".list-item-photos").data(data);
73878       li.exit().remove();
73879       var liEnter = li.enter().append("li").attr("class", function(d2) {
73880         var classes = "list-item-photos list-item-" + d2.id;
73881         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
73882           classes += " indented";
73883         }
73884         return classes;
73885       });
73886       var labelEnter = liEnter.append("label").each(function(d2) {
73887         var titleID;
73888         if (d2.id === "mapillary-signs")
73889           titleID = "mapillary.signs.tooltip";
73890         else if (d2.id === "mapillary")
73891           titleID = "mapillary_images.tooltip";
73892         else if (d2.id === "kartaview")
73893           titleID = "kartaview_images.tooltip";
73894         else
73895           titleID = d2.id.replace(/-/g, "_") + ".tooltip";
73896         select_default2(this).call(
73897           uiTooltip().title(() => {
73898             if (!layerRendered(d2)) {
73899               return _t.append("street_side.minzoom_tooltip");
73900             } else {
73901               return _t.append(titleID);
73902             }
73903           }).placement("top")
73904         );
73905       });
73906       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73907         toggleLayer(d2.id);
73908       });
73909       labelEnter.append("span").html(function(d2) {
73910         var id2 = d2.id;
73911         if (id2 === "mapillary-signs")
73912           id2 = "photo_overlays.traffic_signs";
73913         return _t.html(id2.replace(/-/g, "_") + ".title");
73914       });
73915       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
73916     }
73917     function drawPhotoTypeItems(selection2) {
73918       var data = context.photos().allPhotoTypes();
73919       function typeEnabled(d2) {
73920         return context.photos().showsPhotoType(d2);
73921       }
73922       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
73923       ul.exit().remove();
73924       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
73925       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
73926       li.exit().remove();
73927       var liEnter = li.enter().append("li").attr("class", function(d2) {
73928         return "list-item-photo-types list-item-" + d2;
73929       });
73930       var labelEnter = liEnter.append("label").each(function(d2) {
73931         select_default2(this).call(
73932           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
73933         );
73934       });
73935       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73936         context.photos().togglePhotoType(d2);
73937       });
73938       labelEnter.append("span").html(function(d2) {
73939         return _t.html("photo_overlays.photo_type." + d2 + ".title");
73940       });
73941       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
73942     }
73943     function drawDateFilter(selection2) {
73944       var data = context.photos().dateFilters();
73945       function filterEnabled(d2) {
73946         return context.photos().dateFilterValue(d2);
73947       }
73948       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
73949       ul.exit().remove();
73950       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
73951       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
73952       li.exit().remove();
73953       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
73954       var labelEnter = liEnter.append("label").each(function(d2) {
73955         select_default2(this).call(
73956           uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d2 + ".tooltip")).placement("top")
73957         );
73958       });
73959       labelEnter.append("span").each(function(d2) {
73960         _t.append("photo_overlays.date_filter." + d2 + ".title")(select_default2(this));
73961       });
73962       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d2) {
73963         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
73964       }).on("change", function(d3_event, d2) {
73965         var value = utilGetSetValue(select_default2(this)).trim();
73966         context.photos().setDateFilter(d2, value, true);
73967         li.selectAll("input").each(function(d4) {
73968           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d4) || "");
73969         });
73970       });
73971       li = li.merge(liEnter).classed("active", filterEnabled);
73972     }
73973     function drawUsernameFilter(selection2) {
73974       function filterEnabled() {
73975         return context.photos().usernames();
73976       }
73977       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
73978       ul.exit().remove();
73979       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
73980       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
73981       li.exit().remove();
73982       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
73983       var labelEnter = liEnter.append("label").each(function() {
73984         select_default2(this).call(
73985           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
73986         );
73987       });
73988       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
73989       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
73990         var value = select_default2(this).property("value");
73991         context.photos().setUsernameFilter(value, true);
73992         select_default2(this).property("value", usernameValue);
73993       });
73994       li.merge(liEnter).classed("active", filterEnabled);
73995       function usernameValue() {
73996         var usernames = context.photos().usernames();
73997         if (usernames)
73998           return usernames.join("; ");
73999         return usernames;
74000       }
74001     }
74002     function toggleLayer(which) {
74003       setLayer(which, !showsLayer(which));
74004     }
74005     function showsLayer(which) {
74006       var layer = layers.layer(which);
74007       if (layer) {
74008         return layer.enabled();
74009       }
74010       return false;
74011     }
74012     function setLayer(which, enabled) {
74013       var layer = layers.layer(which);
74014       if (layer) {
74015         layer.enabled(enabled);
74016       }
74017     }
74018     function drawLocalPhotos(selection2) {
74019       var photoLayer = layers.layer("local-photos");
74020       var hasData = photoLayer && photoLayer.hasData();
74021       var showsData = hasData && photoLayer.enabled();
74022       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
74023       ul.exit().remove();
74024       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
74025       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
74026       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
74027       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
74028         toggleLayer("local-photos");
74029       });
74030       localPhotosLabelEnter.call(_t.append("local_photos.header"));
74031       localPhotosEnter.append("button").attr("class", "open-data-options").call(
74032         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74033       ).on("click", function(d3_event) {
74034         d3_event.preventDefault();
74035         editLocalPhotos();
74036       }).call(svgIcon("#iD-icon-more"));
74037       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
74038         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74039       ).on("click", function(d3_event) {
74040         if (select_default2(this).classed("disabled"))
74041           return;
74042         d3_event.preventDefault();
74043         d3_event.stopPropagation();
74044         photoLayer.fitZoom();
74045       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
74046       ul = ul.merge(ulEnter);
74047       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
74048       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
74049     }
74050     function editLocalPhotos() {
74051       context.container().call(settingsLocalPhotos);
74052     }
74053     function localPhotosChanged(d2) {
74054       var localPhotosLayer = layers.layer("local-photos");
74055       localPhotosLayer.fileList(d2);
74056     }
74057     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
74058     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
74059     context.map().on(
74060       "move.photo_overlays",
74061       debounce_default(function() {
74062         window.requestIdleCallback(section.reRender);
74063       }, 1e3)
74064     );
74065     return section;
74066   }
74067
74068   // modules/ui/panes/map_data.js
74069   function uiPaneMapData(context) {
74070     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([
74071       uiSectionDataLayers(context),
74072       uiSectionPhotoOverlays(context),
74073       uiSectionMapStyleOptions(context),
74074       uiSectionMapFeatures(context)
74075     ]);
74076     return mapDataPane;
74077   }
74078
74079   // modules/ui/panes/preferences.js
74080   function uiPanePreferences(context) {
74081     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
74082       uiSectionPrivacy(context)
74083     ]);
74084     return preferencesPane;
74085   }
74086
74087   // modules/ui/init.js
74088   function uiInit(context) {
74089     var _initCounter = 0;
74090     var _needWidth = {};
74091     var _lastPointerType;
74092     function render(container) {
74093       container.on("click.ui", function(d3_event) {
74094         if (d3_event.button !== 0)
74095           return;
74096         if (!d3_event.composedPath)
74097           return;
74098         var isOkayTarget = d3_event.composedPath().some(function(node) {
74099           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
74100           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
74101           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
74102           node.nodeName === "A");
74103         });
74104         if (isOkayTarget)
74105           return;
74106         d3_event.preventDefault();
74107       });
74108       var detected = utilDetect();
74109       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
74110       // but we only need to do this on desktop Safari anyway. – #7694
74111       !detected.isMobileWebKit) {
74112         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
74113           d3_event.preventDefault();
74114         });
74115       }
74116       if ("PointerEvent" in window) {
74117         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
74118           var pointerType = d3_event.pointerType || "mouse";
74119           if (_lastPointerType !== pointerType) {
74120             _lastPointerType = pointerType;
74121             container.attr("pointer", pointerType);
74122           }
74123         }, true);
74124       } else {
74125         _lastPointerType = "mouse";
74126         container.attr("pointer", "mouse");
74127       }
74128       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
74129       container.call(uiFullScreen(context));
74130       var map2 = context.map();
74131       map2.redrawEnable(false);
74132       map2.on("hitMinZoom.ui", function() {
74133         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
74134       });
74135       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
74136       container.append("div").attr("class", "sidebar").call(ui.sidebar);
74137       var content = container.append("div").attr("class", "main-content active");
74138       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
74139       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
74140       var overMap = content.append("div").attr("class", "over-map");
74141       overMap.append("div").attr("class", "select-trap").text("t");
74142       overMap.call(uiMapInMap(context)).call(uiNotice(context));
74143       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
74144       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
74145       var controls = controlsWrap.append("div").attr("class", "map-controls");
74146       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
74147       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
74148       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
74149       controlsWrap.on("wheel.mapControls", function(d3_event) {
74150         if (!d3_event.deltaX) {
74151           controlsWrap.node().scrollTop += d3_event.deltaY;
74152         }
74153       });
74154       var panes = overMap.append("div").attr("class", "map-panes");
74155       var uiPanes = [
74156         uiPaneBackground(context),
74157         uiPaneMapData(context),
74158         uiPaneIssues(context),
74159         uiPanePreferences(context),
74160         uiPaneHelp(context)
74161       ];
74162       uiPanes.forEach(function(pane) {
74163         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
74164         panes.call(pane.renderPane);
74165       });
74166       ui.info = uiInfo(context);
74167       overMap.call(ui.info);
74168       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
74169       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
74170       var about = content.append("div").attr("class", "map-footer");
74171       about.append("div").attr("class", "api-status").call(uiStatus(context));
74172       var footer = about.append("div").attr("class", "map-footer-bar fillD");
74173       footer.append("div").attr("class", "flash-wrap footer-hide");
74174       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
74175       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
74176       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
74177       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
74178       var apiConnections = context.connection().apiConnections();
74179       if (apiConnections && apiConnections.length > 1) {
74180         aboutList.append("li").attr("class", "source-switch").call(
74181           uiSourceSwitch(context).keys(apiConnections)
74182         );
74183       }
74184       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
74185       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
74186       var issueLinks = aboutList.append("li");
74187       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"));
74188       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"));
74189       aboutList.append("li").attr("class", "version").call(uiVersion(context));
74190       if (!context.embed()) {
74191         aboutList.call(uiAccount(context));
74192       }
74193       ui.onResize();
74194       map2.redrawEnable(true);
74195       ui.hash = behaviorHash(context);
74196       ui.hash();
74197       if (!ui.hash.hadLocation) {
74198         map2.centerZoom([0, 0], 2);
74199       }
74200       window.onbeforeunload = function() {
74201         return context.save();
74202       };
74203       window.onunload = function() {
74204         context.history().unlock();
74205       };
74206       select_default2(window).on("resize.editor", function() {
74207         ui.onResize();
74208       });
74209       var panPixels = 80;
74210       context.keybinding().on("\u232B", function(d3_event) {
74211         d3_event.preventDefault();
74212       }).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) {
74213         if (d3_event) {
74214           d3_event.stopImmediatePropagation();
74215           d3_event.preventDefault();
74216         }
74217         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
74218         if (previousBackground) {
74219           var currentBackground = context.background().baseLayerSource();
74220           corePreferences("background-last-used-toggle", currentBackground.id);
74221           corePreferences("background-last-used", previousBackground.id);
74222           context.background().baseLayerSource(previousBackground);
74223         }
74224       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
74225         d3_event.preventDefault();
74226         d3_event.stopPropagation();
74227         context.map().toggleWireframe();
74228       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
74229         d3_event.preventDefault();
74230         d3_event.stopPropagation();
74231         var mode = context.mode();
74232         if (mode && /^draw/.test(mode.id))
74233           return;
74234         var layer = context.layers().layer("osm");
74235         if (layer) {
74236           layer.enabled(!layer.enabled());
74237           if (!layer.enabled()) {
74238             context.enter(modeBrowse(context));
74239           }
74240         }
74241       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
74242         d3_event.preventDefault();
74243         context.map().toggleHighlightEdited();
74244       });
74245       context.on("enter.editor", function(entered) {
74246         container.classed("mode-" + entered.id, true);
74247       }).on("exit.editor", function(exited) {
74248         container.classed("mode-" + exited.id, false);
74249       });
74250       context.enter(modeBrowse(context));
74251       if (!_initCounter++) {
74252         if (!ui.hash.startWalkthrough) {
74253           context.container().call(uiSplash(context)).call(uiRestore(context));
74254         }
74255         context.container().call(ui.shortcuts);
74256       }
74257       var osm = context.connection();
74258       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
74259       if (osm && auth) {
74260         osm.on("authLoading.ui", function() {
74261           context.container().call(auth);
74262         }).on("authDone.ui", function() {
74263           auth.close();
74264         });
74265       }
74266       _initCounter++;
74267       if (ui.hash.startWalkthrough) {
74268         ui.hash.startWalkthrough = false;
74269         context.container().call(uiIntro(context));
74270       }
74271       function pan(d2) {
74272         return function(d3_event) {
74273           if (d3_event.shiftKey)
74274             return;
74275           if (context.container().select(".combobox").size())
74276             return;
74277           d3_event.preventDefault();
74278           context.map().pan(d2, 100);
74279         };
74280       }
74281     }
74282     let ui = {};
74283     let _loadPromise;
74284     ui.ensureLoaded = () => {
74285       if (_loadPromise)
74286         return _loadPromise;
74287       return _loadPromise = Promise.all([
74288         // must have strings and presets before loading the UI
74289         _mainLocalizer.ensureLoaded(),
74290         _mainPresetIndex.ensureLoaded()
74291       ]).then(() => {
74292         if (!context.container().empty())
74293           render(context.container());
74294       }).catch((err) => console.error(err));
74295     };
74296     ui.restart = function() {
74297       context.keybinding().clear();
74298       _loadPromise = null;
74299       context.container().selectAll("*").remove();
74300       ui.ensureLoaded();
74301     };
74302     ui.lastPointerType = function() {
74303       return _lastPointerType;
74304     };
74305     ui.svgDefs = svgDefs(context);
74306     ui.flash = uiFlash(context);
74307     ui.sidebar = uiSidebar(context);
74308     ui.photoviewer = uiPhotoviewer(context);
74309     ui.shortcuts = uiShortcuts(context);
74310     ui.onResize = function(withPan) {
74311       var map2 = context.map();
74312       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
74313       utilGetDimensions(context.container().select(".sidebar"), true);
74314       if (withPan !== void 0) {
74315         map2.redrawEnable(false);
74316         map2.pan(withPan);
74317         map2.redrawEnable(true);
74318       }
74319       map2.dimensions(mapDimensions);
74320       ui.photoviewer.onMapResize();
74321       ui.checkOverflow(".top-toolbar");
74322       ui.checkOverflow(".map-footer-bar");
74323       var resizeWindowEvent = document.createEvent("Event");
74324       resizeWindowEvent.initEvent("resizeWindow", true, true);
74325       document.dispatchEvent(resizeWindowEvent);
74326     };
74327     ui.checkOverflow = function(selector, reset) {
74328       if (reset) {
74329         delete _needWidth[selector];
74330       }
74331       var selection2 = context.container().select(selector);
74332       if (selection2.empty())
74333         return;
74334       var scrollWidth = selection2.property("scrollWidth");
74335       var clientWidth = selection2.property("clientWidth");
74336       var needed = _needWidth[selector] || scrollWidth;
74337       if (scrollWidth > clientWidth) {
74338         selection2.classed("narrow", true);
74339         if (!_needWidth[selector]) {
74340           _needWidth[selector] = scrollWidth;
74341         }
74342       } else if (scrollWidth >= needed) {
74343         selection2.classed("narrow", false);
74344       }
74345     };
74346     ui.togglePanes = function(showPane) {
74347       var hidePanes = context.container().selectAll(".map-pane.shown");
74348       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
74349       hidePanes.classed("shown", false).classed("hide", true);
74350       context.container().selectAll(".map-pane-control button").classed("active", false);
74351       if (showPane) {
74352         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
74353         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
74354         showPane.classed("shown", true).classed("hide", false);
74355         if (hidePanes.empty()) {
74356           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
74357         } else {
74358           showPane.style(side, "0px");
74359         }
74360       } else {
74361         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
74362           select_default2(this).classed("shown", false).classed("hide", true);
74363         });
74364       }
74365     };
74366     var _editMenu = uiEditMenu(context);
74367     ui.editMenu = function() {
74368       return _editMenu;
74369     };
74370     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
74371       ui.closeEditMenu();
74372       if (!operations && context.mode().operations)
74373         operations = context.mode().operations();
74374       if (!operations || !operations.length)
74375         return;
74376       if (!context.map().editableDataEnabled())
74377         return;
74378       var surfaceNode = context.surface().node();
74379       if (surfaceNode.focus) {
74380         surfaceNode.focus();
74381       }
74382       operations.forEach(function(operation) {
74383         if (operation.point)
74384           operation.point(anchorPoint);
74385       });
74386       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
74387       context.map().supersurface.call(_editMenu);
74388     };
74389     ui.closeEditMenu = function() {
74390       context.map().supersurface.select(".edit-menu").remove();
74391     };
74392     var _saveLoading = select_default2(null);
74393     context.uploader().on("saveStarted.ui", function() {
74394       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
74395       context.container().call(_saveLoading);
74396     }).on("saveEnded.ui", function() {
74397       _saveLoading.close();
74398       _saveLoading = select_default2(null);
74399     });
74400     marked.use({
74401       mangle: false,
74402       headerIds: false
74403     });
74404     return ui;
74405   }
74406
74407   // modules/core/context.js
74408   function coreContext() {
74409     const dispatch14 = dispatch_default("enter", "exit", "change");
74410     let context = utilRebind({}, dispatch14, "on");
74411     let _deferred2 = /* @__PURE__ */ new Set();
74412     context.version = package_default.version;
74413     context.privacyVersion = "20201202";
74414     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
74415     context.changeset = null;
74416     let _defaultChangesetComment = context.initialHashParams.comment;
74417     let _defaultChangesetSource = context.initialHashParams.source;
74418     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
74419     context.defaultChangesetComment = function(val) {
74420       if (!arguments.length)
74421         return _defaultChangesetComment;
74422       _defaultChangesetComment = val;
74423       return context;
74424     };
74425     context.defaultChangesetSource = function(val) {
74426       if (!arguments.length)
74427         return _defaultChangesetSource;
74428       _defaultChangesetSource = val;
74429       return context;
74430     };
74431     context.defaultChangesetHashtags = function(val) {
74432       if (!arguments.length)
74433         return _defaultChangesetHashtags;
74434       _defaultChangesetHashtags = val;
74435       return context;
74436     };
74437     let _setsDocumentTitle = true;
74438     context.setsDocumentTitle = function(val) {
74439       if (!arguments.length)
74440         return _setsDocumentTitle;
74441       _setsDocumentTitle = val;
74442       return context;
74443     };
74444     let _documentTitleBase = document.title;
74445     context.documentTitleBase = function(val) {
74446       if (!arguments.length)
74447         return _documentTitleBase;
74448       _documentTitleBase = val;
74449       return context;
74450     };
74451     let _ui;
74452     context.ui = () => _ui;
74453     context.lastPointerType = () => _ui.lastPointerType();
74454     let _keybinding = utilKeybinding("context");
74455     context.keybinding = () => _keybinding;
74456     select_default2(document).call(_keybinding);
74457     let _connection = services.osm;
74458     let _history;
74459     let _validator;
74460     let _uploader;
74461     context.connection = () => _connection;
74462     context.history = () => _history;
74463     context.validator = () => _validator;
74464     context.uploader = () => _uploader;
74465     context.preauth = (options2) => {
74466       if (_connection) {
74467         _connection.switch(options2);
74468       }
74469       return context;
74470     };
74471     context.locale = function(locale2) {
74472       if (!arguments.length)
74473         return _mainLocalizer.localeCode();
74474       _mainLocalizer.preferredLocaleCodes(locale2);
74475       return context;
74476     };
74477     function afterLoad(cid, callback) {
74478       return (err, result) => {
74479         if (err) {
74480           if (err.status === 400 || err.status === 401 || err.status === 403) {
74481             if (_connection) {
74482               _connection.logout();
74483             }
74484           }
74485           if (typeof callback === "function") {
74486             callback(err);
74487           }
74488           return;
74489         } else if (_connection && _connection.getConnectionId() !== cid) {
74490           if (typeof callback === "function") {
74491             callback({ message: "Connection Switched", status: -1 });
74492           }
74493           return;
74494         } else {
74495           _history.merge(result.data, result.extent);
74496           if (typeof callback === "function") {
74497             callback(err, result);
74498           }
74499           return;
74500         }
74501       };
74502     }
74503     context.loadTiles = (projection2, callback) => {
74504       const handle = window.requestIdleCallback(() => {
74505         _deferred2.delete(handle);
74506         if (_connection && context.editableDataEnabled()) {
74507           const cid = _connection.getConnectionId();
74508           _connection.loadTiles(projection2, afterLoad(cid, callback));
74509         }
74510       });
74511       _deferred2.add(handle);
74512     };
74513     context.loadTileAtLoc = (loc, callback) => {
74514       const handle = window.requestIdleCallback(() => {
74515         _deferred2.delete(handle);
74516         if (_connection && context.editableDataEnabled()) {
74517           const cid = _connection.getConnectionId();
74518           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
74519         }
74520       });
74521       _deferred2.add(handle);
74522     };
74523     context.loadEntity = (entityID, callback) => {
74524       if (_connection) {
74525         const cid = _connection.getConnectionId();
74526         _connection.loadEntity(entityID, afterLoad(cid, callback));
74527         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
74528       }
74529     };
74530     context.zoomToEntity = (entityID, zoomTo) => {
74531       context.loadEntity(entityID, (err, result) => {
74532         if (err)
74533           return;
74534         if (zoomTo !== false) {
74535           const entity = result.data.find((e3) => e3.id === entityID);
74536           if (entity) {
74537             _map.zoomTo(entity);
74538           }
74539         }
74540       });
74541       _map.on("drawn.zoomToEntity", () => {
74542         if (!context.hasEntity(entityID))
74543           return;
74544         _map.on("drawn.zoomToEntity", null);
74545         context.on("enter.zoomToEntity", null);
74546         context.enter(modeSelect(context, [entityID]));
74547       });
74548       context.on("enter.zoomToEntity", () => {
74549         if (_mode.id !== "browse") {
74550           _map.on("drawn.zoomToEntity", null);
74551           context.on("enter.zoomToEntity", null);
74552         }
74553       });
74554     };
74555     let _minEditableZoom = 16;
74556     context.minEditableZoom = function(val) {
74557       if (!arguments.length)
74558         return _minEditableZoom;
74559       _minEditableZoom = val;
74560       if (_connection) {
74561         _connection.tileZoom(val);
74562       }
74563       return context;
74564     };
74565     context.maxCharsForTagKey = () => 255;
74566     context.maxCharsForTagValue = () => 255;
74567     context.maxCharsForRelationRole = () => 255;
74568     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
74569     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
74570     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
74571     let _inIntro = false;
74572     context.inIntro = function(val) {
74573       if (!arguments.length)
74574         return _inIntro;
74575       _inIntro = val;
74576       return context;
74577     };
74578     context.save = () => {
74579       if (_inIntro || context.container().select(".modal").size())
74580         return;
74581       let canSave;
74582       if (_mode && _mode.id === "save") {
74583         canSave = false;
74584         if (services.osm && services.osm.isChangesetInflight()) {
74585           _history.clearSaved();
74586           return;
74587         }
74588       } else {
74589         canSave = context.selectedIDs().every((id2) => {
74590           const entity = context.hasEntity(id2);
74591           return entity && !entity.isDegenerate();
74592         });
74593       }
74594       if (canSave) {
74595         _history.save();
74596       }
74597       if (_history.hasChanges()) {
74598         return _t("save.unsaved_changes");
74599       }
74600     };
74601     context.debouncedSave = debounce_default(context.save, 350);
74602     function withDebouncedSave(fn) {
74603       return function() {
74604         const result = fn.apply(_history, arguments);
74605         context.debouncedSave();
74606         return result;
74607       };
74608     }
74609     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
74610     context.entity = (id2) => _history.graph().entity(id2);
74611     let _mode;
74612     context.mode = () => _mode;
74613     context.enter = (newMode) => {
74614       if (_mode) {
74615         _mode.exit();
74616         dispatch14.call("exit", this, _mode);
74617       }
74618       _mode = newMode;
74619       _mode.enter();
74620       dispatch14.call("enter", this, _mode);
74621     };
74622     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
74623     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
74624     let _selectedNoteID;
74625     context.selectedNoteID = function(noteID) {
74626       if (!arguments.length)
74627         return _selectedNoteID;
74628       _selectedNoteID = noteID;
74629       return context;
74630     };
74631     let _selectedErrorID;
74632     context.selectedErrorID = function(errorID) {
74633       if (!arguments.length)
74634         return _selectedErrorID;
74635       _selectedErrorID = errorID;
74636       return context;
74637     };
74638     context.install = (behavior) => context.surface().call(behavior);
74639     context.uninstall = (behavior) => context.surface().call(behavior.off);
74640     let _copyGraph;
74641     context.copyGraph = () => _copyGraph;
74642     let _copyIDs = [];
74643     context.copyIDs = function(val) {
74644       if (!arguments.length)
74645         return _copyIDs;
74646       _copyIDs = val;
74647       _copyGraph = _history.graph();
74648       return context;
74649     };
74650     let _copyLonLat;
74651     context.copyLonLat = function(val) {
74652       if (!arguments.length)
74653         return _copyLonLat;
74654       _copyLonLat = val;
74655       return context;
74656     };
74657     let _background;
74658     context.background = () => _background;
74659     let _features;
74660     context.features = () => _features;
74661     context.hasHiddenConnections = (id2) => {
74662       const graph = _history.graph();
74663       const entity = graph.entity(id2);
74664       return _features.hasHiddenConnections(entity, graph);
74665     };
74666     let _photos;
74667     context.photos = () => _photos;
74668     let _map;
74669     context.map = () => _map;
74670     context.layers = () => _map.layers();
74671     context.surface = () => _map.surface;
74672     context.editableDataEnabled = () => _map.editableDataEnabled();
74673     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
74674     context.editable = () => {
74675       const mode = context.mode();
74676       if (!mode || mode.id === "save")
74677         return false;
74678       return _map.editableDataEnabled();
74679     };
74680     let _debugFlags = {
74681       tile: false,
74682       // tile boundaries
74683       collision: false,
74684       // label collision bounding boxes
74685       imagery: false,
74686       // imagery bounding polygons
74687       target: false,
74688       // touch targets
74689       downloaded: false
74690       // downloaded data from osm
74691     };
74692     context.debugFlags = () => _debugFlags;
74693     context.getDebug = (flag) => flag && _debugFlags[flag];
74694     context.setDebug = function(flag, val) {
74695       if (arguments.length === 1)
74696         val = true;
74697       _debugFlags[flag] = val;
74698       dispatch14.call("change");
74699       return context;
74700     };
74701     let _container = select_default2(null);
74702     context.container = function(val) {
74703       if (!arguments.length)
74704         return _container;
74705       _container = val;
74706       _container.classed("ideditor", true);
74707       return context;
74708     };
74709     context.containerNode = function(val) {
74710       if (!arguments.length)
74711         return context.container().node();
74712       context.container(select_default2(val));
74713       return context;
74714     };
74715     let _embed;
74716     context.embed = function(val) {
74717       if (!arguments.length)
74718         return _embed;
74719       _embed = val;
74720       return context;
74721     };
74722     let _assetPath = "";
74723     context.assetPath = function(val) {
74724       if (!arguments.length)
74725         return _assetPath;
74726       _assetPath = val;
74727       _mainFileFetcher.assetPath(val);
74728       return context;
74729     };
74730     let _assetMap = {};
74731     context.assetMap = function(val) {
74732       if (!arguments.length)
74733         return _assetMap;
74734       _assetMap = val;
74735       _mainFileFetcher.assetMap(val);
74736       return context;
74737     };
74738     context.asset = (val) => {
74739       if (/^http(s)?:\/\//i.test(val))
74740         return val;
74741       const filename = _assetPath + val;
74742       return _assetMap[filename] || filename;
74743     };
74744     context.imagePath = (val) => context.asset(`img/${val}`);
74745     context.reset = context.flush = () => {
74746       context.debouncedSave.cancel();
74747       Array.from(_deferred2).forEach((handle) => {
74748         window.cancelIdleCallback(handle);
74749         _deferred2.delete(handle);
74750       });
74751       Object.values(services).forEach((service) => {
74752         if (service && typeof service.reset === "function") {
74753           service.reset(context);
74754         }
74755       });
74756       context.changeset = null;
74757       _validator.reset();
74758       _features.reset();
74759       _history.reset();
74760       _uploader.reset();
74761       context.container().select(".inspector-wrap *").remove();
74762       return context;
74763     };
74764     context.projection = geoRawMercator();
74765     context.curtainProjection = geoRawMercator();
74766     context.init = () => {
74767       instantiateInternal();
74768       initializeDependents();
74769       return context;
74770       function instantiateInternal() {
74771         _history = coreHistory(context);
74772         context.graph = _history.graph;
74773         context.pauseChangeDispatch = _history.pauseChangeDispatch;
74774         context.resumeChangeDispatch = _history.resumeChangeDispatch;
74775         context.perform = withDebouncedSave(_history.perform);
74776         context.replace = withDebouncedSave(_history.replace);
74777         context.pop = withDebouncedSave(_history.pop);
74778         context.overwrite = withDebouncedSave(_history.overwrite);
74779         context.undo = withDebouncedSave(_history.undo);
74780         context.redo = withDebouncedSave(_history.redo);
74781         _validator = coreValidator(context);
74782         _uploader = coreUploader(context);
74783         _background = rendererBackground(context);
74784         _features = rendererFeatures(context);
74785         _map = rendererMap(context);
74786         _photos = rendererPhotos(context);
74787         _ui = uiInit(context);
74788       }
74789       function initializeDependents() {
74790         if (context.initialHashParams.presets) {
74791           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
74792         }
74793         if (context.initialHashParams.locale) {
74794           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
74795         }
74796         _mainLocalizer.ensureLoaded();
74797         _mainPresetIndex.ensureLoaded();
74798         _background.ensureLoaded();
74799         Object.values(services).forEach((service) => {
74800           if (service && typeof service.init === "function") {
74801             service.init();
74802           }
74803         });
74804         _map.init();
74805         _validator.init();
74806         _features.init();
74807         if (services.maprules && context.initialHashParams.maprules) {
74808           json_default(context.initialHashParams.maprules).then((mapcss) => {
74809             services.maprules.init();
74810             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
74811           }).catch(() => {
74812           });
74813         }
74814         if (!context.container().empty()) {
74815           _ui.ensureLoaded().then(() => {
74816             _background.init();
74817             _photos.init();
74818           });
74819         }
74820       }
74821     };
74822     return context;
74823   }
74824
74825   // modules/services/nominatim.js
74826   var apibase = nominatimApiUrl;
74827   var _inflight = {};
74828   var _nominatimCache;
74829   var nominatim_default = {
74830     init: function() {
74831       _inflight = {};
74832       _nominatimCache = new import_rbush7.default();
74833     },
74834     reset: function() {
74835       Object.values(_inflight).forEach(function(controller) {
74836         controller.abort();
74837       });
74838       _inflight = {};
74839       _nominatimCache = new import_rbush7.default();
74840     },
74841     countryCode: function(location, callback) {
74842       this.reverse(location, function(err, result) {
74843         if (err) {
74844           return callback(err);
74845         } else if (result.address) {
74846           return callback(null, result.address.country_code);
74847         } else {
74848           return callback("Unable to geocode", null);
74849         }
74850       });
74851     },
74852     reverse: function(loc, callback) {
74853       var cached = _nominatimCache.search(
74854         { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
74855       );
74856       if (cached.length > 0) {
74857         if (callback)
74858           callback(null, cached[0].data);
74859         return;
74860       }
74861       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
74862       var url = apibase + "reverse?" + utilQsString(params);
74863       if (_inflight[url])
74864         return;
74865       var controller = new AbortController();
74866       _inflight[url] = controller;
74867       json_default(url, {
74868         signal: controller.signal,
74869         headers: {
74870           "Accept-Language": _mainLocalizer.localeCodes().join(",")
74871         }
74872       }).then(function(result) {
74873         delete _inflight[url];
74874         if (result && result.error) {
74875           throw new Error(result.error);
74876         }
74877         var extent = geoExtent(loc).padByMeters(200);
74878         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
74879         if (callback)
74880           callback(null, result);
74881       }).catch(function(err) {
74882         delete _inflight[url];
74883         if (err.name === "AbortError")
74884           return;
74885         if (callback)
74886           callback(err.message);
74887       });
74888     },
74889     search: function(val, callback) {
74890       const params = {
74891         q: val,
74892         limit: 10,
74893         format: "json"
74894       };
74895       var url = apibase + "search?" + utilQsString(params);
74896       if (_inflight[url])
74897         return;
74898       var controller = new AbortController();
74899       _inflight[url] = controller;
74900       json_default(url, {
74901         signal: controller.signal,
74902         headers: {
74903           "Accept-Language": _mainLocalizer.localeCodes().join(",")
74904         }
74905       }).then(function(result) {
74906         delete _inflight[url];
74907         if (result && result.error) {
74908           throw new Error(result.error);
74909         }
74910         if (callback)
74911           callback(null, result);
74912       }).catch(function(err) {
74913         delete _inflight[url];
74914         if (err.name === "AbortError")
74915           return;
74916         if (callback)
74917           callback(err.message);
74918       });
74919     }
74920   };
74921
74922   // node_modules/name-suggestion-index/lib/matcher.js
74923   var import_which_polygon4 = __toESM(require_which_polygon(), 1);
74924
74925   // node_modules/name-suggestion-index/lib/simplify.js
74926   var import_diacritics3 = __toESM(require_diacritics(), 1);
74927   function simplify2(str2) {
74928     if (typeof str2 !== "string")
74929       return "";
74930     return import_diacritics3.default.remove(
74931       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()
74932     );
74933   }
74934
74935   // node_modules/name-suggestion-index/config/matchGroups.json
74936   var matchGroups_default = {
74937     matchGroups: {
74938       adult_gaming_centre: [
74939         "amenity/casino",
74940         "amenity/gambling",
74941         "leisure/adult_gaming_centre"
74942       ],
74943       beauty: [
74944         "shop/beauty",
74945         "shop/hairdresser_supply"
74946       ],
74947       bed: [
74948         "shop/bed",
74949         "shop/furniture"
74950       ],
74951       beverages: [
74952         "shop/alcohol",
74953         "shop/beer",
74954         "shop/beverages",
74955         "shop/kiosk",
74956         "shop/wine"
74957       ],
74958       camping: [
74959         "tourism/camp_site",
74960         "tourism/caravan_site"
74961       ],
74962       car_parts: [
74963         "shop/car_parts",
74964         "shop/car_repair",
74965         "shop/tires",
74966         "shop/tyres"
74967       ],
74968       clinic: [
74969         "amenity/clinic",
74970         "amenity/doctors",
74971         "healthcare/clinic",
74972         "healthcare/laboratory",
74973         "healthcare/physiotherapist",
74974         "healthcare/sample_collection",
74975         "healthcare/dialysis"
74976       ],
74977       convenience: [
74978         "shop/beauty",
74979         "shop/chemist",
74980         "shop/convenience",
74981         "shop/cosmetics",
74982         "shop/grocery",
74983         "shop/kiosk",
74984         "shop/newsagent",
74985         "shop/perfumery"
74986       ],
74987       coworking: [
74988         "amenity/coworking_space",
74989         "office/coworking",
74990         "office/coworking_space"
74991       ],
74992       dentist: [
74993         "amenity/dentist",
74994         "amenity/doctors",
74995         "healthcare/dentist"
74996       ],
74997       electronics: [
74998         "office/telecommunication",
74999         "shop/computer",
75000         "shop/electronics",
75001         "shop/hifi",
75002         "shop/kiosk",
75003         "shop/mobile",
75004         "shop/mobile_phone",
75005         "shop/telecommunication"
75006       ],
75007       fabric: [
75008         "shop/fabric",
75009         "shop/haberdashery",
75010         "shop/sewing"
75011       ],
75012       fashion: [
75013         "shop/accessories",
75014         "shop/bag",
75015         "shop/boutique",
75016         "shop/clothes",
75017         "shop/department_store",
75018         "shop/fashion",
75019         "shop/fashion_accessories",
75020         "shop/sports",
75021         "shop/shoes"
75022       ],
75023       financial: [
75024         "amenity/bank",
75025         "office/accountant",
75026         "office/financial",
75027         "office/financial_advisor",
75028         "office/tax_advisor",
75029         "shop/tax"
75030       ],
75031       fitness: [
75032         "leisure/fitness_centre",
75033         "leisure/fitness_center",
75034         "leisure/sports_centre",
75035         "leisure/sports_center"
75036       ],
75037       food: [
75038         "amenity/bar",
75039         "amenity/cafe",
75040         "amenity/fast_food",
75041         "amenity/ice_cream",
75042         "amenity/pub",
75043         "amenity/restaurant",
75044         "shop/bakery",
75045         "shop/candy",
75046         "shop/chocolate",
75047         "shop/coffee",
75048         "shop/confectionary",
75049         "shop/confectionery",
75050         "shop/food",
75051         "shop/kiosk",
75052         "shop/ice_cream",
75053         "shop/pastry",
75054         "shop/tea"
75055       ],
75056       fuel: [
75057         "amenity/fuel",
75058         "shop/gas",
75059         "shop/convenience;gas",
75060         "shop/gas;convenience"
75061       ],
75062       gift: [
75063         "shop/gift",
75064         "shop/card",
75065         "shop/cards",
75066         "shop/kiosk",
75067         "shop/stationery"
75068       ],
75069       hardware: [
75070         "shop/bathroom_furnishing",
75071         "shop/carpet",
75072         "shop/diy",
75073         "shop/doityourself",
75074         "shop/doors",
75075         "shop/electrical",
75076         "shop/flooring",
75077         "shop/hardware",
75078         "shop/hardware_store",
75079         "shop/power_tools",
75080         "shop/tool_hire",
75081         "shop/tools",
75082         "shop/trade"
75083       ],
75084       health_food: [
75085         "shop/health",
75086         "shop/health_food",
75087         "shop/herbalist",
75088         "shop/nutrition_supplements"
75089       ],
75090       hobby: [
75091         "shop/electronics",
75092         "shop/hobby",
75093         "shop/books",
75094         "shop/games",
75095         "shop/collector",
75096         "shop/toys",
75097         "shop/model",
75098         "shop/video_games",
75099         "shop/anime"
75100       ],
75101       hospital: [
75102         "amenity/doctors",
75103         "amenity/hospital",
75104         "healthcare/hospital"
75105       ],
75106       houseware: [
75107         "shop/houseware",
75108         "shop/interior_decoration"
75109       ],
75110       lifeboat_station: [
75111         "amenity/lifeboat_station",
75112         "emergency/lifeboat_station",
75113         "emergency/marine_rescue"
75114       ],
75115       lodging: [
75116         "tourism/hotel",
75117         "tourism/motel"
75118       ],
75119       money_transfer: [
75120         "amenity/money_transfer",
75121         "shop/money_transfer"
75122       ],
75123       office_supplies: [
75124         "shop/office_supplies",
75125         "shop/stationary",
75126         "shop/stationery"
75127       ],
75128       outdoor: [
75129         "shop/clothes",
75130         "shop/outdoor",
75131         "shop/sports"
75132       ],
75133       parcel_locker: [
75134         "amenity/parcel_locker",
75135         "amenity/vending_machine"
75136       ],
75137       pharmacy: [
75138         "amenity/doctors",
75139         "amenity/pharmacy",
75140         "healthcare/pharmacy"
75141       ],
75142       playground: [
75143         "amenity/theme_park",
75144         "leisure/amusement_arcade",
75145         "leisure/playground"
75146       ],
75147       rental: [
75148         "amenity/bicycle_rental",
75149         "amenity/boat_rental",
75150         "amenity/car_rental",
75151         "amenity/truck_rental",
75152         "amenity/vehicle_rental",
75153         "shop/kiosk",
75154         "shop/rental"
75155       ],
75156       school: [
75157         "amenity/childcare",
75158         "amenity/college",
75159         "amenity/kindergarten",
75160         "amenity/language_school",
75161         "amenity/prep_school",
75162         "amenity/school",
75163         "amenity/university"
75164       ],
75165       storage: [
75166         "shop/storage_units",
75167         "shop/storage_rental"
75168       ],
75169       substation: [
75170         "power/station",
75171         "power/substation",
75172         "power/sub_station"
75173       ],
75174       supermarket: [
75175         "shop/food",
75176         "shop/frozen_food",
75177         "shop/greengrocer",
75178         "shop/grocery",
75179         "shop/supermarket",
75180         "shop/wholesale"
75181       ],
75182       variety_store: [
75183         "shop/variety_store",
75184         "shop/discount",
75185         "shop/convenience"
75186       ],
75187       vending: [
75188         "amenity/vending_machine",
75189         "shop/kiosk",
75190         "shop/vending_machine"
75191       ],
75192       weight_loss: [
75193         "amenity/clinic",
75194         "amenity/doctors",
75195         "amenity/weight_clinic",
75196         "healthcare/counselling",
75197         "leisure/fitness_centre",
75198         "office/therapist",
75199         "shop/beauty",
75200         "shop/diet",
75201         "shop/food",
75202         "shop/health_food",
75203         "shop/herbalist",
75204         "shop/nutrition",
75205         "shop/nutrition_supplements",
75206         "shop/weight_loss"
75207       ],
75208       wholesale: [
75209         "shop/wholesale",
75210         "shop/supermarket",
75211         "shop/department_store"
75212       ]
75213     }
75214   };
75215
75216   // node_modules/name-suggestion-index/config/genericWords.json
75217   var genericWords_default = {
75218     genericWords: [
75219       "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
75220       "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
75221       "^(club|green|out|ware)\\s?house$",
75222       "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
75223       "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
75224       "^(hofladen|librairie|magazine?|maison)$",
75225       "^(mobile home|skate)?\\s?park$",
75226       "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
75227       "^\\?+$",
75228       "^private$",
75229       "^tattoo( studio)?$",
75230       "^windmill$",
75231       "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
75232     ]
75233   };
75234
75235   // node_modules/name-suggestion-index/config/trees.json
75236   var trees_default = {
75237     trees: {
75238       brands: {
75239         emoji: "\u{1F354}",
75240         mainTag: "brand:wikidata",
75241         sourceTags: ["brand", "name"],
75242         nameTags: {
75243           primary: "^(name|name:\\w+)$",
75244           alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
75245         }
75246       },
75247       flags: {
75248         emoji: "\u{1F6A9}",
75249         mainTag: "flag:wikidata",
75250         nameTags: {
75251           primary: "^(flag:name|flag:name:\\w+)$",
75252           alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
75253         }
75254       },
75255       operators: {
75256         emoji: "\u{1F4BC}",
75257         mainTag: "operator:wikidata",
75258         sourceTags: ["operator"],
75259         nameTags: {
75260           primary: "^(name|name:\\w+|operator|operator:\\w+)$",
75261           alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
75262         }
75263       },
75264       transit: {
75265         emoji: "\u{1F687}",
75266         mainTag: "network:wikidata",
75267         sourceTags: ["network"],
75268         nameTags: {
75269           primary: "^network$",
75270           alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
75271         }
75272       }
75273     }
75274   };
75275
75276   // node_modules/name-suggestion-index/lib/matcher.js
75277   var matchGroups = matchGroups_default.matchGroups;
75278   var trees = trees_default.trees;
75279   var Matcher = class {
75280     //
75281     // `constructor`
75282     // initialize the genericWords regexes
75283     constructor() {
75284       this.matchIndex = void 0;
75285       this.genericWords = /* @__PURE__ */ new Map();
75286       (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
75287       this.itemLocation = void 0;
75288       this.locationSets = void 0;
75289       this.locationIndex = void 0;
75290       this.warnings = [];
75291     }
75292     //
75293     // `buildMatchIndex()`
75294     // Call this to prepare the matcher for use
75295     //
75296     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75297     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75298     // {
75299     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75300     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75301     //    …
75302     // }
75303     //
75304     buildMatchIndex(data) {
75305       const that = this;
75306       if (that.matchIndex)
75307         return;
75308       that.matchIndex = /* @__PURE__ */ new Map();
75309       const seenTree = /* @__PURE__ */ new Map();
75310       Object.keys(data).forEach((tkv) => {
75311         const category = data[tkv];
75312         const parts = tkv.split("/", 3);
75313         const t2 = parts[0];
75314         const k2 = parts[1];
75315         const v2 = parts[2];
75316         const thiskv = `${k2}/${v2}`;
75317         const tree = trees[t2];
75318         let branch = that.matchIndex.get(thiskv);
75319         if (!branch) {
75320           branch = {
75321             primary: /* @__PURE__ */ new Map(),
75322             alternate: /* @__PURE__ */ new Map(),
75323             excludeGeneric: /* @__PURE__ */ new Map(),
75324             excludeNamed: /* @__PURE__ */ new Map()
75325           };
75326           that.matchIndex.set(thiskv, branch);
75327         }
75328         const properties = category.properties || {};
75329         const exclude = properties.exclude || {};
75330         (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
75331         (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
75332         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
75333         let items = category.items;
75334         if (!Array.isArray(items) || !items.length)
75335           return;
75336         const primaryName = new RegExp(tree.nameTags.primary, "i");
75337         const alternateName = new RegExp(tree.nameTags.alternate, "i");
75338         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75339         const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
75340         const genericKV = /* @__PURE__ */ new Set([`${k2}/yes`, `building/yes`]);
75341         const matchGroupKV = /* @__PURE__ */ new Set();
75342         Object.values(matchGroups).forEach((matchGroup) => {
75343           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
75344           if (!inGroup)
75345             return;
75346           matchGroup.forEach((otherkv) => {
75347             if (otherkv === thiskv)
75348               return;
75349             matchGroupKV.add(otherkv);
75350             const otherk = otherkv.split("/", 2)[0];
75351             genericKV.add(`${otherk}/yes`);
75352           });
75353         });
75354         items.forEach((item) => {
75355           if (!item.id)
75356             return;
75357           if (Array.isArray(item.matchTags) && item.matchTags.length) {
75358             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
75359             if (!item.matchTags.length)
75360               delete item.matchTags;
75361           }
75362           let kvTags = [`${thiskv}`].concat(item.matchTags || []);
75363           if (!skipGenericKV) {
75364             kvTags = kvTags.concat(Array.from(genericKV));
75365           }
75366           Object.keys(item.tags).forEach((osmkey) => {
75367             if (notName.test(osmkey))
75368               return;
75369             const osmvalue = item.tags[osmkey];
75370             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
75371               return;
75372             if (primaryName.test(osmkey)) {
75373               kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
75374             } else if (alternateName.test(osmkey)) {
75375               kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
75376             }
75377           });
75378           let keepMatchNames = /* @__PURE__ */ new Set();
75379           (item.matchNames || []).forEach((matchName) => {
75380             const nsimple = simplify2(matchName);
75381             kvTags.forEach((kv) => {
75382               const branch2 = that.matchIndex.get(kv);
75383               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
75384               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
75385               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
75386               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
75387               if (!inPrimary && !inAlternate) {
75388                 insertName("alternate", t2, kv, nsimple, item.id);
75389                 keepMatchNames.add(matchName);
75390               }
75391             });
75392           });
75393           if (keepMatchNames.size) {
75394             item.matchNames = Array.from(keepMatchNames);
75395           } else {
75396             delete item.matchNames;
75397           }
75398         });
75399       });
75400       function insertName(which, t2, kv, nsimple, itemID) {
75401         if (!nsimple) {
75402           that.warnings.push(`Warning: skipping empty ${which} name for item ${t2}/${kv}: ${itemID}`);
75403           return;
75404         }
75405         let branch = that.matchIndex.get(kv);
75406         if (!branch) {
75407           branch = {
75408             primary: /* @__PURE__ */ new Map(),
75409             alternate: /* @__PURE__ */ new Map(),
75410             excludeGeneric: /* @__PURE__ */ new Map(),
75411             excludeNamed: /* @__PURE__ */ new Map()
75412           };
75413           that.matchIndex.set(kv, branch);
75414         }
75415         let leaf = branch[which].get(nsimple);
75416         if (!leaf) {
75417           leaf = /* @__PURE__ */ new Set();
75418           branch[which].set(nsimple, leaf);
75419         }
75420         leaf.add(itemID);
75421         if (!/yes$/.test(kv)) {
75422           const kvnsimple = `${kv}/${nsimple}`;
75423           const existing = seenTree.get(kvnsimple);
75424           if (existing && existing !== t2) {
75425             const items = Array.from(leaf);
75426             that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t2}" and "${existing}", check items: ${items}`);
75427             return;
75428           }
75429           seenTree.set(kvnsimple, t2);
75430         }
75431       }
75432       function skipGenericKVMatches(t2, k2, v2) {
75433         return t2 === "flags" || t2 === "transit" || k2 === "landuse" || v2 === "atm" || v2 === "bicycle_parking" || v2 === "car_sharing" || v2 === "caravan_site" || v2 === "charging_station" || v2 === "dog_park" || v2 === "parking" || v2 === "phone" || v2 === "playground" || v2 === "post_box" || v2 === "public_bookcase" || v2 === "recycling" || v2 === "vending_machine";
75434       }
75435     }
75436     //
75437     // `buildLocationIndex()`
75438     // Call this to prepare a which-polygon location index.
75439     // This *resolves* all the locationSets into GeoJSON, which takes some time.
75440     // You can skip this step if you don't care about matching within a location.
75441     //
75442     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75443     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75444     // {
75445     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75446     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75447     //    …
75448     // }
75449     //
75450     buildLocationIndex(data, loco) {
75451       const that = this;
75452       if (that.locationIndex)
75453         return;
75454       that.itemLocation = /* @__PURE__ */ new Map();
75455       that.locationSets = /* @__PURE__ */ new Map();
75456       Object.keys(data).forEach((tkv) => {
75457         const items = data[tkv].items;
75458         if (!Array.isArray(items) || !items.length)
75459           return;
75460         items.forEach((item) => {
75461           if (that.itemLocation.has(item.id))
75462             return;
75463           let resolved;
75464           try {
75465             resolved = loco.resolveLocationSet(item.locationSet);
75466           } catch (err) {
75467             console.warn(`buildLocationIndex: ${err.message}`);
75468           }
75469           if (!resolved || !resolved.id)
75470             return;
75471           that.itemLocation.set(item.id, resolved.id);
75472           if (that.locationSets.has(resolved.id))
75473             return;
75474           let feature3 = _cloneDeep2(resolved.feature);
75475           feature3.id = resolved.id;
75476           feature3.properties.id = resolved.id;
75477           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
75478             console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
75479             console.warn(JSON.stringify(feature3));
75480             return;
75481           }
75482           that.locationSets.set(resolved.id, feature3);
75483         });
75484       });
75485       that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
75486       function _cloneDeep2(obj) {
75487         return JSON.parse(JSON.stringify(obj));
75488       }
75489     }
75490     //
75491     // `match()`
75492     // Pass parts and return an Array of matches.
75493     // `k` - key
75494     // `v` - value
75495     // `n` - namelike
75496     // `loc` - optional - [lon,lat] location to search
75497     //
75498     // 1. If the [k,v,n] tuple matches a canonical item…
75499     // Return an Array of match results.
75500     // Each result will include the area in km² that the item is valid.
75501     //
75502     // Order of results:
75503     // Primary ordering will be on the "match" column:
75504     //   "primary" - where the query matches the `name` tag, followed by
75505     //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
75506     // Secondary ordering will be on the "area" column:
75507     //   "area descending" if no location was provided, (worldwide before local)
75508     //   "area ascending" if location was provided (local before worldwide)
75509     //
75510     // [
75511     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75512     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75513     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75514     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75515     //   …
75516     // ]
75517     //
75518     // -or-
75519     //
75520     // 2. If the [k,v,n] tuple matches an exclude pattern…
75521     // Return an Array with a single exclude result, either
75522     //
75523     // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
75524     //   or
75525     // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
75526     //
75527     // About results
75528     //   "generic" - a generic word that is probably not really a name.
75529     //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
75530     //   "named" - a real name like "Kebabai" that is just common, but not a brand.
75531     //     For these, iD should just let it be. We don't include these in NSI, but we don't want to nag users about it either.
75532     //
75533     // -or-
75534     //
75535     // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
75536     //
75537     //
75538     match(k2, v2, n3, loc) {
75539       const that = this;
75540       if (!that.matchIndex) {
75541         throw new Error("match:  matchIndex not built.");
75542       }
75543       let matchLocations;
75544       if (Array.isArray(loc) && that.locationIndex) {
75545         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
75546       }
75547       const nsimple = simplify2(n3);
75548       let seen = /* @__PURE__ */ new Set();
75549       let results = [];
75550       gatherResults("primary");
75551       gatherResults("alternate");
75552       if (results.length)
75553         return results;
75554       gatherResults("exclude");
75555       return results.length ? results : null;
75556       function gatherResults(which) {
75557         const kv = `${k2}/${v2}`;
75558         let didMatch = tryMatch(which, kv);
75559         if (didMatch)
75560           return;
75561         for (let mg in matchGroups) {
75562           const matchGroup = matchGroups[mg];
75563           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
75564           if (!inGroup)
75565             continue;
75566           for (let i3 = 0; i3 < matchGroup.length; i3++) {
75567             const otherkv = matchGroup[i3];
75568             if (otherkv === kv)
75569               continue;
75570             didMatch = tryMatch(which, otherkv);
75571             if (didMatch)
75572               return;
75573           }
75574         }
75575         if (which === "exclude") {
75576           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
75577           if (regex) {
75578             results.push({ match: "excludeGeneric", pattern: String(regex) });
75579             return;
75580           }
75581         }
75582       }
75583       function tryMatch(which, kv) {
75584         const branch = that.matchIndex.get(kv);
75585         if (!branch)
75586           return;
75587         if (which === "exclude") {
75588           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
75589           if (regex) {
75590             results.push({ match: "excludeNamed", pattern: String(regex), kv });
75591             return;
75592           }
75593           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
75594           if (regex) {
75595             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
75596             return;
75597           }
75598           return;
75599         }
75600         const leaf = branch[which].get(nsimple);
75601         if (!leaf || !leaf.size)
75602           return;
75603         let hits = Array.from(leaf).map((itemID) => {
75604           let area = Infinity;
75605           if (that.itemLocation && that.locationSets) {
75606             const location = that.locationSets.get(that.itemLocation.get(itemID));
75607             area = location && location.properties.area || Infinity;
75608           }
75609           return { match: which, itemID, area, kv, nsimple };
75610         });
75611         let sortFn = byAreaDescending;
75612         if (matchLocations) {
75613           hits = hits.filter(isValidLocation);
75614           sortFn = byAreaAscending;
75615         }
75616         if (!hits.length)
75617           return;
75618         hits.sort(sortFn).forEach((hit) => {
75619           if (seen.has(hit.itemID))
75620             return;
75621           seen.add(hit.itemID);
75622           results.push(hit);
75623         });
75624         return true;
75625         function isValidLocation(hit) {
75626           if (!that.itemLocation)
75627             return true;
75628           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
75629         }
75630         function byAreaAscending(hitA, hitB) {
75631           return hitA.area - hitB.area;
75632         }
75633         function byAreaDescending(hitA, hitB) {
75634           return hitB.area - hitA.area;
75635         }
75636       }
75637     }
75638     //
75639     // `getWarnings()`
75640     // Return any warnings discovered when buiding the index.
75641     // (currently this does nothing)
75642     //
75643     getWarnings() {
75644       return this.warnings;
75645     }
75646   };
75647
75648   // modules/services/nsi.js
75649   var import_vparse2 = __toESM(require_vparse());
75650   var _nsiStatus = "loading";
75651   var _nsi = {};
75652   var buildingPreset = {
75653     "building/commercial": true,
75654     "building/government": true,
75655     "building/hotel": true,
75656     "building/retail": true,
75657     "building/office": true,
75658     "building/supermarket": true,
75659     "building/yes": true
75660   };
75661   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75662   var notBranches = /(coop|express|wireless|factory|outlet)/i;
75663   function setNsiSources() {
75664     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
75665     const v2 = (0, import_vparse2.default)(nsiVersion);
75666     const vMinor = `${v2.major}.${v2.minor}`;
75667     const cdn = nsiCdnUrl.replace("{version}", vMinor);
75668     const sources = {
75669       "nsi_data": cdn + "dist/nsi.min.json",
75670       "nsi_dissolved": cdn + "dist/dissolved.min.json",
75671       "nsi_features": cdn + "dist/featureCollection.min.json",
75672       "nsi_generics": cdn + "dist/genericWords.min.json",
75673       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
75674       "nsi_replacements": cdn + "dist/replacements.min.json",
75675       "nsi_trees": cdn + "dist/trees.min.json"
75676     };
75677     let fileMap = _mainFileFetcher.fileMap();
75678     for (const k2 in sources) {
75679       if (!fileMap[k2])
75680         fileMap[k2] = sources[k2];
75681     }
75682   }
75683   function loadNsiPresets() {
75684     return Promise.all([
75685       _mainFileFetcher.get("nsi_presets"),
75686       _mainFileFetcher.get("nsi_features")
75687     ]).then((vals) => {
75688       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
75689       _mainPresetIndex.merge({
75690         presets: vals[0].presets,
75691         featureCollection: vals[1]
75692       });
75693     });
75694   }
75695   function loadNsiData() {
75696     return Promise.all([
75697       _mainFileFetcher.get("nsi_data"),
75698       _mainFileFetcher.get("nsi_dissolved"),
75699       _mainFileFetcher.get("nsi_replacements"),
75700       _mainFileFetcher.get("nsi_trees")
75701     ]).then((vals) => {
75702       _nsi = {
75703         data: vals[0].nsi,
75704         // the raw name-suggestion-index data
75705         dissolved: vals[1].dissolved,
75706         // list of dissolved items
75707         replacements: vals[2].replacements,
75708         // trivial old->new qid replacements
75709         trees: vals[3].trees,
75710         // metadata about trees, main tags
75711         kvt: /* @__PURE__ */ new Map(),
75712         // Map (k -> Map (v -> t) )
75713         qids: /* @__PURE__ */ new Map(),
75714         // Map (wd/wp tag values -> qids)
75715         ids: /* @__PURE__ */ new Map()
75716         // Map (id -> NSI item)
75717       };
75718       const matcher = _nsi.matcher = new Matcher();
75719       matcher.buildMatchIndex(_nsi.data);
75720       matcher.itemLocation = /* @__PURE__ */ new Map();
75721       matcher.locationSets = /* @__PURE__ */ new Map();
75722       Object.keys(_nsi.data).forEach((tkv) => {
75723         const items = _nsi.data[tkv].items;
75724         if (!Array.isArray(items) || !items.length)
75725           return;
75726         items.forEach((item) => {
75727           if (matcher.itemLocation.has(item.id))
75728             return;
75729           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
75730           matcher.itemLocation.set(item.id, locationSetID);
75731           if (matcher.locationSets.has(locationSetID))
75732             return;
75733           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
75734           matcher.locationSets.set(locationSetID, fakeFeature);
75735         });
75736       });
75737       matcher.locationIndex = (bbox2) => {
75738         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
75739         const results = [];
75740         for (const [locationSetID, area] of Object.entries(validHere)) {
75741           const fakeFeature = matcher.locationSets.get(locationSetID);
75742           if (fakeFeature) {
75743             fakeFeature.properties.area = area;
75744             results.push(fakeFeature);
75745           }
75746         }
75747         return results;
75748       };
75749       Object.keys(_nsi.data).forEach((tkv) => {
75750         const category = _nsi.data[tkv];
75751         const parts = tkv.split("/", 3);
75752         const t2 = parts[0];
75753         const k2 = parts[1];
75754         const v2 = parts[2];
75755         let vmap = _nsi.kvt.get(k2);
75756         if (!vmap) {
75757           vmap = /* @__PURE__ */ new Map();
75758           _nsi.kvt.set(k2, vmap);
75759         }
75760         vmap.set(v2, t2);
75761         const tree = _nsi.trees[t2];
75762         const mainTag = tree.mainTag;
75763         const items = category.items || [];
75764         items.forEach((item) => {
75765           item.tkv = tkv;
75766           item.mainTag = mainTag;
75767           _nsi.ids.set(item.id, item);
75768           const wd = item.tags[mainTag];
75769           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
75770           if (wd)
75771             _nsi.qids.set(wd, wd);
75772           if (wp && wd)
75773             _nsi.qids.set(wp, wd);
75774         });
75775       });
75776     });
75777   }
75778   function gatherKVs(tags) {
75779     let primary = /* @__PURE__ */ new Set();
75780     let alternate = /* @__PURE__ */ new Set();
75781     Object.keys(tags).forEach((osmkey) => {
75782       const osmvalue = tags[osmkey];
75783       if (!osmvalue)
75784         return;
75785       if (osmkey === "route_master")
75786         osmkey = "route";
75787       const vmap = _nsi.kvt.get(osmkey);
75788       if (!vmap)
75789         return;
75790       if (vmap.get(osmvalue)) {
75791         primary.add(`${osmkey}/${osmvalue}`);
75792       } else if (osmvalue === "yes") {
75793         alternate.add(`${osmkey}/${osmvalue}`);
75794       }
75795     });
75796     const preset = _mainPresetIndex.matchTags(tags, "area");
75797     if (buildingPreset[preset.id]) {
75798       alternate.add("building/yes");
75799     }
75800     return { primary, alternate };
75801   }
75802   function identifyTree(tags) {
75803     let unknown;
75804     let t2;
75805     Object.keys(tags).forEach((osmkey) => {
75806       if (t2)
75807         return;
75808       const osmvalue = tags[osmkey];
75809       if (!osmvalue)
75810         return;
75811       if (osmkey === "route_master")
75812         osmkey = "route";
75813       const vmap = _nsi.kvt.get(osmkey);
75814       if (!vmap)
75815         return;
75816       if (osmvalue === "yes") {
75817         unknown = "unknown";
75818       } else {
75819         t2 = vmap.get(osmvalue);
75820       }
75821     });
75822     return t2 || unknown || null;
75823   }
75824   function gatherNames(tags) {
75825     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
75826     let primary = /* @__PURE__ */ new Set();
75827     let alternate = /* @__PURE__ */ new Set();
75828     let foundSemi = false;
75829     let testNameFragments = false;
75830     let patterns2;
75831     let t2 = identifyTree(tags);
75832     if (!t2)
75833       return empty2;
75834     if (t2 === "transit") {
75835       patterns2 = {
75836         primary: /^network$/i,
75837         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
75838       };
75839     } else if (t2 === "flags") {
75840       patterns2 = {
75841         primary: /^(flag:name|flag:name:\w+)$/i,
75842         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
75843         // note: no `country`, we special-case it below
75844       };
75845     } else if (t2 === "brands") {
75846       testNameFragments = true;
75847       patterns2 = {
75848         primary: /^(name|name:\w+)$/i,
75849         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75850       };
75851     } else if (t2 === "operators") {
75852       testNameFragments = true;
75853       patterns2 = {
75854         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
75855         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
75856       };
75857     } else {
75858       testNameFragments = true;
75859       patterns2 = {
75860         primary: /^(name|name:\w+)$/i,
75861         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75862       };
75863     }
75864     if (tags.name && testNameFragments) {
75865       const nameParts = tags.name.split(/[\s\-\/,.]/);
75866       for (let split = nameParts.length; split > 0; split--) {
75867         const name = nameParts.slice(0, split).join(" ");
75868         primary.add(name);
75869       }
75870     }
75871     Object.keys(tags).forEach((osmkey) => {
75872       const osmvalue = tags[osmkey];
75873       if (!osmvalue)
75874         return;
75875       if (isNamelike(osmkey, "primary")) {
75876         if (/;/.test(osmvalue)) {
75877           foundSemi = true;
75878         } else {
75879           primary.add(osmvalue);
75880           alternate.delete(osmvalue);
75881         }
75882       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
75883         if (/;/.test(osmvalue)) {
75884           foundSemi = true;
75885         } else {
75886           alternate.add(osmvalue);
75887         }
75888       }
75889     });
75890     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
75891       const osmvalue = tags.country;
75892       if (/;/.test(osmvalue)) {
75893         foundSemi = true;
75894       } else {
75895         alternate.add(osmvalue);
75896       }
75897     }
75898     if (foundSemi) {
75899       return empty2;
75900     } else {
75901       return { primary, alternate };
75902     }
75903     function isNamelike(osmkey, which) {
75904       if (osmkey === "old_name")
75905         return false;
75906       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
75907     }
75908   }
75909   function gatherTuples(tryKVs, tryNames) {
75910     let tuples = [];
75911     ["primary", "alternate"].forEach((whichName) => {
75912       const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
75913       arr.forEach((n3) => {
75914         ["primary", "alternate"].forEach((whichKV) => {
75915           tryKVs[whichKV].forEach((kv) => {
75916             const parts = kv.split("/", 2);
75917             const k2 = parts[0];
75918             const v2 = parts[1];
75919             tuples.push({ k: k2, v: v2, n: n3 });
75920           });
75921         });
75922       });
75923     });
75924     return tuples;
75925   }
75926   function _upgradeTags(tags, loc) {
75927     let newTags = Object.assign({}, tags);
75928     let changed = false;
75929     Object.keys(newTags).forEach((osmkey) => {
75930       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
75931       if (matchTag) {
75932         const prefix = matchTag[1] || "";
75933         const wd = newTags[osmkey];
75934         const replace = _nsi.replacements[wd];
75935         if (replace && replace.wikidata !== void 0) {
75936           changed = true;
75937           if (replace.wikidata) {
75938             newTags[osmkey] = replace.wikidata;
75939           } else {
75940             delete newTags[osmkey];
75941           }
75942         }
75943         if (replace && replace.wikipedia !== void 0) {
75944           changed = true;
75945           const wpkey = `${prefix}wikipedia`;
75946           if (replace.wikipedia) {
75947             newTags[wpkey] = replace.wikipedia;
75948           } else {
75949             delete newTags[wpkey];
75950           }
75951         }
75952       }
75953     });
75954     const isRouteMaster = tags.type === "route_master";
75955     const tryKVs = gatherKVs(tags);
75956     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
75957       return changed ? { newTags, matched: null } : null;
75958     }
75959     const tryNames = gatherNames(tags);
75960     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
75961     if (foundQID)
75962       tryNames.primary.add(foundQID);
75963     if (!tryNames.primary.size && !tryNames.alternate.size) {
75964       return changed ? { newTags, matched: null } : null;
75965     }
75966     const tuples = gatherTuples(tryKVs, tryNames);
75967     for (let i3 = 0; i3 < tuples.length; i3++) {
75968       const tuple = tuples[i3];
75969       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
75970       if (!hits || !hits.length)
75971         continue;
75972       if (hits[0].match !== "primary" && hits[0].match !== "alternate")
75973         break;
75974       let itemID, item;
75975       for (let j3 = 0; j3 < hits.length; j3++) {
75976         const hit = hits[j3];
75977         itemID = hit.itemID;
75978         if (_nsi.dissolved[itemID])
75979           continue;
75980         item = _nsi.ids.get(itemID);
75981         if (!item)
75982           continue;
75983         const mainTag = item.mainTag;
75984         const itemQID = item.tags[mainTag];
75985         const notQID = newTags[`not:${mainTag}`];
75986         if (
75987           // Exceptions, skip this hit
75988           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
75989           newTags.office && !item.tags.office
75990         ) {
75991           item = null;
75992           continue;
75993         } else {
75994           break;
75995         }
75996       }
75997       if (!item)
75998         continue;
75999       item = JSON.parse(JSON.stringify(item));
76000       const tkv = item.tkv;
76001       const parts = tkv.split("/", 3);
76002       const k2 = parts[1];
76003       const v2 = parts[2];
76004       const category = _nsi.data[tkv];
76005       const properties = category.properties || {};
76006       let preserveTags = item.preserveTags || properties.preserveTags || [];
76007       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
76008         if (k2 !== osmkey)
76009           preserveTags.push(`^${osmkey}$`);
76010       });
76011       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
76012       let keepTags = {};
76013       Object.keys(newTags).forEach((osmkey) => {
76014         if (regexes.some((regex) => regex.test(osmkey))) {
76015           keepTags[osmkey] = newTags[osmkey];
76016         }
76017       });
76018       _nsi.kvt.forEach((vmap, k3) => {
76019         if (newTags[k3] === "yes")
76020           delete newTags[k3];
76021       });
76022       if (foundQID) {
76023         delete newTags.wikipedia;
76024         delete newTags.wikidata;
76025       }
76026       Object.assign(newTags, item.tags, keepTags);
76027       if (isRouteMaster) {
76028         newTags.route_master = newTags.route;
76029         delete newTags.route;
76030       }
76031       const origName = tags.name;
76032       const newName = newTags.name;
76033       if (newName && origName && newName !== origName && !newTags.branch) {
76034         const newNames = gatherNames(newTags);
76035         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
76036         const isMoved = newSet.has(origName);
76037         if (!isMoved) {
76038           const nameParts = origName.split(/[\s\-\/,.]/);
76039           for (let split = nameParts.length; split > 0; split--) {
76040             const name = nameParts.slice(0, split).join(" ");
76041             const branch = nameParts.slice(split).join(" ");
76042             const nameHits = _nsi.matcher.match(k2, v2, name, loc);
76043             if (!nameHits || !nameHits.length)
76044               continue;
76045             if (nameHits.some((hit) => hit.itemID === itemID)) {
76046               if (branch) {
76047                 if (notBranches.test(branch)) {
76048                   newTags.name = origName;
76049                 } else {
76050                   const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
76051                   if (branchHits && branchHits.length) {
76052                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
76053                       return null;
76054                     }
76055                   } else {
76056                     newTags.branch = branch;
76057                   }
76058                 }
76059               }
76060               break;
76061             }
76062           }
76063         }
76064       }
76065       return { newTags, matched: item };
76066     }
76067     return changed ? { newTags, matched: null } : null;
76068   }
76069   function _isGenericName(tags) {
76070     const n3 = tags.name;
76071     if (!n3)
76072       return false;
76073     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
76074     const tryKVs = gatherKVs(tags);
76075     if (!tryKVs.primary.size && !tryKVs.alternate.size)
76076       return false;
76077     const tuples = gatherTuples(tryKVs, tryNames);
76078     for (let i3 = 0; i3 < tuples.length; i3++) {
76079       const tuple = tuples[i3];
76080       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
76081       if (hits && hits.length && hits[0].match === "excludeGeneric")
76082         return true;
76083     }
76084     return false;
76085   }
76086   var nsi_default = {
76087     // `init()`
76088     // On init, start preparing the name-suggestion-index
76089     //
76090     init: () => {
76091       setNsiSources();
76092       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
76093     },
76094     // `reset()`
76095     // Reset is called when user saves data to OSM (does nothing here)
76096     //
76097     reset: () => {
76098     },
76099     // `status()`
76100     // To let other code know how it's going...
76101     //
76102     // Returns
76103     //   `String`: 'loading', 'ok', 'failed'
76104     //
76105     status: () => _nsiStatus,
76106     // `isGenericName()`
76107     // Is the `name` tag generic?
76108     //
76109     // Arguments
76110     //   `tags`: `Object` containing the feature's OSM tags
76111     // Returns
76112     //   `true` if it is generic, `false` if not
76113     //
76114     isGenericName: (tags) => _isGenericName(tags),
76115     // `upgradeTags()`
76116     // Suggest tag upgrades.
76117     // This function will not modify the input tags, it makes a copy.
76118     //
76119     // Arguments
76120     //   `tags`: `Object` containing the feature's OSM tags
76121     //   `loc`: Location where this feature exists, as a [lon, lat]
76122     // Returns
76123     //   `Object` containing the result, or `null` if no changes needed:
76124     //   {
76125     //     'newTags': `Object` - The tags the the feature should have
76126     //     'matched': `Object` - The matched item
76127     //   }
76128     //
76129     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
76130     // `cache()`
76131     // Direct access to the NSI cache, useful for testing or breaking things
76132     //
76133     // Returns
76134     //   `Object`: the internal NSI cache
76135     //
76136     cache: () => _nsi
76137   };
76138
76139   // modules/services/kartaview.js
76140   var import_rbush8 = __toESM(require_rbush_min());
76141   var apibase2 = "https://kartaview.org";
76142   var maxResults = 1e3;
76143   var tileZoom = 14;
76144   var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
76145   var dispatch7 = dispatch_default("loadedImages");
76146   var imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
76147   var _oscCache;
76148   var _oscSelectedImage;
76149   var _loadViewerPromise2;
76150   function abortRequest4(controller) {
76151     controller.abort();
76152   }
76153   function maxPageAtZoom(z2) {
76154     if (z2 < 15)
76155       return 2;
76156     if (z2 === 15)
76157       return 5;
76158     if (z2 === 16)
76159       return 10;
76160     if (z2 === 17)
76161       return 20;
76162     if (z2 === 18)
76163       return 40;
76164     if (z2 > 18)
76165       return 80;
76166   }
76167   function loadTiles2(which, url, projection2) {
76168     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
76169     var tiles = tiler4.getTiles(projection2);
76170     var cache = _oscCache[which];
76171     Object.keys(cache.inflight).forEach(function(k2) {
76172       var wanted = tiles.find(function(tile) {
76173         return k2.indexOf(tile.id + ",") === 0;
76174       });
76175       if (!wanted) {
76176         abortRequest4(cache.inflight[k2]);
76177         delete cache.inflight[k2];
76178       }
76179     });
76180     tiles.forEach(function(tile) {
76181       loadNextTilePage(which, currZoom, url, tile);
76182     });
76183   }
76184   function loadNextTilePage(which, currZoom, url, tile) {
76185     var cache = _oscCache[which];
76186     var bbox2 = tile.extent.bbox();
76187     var maxPages = maxPageAtZoom(currZoom);
76188     var nextPage = cache.nextPage[tile.id] || 1;
76189     var params = utilQsString({
76190       ipp: maxResults,
76191       page: nextPage,
76192       // client_id: clientId,
76193       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
76194       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
76195     }, true);
76196     if (nextPage > maxPages)
76197       return;
76198     var id2 = tile.id + "," + String(nextPage);
76199     if (cache.loaded[id2] || cache.inflight[id2])
76200       return;
76201     var controller = new AbortController();
76202     cache.inflight[id2] = controller;
76203     var options2 = {
76204       method: "POST",
76205       signal: controller.signal,
76206       body: params,
76207       headers: { "Content-Type": "application/x-www-form-urlencoded" }
76208     };
76209     json_default(url, options2).then(function(data) {
76210       cache.loaded[id2] = true;
76211       delete cache.inflight[id2];
76212       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
76213         throw new Error("No Data");
76214       }
76215       var features = data.currentPageItems.map(function(item) {
76216         var loc = [+item.lng, +item.lat];
76217         var d2;
76218         if (which === "images") {
76219           d2 = {
76220             loc,
76221             key: item.id,
76222             ca: +item.heading,
76223             captured_at: item.shot_date || item.date_added,
76224             captured_by: item.username,
76225             imagePath: item.lth_name,
76226             sequence_id: item.sequence_id,
76227             sequence_index: +item.sequence_index
76228           };
76229           var seq = _oscCache.sequences[d2.sequence_id];
76230           if (!seq) {
76231             seq = { rotation: 0, images: [] };
76232             _oscCache.sequences[d2.sequence_id] = seq;
76233           }
76234           seq.images[d2.sequence_index] = d2;
76235           _oscCache.images.forImageKey[d2.key] = d2;
76236         }
76237         return {
76238           minX: loc[0],
76239           minY: loc[1],
76240           maxX: loc[0],
76241           maxY: loc[1],
76242           data: d2
76243         };
76244       });
76245       cache.rtree.load(features);
76246       if (data.currentPageItems.length === maxResults) {
76247         cache.nextPage[tile.id] = nextPage + 1;
76248         loadNextTilePage(which, currZoom, url, tile);
76249       } else {
76250         cache.nextPage[tile.id] = Infinity;
76251       }
76252       if (which === "images") {
76253         dispatch7.call("loadedImages");
76254       }
76255     }).catch(function() {
76256       cache.loaded[id2] = true;
76257       delete cache.inflight[id2];
76258     });
76259   }
76260   function partitionViewport2(projection2) {
76261     var z2 = geoScaleToZoom(projection2.scale());
76262     var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
76263     var tiler9 = utilTiler().zoomExtent([z22, z22]);
76264     return tiler9.getTiles(projection2).map(function(tile) {
76265       return tile.extent;
76266     });
76267   }
76268   function searchLimited2(limit, projection2, rtree) {
76269     limit = limit || 5;
76270     return partitionViewport2(projection2).reduce(function(result, extent) {
76271       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
76272         return d2.data;
76273       });
76274       return found.length ? result.concat(found) : result;
76275     }, []);
76276   }
76277   var kartaview_default = {
76278     init: function() {
76279       if (!_oscCache) {
76280         this.reset();
76281       }
76282       this.event = utilRebind(this, dispatch7, "on");
76283     },
76284     reset: function() {
76285       if (_oscCache) {
76286         Object.values(_oscCache.images.inflight).forEach(abortRequest4);
76287       }
76288       _oscCache = {
76289         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
76290         sequences: {}
76291       };
76292       _oscSelectedImage = null;
76293     },
76294     images: function(projection2) {
76295       var limit = 5;
76296       return searchLimited2(limit, projection2, _oscCache.images.rtree);
76297     },
76298     sequences: function(projection2) {
76299       var viewport = projection2.clipExtent();
76300       var min3 = [viewport[0][0], viewport[1][1]];
76301       var max3 = [viewport[1][0], viewport[0][1]];
76302       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76303       var sequenceKeys = {};
76304       _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
76305         sequenceKeys[d2.data.sequence_id] = true;
76306       });
76307       var lineStrings = [];
76308       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
76309         var seq = _oscCache.sequences[sequenceKey];
76310         var images = seq && seq.images;
76311         if (images) {
76312           lineStrings.push({
76313             type: "LineString",
76314             coordinates: images.map(function(d2) {
76315               return d2.loc;
76316             }).filter(Boolean),
76317             properties: {
76318               captured_at: images[0] ? images[0].captured_at : null,
76319               captured_by: images[0] ? images[0].captured_by : null,
76320               key: sequenceKey
76321             }
76322           });
76323         }
76324       });
76325       return lineStrings;
76326     },
76327     cachedImage: function(imageKey) {
76328       return _oscCache.images.forImageKey[imageKey];
76329     },
76330     loadImages: function(projection2) {
76331       var url = apibase2 + "/1.0/list/nearby-photos/";
76332       loadTiles2("images", url, projection2);
76333     },
76334     ensureViewerLoaded: function(context) {
76335       if (_loadViewerPromise2)
76336         return _loadViewerPromise2;
76337       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
76338       var that = this;
76339       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom2.on("zoom", zoomPan2)).on("dblclick.zoom", null);
76340       wrapEnter.append("div").attr("class", "photo-attribution fillD");
76341       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76342       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76343       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
76344       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
76345       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76346       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
76347       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
76348         imgZoom2.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
76349       });
76350       function zoomPan2(d3_event) {
76351         var t2 = d3_event.transform;
76352         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
76353       }
76354       function rotate(deg) {
76355         return function() {
76356           if (!_oscSelectedImage)
76357             return;
76358           var sequenceKey = _oscSelectedImage.sequence_id;
76359           var sequence = _oscCache.sequences[sequenceKey];
76360           if (!sequence)
76361             return;
76362           var r2 = sequence.rotation || 0;
76363           r2 += deg;
76364           if (r2 > 180)
76365             r2 -= 360;
76366           if (r2 < -180)
76367             r2 += 360;
76368           sequence.rotation = r2;
76369           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
76370           wrap3.transition().duration(100).call(imgZoom2.transform, identity2);
76371           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
76372         };
76373       }
76374       function step(stepBy) {
76375         return function() {
76376           if (!_oscSelectedImage)
76377             return;
76378           var sequenceKey = _oscSelectedImage.sequence_id;
76379           var sequence = _oscCache.sequences[sequenceKey];
76380           if (!sequence)
76381             return;
76382           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
76383           var nextImage = sequence.images[nextIndex];
76384           if (!nextImage)
76385             return;
76386           context.map().centerEase(nextImage.loc);
76387           that.selectImage(context, nextImage.key);
76388         };
76389       }
76390       _loadViewerPromise2 = Promise.resolve();
76391       return _loadViewerPromise2;
76392     },
76393     showViewer: function(context) {
76394       var viewer = context.container().select(".photoviewer").classed("hide", false);
76395       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
76396       if (isHidden) {
76397         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
76398         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
76399       }
76400       return this;
76401     },
76402     hideViewer: function(context) {
76403       _oscSelectedImage = null;
76404       this.updateUrlImage(null);
76405       var viewer = context.container().select(".photoviewer");
76406       if (!viewer.empty())
76407         viewer.datum(null);
76408       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
76409       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
76410       return this.setStyles(context, null, true);
76411     },
76412     selectImage: function(context, imageKey) {
76413       var d2 = this.cachedImage(imageKey);
76414       _oscSelectedImage = d2;
76415       this.updateUrlImage(imageKey);
76416       var viewer = context.container().select(".photoviewer");
76417       if (!viewer.empty())
76418         viewer.datum(d2);
76419       this.setStyles(context, null, true);
76420       context.container().selectAll(".icon-sign").classed("currentView", false);
76421       if (!d2)
76422         return this;
76423       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
76424       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
76425       var attribution = wrap2.selectAll(".photo-attribution").text("");
76426       wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
76427       imageWrap.selectAll(".kartaview-image").remove();
76428       if (d2) {
76429         var sequence = _oscCache.sequences[d2.sequence_id];
76430         var r2 = sequence && sequence.rotation || 0;
76431         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d2.imagePath).style("transform", "rotate(" + r2 + "deg)");
76432         if (d2.captured_by) {
76433           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
76434           attribution.append("span").text("|");
76435         }
76436         if (d2.captured_at) {
76437           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
76438           attribution.append("span").text("|");
76439         }
76440         attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://kartaview.org/details/" + d2.sequence_id + "/" + d2.sequence_index).text("kartaview.org");
76441       }
76442       return this;
76443       function localeDateString2(s2) {
76444         if (!s2)
76445           return null;
76446         var options2 = { day: "numeric", month: "short", year: "numeric" };
76447         var d4 = new Date(s2);
76448         if (isNaN(d4.getTime()))
76449           return null;
76450         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
76451       }
76452     },
76453     getSelectedImage: function() {
76454       return _oscSelectedImage;
76455     },
76456     getSequenceKeyForImage: function(d2) {
76457       return d2 && d2.sequence_id;
76458     },
76459     // Updates the currently highlighted sequence and selected bubble.
76460     // Reset is only necessary when interacting with the viewport because
76461     // this implicitly changes the currently selected bubble/sequence
76462     setStyles: function(context, hovered, reset) {
76463       if (reset) {
76464         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
76465         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
76466       }
76467       var hoveredImageKey = hovered && hovered.key;
76468       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
76469       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
76470       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d2) {
76471         return d2.key;
76472       }) || [];
76473       var viewer = context.container().select(".photoviewer");
76474       var selected = viewer.empty() ? void 0 : viewer.datum();
76475       var selectedImageKey = selected && selected.key;
76476       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
76477       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
76478       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d2) {
76479         return d2.key;
76480       }) || [];
76481       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
76482       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
76483         return highlightedImageKeys.indexOf(d2.key) !== -1;
76484       }).classed("hovered", function(d2) {
76485         return d2.key === hoveredImageKey;
76486       }).classed("currentView", function(d2) {
76487         return d2.key === selectedImageKey;
76488       });
76489       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
76490         return d2.properties.key === hoveredSequenceKey;
76491       }).classed("currentView", function(d2) {
76492         return d2.properties.key === selectedSequenceKey;
76493       });
76494       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
76495       function viewfieldPath() {
76496         var d2 = this.parentNode.__data__;
76497         if (d2.pano && d2.key !== selectedImageKey) {
76498           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
76499         } else {
76500           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
76501         }
76502       }
76503       return this;
76504     },
76505     updateUrlImage: function(imageKey) {
76506       if (!window.mocha) {
76507         var hash = utilStringQs(window.location.hash);
76508         if (imageKey) {
76509           hash.photo = "kartaview/" + imageKey;
76510         } else {
76511           delete hash.photo;
76512         }
76513         window.location.replace("#" + utilQsString(hash, true));
76514       }
76515     },
76516     cache: function() {
76517       return _oscCache;
76518     }
76519   };
76520
76521   // modules/services/vegbilder.js
76522   var import_rbush9 = __toESM(require_rbush_min());
76523
76524   // modules/services/pannellum_photo.js
76525   var pannellumViewerCSS = "pannellum/pannellum.css";
76526   var pannellumViewerJS = "pannellum/pannellum.js";
76527   var dispatch8 = dispatch_default("viewerChanged");
76528   var _currScenes = [];
76529   var _pannellumViewer;
76530   var pannellum_photo_default = {
76531     init: async function(context, selection2) {
76532       selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true);
76533       if (!window.pannellum) {
76534         await this.loadPannellum(context);
76535       }
76536       const options2 = {
76537         "default": { firstScene: "" },
76538         scenes: {}
76539       };
76540       _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
76541       _pannellumViewer.on("mousedown", () => {
76542         select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
76543           dispatch8.call("viewerChanged");
76544         });
76545       }).on("mouseup", () => {
76546         select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
76547       }).on("animatefinished", () => {
76548         dispatch8.call("viewerChanged");
76549       });
76550       context.ui().photoviewer.on("resize.pannellum", () => {
76551         _pannellumViewer.resize();
76552       });
76553       this.event = utilRebind(this, dispatch8, "on");
76554       return this;
76555     },
76556     loadPannellum: function(context) {
76557       const head = select_default2("head");
76558       return Promise.all([
76559         new Promise((resolve, reject) => {
76560           head.selectAll("#ideditor-pannellum-viewercss").data([0]).enter().append("link").attr("id", "ideditor-pannellum-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS)).on("load.pannellum", resolve).on("error.pannellum", reject);
76561         }),
76562         new Promise((resolve, reject) => {
76563           head.selectAll("#ideditor-pannellum-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-pannellum-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS)).on("load.pannellum", resolve).on("error.pannellum", reject);
76564         })
76565       ]);
76566     },
76567     showPhotoFrame: function(context) {
76568       const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
76569       if (isHidden) {
76570         context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
76571         context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
76572       }
76573       return this;
76574     },
76575     hidePhotoFrame: function(viewerContext) {
76576       viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
76577       return this;
76578     },
76579     selectPhoto: function(data, keepOrientation) {
76580       const { key } = data;
76581       if (!(key in _currScenes)) {
76582         let newSceneOptions = {
76583           showFullscreenCtrl: false,
76584           autoLoad: false,
76585           compass: true,
76586           yaw: 0,
76587           type: "equirectangular",
76588           preview: data.preview_path,
76589           panorama: data.image_path,
76590           northOffset: data.ca
76591         };
76592         _currScenes.push(key);
76593         _pannellumViewer.addScene(key, newSceneOptions);
76594       }
76595       let yaw = 0;
76596       let pitch = 0;
76597       if (keepOrientation) {
76598         yaw = this.getYaw();
76599         pitch = _pannellumViewer.getPitch();
76600       }
76601       _pannellumViewer.loadScene(key, pitch, yaw);
76602       dispatch8.call("viewerChanged");
76603       if (_currScenes.length > 3) {
76604         const old_key = _currScenes.shift();
76605         _pannellumViewer.removeScene(old_key);
76606       }
76607       return this;
76608     },
76609     getYaw: function() {
76610       return _pannellumViewer.getYaw();
76611     }
76612   };
76613
76614   // modules/services/vegbilder.js
76615   var owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
76616   var tileZoom2 = 14;
76617   var tiler5 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
76618   var dispatch9 = dispatch_default("loadedImages", "viewerChanged");
76619   var directionEnum = Object.freeze({
76620     forward: Symbol(0),
76621     backward: Symbol(1)
76622   });
76623   var _planeFrame;
76624   var _pannellumFrame;
76625   var _currentFrame;
76626   var _loadViewerPromise3;
76627   var _vegbilderCache;
76628   async function fetchAvailableLayers() {
76629     const params = {
76630       service: "WFS",
76631       request: "GetCapabilities",
76632       version: "2.0.0"
76633     };
76634     const urlForRequest = owsEndpoint + utilQsString(params);
76635     const response = await xml_default(urlForRequest);
76636     const xPathSelector = "/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name";
76637     const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
76638     const NSResolver = response.createNSResolver(response);
76639     const l2 = response.evaluate(
76640       xPathSelector,
76641       response,
76642       NSResolver,
76643       XPathResult.ANY_TYPE
76644     );
76645     let node;
76646     const availableLayers = [];
76647     while ((node = l2.iterateNext()) !== null) {
76648       const match = node.textContent?.match(regexMatcher);
76649       if (match) {
76650         availableLayers.push({
76651           name: match[0],
76652           is_sphere: !!match.groups?.image_type,
76653           year: parseInt(match.groups?.year, 10)
76654         });
76655       }
76656     }
76657     return availableLayers;
76658   }
76659   function filterAvailableLayers(photoContex) {
76660     const fromDateString = photoContex.fromDate();
76661     const toDateString = photoContex.toDate();
76662     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
76663     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
76664     const showsFlat = photoContex.showsFlat();
76665     const showsPano = photoContex.showsPanoramic();
76666     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
76667   }
76668   function loadWFSLayers(projection2, margin, wfslayers) {
76669     const tiles = tiler5.margin(margin).getTiles(projection2);
76670     for (const cache of wfslayers) {
76671       loadWFSLayer(projection2, cache, tiles);
76672     }
76673   }
76674   function loadWFSLayer(projection2, cache, tiles) {
76675     for (const [key, controller] of cache.inflight.entries()) {
76676       const wanted = tiles.some((tile) => key === tile.id);
76677       if (!wanted) {
76678         controller.abort();
76679         cache.inflight.delete(key);
76680       }
76681     }
76682     Promise.all(tiles.map(
76683       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
76684     )).then(() => orderSequences(projection2, cache));
76685   }
76686   async function loadTile2(cache, typename, tile) {
76687     const bbox2 = tile.extent.bbox();
76688     const tileid = tile.id;
76689     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid))
76690       return;
76691     const params = {
76692       service: "WFS",
76693       request: "GetFeature",
76694       version: "2.0.0",
76695       typenames: typename,
76696       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
76697       outputFormat: "json"
76698     };
76699     const controller = new AbortController();
76700     cache.inflight.set(tileid, controller);
76701     const options2 = {
76702       method: "GET",
76703       signal: controller.signal
76704     };
76705     const urlForRequest = owsEndpoint + utilQsString(params);
76706     let featureCollection;
76707     try {
76708       featureCollection = await json_default(urlForRequest, options2);
76709     } catch {
76710       cache.loaded.set(tileid, false);
76711       return;
76712     } finally {
76713       cache.inflight.delete(tileid);
76714     }
76715     cache.loaded.set(tileid, true);
76716     if (featureCollection.features.length === 0) {
76717       return;
76718     }
76719     const features = featureCollection.features.map((feature3) => {
76720       const loc = feature3.geometry.coordinates;
76721       const key = feature3.id;
76722       const properties = feature3.properties;
76723       const {
76724         RETNING: ca,
76725         TIDSPUNKT: captured_at,
76726         URL: image_path,
76727         URLPREVIEW: preview_path,
76728         BILDETYPE: image_type,
76729         METER: metering,
76730         FELTKODE: lane_code
76731       } = properties;
76732       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
76733       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
76734       const data = {
76735         loc,
76736         key,
76737         ca,
76738         image_path,
76739         preview_path,
76740         road_reference: roadReference(properties),
76741         metering,
76742         lane_code,
76743         direction,
76744         captured_at: new Date(captured_at),
76745         is_sphere: image_type === "360"
76746       };
76747       cache.points.set(key, data);
76748       return {
76749         minX: loc[0],
76750         minY: loc[1],
76751         maxX: loc[0],
76752         maxY: loc[1],
76753         data
76754       };
76755     });
76756     _vegbilderCache.rtree.load(features);
76757     dispatch9.call("loadedImages");
76758   }
76759   function orderSequences(projection2, cache) {
76760     const { points } = cache;
76761     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
76762       const key = image.road_reference;
76763       if (grouped2.has(key)) {
76764         grouped2.get(key).push(image);
76765       } else {
76766         grouped2.set(key, [image]);
76767       }
76768       return grouped2;
76769     }, /* @__PURE__ */ new Map());
76770     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
76771       imageGroup.sort((a2, b2) => {
76772         if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
76773           return 1;
76774         } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
76775           return -1;
76776         } else {
76777           const { direction } = a2;
76778           if (direction === directionEnum.forward) {
76779             return a2.metering - b2.metering;
76780           } else {
76781             return b2.metering - a2.metering;
76782           }
76783         }
76784       });
76785       let imageSequence = [imageGroup[0]];
76786       let angle2 = null;
76787       for (const [lastImage, image] of pairs(imageGroup)) {
76788         if (lastImage.ca === null) {
76789           const b2 = projection2(lastImage.loc);
76790           const a2 = projection2(image.loc);
76791           if (!geoVecEqual(a2, b2)) {
76792             angle2 = geoVecAngle(a2, b2);
76793             angle2 *= 180 / Math.PI;
76794             angle2 -= 90;
76795             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
76796           }
76797           lastImage.ca = angle2;
76798         }
76799         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
76800           imageSequence.push(image);
76801         } else {
76802           imageSequences2.push(imageSequence);
76803           imageSequence = [image];
76804         }
76805       }
76806       imageSequences2.push(imageSequence);
76807       return imageSequences2;
76808     }, []);
76809     cache.sequences = imageSequences.map((images) => {
76810       const sequence = {
76811         images,
76812         key: images[0].key,
76813         geometry: {
76814           type: "LineString",
76815           coordinates: images.map((image) => image.loc)
76816         }
76817       };
76818       for (const image of images) {
76819         _vegbilderCache.image2sequence_map.set(image.key, sequence);
76820       }
76821       return sequence;
76822     });
76823   }
76824   function roadReference(properties) {
76825     const {
76826       FYLKENUMMER: county_number,
76827       VEGKATEGORI: road_class,
76828       VEGSTATUS: road_status,
76829       VEGNUMMER: road_number,
76830       STREKNING: section,
76831       DELSTREKNING: subsection,
76832       HP: parcel,
76833       KRYSSDEL: junction_part,
76834       SIDEANLEGGSDEL: services_part,
76835       ANKERPUNKT: anker_point,
76836       AAR: year
76837     } = properties;
76838     let reference;
76839     if (year >= 2020) {
76840       reference = `${road_class}${road_status}${road_number} S${section}D${subsection}`;
76841       if (junction_part) {
76842         reference = `${reference} M${anker_point} KD${junction_part}`;
76843       } else if (services_part) {
76844         reference = `${reference} M${anker_point} SD${services_part}`;
76845       }
76846     } else {
76847       reference = `${county_number}${road_class}${road_status}${road_number} HP${parcel}`;
76848     }
76849     return reference;
76850   }
76851   function localeTimestamp(date) {
76852     const options2 = {
76853       day: "2-digit",
76854       month: "2-digit",
76855       year: "numeric",
76856       hour: "numeric",
76857       minute: "numeric",
76858       second: "numeric"
76859     };
76860     return date.toLocaleString(_mainLocalizer.localeCode(), options2);
76861   }
76862   function partitionViewport3(projection2) {
76863     const zoom = geoScaleToZoom(projection2.scale());
76864     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
76865     const tiler9 = utilTiler().zoomExtent([roundZoom, roundZoom]);
76866     return tiler9.getTiles(projection2).map((tile) => tile.extent);
76867   }
76868   function searchLimited3(limit, projection2, rtree) {
76869     limit ??= 5;
76870     return partitionViewport3(projection2).reduce((result, extent) => {
76871       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
76872       return result.concat(found);
76873     }, []);
76874   }
76875   var vegbilder_default = {
76876     init: function() {
76877       this.event = utilRebind(this, dispatch9, "on");
76878     },
76879     reset: async function() {
76880       if (_vegbilderCache) {
76881         for (const layer of _vegbilderCache.wfslayers.values()) {
76882           for (const controller of layer.inflight.values()) {
76883             controller.abort();
76884           }
76885         }
76886       }
76887       _vegbilderCache = {
76888         wfslayers: /* @__PURE__ */ new Map(),
76889         rtree: new import_rbush9.default(),
76890         image2sequence_map: /* @__PURE__ */ new Map()
76891       };
76892       const availableLayers = await fetchAvailableLayers();
76893       const { wfslayers } = _vegbilderCache;
76894       for (const layerInfo of availableLayers) {
76895         const cache = {
76896           layerInfo,
76897           loaded: /* @__PURE__ */ new Map(),
76898           inflight: /* @__PURE__ */ new Map(),
76899           points: /* @__PURE__ */ new Map(),
76900           sequences: []
76901         };
76902         wfslayers.set(layerInfo.name, cache);
76903       }
76904     },
76905     images: function(projection2) {
76906       const limit = 5;
76907       return searchLimited3(limit, projection2, _vegbilderCache.rtree);
76908     },
76909     sequences: function(projection2) {
76910       const viewport = projection2.clipExtent();
76911       const min3 = [viewport[0][0], viewport[1][1]];
76912       const max3 = [viewport[1][0], viewport[0][1]];
76913       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76914       const seen = /* @__PURE__ */ new Set();
76915       const line_strings = [];
76916       for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
76917         const sequence = _vegbilderCache.image2sequence_map.get(data.key);
76918         if (!sequence)
76919           continue;
76920         const { key, geometry, images } = sequence;
76921         if (seen.has(key))
76922           continue;
76923         seen.add(key);
76924         const line = {
76925           type: "LineString",
76926           coordinates: geometry.coordinates,
76927           key,
76928           images
76929         };
76930         line_strings.push(line);
76931       }
76932       return line_strings;
76933     },
76934     cachedImage: function(key) {
76935       for (const { points } of _vegbilderCache.wfslayers.values()) {
76936         if (points.has(key))
76937           return points.get(key);
76938       }
76939     },
76940     getSequenceForImage: function(image) {
76941       return _vegbilderCache?.image2sequence_map.get(image?.key);
76942     },
76943     loadImages: async function(context, margin) {
76944       if (!_vegbilderCache) {
76945         await this.reset();
76946       }
76947       margin ??= 1;
76948       const wfslayers = filterAvailableLayers(context.photos());
76949       loadWFSLayers(context.projection, margin, wfslayers);
76950     },
76951     photoFrame: function() {
76952       return _currentFrame;
76953     },
76954     ensureViewerLoaded: function(context) {
76955       if (_loadViewerPromise3)
76956         return _loadViewerPromise3;
76957       const step = (stepBy) => () => {
76958         const viewer = context.container().select(".photoviewer");
76959         const selected = viewer.empty() ? void 0 : viewer.datum();
76960         if (!selected)
76961           return;
76962         const sequence = this.getSequenceForImage(selected);
76963         const nextIndex = sequence.images.indexOf(selected) + stepBy;
76964         const nextImage = sequence.images[nextIndex];
76965         if (!nextImage)
76966           return;
76967         context.map().centerEase(nextImage.loc);
76968         this.selectImage(context, nextImage.key, true);
76969       };
76970       const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
76971       const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
76972       wrapEnter.append("div").attr("class", "photo-attribution fillD");
76973       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76974       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76975       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76976       _loadViewerPromise3 = Promise.all([
76977         pannellum_photo_default.init(context, wrapEnter),
76978         plane_photo_default.init(context, wrapEnter)
76979       ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
76980         _pannellumFrame = pannellumPhotoFrame;
76981         _pannellumFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
76982         _planeFrame = planePhotoFrame;
76983         _planeFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
76984       });
76985       return _loadViewerPromise3;
76986     },
76987     selectImage: function(context, key, keepOrientation) {
76988       const d2 = this.cachedImage(key);
76989       this.updateUrlImage(key);
76990       const viewer = context.container().select(".photoviewer");
76991       if (!viewer.empty()) {
76992         viewer.datum(d2);
76993       }
76994       this.setStyles(context, null, true);
76995       if (!d2)
76996         return this;
76997       const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
76998       const attribution = wrap2.selectAll(".photo-attribution").text("");
76999       if (d2.captured_at) {
77000         attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
77001       }
77002       attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
77003       attribution.append("a").attr("target", "_blank").attr("href", `https://vegbilder.atlas.vegvesen.no/?year=${d2.captured_at.getFullYear()}&lat=${d2.loc[1]}&lng=${d2.loc[0]}&view=image&imageId=${d2.key}`).call(_t.append("vegbilder.view_on"));
77004       _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
77005       _currentFrame.selectPhoto(d2, keepOrientation).showPhotoFrame(wrap2);
77006       return this;
77007     },
77008     showViewer: function(context) {
77009       const viewer = context.container().select(".photoviewer").classed("hide", false);
77010       const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
77011       if (isHidden) {
77012         viewer.selectAll(".photo-wrapper:not(.vegbilder-wrapper)").classed("hide", true);
77013         viewer.selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
77014       }
77015       return this;
77016     },
77017     hideViewer: function(context) {
77018       this.updateUrlImage(null);
77019       const viewer = context.container().select(".photoviewer");
77020       if (!viewer.empty())
77021         viewer.datum(null);
77022       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
77023       context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
77024       return this.setStyles(context, null, true);
77025     },
77026     // Updates the currently highlighted sequence and selected bubble.
77027     // Reset is only necessary when interacting with the viewport because
77028     // this implicitly changes the currently selected bubble/sequence
77029     setStyles: function(context, hovered, reset) {
77030       if (reset) {
77031         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
77032         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
77033       }
77034       const hoveredImageKey = hovered?.key;
77035       const hoveredSequence = this.getSequenceForImage(hovered);
77036       const hoveredSequenceKey = hoveredSequence?.key;
77037       const hoveredImageKeys = hoveredSequence?.images.map((d2) => d2.key) ?? [];
77038       const viewer = context.container().select(".photoviewer");
77039       const selected = viewer.empty() ? void 0 : viewer.datum();
77040       const selectedImageKey = selected?.key;
77041       const selectedSequence = this.getSequenceForImage(selected);
77042       const selectedSequenceKey = selectedSequence?.key;
77043       const selectedImageKeys = selectedSequence?.images.map((d2) => d2.key) ?? [];
77044       const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
77045       context.container().selectAll(".layer-vegbilder .viewfield-group").classed("highlighted", (d2) => highlightedImageKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredImageKey).classed("currentView", (d2) => d2.key === selectedImageKey);
77046       context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
77047       context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
77048       function viewfieldPath() {
77049         const d2 = this.parentNode.__data__;
77050         if (d2.is_sphere && d2.key !== selectedImageKey) {
77051           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
77052         } else {
77053           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
77054         }
77055       }
77056       return this;
77057     },
77058     updateUrlImage: function(key) {
77059       if (!window.mocha) {
77060         const hash = utilStringQs(window.location.hash);
77061         if (key) {
77062           hash.photo = "vegbilder/" + key;
77063         } else {
77064           delete hash.photo;
77065         }
77066         window.location.replace("#" + utilQsString(hash, true));
77067       }
77068     },
77069     validHere: function(extent) {
77070       const bbox2 = Object.values(extent.bbox());
77071       return iso1A2Codes(bbox2).includes("NO");
77072     },
77073     cache: function() {
77074       return _vegbilderCache;
77075     }
77076   };
77077
77078   // node_modules/osm-auth/src/osm-auth.mjs
77079   var import_store = __toESM(require_store_legacy(), 1);
77080   function osmAuth(o2) {
77081     var oauth2 = {};
77082     oauth2.authenticated = function() {
77083       return !!token("oauth2_access_token");
77084     };
77085     oauth2.logout = function() {
77086       token("oauth2_access_token", "");
77087       token("oauth_token", "");
77088       token("oauth_token_secret", "");
77089       token("oauth_request_token_secret", "");
77090       return oauth2;
77091     };
77092     oauth2.authenticate = function(callback) {
77093       if (oauth2.authenticated()) {
77094         callback(null, oauth2);
77095         return;
77096       }
77097       oauth2.logout();
77098       _generatePkceChallenge(function(pkce) {
77099         _authenticate(pkce, callback);
77100       });
77101     };
77102     oauth2.authenticateAsync = function() {
77103       if (oauth2.authenticated()) {
77104         return Promise.resolve(oauth2);
77105       }
77106       oauth2.logout();
77107       return new Promise((resolve, reject) => {
77108         var errback = (err, result) => {
77109           if (err) {
77110             reject(new Error(err));
77111           } else {
77112             resolve(result);
77113           }
77114         };
77115         _generatePkceChallenge((pkce) => _authenticate(pkce, errback));
77116       });
77117     };
77118     function _authenticate(pkce, callback) {
77119       var state = generateState();
77120       var url = o2.url + "/oauth2/authorize?" + utilQsString2({
77121         client_id: o2.client_id,
77122         redirect_uri: o2.redirect_uri,
77123         response_type: "code",
77124         scope: o2.scope,
77125         state,
77126         code_challenge: pkce.code_challenge,
77127         code_challenge_method: pkce.code_challenge_method
77128       });
77129       if (o2.singlepage) {
77130         if (!import_store.default.enabled) {
77131           var error = new Error("local storage unavailable, but require in singlepage mode");
77132           error.status = "pkce-localstorage-unavailable";
77133           callback(error);
77134           return;
77135         }
77136         var params = utilStringQs2(window.location.search.slice(1));
77137         if (params.code) {
77138           oauth2.bootstrapToken(params.code, callback);
77139         } else {
77140           token("oauth2_state", state);
77141           token("oauth2_pkce_code_verifier", pkce.code_verifier);
77142           window.location = url;
77143         }
77144       } else {
77145         var w2 = 600;
77146         var h2 = 550;
77147         var settings = [
77148           ["width", w2],
77149           ["height", h2],
77150           ["left", window.screen.width / 2 - w2 / 2],
77151           ["top", window.screen.height / 2 - h2 / 2]
77152         ].map(function(x2) {
77153           return x2.join("=");
77154         }).join(",");
77155         var popup = window.open("about:blank", "oauth_window", settings);
77156         oauth2.popupWindow = popup;
77157         popup.location = url;
77158         if (!popup) {
77159           error = new Error("Popup was blocked");
77160           error.status = "popup-blocked";
77161           callback(error);
77162         }
77163       }
77164       window.authComplete = function(url2) {
77165         var params2 = utilStringQs2(url2.split("?")[1]);
77166         if (params2.state !== state) {
77167           error = new Error("Invalid state");
77168           error.status = "invalid-state";
77169           callback(error);
77170           return;
77171         }
77172         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
77173         delete window.authComplete;
77174       };
77175       function accessTokenDone(err, xhr) {
77176         o2.done();
77177         if (err) {
77178           callback(err);
77179           return;
77180         }
77181         var access_token = JSON.parse(xhr.response);
77182         token("oauth2_access_token", access_token.access_token);
77183         callback(null, oauth2);
77184       }
77185     }
77186     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
77187       var url = o2.url + "/oauth2/token?" + utilQsString2({
77188         client_id: o2.client_id,
77189         redirect_uri: o2.redirect_uri,
77190         grant_type: "authorization_code",
77191         code: auth_code,
77192         code_verifier
77193       });
77194       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
77195       o2.loading();
77196     }
77197     oauth2.bringPopupWindowToFront = function() {
77198       var broughtPopupToFront = false;
77199       try {
77200         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
77201           oauth2.popupWindow.focus();
77202           broughtPopupToFront = true;
77203         }
77204       } catch (err) {
77205       }
77206       return broughtPopupToFront;
77207     };
77208     oauth2.bootstrapToken = function(auth_code, callback) {
77209       var state = token("oauth2_state");
77210       token("oauth2_state", "");
77211       var params = utilStringQs2(window.location.search.slice(1));
77212       if (params.state !== state) {
77213         var error = new Error("Invalid state");
77214         error.status = "invalid-state";
77215         callback(error);
77216         return;
77217       }
77218       var code_verifier = token("oauth2_pkce_code_verifier");
77219       token("oauth2_pkce_code_verifier", "");
77220       _getAccessToken(auth_code, code_verifier, accessTokenDone);
77221       function accessTokenDone(err, xhr) {
77222         o2.done();
77223         if (err) {
77224           callback(err);
77225           return;
77226         }
77227         var access_token = JSON.parse(xhr.response);
77228         token("oauth2_access_token", access_token.access_token);
77229         callback(null, oauth2);
77230       }
77231     };
77232     oauth2.fetch = function(resource, options2) {
77233       if (oauth2.authenticated()) {
77234         return _doFetch();
77235       } else {
77236         if (o2.auto) {
77237           return oauth2.authenticateAsync().then(_doFetch);
77238         } else {
77239           return Promise.reject(new Error("not authenticated"));
77240         }
77241       }
77242       function _doFetch() {
77243         options2 = options2 || {};
77244         if (!options2.headers) {
77245           options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
77246         }
77247         options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
77248         return fetch(resource, options2);
77249       }
77250     };
77251     oauth2.xhr = function(options2, callback) {
77252       if (oauth2.authenticated()) {
77253         return _doXHR();
77254       } else {
77255         if (o2.auto) {
77256           oauth2.authenticate(_doXHR);
77257           return;
77258         } else {
77259           callback("not authenticated", null);
77260           return;
77261         }
77262       }
77263       function _doXHR() {
77264         var url = options2.prefix !== false ? o2.url + options2.path : options2.path;
77265         return oauth2.rawxhr(
77266           options2.method,
77267           url,
77268           token("oauth2_access_token"),
77269           options2.content,
77270           options2.headers,
77271           done
77272         );
77273       }
77274       function done(err, xhr) {
77275         if (err) {
77276           callback(err);
77277         } else if (xhr.responseXML) {
77278           callback(err, xhr.responseXML);
77279         } else {
77280           callback(err, xhr.response);
77281         }
77282       }
77283     };
77284     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
77285       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
77286       if (access_token) {
77287         headers.Authorization = "Bearer " + access_token;
77288       }
77289       var xhr = new XMLHttpRequest();
77290       xhr.onreadystatechange = function() {
77291         if (4 === xhr.readyState && 0 !== xhr.status) {
77292           if (/^20\d$/.test(xhr.status)) {
77293             callback(null, xhr);
77294           } else {
77295             callback(xhr, null);
77296           }
77297         }
77298       };
77299       xhr.onerror = function(e3) {
77300         callback(e3, null);
77301       };
77302       xhr.open(method, url, true);
77303       for (var h2 in headers)
77304         xhr.setRequestHeader(h2, headers[h2]);
77305       xhr.send(data);
77306       return xhr;
77307     };
77308     oauth2.preauth = function(val) {
77309       if (val && val.access_token) {
77310         token("oauth2_access_token", val.access_token);
77311       }
77312       return oauth2;
77313     };
77314     oauth2.options = function(val) {
77315       if (!arguments.length)
77316         return o2;
77317       o2 = val;
77318       o2.url = o2.url || "https://www.openstreetmap.org";
77319       o2.auto = o2.auto || false;
77320       o2.singlepage = o2.singlepage || false;
77321       o2.loading = o2.loading || function() {
77322       };
77323       o2.done = o2.done || function() {
77324       };
77325       return oauth2.preauth(o2);
77326     };
77327     var token;
77328     if (import_store.default.enabled) {
77329       token = function(x2, y2) {
77330         if (arguments.length === 1)
77331           return import_store.default.get(o2.url + x2);
77332         else if (arguments.length === 2)
77333           return import_store.default.set(o2.url + x2, y2);
77334       };
77335     } else {
77336       var storage = {};
77337       token = function(x2, y2) {
77338         if (arguments.length === 1)
77339           return storage[o2.url + x2];
77340         else if (arguments.length === 2)
77341           return storage[o2.url + x2] = y2;
77342       };
77343     }
77344     oauth2.options(o2);
77345     return oauth2;
77346   }
77347   function utilQsString2(obj) {
77348     return Object.keys(obj).filter(function(key) {
77349       return obj[key] !== void 0;
77350     }).sort().map(function(key) {
77351       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
77352     }).join("&");
77353   }
77354   function utilStringQs2(str2) {
77355     var i3 = 0;
77356     while (i3 < str2.length && (str2[i3] === "?" || str2[i3] === "#"))
77357       i3++;
77358     str2 = str2.slice(i3);
77359     return str2.split("&").reduce(function(obj, pair3) {
77360       var parts = pair3.split("=");
77361       if (parts.length === 2) {
77362         obj[parts[0]] = decodeURIComponent(parts[1]);
77363       }
77364       return obj;
77365     }, {});
77366   }
77367   function supportsWebCryptoAPI() {
77368     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
77369   }
77370   function _generatePkceChallenge(callback) {
77371     var code_verifier;
77372     if (supportsWebCryptoAPI()) {
77373       var random = window.crypto.getRandomValues(new Uint8Array(32));
77374       code_verifier = base64(random.buffer);
77375       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
77376         return char.charCodeAt(0);
77377       }));
77378       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash) {
77379         var code_challenge = base64(hash);
77380         callback({
77381           code_challenge,
77382           code_verifier,
77383           code_challenge_method: "S256"
77384         });
77385       });
77386     } else {
77387       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77388       code_verifier = "";
77389       for (var i3 = 0; i3 < 64; i3++) {
77390         code_verifier += chars[Math.floor(Math.random() * chars.length)];
77391       }
77392       callback({
77393         code_verifier,
77394         code_challenge: code_verifier,
77395         code_challenge_method: "plain"
77396       });
77397     }
77398   }
77399   function generateState() {
77400     var state;
77401     if (supportsWebCryptoAPI()) {
77402       var random = window.crypto.getRandomValues(new Uint8Array(32));
77403       state = base64(random.buffer);
77404     } else {
77405       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77406       state = "";
77407       for (var i3 = 0; i3 < 64; i3++) {
77408         state += chars[Math.floor(Math.random() * chars.length)];
77409       }
77410     }
77411     return state;
77412   }
77413   function base64(buffer) {
77414     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
77415   }
77416
77417   // modules/services/osm.js
77418   var import_rbush10 = __toESM(require_rbush_min());
77419   var tiler6 = utilTiler();
77420   var dispatch10 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
77421   var urlroot = osmApiConnections[0].url;
77422   var redirectPath = window.location.origin + window.location.pathname;
77423   var oauth = osmAuth({
77424     url: urlroot,
77425     client_id: osmApiConnections[0].client_id,
77426     client_secret: osmApiConnections[0].client_secret,
77427     scope: "read_prefs write_prefs write_api read_gpx write_notes",
77428     redirect_uri: redirectPath + "land.html",
77429     loading: authLoading,
77430     done: authDone
77431   });
77432   var _apiConnections = osmApiConnections;
77433   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
77434   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
77435   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
77436   var _userCache = { toLoad: {}, user: {} };
77437   var _cachedApiStatus;
77438   var _changeset = {};
77439   var _deferred = /* @__PURE__ */ new Set();
77440   var _connectionID = 1;
77441   var _tileZoom4 = 16;
77442   var _noteZoom = 12;
77443   var _rateLimitError;
77444   var _userChangesets;
77445   var _userDetails;
77446   var _off;
77447   var _maxWayNodes = 2e3;
77448   function authLoading() {
77449     dispatch10.call("authLoading");
77450   }
77451   function authDone() {
77452     dispatch10.call("authDone");
77453   }
77454   function abortRequest5(controllerOrXHR) {
77455     if (controllerOrXHR) {
77456       controllerOrXHR.abort();
77457     }
77458   }
77459   function hasInflightRequests(cache) {
77460     return Object.keys(cache.inflight).length;
77461   }
77462   function abortUnwantedRequests4(cache, visibleTiles) {
77463     Object.keys(cache.inflight).forEach(function(k2) {
77464       if (cache.toLoad[k2])
77465         return;
77466       if (visibleTiles.find(function(tile) {
77467         return k2 === tile.id;
77468       }))
77469         return;
77470       abortRequest5(cache.inflight[k2]);
77471       delete cache.inflight[k2];
77472     });
77473   }
77474   function getLoc(attrs) {
77475     var lon = attrs.lon && attrs.lon.value;
77476     var lat = attrs.lat && attrs.lat.value;
77477     return [Number(lon), Number(lat)];
77478   }
77479   function getNodes(obj) {
77480     var elems = obj.getElementsByTagName("nd");
77481     var nodes = new Array(elems.length);
77482     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77483       nodes[i3] = "n" + elems[i3].attributes.ref.value;
77484     }
77485     return nodes;
77486   }
77487   function getNodesJSON(obj) {
77488     var elems = obj.nodes;
77489     var nodes = new Array(elems.length);
77490     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77491       nodes[i3] = "n" + elems[i3];
77492     }
77493     return nodes;
77494   }
77495   function getTags(obj) {
77496     var elems = obj.getElementsByTagName("tag");
77497     var tags = {};
77498     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77499       var attrs = elems[i3].attributes;
77500       tags[attrs.k.value] = attrs.v.value;
77501     }
77502     return tags;
77503   }
77504   function getMembers(obj) {
77505     var elems = obj.getElementsByTagName("member");
77506     var members = new Array(elems.length);
77507     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77508       var attrs = elems[i3].attributes;
77509       members[i3] = {
77510         id: attrs.type.value[0] + attrs.ref.value,
77511         type: attrs.type.value,
77512         role: attrs.role.value
77513       };
77514     }
77515     return members;
77516   }
77517   function getMembersJSON(obj) {
77518     var elems = obj.members;
77519     var members = new Array(elems.length);
77520     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77521       var attrs = elems[i3];
77522       members[i3] = {
77523         id: attrs.type[0] + attrs.ref,
77524         type: attrs.type,
77525         role: attrs.role
77526       };
77527     }
77528     return members;
77529   }
77530   function getVisible(attrs) {
77531     return !attrs.visible || attrs.visible.value !== "false";
77532   }
77533   function parseComments(comments) {
77534     var parsedComments = [];
77535     for (var i3 = 0; i3 < comments.length; i3++) {
77536       var comment = comments[i3];
77537       if (comment.nodeName === "comment") {
77538         var childNodes = comment.childNodes;
77539         var parsedComment = {};
77540         for (var j3 = 0; j3 < childNodes.length; j3++) {
77541           var node = childNodes[j3];
77542           var nodeName = node.nodeName;
77543           if (nodeName === "#text")
77544             continue;
77545           parsedComment[nodeName] = node.textContent;
77546           if (nodeName === "uid") {
77547             var uid = node.textContent;
77548             if (uid && !_userCache.user[uid]) {
77549               _userCache.toLoad[uid] = true;
77550             }
77551           }
77552         }
77553         if (parsedComment) {
77554           parsedComments.push(parsedComment);
77555         }
77556       }
77557     }
77558     return parsedComments;
77559   }
77560   function encodeNoteRtree(note) {
77561     return {
77562       minX: note.loc[0],
77563       minY: note.loc[1],
77564       maxX: note.loc[0],
77565       maxY: note.loc[1],
77566       data: note
77567     };
77568   }
77569   var jsonparsers = {
77570     node: function nodeData(obj, uid) {
77571       return new osmNode({
77572         id: uid,
77573         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77574         version: obj.version && obj.version.toString(),
77575         changeset: obj.changeset && obj.changeset.toString(),
77576         timestamp: obj.timestamp,
77577         user: obj.user,
77578         uid: obj.uid && obj.uid.toString(),
77579         loc: [Number(obj.lon), Number(obj.lat)],
77580         tags: obj.tags
77581       });
77582     },
77583     way: function wayData(obj, uid) {
77584       return new osmWay({
77585         id: uid,
77586         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77587         version: obj.version && obj.version.toString(),
77588         changeset: obj.changeset && obj.changeset.toString(),
77589         timestamp: obj.timestamp,
77590         user: obj.user,
77591         uid: obj.uid && obj.uid.toString(),
77592         tags: obj.tags,
77593         nodes: getNodesJSON(obj)
77594       });
77595     },
77596     relation: function relationData(obj, uid) {
77597       return new osmRelation({
77598         id: uid,
77599         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77600         version: obj.version && obj.version.toString(),
77601         changeset: obj.changeset && obj.changeset.toString(),
77602         timestamp: obj.timestamp,
77603         user: obj.user,
77604         uid: obj.uid && obj.uid.toString(),
77605         tags: obj.tags,
77606         members: getMembersJSON(obj)
77607       });
77608     },
77609     user: function parseUser(obj, uid) {
77610       return {
77611         id: uid,
77612         display_name: obj.display_name,
77613         account_created: obj.account_created,
77614         image_url: obj.img && obj.img.href,
77615         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
77616         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
77617       };
77618     }
77619   };
77620   function parseJSON(payload, callback, options2) {
77621     options2 = Object.assign({ skipSeen: true }, options2);
77622     if (!payload) {
77623       return callback({ message: "No JSON", status: -1 });
77624     }
77625     var json = payload;
77626     if (typeof json !== "object")
77627       json = JSON.parse(payload);
77628     if (!json.elements)
77629       return callback({ message: "No JSON", status: -1 });
77630     var children2 = json.elements;
77631     var handle = window.requestIdleCallback(function() {
77632       _deferred.delete(handle);
77633       var results = [];
77634       var result;
77635       for (var i3 = 0; i3 < children2.length; i3++) {
77636         result = parseChild(children2[i3]);
77637         if (result)
77638           results.push(result);
77639       }
77640       callback(null, results);
77641     });
77642     _deferred.add(handle);
77643     function parseChild(child) {
77644       var parser3 = jsonparsers[child.type];
77645       if (!parser3)
77646         return null;
77647       var uid;
77648       uid = osmEntity.id.fromOSM(child.type, child.id);
77649       if (options2.skipSeen) {
77650         if (_tileCache.seen[uid])
77651           return null;
77652         _tileCache.seen[uid] = true;
77653       }
77654       return parser3(child, uid);
77655     }
77656   }
77657   function parseUserJSON(payload, callback, options2) {
77658     options2 = Object.assign({ skipSeen: true }, options2);
77659     if (!payload) {
77660       return callback({ message: "No JSON", status: -1 });
77661     }
77662     var json = payload;
77663     if (typeof json !== "object")
77664       json = JSON.parse(payload);
77665     if (!json.users && !json.user)
77666       return callback({ message: "No JSON", status: -1 });
77667     var objs = json.users || [json];
77668     var handle = window.requestIdleCallback(function() {
77669       _deferred.delete(handle);
77670       var results = [];
77671       var result;
77672       for (var i3 = 0; i3 < objs.length; i3++) {
77673         result = parseObj(objs[i3]);
77674         if (result)
77675           results.push(result);
77676       }
77677       callback(null, results);
77678     });
77679     _deferred.add(handle);
77680     function parseObj(obj) {
77681       var uid = obj.user.id && obj.user.id.toString();
77682       if (options2.skipSeen && _userCache.user[uid]) {
77683         delete _userCache.toLoad[uid];
77684         return null;
77685       }
77686       var user = jsonparsers.user(obj.user, uid);
77687       _userCache.user[uid] = user;
77688       delete _userCache.toLoad[uid];
77689       return user;
77690     }
77691   }
77692   var parsers = {
77693     node: function nodeData2(obj, uid) {
77694       var attrs = obj.attributes;
77695       return new osmNode({
77696         id: uid,
77697         visible: getVisible(attrs),
77698         version: attrs.version.value,
77699         changeset: attrs.changeset && attrs.changeset.value,
77700         timestamp: attrs.timestamp && attrs.timestamp.value,
77701         user: attrs.user && attrs.user.value,
77702         uid: attrs.uid && attrs.uid.value,
77703         loc: getLoc(attrs),
77704         tags: getTags(obj)
77705       });
77706     },
77707     way: function wayData2(obj, uid) {
77708       var attrs = obj.attributes;
77709       return new osmWay({
77710         id: uid,
77711         visible: getVisible(attrs),
77712         version: attrs.version.value,
77713         changeset: attrs.changeset && attrs.changeset.value,
77714         timestamp: attrs.timestamp && attrs.timestamp.value,
77715         user: attrs.user && attrs.user.value,
77716         uid: attrs.uid && attrs.uid.value,
77717         tags: getTags(obj),
77718         nodes: getNodes(obj)
77719       });
77720     },
77721     relation: function relationData2(obj, uid) {
77722       var attrs = obj.attributes;
77723       return new osmRelation({
77724         id: uid,
77725         visible: getVisible(attrs),
77726         version: attrs.version.value,
77727         changeset: attrs.changeset && attrs.changeset.value,
77728         timestamp: attrs.timestamp && attrs.timestamp.value,
77729         user: attrs.user && attrs.user.value,
77730         uid: attrs.uid && attrs.uid.value,
77731         tags: getTags(obj),
77732         members: getMembers(obj)
77733       });
77734     },
77735     note: function parseNote(obj, uid) {
77736       var attrs = obj.attributes;
77737       var childNodes = obj.childNodes;
77738       var props = {};
77739       props.id = uid;
77740       props.loc = getLoc(attrs);
77741       var coincident = false;
77742       var epsilon3 = 1e-5;
77743       do {
77744         if (coincident) {
77745           props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
77746         }
77747         var bbox2 = geoExtent(props.loc).bbox();
77748         coincident = _noteCache.rtree.search(bbox2).length;
77749       } while (coincident);
77750       for (var i3 = 0; i3 < childNodes.length; i3++) {
77751         var node = childNodes[i3];
77752         var nodeName = node.nodeName;
77753         if (nodeName === "#text")
77754           continue;
77755         if (nodeName === "comments") {
77756           props[nodeName] = parseComments(node.childNodes);
77757         } else {
77758           props[nodeName] = node.textContent;
77759         }
77760       }
77761       var note = new osmNote(props);
77762       var item = encodeNoteRtree(note);
77763       _noteCache.note[note.id] = note;
77764       _noteCache.rtree.insert(item);
77765       return note;
77766     },
77767     user: function parseUser2(obj, uid) {
77768       var attrs = obj.attributes;
77769       var user = {
77770         id: uid,
77771         display_name: attrs.display_name && attrs.display_name.value,
77772         account_created: attrs.account_created && attrs.account_created.value,
77773         changesets_count: "0",
77774         active_blocks: "0"
77775       };
77776       var img = obj.getElementsByTagName("img");
77777       if (img && img[0] && img[0].getAttribute("href")) {
77778         user.image_url = img[0].getAttribute("href");
77779       }
77780       var changesets = obj.getElementsByTagName("changesets");
77781       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
77782         user.changesets_count = changesets[0].getAttribute("count");
77783       }
77784       var blocks = obj.getElementsByTagName("blocks");
77785       if (blocks && blocks[0]) {
77786         var received = blocks[0].getElementsByTagName("received");
77787         if (received && received[0] && received[0].getAttribute("active")) {
77788           user.active_blocks = received[0].getAttribute("active");
77789         }
77790       }
77791       _userCache.user[uid] = user;
77792       delete _userCache.toLoad[uid];
77793       return user;
77794     }
77795   };
77796   function parseXML(xml, callback, options2) {
77797     options2 = Object.assign({ skipSeen: true }, options2);
77798     if (!xml || !xml.childNodes) {
77799       return callback({ message: "No XML", status: -1 });
77800     }
77801     var root3 = xml.childNodes[0];
77802     var children2 = root3.childNodes;
77803     var handle = window.requestIdleCallback(function() {
77804       _deferred.delete(handle);
77805       var results = [];
77806       var result;
77807       for (var i3 = 0; i3 < children2.length; i3++) {
77808         result = parseChild(children2[i3]);
77809         if (result)
77810           results.push(result);
77811       }
77812       callback(null, results);
77813     });
77814     _deferred.add(handle);
77815     function parseChild(child) {
77816       var parser3 = parsers[child.nodeName];
77817       if (!parser3)
77818         return null;
77819       var uid;
77820       if (child.nodeName === "user") {
77821         uid = child.attributes.id.value;
77822         if (options2.skipSeen && _userCache.user[uid]) {
77823           delete _userCache.toLoad[uid];
77824           return null;
77825         }
77826       } else if (child.nodeName === "note") {
77827         uid = child.getElementsByTagName("id")[0].textContent;
77828       } else {
77829         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
77830         if (options2.skipSeen) {
77831           if (_tileCache.seen[uid])
77832             return null;
77833           _tileCache.seen[uid] = true;
77834         }
77835       }
77836       return parser3(child, uid);
77837     }
77838   }
77839   function updateRtree4(item, replace) {
77840     _noteCache.rtree.remove(item, function isEql(a2, b2) {
77841       return a2.data.id === b2.data.id;
77842     });
77843     if (replace) {
77844       _noteCache.rtree.insert(item);
77845     }
77846   }
77847   function wrapcb(thisArg, callback, cid) {
77848     return function(err, result) {
77849       if (err) {
77850         if (err.status === 400 || err.status === 401 || err.status === 403) {
77851           thisArg.logout();
77852         }
77853         return callback.call(thisArg, err);
77854       } else if (thisArg.getConnectionId() !== cid) {
77855         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
77856       } else {
77857         return callback.call(thisArg, err, result);
77858       }
77859     };
77860   }
77861   var osm_default = {
77862     init: function() {
77863       utilRebind(this, dispatch10, "on");
77864     },
77865     reset: function() {
77866       Array.from(_deferred).forEach(function(handle) {
77867         window.cancelIdleCallback(handle);
77868         _deferred.delete(handle);
77869       });
77870       _connectionID++;
77871       _userChangesets = void 0;
77872       _userDetails = void 0;
77873       _rateLimitError = void 0;
77874       Object.values(_tileCache.inflight).forEach(abortRequest5);
77875       Object.values(_noteCache.inflight).forEach(abortRequest5);
77876       Object.values(_noteCache.inflightPost).forEach(abortRequest5);
77877       if (_changeset.inflight)
77878         abortRequest5(_changeset.inflight);
77879       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
77880       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
77881       _userCache = { toLoad: {}, user: {} };
77882       _cachedApiStatus = void 0;
77883       _changeset = {};
77884       return this;
77885     },
77886     getConnectionId: function() {
77887       return _connectionID;
77888     },
77889     getUrlRoot: function() {
77890       return urlroot;
77891     },
77892     changesetURL: function(changesetID) {
77893       return urlroot + "/changeset/" + changesetID;
77894     },
77895     changesetsURL: function(center, zoom) {
77896       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
77897       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
77898     },
77899     entityURL: function(entity) {
77900       return urlroot + "/" + entity.type + "/" + entity.osmId();
77901     },
77902     historyURL: function(entity) {
77903       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
77904     },
77905     userURL: function(username) {
77906       return urlroot + "/user/" + encodeURIComponent(username);
77907     },
77908     noteURL: function(note) {
77909       return urlroot + "/note/" + note.id;
77910     },
77911     noteReportURL: function(note) {
77912       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
77913     },
77914     // Generic method to load data from the OSM API
77915     // Can handle either auth or unauth calls.
77916     loadFromAPI: function(path, callback, options2) {
77917       options2 = Object.assign({ skipSeen: true }, options2);
77918       var that = this;
77919       var cid = _connectionID;
77920       function done(err, payload) {
77921         if (that.getConnectionId() !== cid) {
77922           if (callback)
77923             callback({ message: "Connection Switched", status: -1 });
77924           return;
77925         }
77926         var isAuthenticated = that.authenticated();
77927         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
77928           that.logout();
77929           that.loadFromAPI(path, callback, options2);
77930         } else {
77931           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
77932             _rateLimitError = err;
77933             dispatch10.call("change");
77934             that.reloadApiStatus();
77935           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
77936             that.reloadApiStatus();
77937           }
77938           if (callback) {
77939             if (err) {
77940               return callback(err);
77941             } else {
77942               if (path.indexOf(".json") !== -1) {
77943                 return parseJSON(payload, callback, options2);
77944               } else {
77945                 return parseXML(payload, callback, options2);
77946               }
77947             }
77948           }
77949         }
77950       }
77951       if (this.authenticated()) {
77952         return oauth.xhr({ method: "GET", path }, done);
77953       } else {
77954         var url = urlroot + path;
77955         var controller = new AbortController();
77956         var fn;
77957         if (path.indexOf(".json") !== -1) {
77958           fn = json_default;
77959         } else {
77960           fn = xml_default;
77961         }
77962         fn(url, { signal: controller.signal }).then(function(data) {
77963           done(null, data);
77964         }).catch(function(err) {
77965           if (err.name === "AbortError")
77966             return;
77967           var match = err.message.match(/^\d{3}/);
77968           if (match) {
77969             done({ status: +match[0], statusText: err.message });
77970           } else {
77971             done(err.message);
77972           }
77973         });
77974         return controller;
77975       }
77976     },
77977     // Load a single entity by id (ways and relations use the `/full` call to include
77978     // nodes and members). Parent relations are not included, see `loadEntityRelations`.
77979     // GET /api/0.6/node/#id
77980     // GET /api/0.6/[way|relation]/#id/full
77981     loadEntity: function(id2, callback) {
77982       var type2 = osmEntity.id.type(id2);
77983       var osmID = osmEntity.id.toOSM(id2);
77984       var options2 = { skipSeen: false };
77985       this.loadFromAPI(
77986         "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
77987         function(err, entities) {
77988           if (callback)
77989             callback(err, { data: entities });
77990         },
77991         options2
77992       );
77993     },
77994     // Load a single entity with a specific version
77995     // GET /api/0.6/[node|way|relation]/#id/#version
77996     loadEntityVersion: function(id2, version, callback) {
77997       var type2 = osmEntity.id.type(id2);
77998       var osmID = osmEntity.id.toOSM(id2);
77999       var options2 = { skipSeen: false };
78000       this.loadFromAPI(
78001         "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
78002         function(err, entities) {
78003           if (callback)
78004             callback(err, { data: entities });
78005         },
78006         options2
78007       );
78008     },
78009     // Load the relations of a single entity with the given.
78010     // GET /api/0.6/[node|way|relation]/#id/relations
78011     loadEntityRelations: function(id2, callback) {
78012       var type2 = osmEntity.id.type(id2);
78013       var osmID = osmEntity.id.toOSM(id2);
78014       var options2 = { skipSeen: false };
78015       this.loadFromAPI(
78016         "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
78017         function(err, entities) {
78018           if (callback)
78019             callback(err, { data: entities });
78020         },
78021         options2
78022       );
78023     },
78024     // Load multiple entities in chunks
78025     // (note: callback may be called multiple times)
78026     // Unlike `loadEntity`, child nodes and members are not fetched
78027     // GET /api/0.6/[nodes|ways|relations]?#parameters
78028     loadMultiple: function(ids, callback) {
78029       var that = this;
78030       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
78031       Object.keys(groups).forEach(function(k2) {
78032         var type2 = k2 + "s";
78033         var osmIDs = groups[k2].map(function(id2) {
78034           return osmEntity.id.toOSM(id2);
78035         });
78036         var options2 = { skipSeen: false };
78037         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
78038           that.loadFromAPI(
78039             "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
78040             function(err, entities) {
78041               if (callback)
78042                 callback(err, { data: entities });
78043             },
78044             options2
78045           );
78046         });
78047       });
78048     },
78049     // Create, upload, and close a changeset
78050     // PUT /api/0.6/changeset/create
78051     // POST /api/0.6/changeset/#id/upload
78052     // PUT /api/0.6/changeset/#id/close
78053     putChangeset: function(changeset, changes, callback) {
78054       var cid = _connectionID;
78055       if (_changeset.inflight) {
78056         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
78057       } else if (_changeset.open) {
78058         return createdChangeset.call(this, null, _changeset.open);
78059       } else {
78060         var options2 = {
78061           method: "PUT",
78062           path: "/api/0.6/changeset/create",
78063           headers: { "Content-Type": "text/xml" },
78064           content: JXON.stringify(changeset.asJXON())
78065         };
78066         _changeset.inflight = oauth.xhr(
78067           options2,
78068           wrapcb(this, createdChangeset, cid)
78069         );
78070       }
78071       function createdChangeset(err, changesetID) {
78072         _changeset.inflight = null;
78073         if (err) {
78074           return callback(err, changeset);
78075         }
78076         _changeset.open = changesetID;
78077         changeset = changeset.update({ id: changesetID });
78078         var options3 = {
78079           method: "POST",
78080           path: "/api/0.6/changeset/" + changesetID + "/upload",
78081           headers: { "Content-Type": "text/xml" },
78082           content: JXON.stringify(changeset.osmChangeJXON(changes))
78083         };
78084         _changeset.inflight = oauth.xhr(
78085           options3,
78086           wrapcb(this, uploadedChangeset, cid)
78087         );
78088       }
78089       function uploadedChangeset(err) {
78090         _changeset.inflight = null;
78091         if (err)
78092           return callback(err, changeset);
78093         window.setTimeout(function() {
78094           callback(null, changeset);
78095         }, 2500);
78096         _changeset.open = null;
78097         if (this.getConnectionId() === cid) {
78098           oauth.xhr({
78099             method: "PUT",
78100             path: "/api/0.6/changeset/" + changeset.id + "/close",
78101             headers: { "Content-Type": "text/xml" }
78102           }, function() {
78103             return true;
78104           });
78105         }
78106       }
78107     },
78108     // Load multiple users in chunks
78109     // (note: callback may be called multiple times)
78110     // GET /api/0.6/users?users=#id1,#id2,...,#idn
78111     loadUsers: function(uids, callback) {
78112       var toLoad = [];
78113       var cached = [];
78114       utilArrayUniq(uids).forEach(function(uid) {
78115         if (_userCache.user[uid]) {
78116           delete _userCache.toLoad[uid];
78117           cached.push(_userCache.user[uid]);
78118         } else {
78119           toLoad.push(uid);
78120         }
78121       });
78122       if (cached.length || !this.authenticated()) {
78123         callback(void 0, cached);
78124         if (!this.authenticated())
78125           return;
78126       }
78127       utilArrayChunk(toLoad, 150).forEach(function(arr) {
78128         oauth.xhr(
78129           { method: "GET", path: "/api/0.6/users.json?users=" + arr.join() },
78130           wrapcb(this, done, _connectionID)
78131         );
78132       }.bind(this));
78133       function done(err, payload) {
78134         if (err)
78135           return callback(err);
78136         var options2 = { skipSeen: true };
78137         return parseUserJSON(payload, function(err2, results) {
78138           if (err2)
78139             return callback(err2);
78140           return callback(void 0, results);
78141         }, options2);
78142       }
78143     },
78144     // Load a given user by id
78145     // GET /api/0.6/user/#id
78146     loadUser: function(uid, callback) {
78147       if (_userCache.user[uid] || !this.authenticated()) {
78148         delete _userCache.toLoad[uid];
78149         return callback(void 0, _userCache.user[uid]);
78150       }
78151       oauth.xhr(
78152         { method: "GET", path: "/api/0.6/user/" + uid + ".json" },
78153         wrapcb(this, done, _connectionID)
78154       );
78155       function done(err, payload) {
78156         if (err)
78157           return callback(err);
78158         var options2 = { skipSeen: true };
78159         return parseUserJSON(payload, function(err2, results) {
78160           if (err2)
78161             return callback(err2);
78162           return callback(void 0, results[0]);
78163         }, options2);
78164       }
78165     },
78166     // Load the details of the logged-in user
78167     // GET /api/0.6/user/details
78168     userDetails: function(callback) {
78169       if (_userDetails) {
78170         return callback(void 0, _userDetails);
78171       }
78172       oauth.xhr(
78173         { method: "GET", path: "/api/0.6/user/details.json" },
78174         wrapcb(this, done, _connectionID)
78175       );
78176       function done(err, payload) {
78177         if (err)
78178           return callback(err);
78179         var options2 = { skipSeen: false };
78180         return parseUserJSON(payload, function(err2, results) {
78181           if (err2)
78182             return callback(err2);
78183           _userDetails = results[0];
78184           return callback(void 0, _userDetails);
78185         }, options2);
78186       }
78187     },
78188     // Load previous changesets for the logged in user
78189     // GET /api/0.6/changesets?user=#id
78190     userChangesets: function(callback) {
78191       if (_userChangesets) {
78192         return callback(void 0, _userChangesets);
78193       }
78194       this.userDetails(
78195         wrapcb(this, gotDetails, _connectionID)
78196       );
78197       function gotDetails(err, user) {
78198         if (err) {
78199           return callback(err);
78200         }
78201         oauth.xhr(
78202           { method: "GET", path: "/api/0.6/changesets?user=" + user.id },
78203           wrapcb(this, done, _connectionID)
78204         );
78205       }
78206       function done(err, xml) {
78207         if (err) {
78208           return callback(err);
78209         }
78210         _userChangesets = Array.prototype.map.call(
78211           xml.getElementsByTagName("changeset"),
78212           function(changeset) {
78213             return { tags: getTags(changeset) };
78214           }
78215         ).filter(function(changeset) {
78216           var comment = changeset.tags.comment;
78217           return comment && comment !== "";
78218         });
78219         return callback(void 0, _userChangesets);
78220       }
78221     },
78222     // Fetch the status of the OSM API
78223     // GET /api/capabilities
78224     status: function(callback) {
78225       var url = urlroot + "/api/capabilities";
78226       var errback = wrapcb(this, done, _connectionID);
78227       xml_default(url).then(function(data) {
78228         errback(null, data);
78229       }).catch(function(err) {
78230         errback(err.message);
78231       });
78232       function done(err, xml) {
78233         if (err) {
78234           return callback(err, null);
78235         }
78236         var elements = xml.getElementsByTagName("blacklist");
78237         var regexes = [];
78238         for (var i3 = 0; i3 < elements.length; i3++) {
78239           var regexString = elements[i3].getAttribute("regex");
78240           if (regexString) {
78241             try {
78242               var regex = new RegExp(regexString);
78243               regexes.push(regex);
78244             } catch (e3) {
78245             }
78246           }
78247         }
78248         if (regexes.length) {
78249           _imageryBlocklists = regexes;
78250         }
78251         if (_rateLimitError) {
78252           return callback(_rateLimitError, "rateLimited");
78253         } else {
78254           var waynodes = xml.getElementsByTagName("waynodes");
78255           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
78256           if (maxWayNodes && isFinite(maxWayNodes))
78257             _maxWayNodes = maxWayNodes;
78258           var apiStatus = xml.getElementsByTagName("status");
78259           var val = apiStatus[0].getAttribute("api");
78260           return callback(void 0, val);
78261         }
78262       }
78263     },
78264     // Calls `status` and dispatches an `apiStatusChange` event if the returned
78265     // status differs from the cached status.
78266     reloadApiStatus: function() {
78267       if (!this.throttledReloadApiStatus) {
78268         var that = this;
78269         this.throttledReloadApiStatus = throttle_default(function() {
78270           that.status(function(err, status) {
78271             if (status !== _cachedApiStatus) {
78272               _cachedApiStatus = status;
78273               dispatch10.call("apiStatusChange", that, err, status);
78274             }
78275           });
78276         }, 500);
78277       }
78278       this.throttledReloadApiStatus();
78279     },
78280     // Returns the maximum number of nodes a single way can have
78281     maxWayNodes: function() {
78282       return _maxWayNodes;
78283     },
78284     // Load data (entities) from the API in tiles
78285     // GET /api/0.6/map?bbox=
78286     loadTiles: function(projection2, callback) {
78287       if (_off)
78288         return;
78289       var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
78290       var hadRequests = hasInflightRequests(_tileCache);
78291       abortUnwantedRequests4(_tileCache, tiles);
78292       if (hadRequests && !hasInflightRequests(_tileCache)) {
78293         dispatch10.call("loaded");
78294       }
78295       tiles.forEach(function(tile) {
78296         this.loadTile(tile, callback);
78297       }, this);
78298     },
78299     // Load a single data tile
78300     // GET /api/0.6/map?bbox=
78301     loadTile: function(tile, callback) {
78302       if (_off)
78303         return;
78304       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
78305         return;
78306       if (!hasInflightRequests(_tileCache)) {
78307         dispatch10.call("loading");
78308       }
78309       var path = "/api/0.6/map.json?bbox=";
78310       var options2 = { skipSeen: true };
78311       _tileCache.inflight[tile.id] = this.loadFromAPI(
78312         path + tile.extent.toParam(),
78313         tileCallback,
78314         options2
78315       );
78316       function tileCallback(err, parsed) {
78317         delete _tileCache.inflight[tile.id];
78318         if (!err) {
78319           delete _tileCache.toLoad[tile.id];
78320           _tileCache.loaded[tile.id] = true;
78321           var bbox2 = tile.extent.bbox();
78322           bbox2.id = tile.id;
78323           _tileCache.rtree.insert(bbox2);
78324         }
78325         if (callback) {
78326           callback(err, Object.assign({ data: parsed }, tile));
78327         }
78328         if (!hasInflightRequests(_tileCache)) {
78329           dispatch10.call("loaded");
78330         }
78331       }
78332     },
78333     isDataLoaded: function(loc) {
78334       var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
78335       return _tileCache.rtree.collides(bbox2);
78336     },
78337     // load the tile that covers the given `loc`
78338     loadTileAtLoc: function(loc, callback) {
78339       if (Object.keys(_tileCache.toLoad).length > 50)
78340         return;
78341       var k2 = geoZoomToScale(_tileZoom4 + 1);
78342       var offset = geoRawMercator().scale(k2)(loc);
78343       var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
78344       var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
78345       tiles.forEach(function(tile) {
78346         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
78347           return;
78348         _tileCache.toLoad[tile.id] = true;
78349         this.loadTile(tile, callback);
78350       }, this);
78351     },
78352     // Load notes from the API in tiles
78353     // GET /api/0.6/notes?bbox=
78354     loadNotes: function(projection2, noteOptions) {
78355       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
78356       if (_off)
78357         return;
78358       var that = this;
78359       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
78360       var throttleLoadUsers = throttle_default(function() {
78361         var uids = Object.keys(_userCache.toLoad);
78362         if (!uids.length)
78363           return;
78364         that.loadUsers(uids, function() {
78365         });
78366       }, 750);
78367       var tiles = tiler6.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
78368       abortUnwantedRequests4(_noteCache, tiles);
78369       tiles.forEach(function(tile) {
78370         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
78371           return;
78372         var options2 = { skipSeen: false };
78373         _noteCache.inflight[tile.id] = that.loadFromAPI(
78374           path + tile.extent.toParam(),
78375           function(err) {
78376             delete _noteCache.inflight[tile.id];
78377             if (!err) {
78378               _noteCache.loaded[tile.id] = true;
78379             }
78380             throttleLoadUsers();
78381             dispatch10.call("loadedNotes");
78382           },
78383           options2
78384         );
78385       });
78386     },
78387     // Create a note
78388     // POST /api/0.6/notes?params
78389     postNoteCreate: function(note, callback) {
78390       if (!this.authenticated()) {
78391         return callback({ message: "Not Authenticated", status: -3 }, note);
78392       }
78393       if (_noteCache.inflightPost[note.id]) {
78394         return callback({ message: "Note update already inflight", status: -2 }, note);
78395       }
78396       if (!note.loc[0] || !note.loc[1] || !note.newComment)
78397         return;
78398       var comment = note.newComment;
78399       if (note.newCategory && note.newCategory !== "None") {
78400         comment += " #" + note.newCategory;
78401       }
78402       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
78403       _noteCache.inflightPost[note.id] = oauth.xhr(
78404         { method: "POST", path },
78405         wrapcb(this, done, _connectionID)
78406       );
78407       function done(err, xml) {
78408         delete _noteCache.inflightPost[note.id];
78409         if (err) {
78410           return callback(err);
78411         }
78412         this.removeNote(note);
78413         var options2 = { skipSeen: false };
78414         return parseXML(xml, function(err2, results) {
78415           if (err2) {
78416             return callback(err2);
78417           } else {
78418             return callback(void 0, results[0]);
78419           }
78420         }, options2);
78421       }
78422     },
78423     // Update a note
78424     // POST /api/0.6/notes/#id/comment?text=comment
78425     // POST /api/0.6/notes/#id/close?text=comment
78426     // POST /api/0.6/notes/#id/reopen?text=comment
78427     postNoteUpdate: function(note, newStatus, callback) {
78428       if (!this.authenticated()) {
78429         return callback({ message: "Not Authenticated", status: -3 }, note);
78430       }
78431       if (_noteCache.inflightPost[note.id]) {
78432         return callback({ message: "Note update already inflight", status: -2 }, note);
78433       }
78434       var action;
78435       if (note.status !== "closed" && newStatus === "closed") {
78436         action = "close";
78437       } else if (note.status !== "open" && newStatus === "open") {
78438         action = "reopen";
78439       } else {
78440         action = "comment";
78441         if (!note.newComment)
78442           return;
78443       }
78444       var path = "/api/0.6/notes/" + note.id + "/" + action;
78445       if (note.newComment) {
78446         path += "?" + utilQsString({ text: note.newComment });
78447       }
78448       _noteCache.inflightPost[note.id] = oauth.xhr(
78449         { method: "POST", path },
78450         wrapcb(this, done, _connectionID)
78451       );
78452       function done(err, xml) {
78453         delete _noteCache.inflightPost[note.id];
78454         if (err) {
78455           return callback(err);
78456         }
78457         this.removeNote(note);
78458         if (action === "close") {
78459           _noteCache.closed[note.id] = true;
78460         } else if (action === "reopen") {
78461           delete _noteCache.closed[note.id];
78462         }
78463         var options2 = { skipSeen: false };
78464         return parseXML(xml, function(err2, results) {
78465           if (err2) {
78466             return callback(err2);
78467           } else {
78468             return callback(void 0, results[0]);
78469           }
78470         }, options2);
78471       }
78472     },
78473     /* connection options for source switcher (optional) */
78474     apiConnections: function(val) {
78475       if (!arguments.length)
78476         return _apiConnections;
78477       _apiConnections = val;
78478       return this;
78479     },
78480     switch: function(newOptions) {
78481       urlroot = newOptions.url;
78482       var oldOptions = utilObjectOmit(oauth.options(), "access_token");
78483       oauth.options(Object.assign(oldOptions, newOptions));
78484       this.reset();
78485       this.userChangesets(function() {
78486       });
78487       dispatch10.call("change");
78488       return this;
78489     },
78490     toggle: function(val) {
78491       _off = !val;
78492       return this;
78493     },
78494     isChangesetInflight: function() {
78495       return !!_changeset.inflight;
78496     },
78497     // get/set cached data
78498     // This is used to save/restore the state when entering/exiting the walkthrough
78499     // Also used for testing purposes.
78500     caches: function(obj) {
78501       function cloneCache(source) {
78502         var target = {};
78503         Object.keys(source).forEach(function(k2) {
78504           if (k2 === "rtree") {
78505             target.rtree = new import_rbush10.default().fromJSON(source.rtree.toJSON());
78506           } else if (k2 === "note") {
78507             target.note = {};
78508             Object.keys(source.note).forEach(function(id2) {
78509               target.note[id2] = osmNote(source.note[id2]);
78510             });
78511           } else {
78512             target[k2] = JSON.parse(JSON.stringify(source[k2]));
78513           }
78514         });
78515         return target;
78516       }
78517       if (!arguments.length) {
78518         return {
78519           tile: cloneCache(_tileCache),
78520           note: cloneCache(_noteCache),
78521           user: cloneCache(_userCache)
78522         };
78523       }
78524       if (obj === "get") {
78525         return {
78526           tile: _tileCache,
78527           note: _noteCache,
78528           user: _userCache
78529         };
78530       }
78531       if (obj.tile) {
78532         _tileCache = obj.tile;
78533         _tileCache.inflight = {};
78534       }
78535       if (obj.note) {
78536         _noteCache = obj.note;
78537         _noteCache.inflight = {};
78538         _noteCache.inflightPost = {};
78539       }
78540       if (obj.user) {
78541         _userCache = obj.user;
78542       }
78543       return this;
78544     },
78545     logout: function() {
78546       _userChangesets = void 0;
78547       _userDetails = void 0;
78548       oauth.logout();
78549       dispatch10.call("change");
78550       return this;
78551     },
78552     authenticated: function() {
78553       return oauth.authenticated();
78554     },
78555     authenticate: function(callback) {
78556       var that = this;
78557       var cid = _connectionID;
78558       _userChangesets = void 0;
78559       _userDetails = void 0;
78560       function done(err, res) {
78561         if (err) {
78562           if (callback)
78563             callback(err);
78564           return;
78565         }
78566         if (that.getConnectionId() !== cid) {
78567           if (callback)
78568             callback({ message: "Connection Switched", status: -1 });
78569           return;
78570         }
78571         _rateLimitError = void 0;
78572         dispatch10.call("change");
78573         if (callback)
78574           callback(err, res);
78575         that.userChangesets(function() {
78576         });
78577       }
78578       oauth.authenticate(done);
78579     },
78580     imageryBlocklists: function() {
78581       return _imageryBlocklists;
78582     },
78583     tileZoom: function(val) {
78584       if (!arguments.length)
78585         return _tileZoom4;
78586       _tileZoom4 = val;
78587       return this;
78588     },
78589     // get all cached notes covering the viewport
78590     notes: function(projection2) {
78591       var viewport = projection2.clipExtent();
78592       var min3 = [viewport[0][0], viewport[1][1]];
78593       var max3 = [viewport[1][0], viewport[0][1]];
78594       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
78595       return _noteCache.rtree.search(bbox2).map(function(d2) {
78596         return d2.data;
78597       });
78598     },
78599     // get a single note from the cache
78600     getNote: function(id2) {
78601       return _noteCache.note[id2];
78602     },
78603     // remove a single note from the cache
78604     removeNote: function(note) {
78605       if (!(note instanceof osmNote) || !note.id)
78606         return;
78607       delete _noteCache.note[note.id];
78608       updateRtree4(encodeNoteRtree(note), false);
78609     },
78610     // replace a single note in the cache
78611     replaceNote: function(note) {
78612       if (!(note instanceof osmNote) || !note.id)
78613         return;
78614       _noteCache.note[note.id] = note;
78615       updateRtree4(encodeNoteRtree(note), true);
78616       return note;
78617     },
78618     // Get an array of note IDs closed during this session.
78619     // Used to populate `closed:note` changeset tag
78620     getClosedIDs: function() {
78621       return Object.keys(_noteCache.closed).sort();
78622     }
78623   };
78624
78625   // modules/services/osm_wikibase.js
78626   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
78627   var _inflight2 = {};
78628   var _wikibaseCache = {};
78629   var _localeIDs = { en: false };
78630   var debouncedRequest = debounce_default(request, 500, { leading: false });
78631   function request(url, callback) {
78632     if (_inflight2[url])
78633       return;
78634     var controller = new AbortController();
78635     _inflight2[url] = controller;
78636     json_default(url, { signal: controller.signal }).then(function(result) {
78637       delete _inflight2[url];
78638       if (callback)
78639         callback(null, result);
78640     }).catch(function(err) {
78641       delete _inflight2[url];
78642       if (err.name === "AbortError")
78643         return;
78644       if (callback)
78645         callback(err.message);
78646     });
78647   }
78648   var osm_wikibase_default = {
78649     init: function() {
78650       _inflight2 = {};
78651       _wikibaseCache = {};
78652       _localeIDs = {};
78653     },
78654     reset: function() {
78655       Object.values(_inflight2).forEach(function(controller) {
78656         controller.abort();
78657       });
78658       _inflight2 = {};
78659     },
78660     /**
78661      * Get the best value for the property, or undefined if not found
78662      * @param entity object from wikibase
78663      * @param property string e.g. 'P4' for image
78664      * @param langCode string e.g. 'fr' for French
78665      */
78666     claimToValue: function(entity, property, langCode) {
78667       if (!entity.claims[property])
78668         return void 0;
78669       var locale2 = _localeIDs[langCode];
78670       var preferredPick, localePick;
78671       entity.claims[property].forEach(function(stmt) {
78672         if (!preferredPick && stmt.rank === "preferred") {
78673           preferredPick = stmt;
78674         }
78675         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
78676           localePick = stmt;
78677         }
78678       });
78679       var result = localePick || preferredPick;
78680       if (result) {
78681         var datavalue = result.mainsnak.datavalue;
78682         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
78683       } else {
78684         return void 0;
78685       }
78686     },
78687     /**
78688      * Convert monolingual property into a key-value object (language -> value)
78689      * @param entity object from wikibase
78690      * @param property string e.g. 'P31' for monolingual wiki page title
78691      */
78692     monolingualClaimToValueObj: function(entity, property) {
78693       if (!entity || !entity.claims[property])
78694         return void 0;
78695       return entity.claims[property].reduce(function(acc, obj) {
78696         var value = obj.mainsnak.datavalue.value;
78697         acc[value.language] = value.text;
78698         return acc;
78699       }, {});
78700     },
78701     toSitelink: function(key, value) {
78702       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
78703       return result.replace(/_/g, " ").trim();
78704     },
78705     //
78706     // Pass params object of the form:
78707     // {
78708     //   key: 'string',
78709     //   value: 'string',
78710     //   langCode: 'string'
78711     // }
78712     //
78713     getEntity: function(params, callback) {
78714       var doRequest = params.debounce ? debouncedRequest : request;
78715       var that = this;
78716       var titles = [];
78717       var result = {};
78718       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
78719       var keySitelink = params.key ? this.toSitelink(params.key) : false;
78720       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
78721       var localeSitelink;
78722       if (params.langCodes) {
78723         params.langCodes.forEach(function(langCode) {
78724           if (_localeIDs[langCode] === void 0) {
78725             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
78726             titles.push(localeSitelink);
78727           }
78728         });
78729       }
78730       if (rtypeSitelink) {
78731         if (_wikibaseCache[rtypeSitelink]) {
78732           result.rtype = _wikibaseCache[rtypeSitelink];
78733         } else {
78734           titles.push(rtypeSitelink);
78735         }
78736       }
78737       if (keySitelink) {
78738         if (_wikibaseCache[keySitelink]) {
78739           result.key = _wikibaseCache[keySitelink];
78740         } else {
78741           titles.push(keySitelink);
78742         }
78743       }
78744       if (tagSitelink) {
78745         if (_wikibaseCache[tagSitelink]) {
78746           result.tag = _wikibaseCache[tagSitelink];
78747         } else {
78748           titles.push(tagSitelink);
78749         }
78750       }
78751       if (!titles.length) {
78752         return callback(null, result);
78753       }
78754       var obj = {
78755         action: "wbgetentities",
78756         sites: "wiki",
78757         titles: titles.join("|"),
78758         languages: params.langCodes.join("|"),
78759         languagefallback: 1,
78760         origin: "*",
78761         format: "json"
78762         // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
78763         // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
78764         // formatversion: 2,
78765       };
78766       var url = apibase3 + "?" + utilQsString(obj);
78767       doRequest(url, function(err, d2) {
78768         if (err) {
78769           callback(err);
78770         } else if (!d2.success || d2.error) {
78771           callback(d2.error.messages.map(function(v2) {
78772             return v2.html["*"];
78773           }).join("<br>"));
78774         } else {
78775           var localeID = false;
78776           Object.values(d2.entities).forEach(function(res) {
78777             if (res.missing !== "") {
78778               var title = res.sitelinks.wiki.title;
78779               if (title === rtypeSitelink) {
78780                 _wikibaseCache[rtypeSitelink] = res;
78781                 result.rtype = res;
78782               } else if (title === keySitelink) {
78783                 _wikibaseCache[keySitelink] = res;
78784                 result.key = res;
78785               } else if (title === tagSitelink) {
78786                 _wikibaseCache[tagSitelink] = res;
78787                 result.tag = res;
78788               } else if (title === localeSitelink) {
78789                 localeID = res.id;
78790               } else {
78791                 console.log("Unexpected title " + title);
78792               }
78793             }
78794           });
78795           if (localeSitelink) {
78796             that.addLocale(params.langCodes[0], localeID);
78797           }
78798           callback(null, result);
78799         }
78800       });
78801     },
78802     //
78803     // Pass params object of the form:
78804     // {
78805     //   key: 'string',     // required
78806     //   value: 'string'    // optional
78807     // }
78808     //
78809     // Get an result object used to display tag documentation
78810     // {
78811     //   title:        'string',
78812     //   description:  'string',
78813     //   editURL:      'string',
78814     //   imageURL:     'string',
78815     //   wiki:         { title: 'string', text: 'string', url: 'string' }
78816     // }
78817     //
78818     getDocs: function(params, callback) {
78819       var that = this;
78820       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
78821         return code.toLowerCase();
78822       });
78823       params.langCodes = langCodes;
78824       this.getEntity(params, function(err, data) {
78825         if (err) {
78826           callback(err);
78827           return;
78828         }
78829         var entity = data.rtype || data.tag || data.key;
78830         if (!entity) {
78831           callback("No entity");
78832           return;
78833         }
78834         var i3;
78835         var description;
78836         for (i3 in langCodes) {
78837           let code2 = langCodes[i3];
78838           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
78839             description = entity.descriptions[code2];
78840             break;
78841           }
78842         }
78843         if (!description && Object.values(entity.descriptions).length)
78844           description = Object.values(entity.descriptions)[0];
78845         var result = {
78846           title: entity.title,
78847           description: description ? description.value : "",
78848           descriptionLocaleCode: description ? description.language : "",
78849           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
78850         };
78851         if (entity.claims) {
78852           var imageroot;
78853           var image = that.claimToValue(entity, "P4", langCodes[0]);
78854           if (image) {
78855             imageroot = "https://commons.wikimedia.org/w/index.php";
78856           } else {
78857             image = that.claimToValue(entity, "P28", langCodes[0]);
78858             if (image) {
78859               imageroot = "https://wiki.openstreetmap.org/w/index.php";
78860             }
78861           }
78862           if (imageroot && image) {
78863             result.imageURL = imageroot + "?" + utilQsString({
78864               title: "Special:Redirect/file/" + image,
78865               width: 400
78866             });
78867           }
78868         }
78869         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
78870         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
78871         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
78872         var wikis = [rtypeWiki, tagWiki, keyWiki];
78873         for (i3 in wikis) {
78874           var wiki = wikis[i3];
78875           for (var j3 in langCodes) {
78876             var code = langCodes[j3];
78877             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
78878             var info = getWikiInfo(wiki, code, referenceId);
78879             if (info) {
78880               result.wiki = info;
78881               break;
78882             }
78883           }
78884           if (result.wiki)
78885             break;
78886         }
78887         callback(null, result);
78888         function getWikiInfo(wiki2, langCode, tKey) {
78889           if (wiki2 && wiki2[langCode]) {
78890             return {
78891               title: wiki2[langCode],
78892               text: tKey,
78893               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
78894             };
78895           }
78896         }
78897       });
78898     },
78899     addLocale: function(langCode, qid) {
78900       _localeIDs[langCode] = qid;
78901     },
78902     apibase: function(val) {
78903       if (!arguments.length)
78904         return apibase3;
78905       apibase3 = val;
78906       return this;
78907     }
78908   };
78909
78910   // modules/services/streetside.js
78911   var import_rbush11 = __toESM(require_rbush_min());
78912
78913   // modules/util/jsonp_request.js
78914   var jsonpCache = {};
78915   window.jsonpCache = jsonpCache;
78916   function jsonpRequest(url, callback) {
78917     var request3 = {
78918       abort: function() {
78919       }
78920     };
78921     if (window.JSONP_FIX) {
78922       if (window.JSONP_DELAY === 0) {
78923         callback(window.JSONP_FIX);
78924       } else {
78925         var t2 = window.setTimeout(function() {
78926           callback(window.JSONP_FIX);
78927         }, window.JSONP_DELAY || 0);
78928         request3.abort = function() {
78929           window.clearTimeout(t2);
78930         };
78931       }
78932       return request3;
78933     }
78934     function rand() {
78935       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
78936       var c2 = "";
78937       var i3 = -1;
78938       while (++i3 < 15)
78939         c2 += chars.charAt(Math.floor(Math.random() * 52));
78940       return c2;
78941     }
78942     function create2(url2) {
78943       var e3 = url2.match(/callback=(\w+)/);
78944       var c2 = e3 ? e3[1] : rand();
78945       jsonpCache[c2] = function(data) {
78946         if (jsonpCache[c2]) {
78947           callback(data);
78948         }
78949         finalize();
78950       };
78951       function finalize() {
78952         delete jsonpCache[c2];
78953         script.remove();
78954       }
78955       request3.abort = finalize;
78956       return "jsonpCache." + c2;
78957     }
78958     var cb = create2(url);
78959     var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
78960     return request3;
78961   }
78962
78963   // modules/services/streetside.js
78964   var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
78965   var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
78966   var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
78967   var pannellumViewerCSS2 = "pannellum/pannellum.css";
78968   var pannellumViewerJS2 = "pannellum/pannellum.js";
78969   var maxResults2 = 2e3;
78970   var tileZoom3 = 16.5;
78971   var tiler7 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
78972   var dispatch11 = dispatch_default("loadedImages", "viewerChanged");
78973   var minHfov = 10;
78974   var maxHfov = 90;
78975   var defaultHfov = 45;
78976   var _hires = false;
78977   var _resolution = 512;
78978   var _currScene = 0;
78979   var _ssCache;
78980   var _pannellumViewer2;
78981   var _sceneOptions = {
78982     showFullscreenCtrl: false,
78983     autoLoad: true,
78984     compass: true,
78985     yaw: 0,
78986     minHfov,
78987     maxHfov,
78988     hfov: defaultHfov,
78989     type: "cubemap",
78990     cubeMap: []
78991   };
78992   var _loadViewerPromise4;
78993   function abortRequest6(i3) {
78994     i3.abort();
78995   }
78996   function localeTimestamp2(s2) {
78997     if (!s2)
78998       return null;
78999     const options2 = { day: "numeric", month: "short", year: "numeric" };
79000     const d2 = new Date(s2);
79001     if (isNaN(d2.getTime()))
79002       return null;
79003     return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
79004   }
79005   function loadTiles3(which, url, projection2, margin) {
79006     const tiles = tiler7.margin(margin).getTiles(projection2);
79007     const cache = _ssCache[which];
79008     Object.keys(cache.inflight).forEach((k2) => {
79009       const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
79010       if (!wanted) {
79011         abortRequest6(cache.inflight[k2]);
79012         delete cache.inflight[k2];
79013       }
79014     });
79015     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
79016   }
79017   function loadNextTilePage2(which, url, tile) {
79018     const cache = _ssCache[which];
79019     const nextPage = cache.nextPage[tile.id] || 0;
79020     const id2 = tile.id + "," + String(nextPage);
79021     if (cache.loaded[id2] || cache.inflight[id2])
79022       return;
79023     cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
79024       cache.loaded[id2] = true;
79025       delete cache.inflight[id2];
79026       if (!bubbles)
79027         return;
79028       bubbles.shift();
79029       const features = bubbles.map((bubble) => {
79030         if (cache.points[bubble.id])
79031           return null;
79032         const loc = [bubble.lo, bubble.la];
79033         const d2 = {
79034           loc,
79035           key: bubble.id,
79036           ca: bubble.he,
79037           captured_at: bubble.cd,
79038           captured_by: "microsoft",
79039           // nbn: bubble.nbn,
79040           // pbn: bubble.pbn,
79041           // ad: bubble.ad,
79042           // rn: bubble.rn,
79043           pr: bubble.pr,
79044           // previous
79045           ne: bubble.ne,
79046           // next
79047           pano: true,
79048           sequenceKey: null
79049         };
79050         cache.points[bubble.id] = d2;
79051         if (bubble.pr === void 0) {
79052           cache.leaders.push(bubble.id);
79053         }
79054         return {
79055           minX: loc[0],
79056           minY: loc[1],
79057           maxX: loc[0],
79058           maxY: loc[1],
79059           data: d2
79060         };
79061       }).filter(Boolean);
79062       cache.rtree.load(features);
79063       connectSequences();
79064       if (which === "bubbles") {
79065         dispatch11.call("loadedImages");
79066       }
79067     });
79068   }
79069   function connectSequences() {
79070     let cache = _ssCache.bubbles;
79071     let keepLeaders = [];
79072     for (let i3 = 0; i3 < cache.leaders.length; i3++) {
79073       let bubble = cache.points[cache.leaders[i3]];
79074       let seen = {};
79075       let sequence = { key: bubble.key, bubbles: [] };
79076       let complete = false;
79077       do {
79078         sequence.bubbles.push(bubble);
79079         seen[bubble.key] = true;
79080         if (bubble.ne === void 0) {
79081           complete = true;
79082         } else {
79083           bubble = cache.points[bubble.ne];
79084         }
79085       } while (bubble && !seen[bubble.key] && !complete);
79086       if (complete) {
79087         _ssCache.sequences[sequence.key] = sequence;
79088         for (let j3 = 0; j3 < sequence.bubbles.length; j3++) {
79089           sequence.bubbles[j3].sequenceKey = sequence.key;
79090         }
79091         sequence.geojson = {
79092           type: "LineString",
79093           properties: {
79094             captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
79095             captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
79096             key: sequence.key
79097           },
79098           coordinates: sequence.bubbles.map((d2) => d2.loc)
79099         };
79100       } else {
79101         keepLeaders.push(cache.leaders[i3]);
79102       }
79103     }
79104     cache.leaders = keepLeaders;
79105   }
79106   function getBubbles(url, tile, callback) {
79107     let rect = tile.extent.rectangle();
79108     let urlForRequest = url + utilQsString({
79109       n: rect[3],
79110       s: rect[1],
79111       e: rect[2],
79112       w: rect[0],
79113       c: maxResults2,
79114       appkey: bubbleAppKey,
79115       jsCallback: "{callback}"
79116     });
79117     return jsonpRequest(urlForRequest, (data) => {
79118       if (!data || data.error) {
79119         callback(null);
79120       } else {
79121         callback(data);
79122       }
79123     });
79124   }
79125   function partitionViewport4(projection2) {
79126     let z2 = geoScaleToZoom(projection2.scale());
79127     let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
79128     let tiler9 = utilTiler().zoomExtent([z22, z22]);
79129     return tiler9.getTiles(projection2).map((tile) => tile.extent);
79130   }
79131   function searchLimited4(limit, projection2, rtree) {
79132     limit = limit || 5;
79133     return partitionViewport4(projection2).reduce((result, extent) => {
79134       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
79135       return found.length ? result.concat(found) : result;
79136     }, []);
79137   }
79138   function loadImage2(imgInfo) {
79139     return new Promise((resolve) => {
79140       let img = new Image();
79141       img.onload = () => {
79142         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
79143         let ctx = canvas.getContext("2d");
79144         ctx.drawImage(img, imgInfo.x, imgInfo.y);
79145         resolve({ imgInfo, status: "ok" });
79146       };
79147       img.onerror = () => {
79148         resolve({ data: imgInfo, status: "error" });
79149       };
79150       img.setAttribute("crossorigin", "");
79151       img.src = imgInfo.url;
79152     });
79153   }
79154   function loadCanvas(imageGroup) {
79155     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
79156       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
79157       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
79158       let face = data[0].imgInfo.face;
79159       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
79160       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
79161     });
79162   }
79163   function loadFaces(faceGroup) {
79164     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
79165       return { status: "loadFaces done" };
79166     });
79167   }
79168   function setupCanvas(selection2, reset) {
79169     if (reset) {
79170       selection2.selectAll("#ideditor-stitcher-canvases").remove();
79171     }
79172     selection2.selectAll("#ideditor-stitcher-canvases").data([0]).enter().append("div").attr("id", "ideditor-stitcher-canvases").attr("display", "none").selectAll("canvas").data(["canvas01", "canvas02", "canvas03", "canvas10", "canvas11", "canvas12"]).enter().append("canvas").attr("id", (d2) => "ideditor-" + d2).attr("width", _resolution).attr("height", _resolution);
79173   }
79174   function qkToXY(qk) {
79175     let x2 = 0;
79176     let y2 = 0;
79177     let scale = 256;
79178     for (let i3 = qk.length; i3 > 0; i3--) {
79179       const key = qk[i3 - 1];
79180       x2 += +(key === "1" || key === "3") * scale;
79181       y2 += +(key === "2" || key === "3") * scale;
79182       scale *= 2;
79183     }
79184     return [x2, y2];
79185   }
79186   function getQuadKeys() {
79187     let dim = _resolution / 256;
79188     let quadKeys;
79189     if (dim === 16) {
79190       quadKeys = [
79191         "0000",
79192         "0001",
79193         "0010",
79194         "0011",
79195         "0100",
79196         "0101",
79197         "0110",
79198         "0111",
79199         "1000",
79200         "1001",
79201         "1010",
79202         "1011",
79203         "1100",
79204         "1101",
79205         "1110",
79206         "1111",
79207         "0002",
79208         "0003",
79209         "0012",
79210         "0013",
79211         "0102",
79212         "0103",
79213         "0112",
79214         "0113",
79215         "1002",
79216         "1003",
79217         "1012",
79218         "1013",
79219         "1102",
79220         "1103",
79221         "1112",
79222         "1113",
79223         "0020",
79224         "0021",
79225         "0030",
79226         "0031",
79227         "0120",
79228         "0121",
79229         "0130",
79230         "0131",
79231         "1020",
79232         "1021",
79233         "1030",
79234         "1031",
79235         "1120",
79236         "1121",
79237         "1130",
79238         "1131",
79239         "0022",
79240         "0023",
79241         "0032",
79242         "0033",
79243         "0122",
79244         "0123",
79245         "0132",
79246         "0133",
79247         "1022",
79248         "1023",
79249         "1032",
79250         "1033",
79251         "1122",
79252         "1123",
79253         "1132",
79254         "1133",
79255         "0200",
79256         "0201",
79257         "0210",
79258         "0211",
79259         "0300",
79260         "0301",
79261         "0310",
79262         "0311",
79263         "1200",
79264         "1201",
79265         "1210",
79266         "1211",
79267         "1300",
79268         "1301",
79269         "1310",
79270         "1311",
79271         "0202",
79272         "0203",
79273         "0212",
79274         "0213",
79275         "0302",
79276         "0303",
79277         "0312",
79278         "0313",
79279         "1202",
79280         "1203",
79281         "1212",
79282         "1213",
79283         "1302",
79284         "1303",
79285         "1312",
79286         "1313",
79287         "0220",
79288         "0221",
79289         "0230",
79290         "0231",
79291         "0320",
79292         "0321",
79293         "0330",
79294         "0331",
79295         "1220",
79296         "1221",
79297         "1230",
79298         "1231",
79299         "1320",
79300         "1321",
79301         "1330",
79302         "1331",
79303         "0222",
79304         "0223",
79305         "0232",
79306         "0233",
79307         "0322",
79308         "0323",
79309         "0332",
79310         "0333",
79311         "1222",
79312         "1223",
79313         "1232",
79314         "1233",
79315         "1322",
79316         "1323",
79317         "1332",
79318         "1333",
79319         "2000",
79320         "2001",
79321         "2010",
79322         "2011",
79323         "2100",
79324         "2101",
79325         "2110",
79326         "2111",
79327         "3000",
79328         "3001",
79329         "3010",
79330         "3011",
79331         "3100",
79332         "3101",
79333         "3110",
79334         "3111",
79335         "2002",
79336         "2003",
79337         "2012",
79338         "2013",
79339         "2102",
79340         "2103",
79341         "2112",
79342         "2113",
79343         "3002",
79344         "3003",
79345         "3012",
79346         "3013",
79347         "3102",
79348         "3103",
79349         "3112",
79350         "3113",
79351         "2020",
79352         "2021",
79353         "2030",
79354         "2031",
79355         "2120",
79356         "2121",
79357         "2130",
79358         "2131",
79359         "3020",
79360         "3021",
79361         "3030",
79362         "3031",
79363         "3120",
79364         "3121",
79365         "3130",
79366         "3131",
79367         "2022",
79368         "2023",
79369         "2032",
79370         "2033",
79371         "2122",
79372         "2123",
79373         "2132",
79374         "2133",
79375         "3022",
79376         "3023",
79377         "3032",
79378         "3033",
79379         "3122",
79380         "3123",
79381         "3132",
79382         "3133",
79383         "2200",
79384         "2201",
79385         "2210",
79386         "2211",
79387         "2300",
79388         "2301",
79389         "2310",
79390         "2311",
79391         "3200",
79392         "3201",
79393         "3210",
79394         "3211",
79395         "3300",
79396         "3301",
79397         "3310",
79398         "3311",
79399         "2202",
79400         "2203",
79401         "2212",
79402         "2213",
79403         "2302",
79404         "2303",
79405         "2312",
79406         "2313",
79407         "3202",
79408         "3203",
79409         "3212",
79410         "3213",
79411         "3302",
79412         "3303",
79413         "3312",
79414         "3313",
79415         "2220",
79416         "2221",
79417         "2230",
79418         "2231",
79419         "2320",
79420         "2321",
79421         "2330",
79422         "2331",
79423         "3220",
79424         "3221",
79425         "3230",
79426         "3231",
79427         "3320",
79428         "3321",
79429         "3330",
79430         "3331",
79431         "2222",
79432         "2223",
79433         "2232",
79434         "2233",
79435         "2322",
79436         "2323",
79437         "2332",
79438         "2333",
79439         "3222",
79440         "3223",
79441         "3232",
79442         "3233",
79443         "3322",
79444         "3323",
79445         "3332",
79446         "3333"
79447       ];
79448     } else if (dim === 8) {
79449       quadKeys = [
79450         "000",
79451         "001",
79452         "010",
79453         "011",
79454         "100",
79455         "101",
79456         "110",
79457         "111",
79458         "002",
79459         "003",
79460         "012",
79461         "013",
79462         "102",
79463         "103",
79464         "112",
79465         "113",
79466         "020",
79467         "021",
79468         "030",
79469         "031",
79470         "120",
79471         "121",
79472         "130",
79473         "131",
79474         "022",
79475         "023",
79476         "032",
79477         "033",
79478         "122",
79479         "123",
79480         "132",
79481         "133",
79482         "200",
79483         "201",
79484         "210",
79485         "211",
79486         "300",
79487         "301",
79488         "310",
79489         "311",
79490         "202",
79491         "203",
79492         "212",
79493         "213",
79494         "302",
79495         "303",
79496         "312",
79497         "313",
79498         "220",
79499         "221",
79500         "230",
79501         "231",
79502         "320",
79503         "321",
79504         "330",
79505         "331",
79506         "222",
79507         "223",
79508         "232",
79509         "233",
79510         "322",
79511         "323",
79512         "332",
79513         "333"
79514       ];
79515     } else if (dim === 4) {
79516       quadKeys = [
79517         "00",
79518         "01",
79519         "10",
79520         "11",
79521         "02",
79522         "03",
79523         "12",
79524         "13",
79525         "20",
79526         "21",
79527         "30",
79528         "31",
79529         "22",
79530         "23",
79531         "32",
79532         "33"
79533       ];
79534     } else {
79535       quadKeys = [
79536         "0",
79537         "1",
79538         "2",
79539         "3"
79540       ];
79541     }
79542     return quadKeys;
79543   }
79544   var streetside_default = {
79545     /**
79546      * init() initialize streetside.
79547      */
79548     init: function() {
79549       if (!_ssCache) {
79550         this.reset();
79551       }
79552       this.event = utilRebind(this, dispatch11, "on");
79553     },
79554     /**
79555      * reset() reset the cache.
79556      */
79557     reset: function() {
79558       if (_ssCache) {
79559         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
79560       }
79561       _ssCache = {
79562         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush11.default(), points: {}, leaders: [] },
79563         sequences: {}
79564       };
79565     },
79566     /**
79567      * bubbles()
79568      */
79569     bubbles: function(projection2) {
79570       const limit = 5;
79571       return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
79572     },
79573     cachedImage: function(imageKey) {
79574       return _ssCache.bubbles.points[imageKey];
79575     },
79576     sequences: function(projection2) {
79577       const viewport = projection2.clipExtent();
79578       const min3 = [viewport[0][0], viewport[1][1]];
79579       const max3 = [viewport[1][0], viewport[0][1]];
79580       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
79581       let seen = {};
79582       let results = [];
79583       _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
79584         const key = d2.data.sequenceKey;
79585         if (key && !seen[key]) {
79586           seen[key] = true;
79587           results.push(_ssCache.sequences[key].geojson);
79588         }
79589       });
79590       return results;
79591     },
79592     /**
79593      * loadBubbles()
79594      */
79595     loadBubbles: function(projection2, margin) {
79596       if (margin === void 0)
79597         margin = 2;
79598       loadTiles3("bubbles", bubbleApi, projection2, margin);
79599     },
79600     viewer: function() {
79601       return _pannellumViewer2;
79602     },
79603     initViewer: function() {
79604       if (!window.pannellum)
79605         return;
79606       if (_pannellumViewer2)
79607         return;
79608       _currScene += 1;
79609       const sceneID = _currScene.toString();
79610       const options2 = {
79611         "default": { firstScene: sceneID },
79612         scenes: {}
79613       };
79614       options2.scenes[sceneID] = _sceneOptions;
79615       _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
79616     },
79617     ensureViewerLoaded: function(context) {
79618       if (_loadViewerPromise4)
79619         return _loadViewerPromise4;
79620       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
79621       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
79622       let that = this;
79623       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
79624       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
79625         select_default2(window).on(pointerPrefix + "move.streetside", () => {
79626           dispatch11.call("viewerChanged");
79627         }, true);
79628       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
79629         select_default2(window).on(pointerPrefix + "move.streetside", null);
79630         let t2 = timer((elapsed) => {
79631           dispatch11.call("viewerChanged");
79632           if (elapsed > 2e3) {
79633             t2.stop();
79634           }
79635         });
79636       }).append("div").attr("class", "photo-attribution fillD");
79637       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
79638       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
79639       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
79640       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
79641       context.ui().photoviewer.on("resize.streetside", () => {
79642         if (_pannellumViewer2) {
79643           _pannellumViewer2.resize();
79644         }
79645       });
79646       _loadViewerPromise4 = new Promise((resolve, reject) => {
79647         let loadedCount = 0;
79648         function loaded() {
79649           loadedCount += 1;
79650           if (loadedCount === 2)
79651             resolve();
79652         }
79653         const head = select_default2("head");
79654         head.selectAll("#ideditor-streetside-viewercss").data([0]).enter().append("link").attr("id", "ideditor-streetside-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
79655           reject();
79656         });
79657         head.selectAll("#ideditor-streetside-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-streetside-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
79658           reject();
79659         });
79660       }).catch(function() {
79661         _loadViewerPromise4 = null;
79662       });
79663       return _loadViewerPromise4;
79664       function step(stepBy) {
79665         return () => {
79666           let viewer = context.container().select(".photoviewer");
79667           let selected = viewer.empty() ? void 0 : viewer.datum();
79668           if (!selected)
79669             return;
79670           let nextID = stepBy === 1 ? selected.ne : selected.pr;
79671           let yaw = _pannellumViewer2.getYaw();
79672           let ca = selected.ca + yaw;
79673           let origin = selected.loc;
79674           const meters = 35;
79675           let p1 = [
79676             origin[0] + geoMetersToLon(meters / 5, origin[1]),
79677             origin[1]
79678           ];
79679           let p2 = [
79680             origin[0] + geoMetersToLon(meters / 2, origin[1]),
79681             origin[1] + geoMetersToLat(meters)
79682           ];
79683           let p3 = [
79684             origin[0] - geoMetersToLon(meters / 2, origin[1]),
79685             origin[1] + geoMetersToLat(meters)
79686           ];
79687           let p4 = [
79688             origin[0] - geoMetersToLon(meters / 5, origin[1]),
79689             origin[1]
79690           ];
79691           let poly = [p1, p2, p3, p4, p1];
79692           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
79693           poly = geoRotate(poly, -angle2, origin);
79694           let extent = poly.reduce((extent2, point2) => {
79695             return extent2.extend(geoExtent(point2));
79696           }, geoExtent());
79697           let minDist = Infinity;
79698           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
79699             if (d2.data.key === selected.key)
79700               return;
79701             if (!geoPointInPolygon(d2.data.loc, poly))
79702               return;
79703             let dist = geoVecLength(d2.data.loc, selected.loc);
79704             let theta = selected.ca - d2.data.ca;
79705             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
79706             if (minTheta > 20) {
79707               dist += 5;
79708             }
79709             if (dist < minDist) {
79710               nextID = d2.data.key;
79711               minDist = dist;
79712             }
79713           });
79714           let nextBubble = nextID && that.cachedImage(nextID);
79715           if (!nextBubble)
79716             return;
79717           context.map().centerEase(nextBubble.loc);
79718           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
79719         };
79720       }
79721     },
79722     yaw: function(yaw) {
79723       if (typeof yaw !== "number")
79724         return yaw;
79725       _sceneOptions.yaw = yaw;
79726       return this;
79727     },
79728     /**
79729      * showViewer()
79730      */
79731     showViewer: function(context) {
79732       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
79733       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
79734       if (isHidden) {
79735         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
79736         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
79737       }
79738       return this;
79739     },
79740     /**
79741      * hideViewer()
79742      */
79743     hideViewer: function(context) {
79744       let viewer = context.container().select(".photoviewer");
79745       if (!viewer.empty())
79746         viewer.datum(null);
79747       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
79748       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
79749       this.updateUrlImage(null);
79750       return this.setStyles(context, null, true);
79751     },
79752     /**
79753      * selectImage().
79754      */
79755     selectImage: function(context, key) {
79756       let that = this;
79757       let d2 = this.cachedImage(key);
79758       let viewer = context.container().select(".photoviewer");
79759       if (!viewer.empty())
79760         viewer.datum(d2);
79761       this.setStyles(context, null, true);
79762       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
79763       let attribution = wrap2.selectAll(".photo-attribution").html("");
79764       wrap2.selectAll(".pnlm-load-box").style("display", "block");
79765       if (!d2)
79766         return this;
79767       this.updateUrlImage(key);
79768       _sceneOptions.northOffset = d2.ca;
79769       let line1 = attribution.append("div").attr("class", "attribution-row");
79770       const hiresDomId = utilUniqueDomId("streetside-hires");
79771       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
79772       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
79773         d3_event.stopPropagation();
79774         _hires = !_hires;
79775         _resolution = _hires ? 1024 : 512;
79776         wrap2.call(setupCanvas, true);
79777         let viewstate = {
79778           yaw: _pannellumViewer2.getYaw(),
79779           pitch: _pannellumViewer2.getPitch(),
79780           hfov: _pannellumViewer2.getHfov()
79781         };
79782         _sceneOptions = Object.assign(_sceneOptions, viewstate);
79783         that.selectImage(context, d2.key).showViewer(context);
79784       });
79785       label.append("span").call(_t.append("streetside.hires"));
79786       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
79787       if (d2.captured_by) {
79788         const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
79789         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
79790         captureInfo.append("span").text("|");
79791       }
79792       if (d2.captured_at) {
79793         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
79794       }
79795       let line2 = attribution.append("div").attr("class", "attribution-row");
79796       line2.append("a").attr("class", "image-view-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps?cp=" + d2.loc[1] + "~" + d2.loc[0] + "&lvl=17&dir=" + d2.ca + "&style=x&v=2&sV=1").call(_t.append("streetside.view_on_bing"));
79797       line2.append("a").attr("class", "image-report-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid=" + encodeURIComponent(d2.key) + "&focus=photo&lat=" + d2.loc[1] + "&lng=" + d2.loc[0] + "&z=17").call(_t.append("streetside.report"));
79798       let bubbleIdQuadKey = d2.key.toString(4);
79799       const paddingNeeded = 16 - bubbleIdQuadKey.length;
79800       for (let i3 = 0; i3 < paddingNeeded; i3++) {
79801         bubbleIdQuadKey = "0" + bubbleIdQuadKey;
79802       }
79803       const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
79804       const imgUrlSuffix = ".jpg?g=13515&n=z";
79805       const faceKeys = ["01", "02", "03", "10", "11", "12"];
79806       let quadKeys = getQuadKeys();
79807       let faces = faceKeys.map((faceKey) => {
79808         return quadKeys.map((quadKey) => {
79809           const xy = qkToXY(quadKey);
79810           return {
79811             face: faceKey,
79812             url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
79813             x: xy[0],
79814             y: xy[1]
79815           };
79816         });
79817       });
79818       loadFaces(faces).then(function() {
79819         if (!_pannellumViewer2) {
79820           that.initViewer();
79821         } else {
79822           _currScene += 1;
79823           let sceneID = _currScene.toString();
79824           _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
79825           if (_currScene > 2) {
79826             sceneID = (_currScene - 1).toString();
79827             _pannellumViewer2.removeScene(sceneID);
79828           }
79829         }
79830       });
79831       return this;
79832     },
79833     getSequenceKeyForBubble: function(d2) {
79834       return d2 && d2.sequenceKey;
79835     },
79836     // Updates the currently highlighted sequence and selected bubble.
79837     // Reset is only necessary when interacting with the viewport because
79838     // this implicitly changes the currently selected bubble/sequence
79839     setStyles: function(context, hovered, reset) {
79840       if (reset) {
79841         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
79842         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
79843       }
79844       let hoveredBubbleKey = hovered && hovered.key;
79845       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
79846       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
79847       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
79848       let viewer = context.container().select(".photoviewer");
79849       let selected = viewer.empty() ? void 0 : viewer.datum();
79850       let selectedBubbleKey = selected && selected.key;
79851       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
79852       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
79853       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
79854       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
79855       context.container().selectAll(".layer-streetside-images .viewfield-group").classed("highlighted", (d2) => highlightedBubbleKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredBubbleKey).classed("currentView", (d2) => d2.key === selectedBubbleKey);
79856       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
79857       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
79858       function viewfieldPath() {
79859         let d2 = this.parentNode.__data__;
79860         if (d2.pano && d2.key !== selectedBubbleKey) {
79861           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
79862         } else {
79863           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
79864         }
79865       }
79866       return this;
79867     },
79868     updateUrlImage: function(imageKey) {
79869       if (!window.mocha) {
79870         var hash = utilStringQs(window.location.hash);
79871         if (imageKey) {
79872           hash.photo = "streetside/" + imageKey;
79873         } else {
79874           delete hash.photo;
79875         }
79876         window.location.replace("#" + utilQsString(hash, true));
79877       }
79878     },
79879     /**
79880      * cache().
79881      */
79882     cache: function() {
79883       return _ssCache;
79884     }
79885   };
79886
79887   // modules/services/taginfo.js
79888   var apibase4 = taginfoApiUrl;
79889   var _inflight3 = {};
79890   var _popularKeys = {};
79891   var _taginfoCache = {};
79892   var tag_sorts = {
79893     point: "count_nodes",
79894     vertex: "count_nodes",
79895     area: "count_ways",
79896     line: "count_ways"
79897   };
79898   var tag_sort_members = {
79899     point: "count_node_members",
79900     vertex: "count_node_members",
79901     area: "count_way_members",
79902     line: "count_way_members",
79903     relation: "count_relation_members"
79904   };
79905   var tag_filters = {
79906     point: "nodes",
79907     vertex: "nodes",
79908     area: "ways",
79909     line: "ways"
79910   };
79911   var tag_members_fractions = {
79912     point: "count_node_members_fraction",
79913     vertex: "count_node_members_fraction",
79914     area: "count_way_members_fraction",
79915     line: "count_way_members_fraction",
79916     relation: "count_relation_members_fraction"
79917   };
79918   function sets(params, n3, o2) {
79919     if (params.geometry && o2[params.geometry]) {
79920       params[n3] = o2[params.geometry];
79921     }
79922     return params;
79923   }
79924   function setFilter(params) {
79925     return sets(params, "filter", tag_filters);
79926   }
79927   function setSort(params) {
79928     return sets(params, "sortname", tag_sorts);
79929   }
79930   function setSortMembers(params) {
79931     return sets(params, "sortname", tag_sort_members);
79932   }
79933   function clean(params) {
79934     return utilObjectOmit(params, ["geometry", "debounce"]);
79935   }
79936   function filterKeys(type2) {
79937     var count_type = type2 ? "count_" + type2 : "count_all";
79938     return function(d2) {
79939       return Number(d2[count_type]) > 2500 || d2.in_wiki;
79940     };
79941   }
79942   function filterMultikeys(prefix) {
79943     return function(d2) {
79944       var re3 = new RegExp("^" + prefix + "(.*)$", "i");
79945       var matches = d2.key.match(re3) || [];
79946       return matches.length === 2 && matches[1].indexOf(":") === -1;
79947     };
79948   }
79949   function filterValues(allowUpperCase) {
79950     return function(d2) {
79951       if (d2.value.match(/[;,]/) !== null)
79952         return false;
79953       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null)
79954         return false;
79955       return d2.count > 100 || d2.in_wiki;
79956     };
79957   }
79958   function filterRoles(geometry) {
79959     return function(d2) {
79960       if (d2.role === "")
79961         return false;
79962       if (d2.role.match(/[A-Z*;,]/) !== null)
79963         return false;
79964       return Number(d2[tag_members_fractions[geometry]]) > 0;
79965     };
79966   }
79967   function valKey(d2) {
79968     return {
79969       value: d2.key,
79970       title: d2.key
79971     };
79972   }
79973   function valKeyDescription(d2) {
79974     var obj = {
79975       value: d2.value,
79976       title: d2.description || d2.value
79977     };
79978     return obj;
79979   }
79980   function roleKey(d2) {
79981     return {
79982       value: d2.role,
79983       title: d2.role
79984     };
79985   }
79986   function sortKeys(a2, b2) {
79987     return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
79988   }
79989   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
79990   function request2(url, params, exactMatch, callback, loaded) {
79991     if (_inflight3[url])
79992       return;
79993     if (checkCache(url, params, exactMatch, callback))
79994       return;
79995     var controller = new AbortController();
79996     _inflight3[url] = controller;
79997     json_default(url, { signal: controller.signal }).then(function(result) {
79998       delete _inflight3[url];
79999       if (loaded)
80000         loaded(null, result);
80001     }).catch(function(err) {
80002       delete _inflight3[url];
80003       if (err.name === "AbortError")
80004         return;
80005       if (loaded)
80006         loaded(err.message);
80007     });
80008   }
80009   function checkCache(url, params, exactMatch, callback) {
80010     var rp = params.rp || 25;
80011     var testQuery = params.query || "";
80012     var testUrl = url;
80013     do {
80014       var hit = _taginfoCache[testUrl];
80015       if (hit && (url === testUrl || hit.length < rp)) {
80016         callback(null, hit);
80017         return true;
80018       }
80019       if (exactMatch || !testQuery.length)
80020         return false;
80021       testQuery = testQuery.slice(0, -1);
80022       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
80023     } while (testQuery.length >= 0);
80024     return false;
80025   }
80026   var taginfo_default = {
80027     init: function() {
80028       _inflight3 = {};
80029       _taginfoCache = {};
80030       _popularKeys = {
80031         // manually exclude some keys – #5377, #7485
80032         postal_code: true,
80033         full_name: true,
80034         loc_name: true,
80035         reg_name: true,
80036         short_name: true,
80037         sorting_name: true,
80038         artist_name: true,
80039         nat_name: true,
80040         long_name: true,
80041         via: true,
80042         "bridge:name": true
80043       };
80044       var params = {
80045         rp: 100,
80046         sortname: "values_all",
80047         sortorder: "desc",
80048         page: 1,
80049         debounce: false,
80050         lang: _mainLocalizer.languageCode()
80051       };
80052       this.keys(params, function(err, data) {
80053         if (err)
80054           return;
80055         data.forEach(function(d2) {
80056           if (d2.value === "opening_hours")
80057             return;
80058           _popularKeys[d2.value] = true;
80059         });
80060       });
80061     },
80062     reset: function() {
80063       Object.values(_inflight3).forEach(function(controller) {
80064         controller.abort();
80065       });
80066       _inflight3 = {};
80067     },
80068     keys: function(params, callback) {
80069       var doRequest = params.debounce ? debouncedRequest2 : request2;
80070       params = clean(setSort(params));
80071       params = Object.assign({
80072         rp: 10,
80073         sortname: "count_all",
80074         sortorder: "desc",
80075         page: 1,
80076         lang: _mainLocalizer.languageCode()
80077       }, params);
80078       var url = apibase4 + "keys/all?" + utilQsString(params);
80079       doRequest(url, params, false, callback, function(err, d2) {
80080         if (err) {
80081           callback(err);
80082         } else {
80083           var f3 = filterKeys(params.filter);
80084           var result = d2.data.filter(f3).sort(sortKeys).map(valKey);
80085           _taginfoCache[url] = result;
80086           callback(null, result);
80087         }
80088       });
80089     },
80090     multikeys: function(params, callback) {
80091       var doRequest = params.debounce ? debouncedRequest2 : request2;
80092       params = clean(setSort(params));
80093       params = Object.assign({
80094         rp: 25,
80095         sortname: "count_all",
80096         sortorder: "desc",
80097         page: 1,
80098         lang: _mainLocalizer.languageCode()
80099       }, params);
80100       var prefix = params.query;
80101       var url = apibase4 + "keys/all?" + utilQsString(params);
80102       doRequest(url, params, true, callback, function(err, d2) {
80103         if (err) {
80104           callback(err);
80105         } else {
80106           var f3 = filterMultikeys(prefix);
80107           var result = d2.data.filter(f3).map(valKey);
80108           _taginfoCache[url] = result;
80109           callback(null, result);
80110         }
80111       });
80112     },
80113     values: function(params, callback) {
80114       var key = params.key;
80115       if (key && _popularKeys[key]) {
80116         callback(null, []);
80117         return;
80118       }
80119       var doRequest = params.debounce ? debouncedRequest2 : request2;
80120       params = clean(setSort(setFilter(params)));
80121       params = Object.assign({
80122         rp: 25,
80123         sortname: "count_all",
80124         sortorder: "desc",
80125         page: 1,
80126         lang: _mainLocalizer.languageCode()
80127       }, params);
80128       var url = apibase4 + "key/values?" + utilQsString(params);
80129       doRequest(url, params, false, callback, function(err, d2) {
80130         if (err) {
80131           callback(err);
80132         } else {
80133           var allowUpperCase = allowUpperCaseTagValues.test(params.key);
80134           var f3 = filterValues(allowUpperCase);
80135           var result = d2.data.filter(f3).map(valKeyDescription);
80136           _taginfoCache[url] = result;
80137           callback(null, result);
80138         }
80139       });
80140     },
80141     roles: function(params, callback) {
80142       var doRequest = params.debounce ? debouncedRequest2 : request2;
80143       var geometry = params.geometry;
80144       params = clean(setSortMembers(params));
80145       params = Object.assign({
80146         rp: 25,
80147         sortname: "count_all_members",
80148         sortorder: "desc",
80149         page: 1,
80150         lang: _mainLocalizer.languageCode()
80151       }, params);
80152       var url = apibase4 + "relation/roles?" + utilQsString(params);
80153       doRequest(url, params, true, callback, function(err, d2) {
80154         if (err) {
80155           callback(err);
80156         } else {
80157           var f3 = filterRoles(geometry);
80158           var result = d2.data.filter(f3).map(roleKey);
80159           _taginfoCache[url] = result;
80160           callback(null, result);
80161         }
80162       });
80163     },
80164     docs: function(params, callback) {
80165       var doRequest = params.debounce ? debouncedRequest2 : request2;
80166       params = clean(setSort(params));
80167       var path = "key/wiki_pages?";
80168       if (params.value) {
80169         path = "tag/wiki_pages?";
80170       } else if (params.rtype) {
80171         path = "relation/wiki_pages?";
80172       }
80173       var url = apibase4 + path + utilQsString(params);
80174       doRequest(url, params, true, callback, function(err, d2) {
80175         if (err) {
80176           callback(err);
80177         } else {
80178           _taginfoCache[url] = d2.data;
80179           callback(null, d2.data);
80180         }
80181       });
80182     },
80183     apibase: function(_2) {
80184       if (!arguments.length)
80185         return apibase4;
80186       apibase4 = _2;
80187       return this;
80188     }
80189   };
80190
80191   // modules/services/vector_tile.js
80192   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
80193   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
80194   var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
80195   var import_pbf2 = __toESM(require_pbf());
80196   var import_vector_tile2 = __toESM(require_vector_tile());
80197   var tiler8 = utilTiler().tileSize(512).margin(1);
80198   var dispatch12 = dispatch_default("loadedData");
80199   var _vtCache;
80200   function abortRequest7(controller) {
80201     controller.abort();
80202   }
80203   function vtToGeoJSON(data, tile, mergeCache) {
80204     var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
80205     var layers = Object.keys(vectorTile.layers);
80206     if (!Array.isArray(layers)) {
80207       layers = [layers];
80208     }
80209     var features = [];
80210     layers.forEach(function(layerID) {
80211       var layer = vectorTile.layers[layerID];
80212       if (layer) {
80213         for (var i3 = 0; i3 < layer.length; i3++) {
80214           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80215           var geometry = feature3.geometry;
80216           if (geometry.type === "Polygon") {
80217             geometry.type = "MultiPolygon";
80218             geometry.coordinates = [geometry.coordinates];
80219           }
80220           var isClipped = false;
80221           if (geometry.type === "MultiPolygon") {
80222             var featureClip = bboxClip(feature3, tile.extent.rectangle());
80223             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
80224               isClipped = true;
80225             }
80226             if (!feature3.geometry.coordinates.length)
80227               continue;
80228             if (!feature3.geometry.coordinates[0].length)
80229               continue;
80230           }
80231           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
80232           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
80233           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
80234           feature3.__featurehash__ = featurehash;
80235           feature3.__propertyhash__ = propertyhash;
80236           features.push(feature3);
80237           if (isClipped && geometry.type === "MultiPolygon") {
80238             var merged = mergeCache[propertyhash];
80239             if (merged && merged.length) {
80240               var other = merged[0];
80241               var coords = import_polygon_clipping2.default.union(
80242                 feature3.geometry.coordinates,
80243                 other.geometry.coordinates
80244               );
80245               if (!coords || !coords.length) {
80246                 continue;
80247               }
80248               merged.push(feature3);
80249               for (var j3 = 0; j3 < merged.length; j3++) {
80250                 merged[j3].geometry.coordinates = coords;
80251                 merged[j3].__featurehash__ = featurehash;
80252               }
80253             } else {
80254               mergeCache[propertyhash] = [feature3];
80255             }
80256           }
80257         }
80258       }
80259     });
80260     return features;
80261   }
80262   function loadTile3(source, tile) {
80263     if (source.loaded[tile.id] || source.inflight[tile.id])
80264       return;
80265     var url = source.template.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace(/\{[t-]y\}/, Math.pow(2, tile.xyz[2]) - tile.xyz[1] - 1).replace(/\{z(oom)?\}/, tile.xyz[2]).replace(/\{switch:([^}]+)\}/, function(s2, r2) {
80266       var subdomains = r2.split(",");
80267       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
80268     });
80269     var controller = new AbortController();
80270     source.inflight[tile.id] = controller;
80271     fetch(url, { signal: controller.signal }).then(function(response) {
80272       if (!response.ok) {
80273         throw new Error(response.status + " " + response.statusText);
80274       }
80275       source.loaded[tile.id] = [];
80276       delete source.inflight[tile.id];
80277       return response.arrayBuffer();
80278     }).then(function(data) {
80279       if (!data) {
80280         throw new Error("No Data");
80281       }
80282       var z2 = tile.xyz[2];
80283       if (!source.canMerge[z2]) {
80284         source.canMerge[z2] = {};
80285       }
80286       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
80287       dispatch12.call("loadedData");
80288     }).catch(function() {
80289       source.loaded[tile.id] = [];
80290       delete source.inflight[tile.id];
80291     });
80292   }
80293   var vector_tile_default = {
80294     init: function() {
80295       if (!_vtCache) {
80296         this.reset();
80297       }
80298       this.event = utilRebind(this, dispatch12, "on");
80299     },
80300     reset: function() {
80301       for (var sourceID in _vtCache) {
80302         var source = _vtCache[sourceID];
80303         if (source && source.inflight) {
80304           Object.values(source.inflight).forEach(abortRequest7);
80305         }
80306       }
80307       _vtCache = {};
80308     },
80309     addSource: function(sourceID, template) {
80310       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
80311       return _vtCache[sourceID];
80312     },
80313     data: function(sourceID, projection2) {
80314       var source = _vtCache[sourceID];
80315       if (!source)
80316         return [];
80317       var tiles = tiler8.getTiles(projection2);
80318       var seen = {};
80319       var results = [];
80320       for (var i3 = 0; i3 < tiles.length; i3++) {
80321         var features = source.loaded[tiles[i3].id];
80322         if (!features || !features.length)
80323           continue;
80324         for (var j3 = 0; j3 < features.length; j3++) {
80325           var feature3 = features[j3];
80326           var hash = feature3.__featurehash__;
80327           if (seen[hash])
80328             continue;
80329           seen[hash] = true;
80330           results.push(Object.assign({}, feature3));
80331         }
80332       }
80333       return results;
80334     },
80335     loadTiles: function(sourceID, template, projection2) {
80336       var source = _vtCache[sourceID];
80337       if (!source) {
80338         source = this.addSource(sourceID, template);
80339       }
80340       var tiles = tiler8.getTiles(projection2);
80341       Object.keys(source.inflight).forEach(function(k2) {
80342         var wanted = tiles.find(function(tile) {
80343           return k2 === tile.id;
80344         });
80345         if (!wanted) {
80346           abortRequest7(source.inflight[k2]);
80347           delete source.inflight[k2];
80348         }
80349       });
80350       tiles.forEach(function(tile) {
80351         loadTile3(source, tile);
80352       });
80353     },
80354     cache: function() {
80355       return _vtCache;
80356     }
80357   };
80358
80359   // modules/services/wikidata.js
80360   var apibase5 = "https://www.wikidata.org/w/api.php?";
80361   var _wikidataCache = {};
80362   var wikidata_default = {
80363     init: function() {
80364     },
80365     reset: function() {
80366       _wikidataCache = {};
80367     },
80368     // Search for Wikidata items matching the query
80369     itemsForSearchQuery: function(query, callback, language) {
80370       if (!query) {
80371         if (callback)
80372           callback("No query", {});
80373         return;
80374       }
80375       var lang = this.languagesToQuery()[0];
80376       var url = apibase5 + utilQsString({
80377         action: "wbsearchentities",
80378         format: "json",
80379         formatversion: 2,
80380         search: query,
80381         type: "item",
80382         // the language to search
80383         language: language || lang,
80384         // the language for the label and description in the result
80385         uselang: lang,
80386         limit: 10,
80387         origin: "*"
80388       });
80389       json_default(url).then((result) => {
80390         if (result && result.error) {
80391           if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
80392             this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
80393             return;
80394           } else {
80395             throw new Error(result.error);
80396           }
80397         }
80398         if (callback)
80399           callback(null, result.search || {});
80400       }).catch(function(err) {
80401         if (callback)
80402           callback(err.message, {});
80403       });
80404     },
80405     // Given a Wikipedia language and article title,
80406     // return an array of corresponding Wikidata entities.
80407     itemsByTitle: function(lang, title, callback) {
80408       if (!title) {
80409         if (callback)
80410           callback("No title", {});
80411         return;
80412       }
80413       lang = lang || "en";
80414       var url = apibase5 + utilQsString({
80415         action: "wbgetentities",
80416         format: "json",
80417         formatversion: 2,
80418         sites: lang.replace(/-/g, "_") + "wiki",
80419         titles: title,
80420         languages: "en",
80421         // shrink response by filtering to one language
80422         origin: "*"
80423       });
80424       json_default(url).then(function(result) {
80425         if (result && result.error) {
80426           throw new Error(result.error);
80427         }
80428         if (callback)
80429           callback(null, result.entities || {});
80430       }).catch(function(err) {
80431         if (callback)
80432           callback(err.message, {});
80433       });
80434     },
80435     languagesToQuery: function() {
80436       return _mainLocalizer.localeCodes().map(function(code) {
80437         return code.toLowerCase();
80438       }).filter(function(code) {
80439         return code !== "en-us";
80440       });
80441     },
80442     entityByQID: function(qid, callback) {
80443       if (!qid) {
80444         callback("No qid", {});
80445         return;
80446       }
80447       if (_wikidataCache[qid]) {
80448         if (callback)
80449           callback(null, _wikidataCache[qid]);
80450         return;
80451       }
80452       var langs = this.languagesToQuery();
80453       var url = apibase5 + utilQsString({
80454         action: "wbgetentities",
80455         format: "json",
80456         formatversion: 2,
80457         ids: qid,
80458         props: "labels|descriptions|claims|sitelinks",
80459         sitefilter: langs.map(function(d2) {
80460           return d2 + "wiki";
80461         }).join("|"),
80462         languages: langs.join("|"),
80463         languagefallback: 1,
80464         origin: "*"
80465       });
80466       json_default(url).then(function(result) {
80467         if (result && result.error) {
80468           throw new Error(result.error);
80469         }
80470         if (callback)
80471           callback(null, result.entities[qid] || {});
80472       }).catch(function(err) {
80473         if (callback)
80474           callback(err.message, {});
80475       });
80476     },
80477     // Pass `params` object of the form:
80478     // {
80479     //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
80480     // }
80481     //
80482     // Get an result object used to display tag documentation
80483     // {
80484     //   title:        'string',
80485     //   description:  'string',
80486     //   editURL:      'string',
80487     //   imageURL:     'string',
80488     //   wiki:         { title: 'string', text: 'string', url: 'string' }
80489     // }
80490     //
80491     getDocs: function(params, callback) {
80492       var langs = this.languagesToQuery();
80493       this.entityByQID(params.qid, function(err, entity) {
80494         if (err || !entity) {
80495           callback(err || "No entity");
80496           return;
80497         }
80498         var i3;
80499         var description;
80500         for (i3 in langs) {
80501           let code = langs[i3];
80502           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
80503             description = entity.descriptions[code];
80504             break;
80505           }
80506         }
80507         if (!description && Object.values(entity.descriptions).length)
80508           description = Object.values(entity.descriptions)[0];
80509         var result = {
80510           title: entity.id,
80511           description: description ? description.value : "",
80512           descriptionLocaleCode: description ? description.language : "",
80513           editURL: "https://www.wikidata.org/wiki/" + entity.id
80514         };
80515         if (entity.claims) {
80516           var imageroot = "https://commons.wikimedia.org/w/index.php";
80517           var props = ["P154", "P18"];
80518           var prop, image;
80519           for (i3 = 0; i3 < props.length; i3++) {
80520             prop = entity.claims[props[i3]];
80521             if (prop && Object.keys(prop).length > 0) {
80522               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
80523               if (image) {
80524                 result.imageURL = imageroot + "?" + utilQsString({
80525                   title: "Special:Redirect/file/" + image,
80526                   width: 400
80527                 });
80528                 break;
80529               }
80530             }
80531           }
80532         }
80533         if (entity.sitelinks) {
80534           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
80535           for (i3 = 0; i3 < langs.length; i3++) {
80536             var w2 = langs[i3] + "wiki";
80537             if (entity.sitelinks[w2]) {
80538               var title = entity.sitelinks[w2].title;
80539               var tKey = "inspector.wiki_reference";
80540               if (!englishLocale && langs[i3] === "en") {
80541                 tKey = "inspector.wiki_en_reference";
80542               }
80543               result.wiki = {
80544                 title,
80545                 text: tKey,
80546                 url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
80547               };
80548               break;
80549             }
80550           }
80551         }
80552         callback(null, result);
80553       });
80554     }
80555   };
80556
80557   // modules/services/wikipedia.js
80558   var endpoint = "https://en.wikipedia.org/w/api.php?";
80559   var wikipedia_default = {
80560     init: function() {
80561     },
80562     reset: function() {
80563     },
80564     search: function(lang, query, callback) {
80565       if (!query) {
80566         if (callback)
80567           callback("No Query", []);
80568         return;
80569       }
80570       lang = lang || "en";
80571       var url = endpoint.replace("en", lang) + utilQsString({
80572         action: "query",
80573         list: "search",
80574         srlimit: "10",
80575         srinfo: "suggestion",
80576         format: "json",
80577         origin: "*",
80578         srsearch: query
80579       });
80580       json_default(url).then(function(result) {
80581         if (result && result.error) {
80582           throw new Error(result.error);
80583         } else if (!result || !result.query || !result.query.search) {
80584           throw new Error("No Results");
80585         }
80586         if (callback) {
80587           var titles = result.query.search.map(function(d2) {
80588             return d2.title;
80589           });
80590           callback(null, titles);
80591         }
80592       }).catch(function(err) {
80593         if (callback)
80594           callback(err, []);
80595       });
80596     },
80597     suggestions: function(lang, query, callback) {
80598       if (!query) {
80599         if (callback)
80600           callback("", []);
80601         return;
80602       }
80603       lang = lang || "en";
80604       var url = endpoint.replace("en", lang) + utilQsString({
80605         action: "opensearch",
80606         namespace: 0,
80607         suggest: "",
80608         format: "json",
80609         origin: "*",
80610         search: query
80611       });
80612       json_default(url).then(function(result) {
80613         if (result && result.error) {
80614           throw new Error(result.error);
80615         } else if (!result || result.length < 2) {
80616           throw new Error("No Results");
80617         }
80618         if (callback)
80619           callback(null, result[1] || []);
80620       }).catch(function(err) {
80621         if (callback)
80622           callback(err.message, []);
80623       });
80624     },
80625     translations: function(lang, title, callback) {
80626       if (!title) {
80627         if (callback)
80628           callback("No Title");
80629         return;
80630       }
80631       var url = endpoint.replace("en", lang) + utilQsString({
80632         action: "query",
80633         prop: "langlinks",
80634         format: "json",
80635         origin: "*",
80636         lllimit: 500,
80637         titles: title
80638       });
80639       json_default(url).then(function(result) {
80640         if (result && result.error) {
80641           throw new Error(result.error);
80642         } else if (!result || !result.query || !result.query.pages) {
80643           throw new Error("No Results");
80644         }
80645         if (callback) {
80646           var list = result.query.pages[Object.keys(result.query.pages)[0]];
80647           var translations = {};
80648           if (list && list.langlinks) {
80649             list.langlinks.forEach(function(d2) {
80650               translations[d2.lang] = d2["*"];
80651             });
80652           }
80653           callback(null, translations);
80654         }
80655       }).catch(function(err) {
80656         if (callback)
80657           callback(err.message);
80658       });
80659     }
80660   };
80661
80662   // modules/services/mapilio.js
80663   var import_pbf3 = __toESM(require_pbf());
80664   var import_rbush12 = __toESM(require_rbush_min());
80665   var import_vector_tile3 = __toESM(require_vector_tile());
80666   var apiUrl2 = "https://end.mapilio.com";
80667   var imageBaseUrl = "https://cdn.mapilio.com/im";
80668   var baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
80669   var pointLayer = "map_points";
80670   var lineLayer = "map_roads_line";
80671   var tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
80672   var minZoom3 = 14;
80673   var dispatch13 = dispatch_default("loadedImages", "loadedLines");
80674   var imgZoom3 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
80675   var pannellumViewerCSS3 = "pannellum/pannellum.css";
80676   var pannellumViewerJS3 = "pannellum/pannellum.js";
80677   var resolution = 1080;
80678   var _mlyActiveImage2;
80679   var _mlyCache2;
80680   var _loadViewerPromise5;
80681   var _pannellumViewer3;
80682   var _mlySceneOptions = {
80683     showFullscreenCtrl: false,
80684     autoLoad: true,
80685     yaw: 0,
80686     minHfov: 10,
80687     maxHfov: 90,
80688     hfov: 60
80689   };
80690   var _currScene2 = 0;
80691   function partitionViewport5(projection2) {
80692     const z2 = geoScaleToZoom(projection2.scale());
80693     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
80694     const tiler9 = utilTiler().zoomExtent([z22, z22]);
80695     return tiler9.getTiles(projection2).map(function(tile) {
80696       return tile.extent;
80697     });
80698   }
80699   function searchLimited5(limit, projection2, rtree) {
80700     limit = limit || 5;
80701     return partitionViewport5(projection2).reduce(function(result, extent) {
80702       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
80703         return d2.data;
80704       });
80705       return found.length ? result.concat(found) : result;
80706     }, []);
80707   }
80708   function loadTiles4(which, url, maxZoom2, projection2) {
80709     const tiler9 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
80710     const tiles = tiler9.getTiles(projection2);
80711     tiles.forEach(function(tile) {
80712       loadTile4(which, url, tile);
80713     });
80714   }
80715   function loadTile4(which, url, tile) {
80716     const cache = _mlyCache2.requests;
80717     const tileId = `${tile.id}-${which}`;
80718     if (cache.loaded[tileId] || cache.inflight[tileId])
80719       return;
80720     const controller = new AbortController();
80721     cache.inflight[tileId] = controller;
80722     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
80723     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
80724       if (!response.ok) {
80725         throw new Error(response.status + " " + response.statusText);
80726       }
80727       cache.loaded[tileId] = true;
80728       delete cache.inflight[tileId];
80729       return response.arrayBuffer();
80730     }).then(function(data) {
80731       if (data.byteLength === 0) {
80732         throw new Error("No Data");
80733       }
80734       loadTileDataToCache2(data, tile, which);
80735       if (which === "images") {
80736         dispatch13.call("loadedImages");
80737       } else {
80738         dispatch13.call("loadedLines");
80739       }
80740     }).catch(function(e3) {
80741       if (e3.message === "No Data") {
80742         cache.loaded[tileId] = true;
80743       } else {
80744         console.error(e3);
80745       }
80746     });
80747   }
80748   function loadTileDataToCache2(data, tile) {
80749     const vectorTile = new import_vector_tile3.VectorTile(new import_pbf3.default(data));
80750     let features, cache, layer, i3, feature3, loc, d2;
80751     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
80752       features = [];
80753       cache = _mlyCache2.images;
80754       layer = vectorTile.layers[pointLayer];
80755       for (i3 = 0; i3 < layer.length; i3++) {
80756         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80757         loc = feature3.geometry.coordinates;
80758         let resolutionArr = feature3.properties.resolution.split("x");
80759         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
80760         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
80761         let isPano = sourceWidth % sourceHeight === 0;
80762         d2 = {
80763           loc,
80764           capture_time: feature3.properties.capture_time,
80765           id: feature3.properties.id,
80766           sequence_id: feature3.properties.sequence_uuid,
80767           heading: feature3.properties.heading,
80768           resolution: feature3.properties.resolution,
80769           isPano
80770         };
80771         cache.forImageId[d2.id] = d2;
80772         features.push({
80773           minX: loc[0],
80774           minY: loc[1],
80775           maxX: loc[0],
80776           maxY: loc[1],
80777           data: d2
80778         });
80779       }
80780       if (cache.rtree) {
80781         cache.rtree.load(features);
80782       }
80783     }
80784     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
80785       cache = _mlyCache2.sequences;
80786       layer = vectorTile.layers[lineLayer];
80787       for (i3 = 0; i3 < layer.length; i3++) {
80788         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80789         if (cache.lineString[feature3.properties.sequence_uuid]) {
80790           cache.lineString[feature3.properties.sequence_uuid].push(feature3);
80791         } else {
80792           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
80793         }
80794       }
80795     }
80796   }
80797   function getImageData(imageId, sequenceId) {
80798     return fetch(apiUrl2 + `/api/sequence-detail?sequence_uuid=${sequenceId}`, { method: "GET" }).then(function(response) {
80799       if (!response.ok) {
80800         throw new Error(response.status + " " + response.statusText);
80801       }
80802       return response.json();
80803     }).then(function(data) {
80804       let index = data.data.findIndex((feature3) => feature3.id === imageId);
80805       const { filename, uploaded_hash } = data.data[index];
80806       _mlySceneOptions.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
80807     });
80808   }
80809   var mapilio_default = {
80810     // Initialize Mapilio
80811     init: function() {
80812       if (!_mlyCache2) {
80813         this.reset();
80814       }
80815       this.event = utilRebind(this, dispatch13, "on");
80816     },
80817     // Reset cache and state
80818     reset: function() {
80819       if (_mlyCache2) {
80820         Object.values(_mlyCache2.requests.inflight).forEach(function(request3) {
80821           request3.abort();
80822         });
80823       }
80824       _mlyCache2 = {
80825         images: { rtree: new import_rbush12.default(), forImageId: {} },
80826         sequences: { rtree: new import_rbush12.default(), lineString: {} },
80827         requests: { loaded: {}, inflight: {} }
80828       };
80829       _mlyActiveImage2 = null;
80830     },
80831     // Get visible images
80832     images: function(projection2) {
80833       const limit = 5;
80834       return searchLimited5(limit, projection2, _mlyCache2.images.rtree);
80835     },
80836     cachedImage: function(imageKey) {
80837       return _mlyCache2.images.forImageId[imageKey];
80838     },
80839     // Load images in the visible area
80840     loadImages: function(projection2) {
80841       let url = baseTileUrl2 + pointLayer + tileStyle;
80842       loadTiles4("images", url, 14, projection2);
80843     },
80844     // Load line in the visible area
80845     loadLines: function(projection2) {
80846       let url = baseTileUrl2 + lineLayer + tileStyle;
80847       loadTiles4("line", url, 14, projection2);
80848     },
80849     // Get visible sequences
80850     sequences: function(projection2) {
80851       const viewport = projection2.clipExtent();
80852       const min3 = [viewport[0][0], viewport[1][1]];
80853       const max3 = [viewport[1][0], viewport[0][1]];
80854       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
80855       const sequenceIds = {};
80856       let lineStrings = [];
80857       _mlyCache2.images.rtree.search(bbox2).forEach(function(d2) {
80858         if (d2.data.sequence_id) {
80859           sequenceIds[d2.data.sequence_id] = true;
80860         }
80861       });
80862       Object.keys(sequenceIds).forEach(function(sequenceId) {
80863         if (_mlyCache2.sequences.lineString[sequenceId]) {
80864           lineStrings = lineStrings.concat(_mlyCache2.sequences.lineString[sequenceId]);
80865         }
80866       });
80867       return lineStrings;
80868     },
80869     // Set the currently visible image
80870     setActiveImage: function(image) {
80871       if (image) {
80872         _mlyActiveImage2 = {
80873           id: image.id,
80874           sequence_id: image.sequence_id
80875         };
80876       } else {
80877         _mlyActiveImage2 = null;
80878       }
80879     },
80880     // Update the currently highlighted sequence and selected bubble.
80881     setStyles: function(context, hovered) {
80882       const hoveredImageId = hovered && hovered.id;
80883       const hoveredSequenceId = hovered && hovered.sequence_id;
80884       const selectedSequenceId = _mlyActiveImage2 && _mlyActiveImage2.sequence_id;
80885       const selectedImageId = _mlyActiveImage2 && _mlyActiveImage2.id;
80886       const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
80887       const sequences = context.container().selectAll(".layer-mapilio .sequence");
80888       markers.classed("highlighted", function(d2) {
80889         return d2.id === hoveredImageId;
80890       }).classed("hovered", function(d2) {
80891         return d2.id === hoveredImageId;
80892       }).classed("currentView", function(d2) {
80893         return d2.id === selectedImageId;
80894       });
80895       sequences.classed("highlighted", function(d2) {
80896         return d2.properties.sequence_uuid === hoveredSequenceId;
80897       }).classed("currentView", function(d2) {
80898         return d2.properties.sequence_uuid === selectedSequenceId;
80899       });
80900       return this;
80901     },
80902     updateUrlImage: function(imageKey) {
80903       if (!window.mocha) {
80904         var hash = utilStringQs(window.location.hash);
80905         if (imageKey) {
80906           hash.photo = "mapilio/" + imageKey;
80907         } else {
80908           delete hash.photo;
80909         }
80910         window.location.replace("#" + utilQsString(hash, true));
80911       }
80912     },
80913     initViewer: function() {
80914       if (!window.pannellum)
80915         return;
80916       if (_pannellumViewer3)
80917         return;
80918       _currScene2 += 1;
80919       const sceneID = _currScene2.toString();
80920       const options2 = {
80921         "default": { firstScene: sceneID },
80922         scenes: {}
80923       };
80924       options2.scenes[sceneID] = _mlySceneOptions;
80925       _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
80926     },
80927     selectImage: function(context, id2) {
80928       let that = this;
80929       let d2 = this.cachedImage(id2);
80930       this.setActiveImage(d2);
80931       this.updateUrlImage(d2.id);
80932       let viewer = context.container().select(".photoviewer");
80933       if (!viewer.empty())
80934         viewer.datum(d2);
80935       this.setStyles(context, null);
80936       if (!d2)
80937         return this;
80938       let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
80939       let attribution = wrap2.selectAll(".photo-attribution").text("");
80940       if (d2.capture_time) {
80941         attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
80942         attribution.append("span").text("|");
80943       }
80944       attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", `https://mapilio.com/app?lat=${d2.loc[1]}&lng=${d2.loc[0]}&zoom=17&pId=${d2.id}`).text("mapilio.com");
80945       wrap2.transition().duration(100).call(imgZoom3.transform, identity2);
80946       wrap2.selectAll("img").remove();
80947       getImageData(d2.id, d2.sequence_id).then(function() {
80948         if (d2.isPano) {
80949           if (!_pannellumViewer3) {
80950             that.initViewer();
80951           } else {
80952             _currScene2 += 1;
80953             let sceneID = _currScene2.toString();
80954             _pannellumViewer3.addScene(sceneID, _mlySceneOptions).loadScene(sceneID);
80955             if (_currScene2 > 2) {
80956               sceneID = (_currScene2 - 1).toString();
80957               _pannellumViewer3.removeScene(sceneID);
80958             }
80959           }
80960         } else {
80961           that.initOnlyPhoto(context);
80962         }
80963       });
80964       function localeDateString2(s2) {
80965         if (!s2)
80966           return null;
80967         var options2 = { day: "numeric", month: "short", year: "numeric" };
80968         var d4 = new Date(s2);
80969         if (isNaN(d4.getTime()))
80970           return null;
80971         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
80972       }
80973       return this;
80974     },
80975     initOnlyPhoto: function(context) {
80976       if (_pannellumViewer3) {
80977         _pannellumViewer3.destroy();
80978         _pannellumViewer3 = null;
80979       }
80980       let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
80981       let imgWrap = wrap2.select("img");
80982       if (!imgWrap.empty()) {
80983         imgWrap.attr("src", _mlySceneOptions.panorama);
80984       } else {
80985         wrap2.append("img").attr("src", _mlySceneOptions.panorama);
80986       }
80987     },
80988     ensureViewerLoaded: function(context) {
80989       let that = this;
80990       let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
80991       if (!imgWrap.empty()) {
80992         imgWrap.remove();
80993       }
80994       if (_loadViewerPromise5)
80995         return _loadViewerPromise5;
80996       let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
80997       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
80998       wrapEnter.append("div").attr("class", "photo-attribution fillD");
80999       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
81000       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
81001       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
81002       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
81003       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom3.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
81004       context.ui().photoviewer.on("resize.mapilio", () => {
81005         if (_pannellumViewer3) {
81006           _pannellumViewer3.resize();
81007         }
81008       });
81009       _loadViewerPromise5 = new Promise((resolve, reject) => {
81010         let loadedCount = 0;
81011         function loaded() {
81012           loadedCount += 1;
81013           if (loadedCount === 2)
81014             resolve();
81015         }
81016         const head = select_default2("head");
81017         head.selectAll("#ideditor-mapilio-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapilio-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
81018           reject();
81019         });
81020         head.selectAll("#ideditor-mapilio-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapilio-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
81021           reject();
81022         });
81023       }).catch(function() {
81024         _loadViewerPromise5 = null;
81025       });
81026       function step(stepBy) {
81027         return function() {
81028           if (!_mlyActiveImage2)
81029             return;
81030           const imageId = _mlyActiveImage2.id;
81031           const nextIndex = imageId + stepBy;
81032           if (!nextIndex)
81033             return;
81034           const nextImage = _mlyCache2.images.forImageId[nextIndex];
81035           context.map().centerEase(nextImage.loc);
81036           that.selectImage(context, nextImage.id);
81037         };
81038       }
81039       function zoomPan2(d3_event) {
81040         var t2 = d3_event.transform;
81041         context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
81042       }
81043       return _loadViewerPromise5;
81044     },
81045     showViewer: function(context) {
81046       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
81047       let isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
81048       if (isHidden) {
81049         wrap2.selectAll(".photo-wrapper:not(.mapilio-wrapper)").classed("hide", true);
81050         wrap2.selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
81051       }
81052       return this;
81053     },
81054     /**
81055      * hideViewer()
81056      */
81057     hideViewer: function(context) {
81058       let viewer = context.container().select(".photoviewer");
81059       if (!viewer.empty())
81060         viewer.datum(null);
81061       this.updateUrlImage(null);
81062       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
81063       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
81064       this.setActiveImage();
81065       return this.setStyles(context, null);
81066     },
81067     // Return the current cache
81068     cache: function() {
81069       return _mlyCache2;
81070     }
81071   };
81072
81073   // modules/services/index.js
81074   var services = {
81075     geocoder: nominatim_default,
81076     keepRight: keepRight_default,
81077     improveOSM: improveOSM_default,
81078     osmose: osmose_default,
81079     mapillary: mapillary_default,
81080     nsi: nsi_default,
81081     kartaview: kartaview_default,
81082     vegbilder: vegbilder_default,
81083     osm: osm_default,
81084     osmWikibase: osm_wikibase_default,
81085     maprules: maprules_default,
81086     streetside: streetside_default,
81087     taginfo: taginfo_default,
81088     vectorTile: vector_tile_default,
81089     wikidata: wikidata_default,
81090     wikipedia: wikipedia_default,
81091     mapilio: mapilio_default
81092   };
81093
81094   // modules/modes/drag_note.js
81095   function modeDragNote(context) {
81096     var mode = {
81097       id: "drag-note",
81098       button: "browse"
81099     };
81100     var edit2 = behaviorEdit(context);
81101     var _nudgeInterval;
81102     var _lastLoc;
81103     var _note;
81104     function startNudge(d3_event, nudge) {
81105       if (_nudgeInterval)
81106         window.clearInterval(_nudgeInterval);
81107       _nudgeInterval = window.setInterval(function() {
81108         context.map().pan(nudge);
81109         doMove(d3_event, nudge);
81110       }, 50);
81111     }
81112     function stopNudge() {
81113       if (_nudgeInterval) {
81114         window.clearInterval(_nudgeInterval);
81115         _nudgeInterval = null;
81116       }
81117     }
81118     function origin(note) {
81119       return context.projection(note.loc);
81120     }
81121     function start2(d3_event, note) {
81122       _note = note;
81123       var osm = services.osm;
81124       if (osm) {
81125         _note = osm.getNote(_note.id);
81126       }
81127       context.surface().selectAll(".note-" + _note.id).classed("active", true);
81128       context.perform(actionNoop());
81129       context.enter(mode);
81130       context.selectedNoteID(_note.id);
81131     }
81132     function move(d3_event, entity, point2) {
81133       d3_event.stopPropagation();
81134       _lastLoc = context.projection.invert(point2);
81135       doMove(d3_event);
81136       var nudge = geoViewportEdge(point2, context.map().dimensions());
81137       if (nudge) {
81138         startNudge(d3_event, nudge);
81139       } else {
81140         stopNudge();
81141       }
81142     }
81143     function doMove(d3_event, nudge) {
81144       nudge = nudge || [0, 0];
81145       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
81146       var currMouse = geoVecSubtract(currPoint, nudge);
81147       var loc = context.projection.invert(currMouse);
81148       _note = _note.move(loc);
81149       var osm = services.osm;
81150       if (osm) {
81151         osm.replaceNote(_note);
81152       }
81153       context.replace(actionNoop());
81154     }
81155     function end() {
81156       context.replace(actionNoop());
81157       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
81158     }
81159     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);
81160     mode.enter = function() {
81161       context.install(edit2);
81162     };
81163     mode.exit = function() {
81164       context.ui().sidebar.hover.cancel();
81165       context.uninstall(edit2);
81166       context.surface().selectAll(".active").classed("active", false);
81167       stopNudge();
81168     };
81169     mode.behavior = drag;
81170     return mode;
81171   }
81172
81173   // modules/modes/select_data.js
81174   function modeSelectData(context, selectedDatum) {
81175     var mode = {
81176       id: "select-data",
81177       button: "browse"
81178     };
81179     var keybinding = utilKeybinding("select-data");
81180     var dataEditor = uiDataEditor(context);
81181     var behaviors = [
81182       behaviorBreathe(context),
81183       behaviorHover(context),
81184       behaviorSelect(context),
81185       behaviorLasso(context),
81186       modeDragNode(context).behavior,
81187       modeDragNote(context).behavior
81188     ];
81189     function selectData(d3_event, drawn) {
81190       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
81191       if (selection2.empty()) {
81192         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
81193         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
81194           context.enter(modeBrowse(context));
81195         }
81196       } else {
81197         selection2.classed("selected", true);
81198       }
81199     }
81200     function esc() {
81201       if (context.container().select(".combobox").size())
81202         return;
81203       context.enter(modeBrowse(context));
81204     }
81205     mode.zoomToSelected = function() {
81206       var extent = geoExtent(bounds_default(selectedDatum));
81207       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
81208     };
81209     mode.enter = function() {
81210       behaviors.forEach(context.install);
81211       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
81212       select_default2(document).call(keybinding);
81213       selectData();
81214       var sidebar = context.ui().sidebar;
81215       sidebar.show(dataEditor.datum(selectedDatum));
81216       var extent = geoExtent(bounds_default(selectedDatum));
81217       sidebar.expand(sidebar.intersects(extent));
81218       context.map().on("drawn.select-data", selectData);
81219     };
81220     mode.exit = function() {
81221       behaviors.forEach(context.uninstall);
81222       select_default2(document).call(keybinding.unbind);
81223       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
81224       context.map().on("drawn.select-data", null);
81225       context.ui().sidebar.hide();
81226     };
81227     return mode;
81228   }
81229
81230   // modules/behavior/select.js
81231   function behaviorSelect(context) {
81232     var _tolerancePx = 4;
81233     var _lastMouseEvent = null;
81234     var _showMenu = false;
81235     var _downPointers = {};
81236     var _longPressTimeout = null;
81237     var _lastInteractionType = null;
81238     var _multiselectionPointerId = null;
81239     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
81240     function keydown(d3_event) {
81241       if (d3_event.keyCode === 32) {
81242         var activeNode = document.activeElement;
81243         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
81244           return;
81245       }
81246       if (d3_event.keyCode === 93 || // context menu key
81247       d3_event.keyCode === 32) {
81248         d3_event.preventDefault();
81249       }
81250       if (d3_event.repeat)
81251         return;
81252       cancelLongPress();
81253       if (d3_event.shiftKey) {
81254         context.surface().classed("behavior-multiselect", true);
81255       }
81256       if (d3_event.keyCode === 32) {
81257         if (!_downPointers.spacebar && _lastMouseEvent) {
81258           cancelLongPress();
81259           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
81260           _downPointers.spacebar = {
81261             firstEvent: _lastMouseEvent,
81262             lastEvent: _lastMouseEvent
81263           };
81264         }
81265       }
81266     }
81267     function keyup(d3_event) {
81268       cancelLongPress();
81269       if (!d3_event.shiftKey) {
81270         context.surface().classed("behavior-multiselect", false);
81271       }
81272       if (d3_event.keyCode === 93) {
81273         d3_event.preventDefault();
81274         _lastInteractionType = "menukey";
81275         contextmenu(d3_event);
81276       } else if (d3_event.keyCode === 32) {
81277         var pointer = _downPointers.spacebar;
81278         if (pointer) {
81279           delete _downPointers.spacebar;
81280           if (pointer.done)
81281             return;
81282           d3_event.preventDefault();
81283           _lastInteractionType = "spacebar";
81284           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
81285         }
81286       }
81287     }
81288     function pointerdown(d3_event) {
81289       var id2 = (d3_event.pointerId || "mouse").toString();
81290       cancelLongPress();
81291       if (d3_event.buttons && d3_event.buttons !== 1)
81292         return;
81293       context.ui().closeEditMenu();
81294       if (d3_event.pointerType !== "mouse") {
81295         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
81296       }
81297       _downPointers[id2] = {
81298         firstEvent: d3_event,
81299         lastEvent: d3_event
81300       };
81301     }
81302     function didLongPress(id2, interactionType) {
81303       var pointer = _downPointers[id2];
81304       if (!pointer)
81305         return;
81306       for (var i3 in _downPointers) {
81307         _downPointers[i3].done = true;
81308       }
81309       _longPressTimeout = null;
81310       _lastInteractionType = interactionType;
81311       _showMenu = true;
81312       click(pointer.firstEvent, pointer.lastEvent, id2);
81313     }
81314     function pointermove(d3_event) {
81315       var id2 = (d3_event.pointerId || "mouse").toString();
81316       if (_downPointers[id2]) {
81317         _downPointers[id2].lastEvent = d3_event;
81318       }
81319       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
81320         _lastMouseEvent = d3_event;
81321         if (_downPointers.spacebar) {
81322           _downPointers.spacebar.lastEvent = d3_event;
81323         }
81324       }
81325     }
81326     function pointerup(d3_event) {
81327       var id2 = (d3_event.pointerId || "mouse").toString();
81328       var pointer = _downPointers[id2];
81329       if (!pointer)
81330         return;
81331       delete _downPointers[id2];
81332       if (_multiselectionPointerId === id2) {
81333         _multiselectionPointerId = null;
81334       }
81335       if (pointer.done)
81336         return;
81337       click(pointer.firstEvent, d3_event, id2);
81338     }
81339     function pointercancel(d3_event) {
81340       var id2 = (d3_event.pointerId || "mouse").toString();
81341       if (!_downPointers[id2])
81342         return;
81343       delete _downPointers[id2];
81344       if (_multiselectionPointerId === id2) {
81345         _multiselectionPointerId = null;
81346       }
81347     }
81348     function contextmenu(d3_event) {
81349       d3_event.preventDefault();
81350       if (!+d3_event.clientX && !+d3_event.clientY) {
81351         if (_lastMouseEvent) {
81352           d3_event = _lastMouseEvent;
81353         } else {
81354           return;
81355         }
81356       } else {
81357         _lastMouseEvent = d3_event;
81358         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
81359         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
81360           _lastInteractionType = "touch";
81361         } else {
81362           _lastInteractionType = "rightclick";
81363         }
81364       }
81365       _showMenu = true;
81366       click(d3_event, d3_event);
81367     }
81368     function click(firstEvent, lastEvent, pointerId) {
81369       cancelLongPress();
81370       var mapNode = context.container().select(".main-map").node();
81371       var pointGetter = utilFastMouse(mapNode);
81372       var p1 = pointGetter(firstEvent);
81373       var p2 = pointGetter(lastEvent);
81374       var dist = geoVecLength(p1, p2);
81375       if (dist > _tolerancePx || !mapContains(lastEvent)) {
81376         resetProperties();
81377         return;
81378       }
81379       var targetDatum = lastEvent.target.__data__;
81380       var multiselectEntityId;
81381       if (!_multiselectionPointerId) {
81382         var selectPointerInfo = pointerDownOnSelection(pointerId);
81383         if (selectPointerInfo) {
81384           _multiselectionPointerId = selectPointerInfo.pointerId;
81385           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
81386           _downPointers[selectPointerInfo.pointerId].done = true;
81387         }
81388       }
81389       var isMultiselect = context.mode().id === "select" && // and shift key is down
81390       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
81391       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
81392       _multiselectionPointerId && !multiselectEntityId);
81393       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
81394       function mapContains(event) {
81395         var rect = mapNode.getBoundingClientRect();
81396         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
81397       }
81398       function pointerDownOnSelection(skipPointerId) {
81399         var mode = context.mode();
81400         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
81401         for (var pointerId2 in _downPointers) {
81402           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
81403             continue;
81404           var pointerInfo = _downPointers[pointerId2];
81405           var p12 = pointGetter(pointerInfo.firstEvent);
81406           var p22 = pointGetter(pointerInfo.lastEvent);
81407           if (geoVecLength(p12, p22) > _tolerancePx)
81408             continue;
81409           var datum2 = pointerInfo.firstEvent.target.__data__;
81410           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
81411           if (context.graph().hasEntity(entity.id)) {
81412             return {
81413               pointerId: pointerId2,
81414               entityId: entity.id,
81415               selected: selectedIDs.indexOf(entity.id) !== -1
81416             };
81417           }
81418         }
81419         return null;
81420       }
81421     }
81422     function processClick(datum2, isMultiselect, point2, alsoSelectId) {
81423       var mode = context.mode();
81424       var showMenu = _showMenu;
81425       var interactionType = _lastInteractionType;
81426       var entity = datum2 && datum2.properties && datum2.properties.entity;
81427       if (entity)
81428         datum2 = entity;
81429       if (datum2 && datum2.type === "midpoint") {
81430         datum2 = datum2.parents[0];
81431       }
81432       var newMode;
81433       if (datum2 instanceof osmEntity) {
81434         var selectedIDs = context.selectedIDs();
81435         context.selectedNoteID(null);
81436         context.selectedErrorID(null);
81437         if (!isMultiselect) {
81438           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
81439             if (alsoSelectId === datum2.id)
81440               alsoSelectId = null;
81441             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
81442             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
81443             context.enter(newMode);
81444           }
81445         } else {
81446           if (selectedIDs.indexOf(datum2.id) !== -1) {
81447             if (!showMenu) {
81448               selectedIDs = selectedIDs.filter(function(id2) {
81449                 return id2 !== datum2.id;
81450               });
81451               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
81452               context.enter(newMode);
81453             }
81454           } else {
81455             selectedIDs = selectedIDs.concat([datum2.id]);
81456             newMode = mode.selectedIDs(selectedIDs);
81457             context.enter(newMode);
81458           }
81459         }
81460       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
81461         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
81462       } else if (datum2 instanceof osmNote && !isMultiselect) {
81463         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
81464       } else if (datum2 instanceof QAItem && !isMultiselect) {
81465         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
81466       } else {
81467         context.selectedNoteID(null);
81468         context.selectedErrorID(null);
81469         if (!isMultiselect && mode.id !== "browse") {
81470           context.enter(modeBrowse(context));
81471         }
81472       }
81473       context.ui().closeEditMenu();
81474       if (showMenu)
81475         context.ui().showEditMenu(point2, interactionType);
81476       resetProperties();
81477     }
81478     function cancelLongPress() {
81479       if (_longPressTimeout)
81480         window.clearTimeout(_longPressTimeout);
81481       _longPressTimeout = null;
81482     }
81483     function resetProperties() {
81484       cancelLongPress();
81485       _showMenu = false;
81486       _lastInteractionType = null;
81487     }
81488     function behavior(selection2) {
81489       resetProperties();
81490       _lastMouseEvent = context.map().lastPointerEvent();
81491       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) {
81492         var e3 = d3_event;
81493         if (+e3.clientX === 0 && +e3.clientY === 0) {
81494           d3_event.preventDefault();
81495         }
81496       });
81497       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
81498     }
81499     behavior.off = function(selection2) {
81500       cancelLongPress();
81501       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);
81502       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
81503       context.surface().classed("behavior-multiselect", false);
81504     };
81505     return behavior;
81506   }
81507
81508   // modules/operations/index.js
81509   var operations_exports = {};
81510   __export(operations_exports, {
81511     operationCircularize: () => operationCircularize,
81512     operationContinue: () => operationContinue,
81513     operationCopy: () => operationCopy,
81514     operationDelete: () => operationDelete,
81515     operationDisconnect: () => operationDisconnect,
81516     operationDowngrade: () => operationDowngrade,
81517     operationExtract: () => operationExtract,
81518     operationMerge: () => operationMerge,
81519     operationMove: () => operationMove,
81520     operationOrthogonalize: () => operationOrthogonalize,
81521     operationPaste: () => operationPaste,
81522     operationReflectLong: () => operationReflectLong,
81523     operationReflectShort: () => operationReflectShort,
81524     operationReverse: () => operationReverse,
81525     operationRotate: () => operationRotate,
81526     operationSplit: () => operationSplit,
81527     operationStraighten: () => operationStraighten
81528   });
81529
81530   // modules/operations/continue.js
81531   function operationContinue(context, selectedIDs) {
81532     var _entities = selectedIDs.map(function(id2) {
81533       return context.graph().entity(id2);
81534     });
81535     var _geometries = Object.assign(
81536       { line: [], vertex: [] },
81537       utilArrayGroupBy(_entities, function(entity) {
81538         return entity.geometry(context.graph());
81539       })
81540     );
81541     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
81542     function candidateWays() {
81543       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
81544         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
81545       }) : [];
81546     }
81547     var _candidates = candidateWays();
81548     var operation = function() {
81549       var candidate = _candidates[0];
81550       context.enter(
81551         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
81552       );
81553     };
81554     operation.relatedEntityIds = function() {
81555       return _candidates.length ? [_candidates[0].id] : [];
81556     };
81557     operation.available = function() {
81558       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
81559     };
81560     operation.disabled = function() {
81561       if (_candidates.length === 0) {
81562         return "not_eligible";
81563       } else if (_candidates.length > 1) {
81564         return "multiple";
81565       }
81566       return false;
81567     };
81568     operation.tooltip = function() {
81569       var disable = operation.disabled();
81570       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
81571     };
81572     operation.annotation = function() {
81573       return _t("operations.continue.annotation.line");
81574     };
81575     operation.id = "continue";
81576     operation.keys = [_t("operations.continue.key")];
81577     operation.title = _t.append("operations.continue.title");
81578     operation.behavior = behaviorOperation(context).which(operation);
81579     return operation;
81580   }
81581
81582   // modules/operations/copy.js
81583   function operationCopy(context, selectedIDs) {
81584     function getFilteredIdsToCopy() {
81585       return selectedIDs.filter(function(selectedID) {
81586         var entity = context.graph().hasEntity(selectedID);
81587         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
81588       });
81589     }
81590     var operation = function() {
81591       var graph = context.graph();
81592       var selected = groupEntities(getFilteredIdsToCopy(), graph);
81593       var canCopy = [];
81594       var skip = {};
81595       var entity;
81596       var i3;
81597       for (i3 = 0; i3 < selected.relation.length; i3++) {
81598         entity = selected.relation[i3];
81599         if (!skip[entity.id] && entity.isComplete(graph)) {
81600           canCopy.push(entity.id);
81601           skip = getDescendants(entity.id, graph, skip);
81602         }
81603       }
81604       for (i3 = 0; i3 < selected.way.length; i3++) {
81605         entity = selected.way[i3];
81606         if (!skip[entity.id]) {
81607           canCopy.push(entity.id);
81608           skip = getDescendants(entity.id, graph, skip);
81609         }
81610       }
81611       for (i3 = 0; i3 < selected.node.length; i3++) {
81612         entity = selected.node[i3];
81613         if (!skip[entity.id]) {
81614           canCopy.push(entity.id);
81615         }
81616       }
81617       context.copyIDs(canCopy);
81618       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
81619         context.copyLonLat(context.projection.invert(_point));
81620       } else {
81621         context.copyLonLat(null);
81622       }
81623     };
81624     function groupEntities(ids, graph) {
81625       var entities = ids.map(function(id2) {
81626         return graph.entity(id2);
81627       });
81628       return Object.assign(
81629         { relation: [], way: [], node: [] },
81630         utilArrayGroupBy(entities, "type")
81631       );
81632     }
81633     function getDescendants(id2, graph, descendants) {
81634       var entity = graph.entity(id2);
81635       var children2;
81636       descendants = descendants || {};
81637       if (entity.type === "relation") {
81638         children2 = entity.members.map(function(m2) {
81639           return m2.id;
81640         });
81641       } else if (entity.type === "way") {
81642         children2 = entity.nodes;
81643       } else {
81644         children2 = [];
81645       }
81646       for (var i3 = 0; i3 < children2.length; i3++) {
81647         if (!descendants[children2[i3]]) {
81648           descendants[children2[i3]] = true;
81649           descendants = getDescendants(children2[i3], graph, descendants);
81650         }
81651       }
81652       return descendants;
81653     }
81654     operation.available = function() {
81655       return getFilteredIdsToCopy().length > 0;
81656     };
81657     operation.disabled = function() {
81658       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
81659       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
81660         return "too_large";
81661       }
81662       return false;
81663     };
81664     operation.availableForKeypress = function() {
81665       var selection2 = window.getSelection && window.getSelection();
81666       return !selection2 || !selection2.toString();
81667     };
81668     operation.tooltip = function() {
81669       var disable = operation.disabled();
81670       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
81671     };
81672     operation.annotation = function() {
81673       return _t("operations.copy.annotation", { n: selectedIDs.length });
81674     };
81675     var _point;
81676     operation.point = function(val) {
81677       _point = val;
81678       return operation;
81679     };
81680     operation.id = "copy";
81681     operation.keys = [uiCmd("\u2318C")];
81682     operation.title = _t.append("operations.copy.title");
81683     operation.behavior = behaviorOperation(context).which(operation);
81684     return operation;
81685   }
81686
81687   // modules/operations/disconnect.js
81688   function operationDisconnect(context, selectedIDs) {
81689     var _vertexIDs = [];
81690     var _wayIDs = [];
81691     var _otherIDs = [];
81692     var _actions = [];
81693     selectedIDs.forEach(function(id2) {
81694       var entity = context.entity(id2);
81695       if (entity.type === "way") {
81696         _wayIDs.push(id2);
81697       } else if (entity.geometry(context.graph()) === "vertex") {
81698         _vertexIDs.push(id2);
81699       } else {
81700         _otherIDs.push(id2);
81701       }
81702     });
81703     var _coords, _descriptionID = "", _annotationID = "features";
81704     var _disconnectingVertexIds = [];
81705     var _disconnectingWayIds = [];
81706     if (_vertexIDs.length > 0) {
81707       _disconnectingVertexIds = _vertexIDs;
81708       _vertexIDs.forEach(function(vertexID) {
81709         var action = actionDisconnect(vertexID);
81710         if (_wayIDs.length > 0) {
81711           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
81712             var way = context.entity(wayID);
81713             return way.nodes.indexOf(vertexID) !== -1;
81714           });
81715           action.limitWays(waysIDsForVertex);
81716         }
81717         _actions.push(action);
81718         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
81719       });
81720       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
81721         return _wayIDs.indexOf(id2) === -1;
81722       });
81723       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
81724       if (_wayIDs.length === 1) {
81725         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
81726       } else {
81727         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
81728       }
81729     } else if (_wayIDs.length > 0) {
81730       var ways = _wayIDs.map(function(id2) {
81731         return context.entity(id2);
81732       });
81733       var nodes = utilGetAllNodes(_wayIDs, context.graph());
81734       _coords = nodes.map(function(n3) {
81735         return n3.loc;
81736       });
81737       var sharedActions = [];
81738       var sharedNodes = [];
81739       var unsharedActions = [];
81740       var unsharedNodes = [];
81741       nodes.forEach(function(node) {
81742         var action = actionDisconnect(node.id).limitWays(_wayIDs);
81743         if (action.disabled(context.graph()) !== "not_connected") {
81744           var count = 0;
81745           for (var i3 in ways) {
81746             var way = ways[i3];
81747             if (way.nodes.indexOf(node.id) !== -1) {
81748               count += 1;
81749             }
81750             if (count > 1)
81751               break;
81752           }
81753           if (count > 1) {
81754             sharedActions.push(action);
81755             sharedNodes.push(node);
81756           } else {
81757             unsharedActions.push(action);
81758             unsharedNodes.push(node);
81759           }
81760         }
81761       });
81762       _descriptionID += "no_points.";
81763       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
81764       if (sharedActions.length) {
81765         _actions = sharedActions;
81766         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
81767         _descriptionID += "conjoined";
81768         _annotationID = "from_each_other";
81769       } else {
81770         _actions = unsharedActions;
81771         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
81772         if (_wayIDs.length === 1) {
81773           _descriptionID += context.graph().geometry(_wayIDs[0]);
81774         } else {
81775           _descriptionID += "separate";
81776         }
81777       }
81778     }
81779     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
81780     var operation = function() {
81781       context.perform(function(graph) {
81782         return _actions.reduce(function(graph2, action) {
81783           return action(graph2);
81784         }, graph);
81785       }, operation.annotation());
81786       context.validator().validate();
81787     };
81788     operation.relatedEntityIds = function() {
81789       if (_vertexIDs.length) {
81790         return _disconnectingWayIds;
81791       }
81792       return _disconnectingVertexIds;
81793     };
81794     operation.available = function() {
81795       if (_actions.length === 0)
81796         return false;
81797       if (_otherIDs.length !== 0)
81798         return false;
81799       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
81800         return _vertexIDs.some(function(vertexID) {
81801           var way = context.entity(wayID);
81802           return way.nodes.indexOf(vertexID) !== -1;
81803         });
81804       }))
81805         return false;
81806       return true;
81807     };
81808     operation.disabled = function() {
81809       var reason;
81810       for (var actionIndex in _actions) {
81811         reason = _actions[actionIndex].disabled(context.graph());
81812         if (reason)
81813           return reason;
81814       }
81815       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
81816         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
81817       } else if (_coords && someMissing()) {
81818         return "not_downloaded";
81819       } else if (selectedIDs.some(context.hasHiddenConnections)) {
81820         return "connected_to_hidden";
81821       }
81822       return false;
81823       function someMissing() {
81824         if (context.inIntro())
81825           return false;
81826         var osm = context.connection();
81827         if (osm) {
81828           var missing = _coords.filter(function(loc) {
81829             return !osm.isDataLoaded(loc);
81830           });
81831           if (missing.length) {
81832             missing.forEach(function(loc) {
81833               context.loadTileAtLoc(loc);
81834             });
81835             return true;
81836           }
81837         }
81838         return false;
81839       }
81840     };
81841     operation.tooltip = function() {
81842       var disable = operation.disabled();
81843       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
81844     };
81845     operation.annotation = function() {
81846       return _t("operations.disconnect.annotation." + _annotationID);
81847     };
81848     operation.id = "disconnect";
81849     operation.keys = [_t("operations.disconnect.key")];
81850     operation.title = _t.append("operations.disconnect.title");
81851     operation.behavior = behaviorOperation(context).which(operation);
81852     return operation;
81853   }
81854
81855   // modules/operations/downgrade.js
81856   function operationDowngrade(context, selectedIDs) {
81857     var _affectedFeatureCount = 0;
81858     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
81859     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
81860     function downgradeTypeForEntityIDs(entityIds) {
81861       var downgradeType;
81862       _affectedFeatureCount = 0;
81863       for (var i3 in entityIds) {
81864         var entityID = entityIds[i3];
81865         var type2 = downgradeTypeForEntityID(entityID);
81866         if (type2) {
81867           _affectedFeatureCount += 1;
81868           if (downgradeType && type2 !== downgradeType) {
81869             if (downgradeType !== "generic" && type2 !== "generic") {
81870               downgradeType = "building_address";
81871             } else {
81872               downgradeType = "generic";
81873             }
81874           } else {
81875             downgradeType = type2;
81876           }
81877         }
81878       }
81879       return downgradeType;
81880     }
81881     function downgradeTypeForEntityID(entityID) {
81882       var graph = context.graph();
81883       var entity = graph.entity(entityID);
81884       var preset = _mainPresetIndex.match(entity, graph);
81885       if (!preset || preset.isFallback())
81886         return null;
81887       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
81888         return key.match(/^addr:.{1,}/);
81889       })) {
81890         return "address";
81891       }
81892       var geometry = entity.geometry(graph);
81893       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
81894         return "building";
81895       }
81896       if (geometry === "vertex" && Object.keys(entity.tags).length) {
81897         return "generic";
81898       }
81899       return null;
81900     }
81901     var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
81902     var addressKeysToKeep = ["source"];
81903     var operation = function() {
81904       context.perform(function(graph) {
81905         for (var i3 in selectedIDs) {
81906           var entityID = selectedIDs[i3];
81907           var type2 = downgradeTypeForEntityID(entityID);
81908           if (!type2)
81909             continue;
81910           var tags = Object.assign({}, graph.entity(entityID).tags);
81911           for (var key in tags) {
81912             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1)
81913               continue;
81914             if (type2 === "building") {
81915               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
81916                 continue;
81917             }
81918             if (type2 !== "generic") {
81919               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
81920                 continue;
81921             }
81922             delete tags[key];
81923           }
81924           graph = actionChangeTags(entityID, tags)(graph);
81925         }
81926         return graph;
81927       }, operation.annotation());
81928       context.validator().validate();
81929       context.enter(modeSelect(context, selectedIDs));
81930     };
81931     operation.available = function() {
81932       return _downgradeType;
81933     };
81934     operation.disabled = function() {
81935       if (selectedIDs.some(hasWikidataTag)) {
81936         return "has_wikidata_tag";
81937       }
81938       return false;
81939       function hasWikidataTag(id2) {
81940         var entity = context.entity(id2);
81941         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
81942       }
81943     };
81944     operation.tooltip = function() {
81945       var disable = operation.disabled();
81946       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
81947     };
81948     operation.annotation = function() {
81949       var suffix;
81950       if (_downgradeType === "building_address") {
81951         suffix = "generic";
81952       } else {
81953         suffix = _downgradeType;
81954       }
81955       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
81956     };
81957     operation.id = "downgrade";
81958     operation.keys = [uiCmd("\u232B")];
81959     operation.title = _t.append("operations.downgrade.title");
81960     operation.behavior = behaviorOperation(context).which(operation);
81961     return operation;
81962   }
81963
81964   // modules/operations/extract.js
81965   function operationExtract(context, selectedIDs) {
81966     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
81967     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
81968       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
81969     }).filter(Boolean));
81970     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
81971     var _extent;
81972     var _actions = selectedIDs.map(function(entityID) {
81973       var graph = context.graph();
81974       var entity = graph.hasEntity(entityID);
81975       if (!entity || !entity.hasInterestingTags())
81976         return null;
81977       if (entity.type === "node" && graph.parentWays(entity).length === 0)
81978         return null;
81979       if (entity.type !== "node") {
81980         var preset = _mainPresetIndex.match(entity, graph);
81981         if (preset.geometry.indexOf("point") === -1)
81982           return null;
81983       }
81984       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
81985       return actionExtract(entityID, context.projection);
81986     }).filter(Boolean);
81987     var operation = function() {
81988       var combinedAction = function(graph) {
81989         _actions.forEach(function(action) {
81990           graph = action(graph);
81991         });
81992         return graph;
81993       };
81994       context.perform(combinedAction, operation.annotation());
81995       var extractedNodeIDs = _actions.map(function(action) {
81996         return action.getExtractedNodeID();
81997       });
81998       context.enter(modeSelect(context, extractedNodeIDs));
81999     };
82000     operation.available = function() {
82001       return _actions.length && selectedIDs.length === _actions.length;
82002     };
82003     operation.disabled = function() {
82004       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
82005         return "too_large";
82006       } else if (selectedIDs.some(function(entityID) {
82007         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
82008       })) {
82009         return "connected_to_hidden";
82010       }
82011       return false;
82012     };
82013     operation.tooltip = function() {
82014       var disableReason = operation.disabled();
82015       if (disableReason) {
82016         return _t.append("operations.extract." + disableReason + "." + _amount);
82017       } else {
82018         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
82019       }
82020     };
82021     operation.annotation = function() {
82022       return _t("operations.extract.annotation", { n: selectedIDs.length });
82023     };
82024     operation.id = "extract";
82025     operation.keys = [_t("operations.extract.key")];
82026     operation.title = _t.append("operations.extract.title");
82027     operation.behavior = behaviorOperation(context).which(operation);
82028     return operation;
82029   }
82030
82031   // modules/operations/merge.js
82032   function operationMerge(context, selectedIDs) {
82033     var _action = getAction();
82034     function getAction() {
82035       var join = actionJoin(selectedIDs);
82036       if (!join.disabled(context.graph()))
82037         return join;
82038       var merge2 = actionMerge(selectedIDs);
82039       if (!merge2.disabled(context.graph()))
82040         return merge2;
82041       var mergePolygon = actionMergePolygon(selectedIDs);
82042       if (!mergePolygon.disabled(context.graph()))
82043         return mergePolygon;
82044       var mergeNodes = actionMergeNodes(selectedIDs);
82045       if (!mergeNodes.disabled(context.graph()))
82046         return mergeNodes;
82047       if (join.disabled(context.graph()) !== "not_eligible")
82048         return join;
82049       if (merge2.disabled(context.graph()) !== "not_eligible")
82050         return merge2;
82051       if (mergePolygon.disabled(context.graph()) !== "not_eligible")
82052         return mergePolygon;
82053       return mergeNodes;
82054     }
82055     var operation = function() {
82056       if (operation.disabled())
82057         return;
82058       context.perform(_action, operation.annotation());
82059       context.validator().validate();
82060       var resultIDs = selectedIDs.filter(context.hasEntity);
82061       if (resultIDs.length > 1) {
82062         var interestingIDs = resultIDs.filter(function(id2) {
82063           return context.entity(id2).hasInterestingTags();
82064         });
82065         if (interestingIDs.length)
82066           resultIDs = interestingIDs;
82067       }
82068       context.enter(modeSelect(context, resultIDs));
82069     };
82070     operation.available = function() {
82071       return selectedIDs.length >= 2;
82072     };
82073     operation.disabled = function() {
82074       var actionDisabled = _action.disabled(context.graph());
82075       if (actionDisabled)
82076         return actionDisabled;
82077       var osm = context.connection();
82078       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
82079         return "too_many_vertices";
82080       }
82081       return false;
82082     };
82083     operation.tooltip = function() {
82084       var disabled = operation.disabled();
82085       if (disabled) {
82086         if (disabled === "conflicting_relations") {
82087           return _t.append("operations.merge.conflicting_relations");
82088         }
82089         if (disabled === "restriction" || disabled === "connectivity") {
82090           return _t.append(
82091             "operations.merge.damage_relation",
82092             { relation: _mainPresetIndex.item("type/" + disabled).name() }
82093           );
82094         }
82095         return _t.append("operations.merge." + disabled);
82096       }
82097       return _t.append("operations.merge.description");
82098     };
82099     operation.annotation = function() {
82100       return _t("operations.merge.annotation", { n: selectedIDs.length });
82101     };
82102     operation.id = "merge";
82103     operation.keys = [_t("operations.merge.key")];
82104     operation.title = _t.append("operations.merge.title");
82105     operation.behavior = behaviorOperation(context).which(operation);
82106     return operation;
82107   }
82108
82109   // modules/operations/paste.js
82110   function operationPaste(context) {
82111     var _pastePoint;
82112     var operation = function() {
82113       if (!_pastePoint)
82114         return;
82115       var oldIDs = context.copyIDs();
82116       if (!oldIDs.length)
82117         return;
82118       var projection2 = context.projection;
82119       var extent = geoExtent();
82120       var oldGraph = context.copyGraph();
82121       var newIDs = [];
82122       var action = actionCopyEntities(oldIDs, oldGraph);
82123       context.perform(action);
82124       var copies = action.copies();
82125       var originals = /* @__PURE__ */ new Set();
82126       Object.values(copies).forEach(function(entity) {
82127         originals.add(entity.id);
82128       });
82129       for (var id2 in copies) {
82130         var oldEntity = oldGraph.entity(id2);
82131         var newEntity = copies[id2];
82132         extent._extend(oldEntity.extent(oldGraph));
82133         var parents = context.graph().parentWays(newEntity);
82134         var parentCopied = parents.some(function(parent) {
82135           return originals.has(parent.id);
82136         });
82137         if (!parentCopied) {
82138           newIDs.push(newEntity.id);
82139         }
82140       }
82141       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
82142       var delta = geoVecSubtract(_pastePoint, copyPoint);
82143       context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
82144       context.enter(modeSelect(context, newIDs));
82145     };
82146     operation.point = function(val) {
82147       _pastePoint = val;
82148       return operation;
82149     };
82150     operation.available = function() {
82151       return context.mode().id === "browse";
82152     };
82153     operation.disabled = function() {
82154       return !context.copyIDs().length;
82155     };
82156     operation.tooltip = function() {
82157       var oldGraph = context.copyGraph();
82158       var ids = context.copyIDs();
82159       if (!ids.length) {
82160         return _t.append("operations.paste.nothing_copied");
82161       }
82162       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
82163     };
82164     operation.annotation = function() {
82165       var ids = context.copyIDs();
82166       return _t("operations.paste.annotation", { n: ids.length });
82167     };
82168     operation.id = "paste";
82169     operation.keys = [uiCmd("\u2318V")];
82170     operation.title = _t.append("operations.paste.title");
82171     return operation;
82172   }
82173
82174   // modules/operations/reverse.js
82175   function operationReverse(context, selectedIDs) {
82176     var operation = function() {
82177       context.perform(function combinedReverseAction(graph) {
82178         actions().forEach(function(action) {
82179           graph = action(graph);
82180         });
82181         return graph;
82182       }, operation.annotation());
82183       context.validator().validate();
82184     };
82185     function actions(situation) {
82186       return selectedIDs.map(function(entityID) {
82187         var entity = context.hasEntity(entityID);
82188         if (!entity)
82189           return null;
82190         if (situation === "toolbar") {
82191           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
82192             return null;
82193         }
82194         var geometry = entity.geometry(context.graph());
82195         if (entity.type !== "node" && geometry !== "line")
82196           return null;
82197         var action = actionReverse(entityID);
82198         if (action.disabled(context.graph()))
82199           return null;
82200         return action;
82201       }).filter(Boolean);
82202     }
82203     function reverseTypeID() {
82204       var acts = actions();
82205       var nodeActionCount = acts.filter(function(act) {
82206         var entity = context.hasEntity(act.entityID());
82207         return entity && entity.type === "node";
82208       }).length;
82209       if (nodeActionCount === 0)
82210         return "line";
82211       if (nodeActionCount === acts.length)
82212         return "point";
82213       return "feature";
82214     }
82215     operation.available = function(situation) {
82216       return actions(situation).length > 0;
82217     };
82218     operation.disabled = function() {
82219       return false;
82220     };
82221     operation.tooltip = function() {
82222       return _t.append("operations.reverse.description." + reverseTypeID());
82223     };
82224     operation.annotation = function() {
82225       var acts = actions();
82226       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
82227     };
82228     operation.id = "reverse";
82229     operation.keys = [_t("operations.reverse.key")];
82230     operation.title = _t.append("operations.reverse.title");
82231     operation.behavior = behaviorOperation(context).which(operation);
82232     return operation;
82233   }
82234
82235   // modules/operations/split.js
82236   function operationSplit(context, selectedIDs) {
82237     var _vertexIds = selectedIDs.filter(function(id2) {
82238       return context.graph().geometry(id2) === "vertex";
82239     });
82240     var _selectedWayIds = selectedIDs.filter(function(id2) {
82241       var entity = context.graph().hasEntity(id2);
82242       return entity && entity.type === "way";
82243     });
82244     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
82245     var _action = actionSplit(_vertexIds);
82246     var _ways = [];
82247     var _geometry = "feature";
82248     var _waysAmount = "single";
82249     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
82250     if (_isAvailable) {
82251       if (_selectedWayIds.length)
82252         _action.limitWays(_selectedWayIds);
82253       _ways = _action.ways(context.graph());
82254       var geometries = {};
82255       _ways.forEach(function(way) {
82256         geometries[way.geometry(context.graph())] = true;
82257       });
82258       if (Object.keys(geometries).length === 1) {
82259         _geometry = Object.keys(geometries)[0];
82260       }
82261       _waysAmount = _ways.length === 1 ? "single" : "multiple";
82262     }
82263     var operation = function() {
82264       var difference = context.perform(_action, operation.annotation());
82265       var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
82266         return context.entity(id2).type === "way";
82267       }));
82268       context.enter(modeSelect(context, idsToSelect));
82269     };
82270     operation.relatedEntityIds = function() {
82271       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
82272     };
82273     operation.available = function() {
82274       return _isAvailable;
82275     };
82276     operation.disabled = function() {
82277       var reason = _action.disabled(context.graph());
82278       if (reason) {
82279         return reason;
82280       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82281         return "connected_to_hidden";
82282       }
82283       return false;
82284     };
82285     operation.tooltip = function() {
82286       var disable = operation.disabled();
82287       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
82288     };
82289     operation.annotation = function() {
82290       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
82291     };
82292     operation.icon = function() {
82293       if (_waysAmount === "multiple") {
82294         return "#iD-operation-split-multiple";
82295       } else {
82296         return "#iD-operation-split";
82297       }
82298     };
82299     operation.id = "split";
82300     operation.keys = [_t("operations.split.key")];
82301     operation.title = _t.append("operations.split.title");
82302     operation.behavior = behaviorOperation(context).which(operation);
82303     return operation;
82304   }
82305
82306   // modules/operations/straighten.js
82307   function operationStraighten(context, selectedIDs) {
82308     var _wayIDs = selectedIDs.filter(function(id2) {
82309       return id2.charAt(0) === "w";
82310     });
82311     var _nodeIDs = selectedIDs.filter(function(id2) {
82312       return id2.charAt(0) === "n";
82313     });
82314     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
82315     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
82316     var _coords = _nodes.map(function(n3) {
82317       return n3.loc;
82318     });
82319     var _extent = utilTotalExtent(selectedIDs, context.graph());
82320     var _action = chooseAction();
82321     var _geometry;
82322     function chooseAction() {
82323       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
82324         _geometry = "point";
82325         return actionStraightenNodes(_nodeIDs, context.projection);
82326       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
82327         var startNodeIDs = [];
82328         var endNodeIDs = [];
82329         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82330           var entity = context.entity(selectedIDs[i3]);
82331           if (entity.type === "node") {
82332             continue;
82333           } else if (entity.type !== "way" || entity.isClosed()) {
82334             return null;
82335           }
82336           startNodeIDs.push(entity.first());
82337           endNodeIDs.push(entity.last());
82338         }
82339         startNodeIDs = startNodeIDs.filter(function(n3) {
82340           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
82341         });
82342         endNodeIDs = endNodeIDs.filter(function(n3) {
82343           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
82344         });
82345         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
82346           return null;
82347         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
82348           return node.id;
82349         });
82350         if (wayNodeIDs.length <= 2)
82351           return null;
82352         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
82353           return null;
82354         if (_nodeIDs.length) {
82355           _extent = utilTotalExtent(_nodeIDs, context.graph());
82356         }
82357         _geometry = "line";
82358         return actionStraightenWay(selectedIDs, context.projection);
82359       }
82360       return null;
82361     }
82362     function operation() {
82363       if (!_action)
82364         return;
82365       context.perform(_action, operation.annotation());
82366       window.setTimeout(function() {
82367         context.validator().validate();
82368       }, 300);
82369     }
82370     operation.available = function() {
82371       return Boolean(_action);
82372     };
82373     operation.disabled = function() {
82374       var reason = _action.disabled(context.graph());
82375       if (reason) {
82376         return reason;
82377       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
82378         return "too_large";
82379       } else if (someMissing()) {
82380         return "not_downloaded";
82381       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82382         return "connected_to_hidden";
82383       }
82384       return false;
82385       function someMissing() {
82386         if (context.inIntro())
82387           return false;
82388         var osm = context.connection();
82389         if (osm) {
82390           var missing = _coords.filter(function(loc) {
82391             return !osm.isDataLoaded(loc);
82392           });
82393           if (missing.length) {
82394             missing.forEach(function(loc) {
82395               context.loadTileAtLoc(loc);
82396             });
82397             return true;
82398           }
82399         }
82400         return false;
82401       }
82402     };
82403     operation.tooltip = function() {
82404       var disable = operation.disabled();
82405       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
82406     };
82407     operation.annotation = function() {
82408       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
82409     };
82410     operation.id = "straighten";
82411     operation.keys = [_t("operations.straighten.key")];
82412     operation.title = _t.append("operations.straighten.title");
82413     operation.behavior = behaviorOperation(context).which(operation);
82414     return operation;
82415   }
82416
82417   // modules/modes/select.js
82418   function modeSelect(context, selectedIDs) {
82419     var mode = {
82420       id: "select",
82421       button: "browse"
82422     };
82423     var keybinding = utilKeybinding("select");
82424     var _breatheBehavior = behaviorBreathe(context);
82425     var _modeDragNode = modeDragNode(context);
82426     var _selectBehavior;
82427     var _behaviors = [];
82428     var _operations = [];
82429     var _newFeature = false;
82430     var _follow = false;
82431     var _focusedParentWayId;
82432     var _focusedVertexIds;
82433     function singular() {
82434       if (selectedIDs && selectedIDs.length === 1) {
82435         return context.hasEntity(selectedIDs[0]);
82436       }
82437     }
82438     function selectedEntities() {
82439       return selectedIDs.map(function(id2) {
82440         return context.hasEntity(id2);
82441       }).filter(Boolean);
82442     }
82443     function checkSelectedIDs() {
82444       var ids = [];
82445       if (Array.isArray(selectedIDs)) {
82446         ids = selectedIDs.filter(function(id2) {
82447           return context.hasEntity(id2);
82448         });
82449       }
82450       if (!ids.length) {
82451         context.enter(modeBrowse(context));
82452         return false;
82453       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
82454         context.enter(modeSelect(context, ids));
82455         return false;
82456       }
82457       selectedIDs = ids;
82458       return true;
82459     }
82460     function parentWaysIdsOfSelection(onlyCommonParents) {
82461       var graph = context.graph();
82462       var parents = [];
82463       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82464         var entity = context.hasEntity(selectedIDs[i3]);
82465         if (!entity || entity.geometry(graph) !== "vertex") {
82466           return [];
82467         }
82468         var currParents = graph.parentWays(entity).map(function(w2) {
82469           return w2.id;
82470         });
82471         if (!parents.length) {
82472           parents = currParents;
82473           continue;
82474         }
82475         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
82476         if (!parents.length) {
82477           return [];
82478         }
82479       }
82480       return parents;
82481     }
82482     function childNodeIdsOfSelection(onlyCommon) {
82483       var graph = context.graph();
82484       var childs = [];
82485       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82486         var entity = context.hasEntity(selectedIDs[i3]);
82487         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
82488           return [];
82489         }
82490         var currChilds = graph.childNodes(entity).map(function(node) {
82491           return node.id;
82492         });
82493         if (!childs.length) {
82494           childs = currChilds;
82495           continue;
82496         }
82497         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
82498         if (!childs.length) {
82499           return [];
82500         }
82501       }
82502       return childs;
82503     }
82504     function checkFocusedParent() {
82505       if (_focusedParentWayId) {
82506         var parents = parentWaysIdsOfSelection(true);
82507         if (parents.indexOf(_focusedParentWayId) === -1)
82508           _focusedParentWayId = null;
82509       }
82510     }
82511     function parentWayIdForVertexNavigation() {
82512       var parentIds = parentWaysIdsOfSelection(true);
82513       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
82514         return _focusedParentWayId;
82515       }
82516       return parentIds.length ? parentIds[0] : null;
82517     }
82518     mode.selectedIDs = function(val) {
82519       if (!arguments.length)
82520         return selectedIDs;
82521       selectedIDs = val;
82522       return mode;
82523     };
82524     mode.zoomToSelected = function() {
82525       context.map().zoomToEase(selectedEntities());
82526     };
82527     mode.newFeature = function(val) {
82528       if (!arguments.length)
82529         return _newFeature;
82530       _newFeature = val;
82531       return mode;
82532     };
82533     mode.selectBehavior = function(val) {
82534       if (!arguments.length)
82535         return _selectBehavior;
82536       _selectBehavior = val;
82537       return mode;
82538     };
82539     mode.follow = function(val) {
82540       if (!arguments.length)
82541         return _follow;
82542       _follow = val;
82543       return mode;
82544     };
82545     function loadOperations() {
82546       _operations.forEach(function(operation) {
82547         if (operation.behavior) {
82548           context.uninstall(operation.behavior);
82549         }
82550       });
82551       _operations = Object.values(operations_exports).map(function(o2) {
82552         return o2(context, selectedIDs);
82553       }).filter(function(o2) {
82554         return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
82555       }).concat([
82556         // group copy/downgrade/delete operation together at the end of the list
82557         operationCopy(context, selectedIDs),
82558         operationDowngrade(context, selectedIDs),
82559         operationDelete(context, selectedIDs)
82560       ]).filter(function(operation) {
82561         return operation.available();
82562       });
82563       _operations.forEach(function(operation) {
82564         if (operation.behavior) {
82565           context.install(operation.behavior);
82566         }
82567       });
82568       context.ui().closeEditMenu();
82569     }
82570     mode.operations = function() {
82571       return _operations;
82572     };
82573     mode.enter = function() {
82574       if (!checkSelectedIDs())
82575         return;
82576       context.features().forceVisible(selectedIDs);
82577       _modeDragNode.restoreSelectedIDs(selectedIDs);
82578       loadOperations();
82579       if (!_behaviors.length) {
82580         if (!_selectBehavior)
82581           _selectBehavior = behaviorSelect(context);
82582         _behaviors = [
82583           behaviorPaste(context),
82584           _breatheBehavior,
82585           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
82586           _selectBehavior,
82587           behaviorLasso(context),
82588           _modeDragNode.behavior,
82589           modeDragNote(context).behavior
82590         ];
82591       }
82592       _behaviors.forEach(context.install);
82593       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);
82594       select_default2(document).call(keybinding);
82595       context.ui().sidebar.select(selectedIDs, _newFeature);
82596       context.history().on("change.select", function() {
82597         loadOperations();
82598         selectElements();
82599       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
82600       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
82601         selectElements();
82602         _breatheBehavior.restartIfNeeded(context.surface());
82603       });
82604       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
82605       selectElements();
82606       if (_follow) {
82607         var extent = geoExtent();
82608         var graph = context.graph();
82609         selectedIDs.forEach(function(id2) {
82610           var entity = context.entity(id2);
82611           extent._extend(entity.extent(graph));
82612         });
82613         var loc = extent.center();
82614         context.map().centerEase(loc);
82615         _follow = false;
82616       }
82617       function nudgeSelection(delta) {
82618         return function() {
82619           if (!context.map().withinEditableZoom())
82620             return;
82621           var moveOp = operationMove(context, selectedIDs);
82622           if (moveOp.disabled()) {
82623             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
82624           } else {
82625             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
82626             context.validator().validate();
82627           }
82628         };
82629       }
82630       function scaleSelection(factor) {
82631         return function() {
82632           if (!context.map().withinEditableZoom())
82633             return;
82634           let nodes = utilGetAllNodes(selectedIDs, context.graph());
82635           let isUp = factor > 1;
82636           if (nodes.length <= 1)
82637             return;
82638           let extent2 = utilTotalExtent(selectedIDs, context.graph());
82639           function scalingDisabled() {
82640             if (tooSmall()) {
82641               return "too_small";
82642             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
82643               return "too_large";
82644             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
82645               return "not_downloaded";
82646             } else if (selectedIDs.some(context.hasHiddenConnections)) {
82647               return "connected_to_hidden";
82648             }
82649             return false;
82650             function tooSmall() {
82651               if (isUp)
82652                 return false;
82653               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
82654               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
82655               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
82656             }
82657             function someMissing() {
82658               if (context.inIntro())
82659                 return false;
82660               let osm = context.connection();
82661               if (osm) {
82662                 let missing = nodes.filter(function(n3) {
82663                   return !osm.isDataLoaded(n3.loc);
82664                 });
82665                 if (missing.length) {
82666                   missing.forEach(function(loc2) {
82667                     context.loadTileAtLoc(loc2);
82668                   });
82669                   return true;
82670                 }
82671               }
82672               return false;
82673             }
82674             function incompleteRelation(id2) {
82675               let entity = context.entity(id2);
82676               return entity.type === "relation" && !entity.isComplete(context.graph());
82677             }
82678           }
82679           const disabled = scalingDisabled();
82680           if (disabled) {
82681             let multi = selectedIDs.length === 1 ? "single" : "multiple";
82682             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
82683           } else {
82684             const pivot = context.projection(extent2.center());
82685             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
82686             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
82687             context.validator().validate();
82688           }
82689         };
82690       }
82691       function didDoubleUp(d3_event, loc2) {
82692         if (!context.map().withinEditableZoom())
82693           return;
82694         var target = select_default2(d3_event.target);
82695         var datum2 = target.datum();
82696         var entity = datum2 && datum2.properties && datum2.properties.entity;
82697         if (!entity)
82698           return;
82699         if (entity instanceof osmWay && target.classed("target")) {
82700           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
82701           var prev = entity.nodes[choice.index - 1];
82702           var next = entity.nodes[choice.index];
82703           context.perform(
82704             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
82705             _t("operations.add.annotation.vertex")
82706           );
82707           context.validator().validate();
82708         } else if (entity.type === "midpoint") {
82709           context.perform(
82710             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
82711             _t("operations.add.annotation.vertex")
82712           );
82713           context.validator().validate();
82714         }
82715       }
82716       function selectElements() {
82717         if (!checkSelectedIDs())
82718           return;
82719         var surface = context.surface();
82720         surface.selectAll(".selected-member").classed("selected-member", false);
82721         surface.selectAll(".selected").classed("selected", false);
82722         surface.selectAll(".related").classed("related", false);
82723         checkFocusedParent();
82724         if (_focusedParentWayId) {
82725           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
82726         }
82727         if (context.map().withinEditableZoom()) {
82728           surface.selectAll(utilDeepMemberSelector(
82729             selectedIDs,
82730             context.graph(),
82731             true
82732             /* skipMultipolgonMembers */
82733           )).classed("selected-member", true);
82734           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
82735         }
82736       }
82737       function esc() {
82738         if (context.container().select(".combobox").size())
82739           return;
82740         context.enter(modeBrowse(context));
82741       }
82742       function firstVertex(d3_event) {
82743         d3_event.preventDefault();
82744         var entity = singular();
82745         var parentId = parentWayIdForVertexNavigation();
82746         var way;
82747         if (entity && entity.type === "way") {
82748           way = entity;
82749         } else if (parentId) {
82750           way = context.entity(parentId);
82751         }
82752         _focusedParentWayId = way && way.id;
82753         if (way) {
82754           context.enter(
82755             mode.selectedIDs([way.first()]).follow(true)
82756           );
82757         }
82758       }
82759       function lastVertex(d3_event) {
82760         d3_event.preventDefault();
82761         var entity = singular();
82762         var parentId = parentWayIdForVertexNavigation();
82763         var way;
82764         if (entity && entity.type === "way") {
82765           way = entity;
82766         } else if (parentId) {
82767           way = context.entity(parentId);
82768         }
82769         _focusedParentWayId = way && way.id;
82770         if (way) {
82771           context.enter(
82772             mode.selectedIDs([way.last()]).follow(true)
82773           );
82774         }
82775       }
82776       function previousVertex(d3_event) {
82777         d3_event.preventDefault();
82778         var parentId = parentWayIdForVertexNavigation();
82779         _focusedParentWayId = parentId;
82780         if (!parentId)
82781           return;
82782         var way = context.entity(parentId);
82783         var length = way.nodes.length;
82784         var curr = way.nodes.indexOf(selectedIDs[0]);
82785         var index = -1;
82786         if (curr > 0) {
82787           index = curr - 1;
82788         } else if (way.isClosed()) {
82789           index = length - 2;
82790         }
82791         if (index !== -1) {
82792           context.enter(
82793             mode.selectedIDs([way.nodes[index]]).follow(true)
82794           );
82795         }
82796       }
82797       function nextVertex(d3_event) {
82798         d3_event.preventDefault();
82799         var parentId = parentWayIdForVertexNavigation();
82800         _focusedParentWayId = parentId;
82801         if (!parentId)
82802           return;
82803         var way = context.entity(parentId);
82804         var length = way.nodes.length;
82805         var curr = way.nodes.indexOf(selectedIDs[0]);
82806         var index = -1;
82807         if (curr < length - 1) {
82808           index = curr + 1;
82809         } else if (way.isClosed()) {
82810           index = 0;
82811         }
82812         if (index !== -1) {
82813           context.enter(
82814             mode.selectedIDs([way.nodes[index]]).follow(true)
82815           );
82816         }
82817       }
82818       function focusNextParent(d3_event) {
82819         d3_event.preventDefault();
82820         var parents = parentWaysIdsOfSelection(true);
82821         if (!parents || parents.length < 2)
82822           return;
82823         var index = parents.indexOf(_focusedParentWayId);
82824         if (index < 0 || index > parents.length - 2) {
82825           _focusedParentWayId = parents[0];
82826         } else {
82827           _focusedParentWayId = parents[index + 1];
82828         }
82829         var surface = context.surface();
82830         surface.selectAll(".related").classed("related", false);
82831         if (_focusedParentWayId) {
82832           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
82833         }
82834       }
82835       function selectParent(d3_event) {
82836         d3_event.preventDefault();
82837         var currentSelectedIds = mode.selectedIDs();
82838         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
82839         if (!parentIds.length)
82840           return;
82841         context.enter(
82842           mode.selectedIDs(parentIds)
82843         );
82844         _focusedVertexIds = currentSelectedIds;
82845       }
82846       function selectChild(d3_event) {
82847         d3_event.preventDefault();
82848         var currentSelectedIds = mode.selectedIDs();
82849         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
82850         if (!childIds || !childIds.length)
82851           return;
82852         if (currentSelectedIds.length === 1)
82853           _focusedParentWayId = currentSelectedIds[0];
82854         context.enter(
82855           mode.selectedIDs(childIds)
82856         );
82857       }
82858     };
82859     mode.exit = function() {
82860       _newFeature = false;
82861       _focusedVertexIds = null;
82862       _operations.forEach(function(operation) {
82863         if (operation.behavior) {
82864           context.uninstall(operation.behavior);
82865         }
82866       });
82867       _operations = [];
82868       _behaviors.forEach(context.uninstall);
82869       select_default2(document).call(keybinding.unbind);
82870       context.ui().closeEditMenu();
82871       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
82872       var surface = context.surface();
82873       surface.selectAll(".selected-member").classed("selected-member", false);
82874       surface.selectAll(".selected").classed("selected", false);
82875       surface.selectAll(".highlighted").classed("highlighted", false);
82876       surface.selectAll(".related").classed("related", false);
82877       context.map().on("drawn.select", null);
82878       context.ui().sidebar.hide();
82879       context.features().forceVisible([]);
82880       var entity = singular();
82881       if (_newFeature && entity && entity.type === "relation" && // no tags
82882       Object.keys(entity.tags).length === 0 && // no parent relations
82883       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
82884       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
82885         var deleteAction = actionDeleteRelation(
82886           entity.id,
82887           true
82888           /* don't delete untagged members */
82889         );
82890         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
82891         context.validator().validate();
82892       }
82893     };
82894     return mode;
82895   }
82896
82897   // modules/behavior/lasso.js
82898   function behaviorLasso(context) {
82899     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
82900     var behavior = function(selection2) {
82901       var lasso;
82902       function pointerdown(d3_event) {
82903         var button = 0;
82904         if (d3_event.button === button && d3_event.shiftKey === true) {
82905           lasso = null;
82906           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
82907           d3_event.stopPropagation();
82908         }
82909       }
82910       function pointermove() {
82911         if (!lasso) {
82912           lasso = uiLasso(context);
82913           context.surface().call(lasso);
82914         }
82915         lasso.p(context.map().mouse());
82916       }
82917       function normalize2(a2, b2) {
82918         return [
82919           [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
82920           [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
82921         ];
82922       }
82923       function lassoed() {
82924         if (!lasso)
82925           return [];
82926         var graph = context.graph();
82927         var limitToNodes;
82928         if (context.map().editableDataEnabled(
82929           true
82930           /* skipZoomCheck */
82931         ) && context.map().isInWideSelection()) {
82932           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
82933         } else if (!context.map().editableDataEnabled()) {
82934           return [];
82935         }
82936         var bounds = lasso.extent().map(context.projection.invert);
82937         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
82938         var intersects = context.history().intersects(extent).filter(function(entity) {
82939           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
82940         });
82941         intersects.sort(function(node1, node2) {
82942           var parents1 = graph.parentWays(node1);
82943           var parents2 = graph.parentWays(node2);
82944           if (parents1.length && parents2.length) {
82945             var sharedParents = utilArrayIntersection(parents1, parents2);
82946             if (sharedParents.length) {
82947               var sharedParentNodes = sharedParents[0].nodes;
82948               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
82949             } else {
82950               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
82951             }
82952           } else if (parents1.length || parents2.length) {
82953             return parents1.length - parents2.length;
82954           }
82955           return node1.loc[0] - node2.loc[0];
82956         });
82957         return intersects.map(function(entity) {
82958           return entity.id;
82959         });
82960       }
82961       function pointerup() {
82962         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
82963         if (!lasso)
82964           return;
82965         var ids = lassoed();
82966         lasso.close();
82967         if (ids.length) {
82968           context.enter(modeSelect(context, ids));
82969         }
82970       }
82971       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
82972     };
82973     behavior.off = function(selection2) {
82974       selection2.on(_pointerPrefix + "down.lasso", null);
82975     };
82976     return behavior;
82977   }
82978
82979   // modules/modes/browse.js
82980   function modeBrowse(context) {
82981     var mode = {
82982       button: "browse",
82983       id: "browse",
82984       title: _t.append("modes.browse.title"),
82985       description: _t.append("modes.browse.description")
82986     };
82987     var sidebar;
82988     var _selectBehavior;
82989     var _behaviors = [];
82990     mode.selectBehavior = function(val) {
82991       if (!arguments.length)
82992         return _selectBehavior;
82993       _selectBehavior = val;
82994       return mode;
82995     };
82996     mode.enter = function() {
82997       if (!_behaviors.length) {
82998         if (!_selectBehavior)
82999           _selectBehavior = behaviorSelect(context);
83000         _behaviors = [
83001           behaviorPaste(context),
83002           behaviorHover(context).on("hover", context.ui().sidebar.hover),
83003           _selectBehavior,
83004           behaviorLasso(context),
83005           modeDragNode(context).behavior,
83006           modeDragNote(context).behavior
83007         ];
83008       }
83009       _behaviors.forEach(context.install);
83010       if (document.activeElement && document.activeElement.blur) {
83011         document.activeElement.blur();
83012       }
83013       if (sidebar) {
83014         context.ui().sidebar.show(sidebar);
83015       } else {
83016         context.ui().sidebar.select(null);
83017       }
83018     };
83019     mode.exit = function() {
83020       context.ui().sidebar.hover.cancel();
83021       _behaviors.forEach(context.uninstall);
83022       if (sidebar) {
83023         context.ui().sidebar.hide();
83024       }
83025     };
83026     mode.sidebar = function(_2) {
83027       if (!arguments.length)
83028         return sidebar;
83029       sidebar = _2;
83030       return mode;
83031     };
83032     mode.operations = function() {
83033       return [operationPaste(context)];
83034     };
83035     return mode;
83036   }
83037
83038   // modules/behavior/add_way.js
83039   function behaviorAddWay(context) {
83040     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
83041     var draw = behaviorDraw(context);
83042     function behavior(surface) {
83043       draw.on("click", function() {
83044         dispatch14.apply("start", this, arguments);
83045       }).on("clickWay", function() {
83046         dispatch14.apply("startFromWay", this, arguments);
83047       }).on("clickNode", function() {
83048         dispatch14.apply("startFromNode", this, arguments);
83049       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
83050       context.map().dblclickZoomEnable(false);
83051       surface.call(draw);
83052     }
83053     behavior.off = function(surface) {
83054       surface.call(draw.off);
83055     };
83056     behavior.cancel = function() {
83057       window.setTimeout(function() {
83058         context.map().dblclickZoomEnable(true);
83059       }, 1e3);
83060       context.enter(modeBrowse(context));
83061     };
83062     return utilRebind(behavior, dispatch14, "on");
83063   }
83064
83065   // modules/behavior/hash.js
83066   function behaviorHash(context) {
83067     var _cachedHash = null;
83068     var _latitudeLimit = 90 - 1e-8;
83069     function computedHashParameters() {
83070       var map2 = context.map();
83071       var center = map2.center();
83072       var zoom = map2.zoom();
83073       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
83074       var oldParams = utilObjectOmit(
83075         utilStringQs(window.location.hash),
83076         ["comment", "source", "hashtags", "walkthrough"]
83077       );
83078       var newParams = {};
83079       delete oldParams.id;
83080       var selected = context.selectedIDs().filter(function(id2) {
83081         return context.hasEntity(id2);
83082       });
83083       if (selected.length) {
83084         newParams.id = selected.join(",");
83085       }
83086       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
83087       return Object.assign(oldParams, newParams);
83088     }
83089     function computedHash() {
83090       return "#" + utilQsString(computedHashParameters(), true);
83091     }
83092     function computedTitle(includeChangeCount) {
83093       var baseTitle = context.documentTitleBase() || "iD";
83094       var contextual;
83095       var changeCount;
83096       var titleID;
83097       var selected = context.selectedIDs().filter(function(id2) {
83098         return context.hasEntity(id2);
83099       });
83100       if (selected.length) {
83101         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
83102         if (selected.length > 1) {
83103           contextual = _t("title.labeled_and_more", {
83104             labeled: firstLabel,
83105             count: selected.length - 1
83106           });
83107         } else {
83108           contextual = firstLabel;
83109         }
83110         titleID = "context";
83111       }
83112       if (includeChangeCount) {
83113         changeCount = context.history().difference().summary().length;
83114         if (changeCount > 0) {
83115           titleID = contextual ? "changes_context" : "changes";
83116         }
83117       }
83118       if (titleID) {
83119         return _t("title.format." + titleID, {
83120           changes: changeCount,
83121           base: baseTitle,
83122           context: contextual
83123         });
83124       }
83125       return baseTitle;
83126     }
83127     function updateTitle(includeChangeCount) {
83128       if (!context.setsDocumentTitle())
83129         return;
83130       var newTitle = computedTitle(includeChangeCount);
83131       if (document.title !== newTitle) {
83132         document.title = newTitle;
83133       }
83134     }
83135     function updateHashIfNeeded() {
83136       if (context.inIntro())
83137         return;
83138       var latestHash = computedHash();
83139       if (_cachedHash !== latestHash) {
83140         _cachedHash = latestHash;
83141         window.history.replaceState(null, computedTitle(
83142           false
83143           /* includeChangeCount */
83144         ), latestHash);
83145         updateTitle(
83146           true
83147           /* includeChangeCount */
83148         );
83149         const q2 = utilStringQs(latestHash);
83150         if (q2.map) {
83151           corePreferences("map-location", q2.map);
83152         }
83153       }
83154     }
83155     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
83156     var _throttledUpdateTitle = throttle_default(function() {
83157       updateTitle(
83158         true
83159         /* includeChangeCount */
83160       );
83161     }, 500);
83162     function hashchange() {
83163       if (window.location.hash === _cachedHash)
83164         return;
83165       _cachedHash = window.location.hash;
83166       var q2 = utilStringQs(_cachedHash);
83167       var mapArgs = (q2.map || "").split("/").map(Number);
83168       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
83169         updateHashIfNeeded();
83170       } else {
83171         if (_cachedHash === computedHash())
83172           return;
83173         var mode = context.mode();
83174         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83175         if (q2.id && mode) {
83176           var ids = q2.id.split(",").filter(function(id2) {
83177             return context.hasEntity(id2);
83178           });
83179           if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
83180             context.enter(modeSelect(context, ids));
83181             return;
83182           }
83183         }
83184         var center = context.map().center();
83185         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
83186         var maxdist = 500;
83187         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
83188           context.enter(modeBrowse(context));
83189           return;
83190         }
83191       }
83192     }
83193     function behavior() {
83194       context.map().on("move.behaviorHash", _throttledUpdate);
83195       context.history().on("change.behaviorHash", _throttledUpdateTitle);
83196       context.on("enter.behaviorHash", _throttledUpdate);
83197       select_default2(window).on("hashchange.behaviorHash", hashchange);
83198       var q2 = utilStringQs(window.location.hash);
83199       if (q2.id) {
83200         context.zoomToEntity(q2.id.split(",")[0], !q2.map);
83201       }
83202       if (q2.walkthrough === "true") {
83203         behavior.startWalkthrough = true;
83204       }
83205       if (q2.map) {
83206         behavior.hadLocation = true;
83207       } else if (!q2.id && corePreferences("map-location")) {
83208         const mapArgs = corePreferences("map-location").split("/").map(Number);
83209         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83210         updateHashIfNeeded();
83211         behavior.hadLocation = true;
83212       }
83213       hashchange();
83214       updateTitle(false);
83215     }
83216     behavior.off = function() {
83217       _throttledUpdate.cancel();
83218       _throttledUpdateTitle.cancel();
83219       context.map().on("move.behaviorHash", null);
83220       context.on("enter.behaviorHash", null);
83221       select_default2(window).on("hashchange.behaviorHash", null);
83222       window.location.hash = "";
83223     };
83224     return behavior;
83225   }
83226
83227   // node_modules/d3-brush/src/brush.js
83228   var { abs: abs2, max: max2, min: min2 } = Math;
83229   function number1(e3) {
83230     return [+e3[0], +e3[1]];
83231   }
83232   function number22(e3) {
83233     return [number1(e3[0]), number1(e3[1])];
83234   }
83235   var X3 = {
83236     name: "x",
83237     handles: ["w", "e"].map(type),
83238     input: function(x2, e3) {
83239       return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
83240     },
83241     output: function(xy) {
83242       return xy && [xy[0][0], xy[1][0]];
83243     }
83244   };
83245   var Y3 = {
83246     name: "y",
83247     handles: ["n", "s"].map(type),
83248     input: function(y2, e3) {
83249       return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
83250     },
83251     output: function(xy) {
83252       return xy && [xy[0][1], xy[1][1]];
83253     }
83254   };
83255   var XY = {
83256     name: "xy",
83257     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
83258     input: function(xy) {
83259       return xy == null ? null : number22(xy);
83260     },
83261     output: function(xy) {
83262       return xy;
83263     }
83264   };
83265   function type(t2) {
83266     return { type: t2 };
83267   }
83268
83269   // modules/index.js
83270   var debug = false;
83271   var d3 = {
83272     dispatch: dispatch_default,
83273     geoMercator: mercator_default,
83274     geoProjection: projection,
83275     polygonArea: area_default3,
83276     polygonCentroid: centroid_default2,
83277     select: select_default2,
83278     selectAll: selectAll_default2,
83279     timerFlush
83280   };
83281
83282   // modules/id.js
83283   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
83284     var start2 = Date.now();
83285     return window.requestAnimationFrame(function() {
83286       cb({
83287         didTimeout: false,
83288         timeRemaining: function() {
83289           return Math.max(0, 50 - (Date.now() - start2));
83290         }
83291       });
83292     });
83293   };
83294   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
83295     window.cancelAnimationFrame(id2);
83296   };
83297   window.iD = modules_exports;
83298 })();
83299 //# sourceMappingURL=iD.js.map